Post Reply 
HELP on compiling BASIC C Source Code
05-03-2014, 07:26 PM
Post: #1
HELP on compiling BASIC C Source Code
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
main.c: In function '_destroy_code':
main.c:78: warning: implicit declaration of function 'assert'
main.c: In function '_load_file':
main.c:151: warning: implicit declaration of function 'ftell'
main.c: In function '_clear_screen':
main.c:227: warning: implicit declaration of function 'system'
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
main.c: In function '_kill_program':
main.c:316: warning: implicit declaration of function 'unlink'
main.c: In function '_do_line':
main.c:362: warning: implicit declaration of function 'strcasecmp'
make: *** [main.o] Error 1

> Process Exit Code: 2
> Time Taken: 00:00

Can someone be so kind to tell me what should I do so that I get it compiled properly.
Thank You
Alvaro
Find all posts by this user
Quote this message in a reply
05-03-2014, 08:23 PM
Post: #2
RE: HELP on compiling BASIC C Source Code
(05-03-2014 07:26 PM)Alvaro Wrote:  -IH:\HPGCC-2.0-native-win32-SP2/include

That doesn't look correct. Mixed \ and /. Just guessing BTW, I do not do Windows.
Find all posts by this user
Quote this message in a reply
05-03-2014, 08:32 PM
Post: #3
RE: HELP on compiling BASIC C Source Code
(05-03-2014 08:23 PM)Egan Ford Wrote:  
(05-03-2014 07:26 PM)Alvaro Wrote:  -IH:\HPGCC-2.0-native-win32-SP2/include

That doesn't look correct. Mixed \ and /. Just guessing BTW, I do not do Windows.

Well, I have no ideia, but it seems to be OK, because all the *.h files are beeing found and there is no "complain" about them.
On the INCLUDE directory there are missing unistd.h and assert.h. Where do I find these headers?
Find all posts by this user
Quote this message in a reply
05-03-2014, 09:22 PM
Post: #4
RE: HELP on compiling BASIC C Source Code
Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter.
So maybe you do not want to compile it at all if you target an HP calculator.
Find all posts by this user
Quote this message in a reply
05-03-2014, 09:47 PM
Post: #5
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:22 PM)pascal_meheut Wrote:  Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter.
So maybe you do not want to compile it at all if you target an HP calculator.

That is a normal BASIC interpreter, even has a LOAD comand that is loading in memory all the programm.
It runs under Windows as DOS box, looking very like a normal BASIC interpreter.
Find all posts by this user
Quote this message in a reply
05-04-2014, 04:42 AM (This post was last modified: 05-04-2014 04:53 AM by Egan Ford.)
Post: #6
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:47 PM)Alvaro Wrote:  
(05-03-2014 09:22 PM)pascal_meheut Wrote:  Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter.
So maybe you do not want to compile it at all if you target an HP calculator.

That is a normal BASIC interpreter, even has a LOAD comand that is loading in memory all the programm.
It runs under Windows as DOS box, looking very like a normal BASIC interpreter.

Sorry, I didn't read your original post completely. C is very portable, but the libs that C use can be platform specific, especially I/O. Porting anything with HPGCC will require some effort if it is interactive and/or based on Windows or another platform.

Example HPGCC program (http://sense.net/~egan/hpgcc/#Hello, World):

Code:

#include <hpgcc49.h>
       
int main(void)
{
    clear_screen();
    printf("hello, world\n");
    WAIT_CANCEL;
    return(0);
}

The clear_screen() and WAIT_CANCEL are unique to HPGCC.
Find all posts by this user
Quote this message in a reply
05-04-2014, 06:14 AM
Post: #7
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:47 PM)Alvaro Wrote:  That is a normal BASIC interpreter, even has a LOAD comand that is loading in memory all the programm.
It runs under Windows as DOS box, looking very like a normal BASIC interpreter.

If you do not understand my answer, you should avoid explaining to me what I already know.
Good luck.
Find all posts by this user
Quote this message in a reply
05-04-2014, 06:15 AM
Post: #8
RE: HELP on compiling BASIC C Source Code
Quote:“When in doubt, run Process Monitor.”
-Dave Solomon

Google, download and run Process Monitor. Try to compile your source. Set a filter with the first file not found. You will know exactly where the compiler is looking for the files.

Rinse, repeat.

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
05-05-2014, 07:42 PM
Post: #9
RE: HELP on compiling BASIC C Source Code
(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
Find all posts by this user
Quote this message in a reply
05-05-2014, 08:53 PM
Post: #10
RE: HELP on compiling BASIC C Source Code
(05-05-2014 07:42 PM)David Hayden Wrote:  Hope this helps,
Dave

Hi Dave,
Thank you very much for your answer and your effort. I really do apreciate.
Surely it is very helpfull but unfortunatelly I have no knowledge of C and I have no time not the interest to read such a huge amount of DOC´s that there is implicit to learn C.
It is not something for just spring in.

I am a "end-user", not a developer and as I see there is still a need to do "some extra expert work" from of what there is available around.

I lost every interest in doing something with the 50g, there is no point at all, simply was a wrong "buy" choice.

Thank you again Dave
Regards
Alvaro
Find all posts by this user
Quote this message in a reply
Post Reply 




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