Post Reply 
HELP on compiling BASIC C Source Code
04-16-2023, 10:04 PM
Post: #11
RE: HELP on compiling BASIC C Source Code
(05-05-2014 07:42 PM)David Hayden Wrote:  
(05-03-2014 07:26 PM)Alvaro Wrote:  Hi,
I found the "C" Source Code of "My-BASIC" (https://code.google.com/p/my-basic/) and I am trying to compile it with HPGCC 2.0 Win.
The HPGCC compiler is giving following errors:

> "dmake" main.hp
arm-elf-gcc -mtune=arm920t -mcpu=arm920t -mlittle-endian -fomit-frame-pointer -msoft-float -Wall -Os -pipe -mthumb-interwork -mthumb -IH:\HPGCC-2.0-native-win32-SP2/include -I.. -c main.c -o main.o
main.c:36:27: error: unistd.h: No such file or directory
main.c:38:20: error: assert.h: No such file or directory
unistd.h declares a bunch of unix functions. assert.h declares the assert() function. What really matters are the implicitly declared functions that follow. You might want to google "<function> man page" to get a description of what each function does. Then you can reimplement, replace it or ignore it as you see fit.
Quote:main.c: In function '_destroy_code':
main.c:78: warning: implicit declaration of function 'assert'
the assert() function is used to assert something that is always true. if the argument to assert() is false then it aborts the program. You can probably reimplement this.
Quote:main.c: In function '_load_file':
main.c:151: warning: implicit declaration of function 'ftell'
ftell() returns the current position within an open file. You can use the return value as an argument to fseek() to go back to that place in the file.
Quote:main.c: In function '_clear_screen':
main.c:227: warning: implicit declaration of function 'system'
system() takes a string and more-or-less execute the string as though it had been typed on the keyboard. Since this is inside _clear_screen(), I suspect that you can just reimplement clear_screen() using the hpgcc graphics functions.
Quote:main.c: In function '_list_program':
main.c:240: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
main.c:241: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
main.c: In function '_edit_program':
main.c:272: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
These can probably be ignored. Check the type of the argument to atoi(). It is supposed to be a char*.
Quote:main.c: In function '_kill_program':
main.c:316: warning: implicit declaration of function 'unlink'
unlink() removes a file.
Quote:main.c: In function '_do_line':
main.c:362: warning: implicit declaration of function 'strcasecmp'
make: *** [main.o] Error 1
strcasecmp() compares two strings without regard to upper/lower case. I'm surprised that this isn't in the hpgcc libs already. Maybe you just need to find the right header file to include to get this.

Hope this helps,
Dave

Okay this thread is ancient but it seemed like you knew what you are talking about! So, if you have a moment I have a question that should be simple but for the life of me I cant get to work. I am using the 49g+/50g C compiler and have created a program that does compile without any issues as it uses all of the libraries and header files included with the HPGCC 2.0 Win install and the included Programmers Notepad 2 environment/IDE. I used the example make file and can create the .hp output binary. However how do I run this on the HP49g+ (or 50g)? I put it on the SD card, then I move it to the port:0 (internal ram) then try to select it from the soft menu from the library view it but I just end up getting the full program as a "string" displayed on the first line of the stack. Its like it does not know its a binary but I dont know how to tell it to execute as a binary. Thank you in advance for your insight here. Seems like this is a dead subject but this is of interest to me as are most of my HP collection.

------------------------------------------------
Prime, 50g,49g+,48gII,48sx,48g, 48gx,71b,75c,28s,28c
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HELP on compiling BASIC C Source Code - dkostan - 04-16-2023 10:04 PM



User(s) browsing this thread: 1 Guest(s)