Author Topic: C Basic Class Library  (Read 65701 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #75 on: November 18, 2013, 01:19:41 AM »
It compiles and runs but now gives warnings with or without -Wall

Should we standardize on <stdint.h> (and other std libs) C provides for a smooth 32 to 64 bit migration?

Code: [Select]
jrs@laptop:~/C_BASIC/cbclass/20131118$ gcc -Wall Test.c -o cbgcc
In file included from BasicClassLibrary.h:11:0,
                 from Test.c:2:
LexiClass.c: In function ‘WordInfo’:
LexiClass.c:50:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Word Start: %i\n",(int)w->bp);
                               ^
LexiClass.c:51:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Word End:   %i\n",(int)w->ep);
                               ^
LexiClass.c:52:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Text End:   %i\n",(int)w->et);
                               ^
jrs@laptop:~/C_BASIC/cbclass/20131118$ gcc Test.c -o cbgcc
In file included from BasicClassLibrary.h:11:0,
                 from Test.c:2:
LexiClass.c: In function ‘WordInfo’:
LexiClass.c:50:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Word Start: %i\n",(int)w->bp);
                               ^
LexiClass.c:51:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Word End:   %i\n",(int)w->ep);
                               ^
LexiClass.c:52:31: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     printf("Text End:   %i\n",(int)w->et);
                               ^
jrs@laptop:~/C_BASIC/cbclass/20131118$ ./cbgcc
LO
HELLO
HELLOHELLOHELLO
9
helloLOhellohello
hellohellohello
42.000000
42.000000
AbcAbcAbcAbcAbcAbcAbc
LOLOLOLOLOLOLO
AbcAbcAbcAbcAbcAbcAbc
<
>
  Hello World!
<HELLO WORLD!>
<<HELLO WORLD!>>
HELLO
HELLOH
abc
       \abc
WORD:       aa
Class Size: 80
Char Width: 1
Word Len:   2
Word Start: 19972306
Word End:   19972308
Text End:   19972312
=
jrs@laptop:~/C_BASIC/cbclass/20131118$
« Last Edit: November 18, 2013, 01:30:07 AM by John »

Offline Charles Pegge

  • BASIC Developer
  • Posts: 69
Re: C Basic Class Library
« Reply #76 on: November 18, 2013, 01:40:28 AM »
That's curious. It's okay on 32bit gcc (4.7.0) but shows up on 64 bit.

Using %p instead of %i should fix it.

    printf("Word Start: %p\n",w->bp);
    printf("Word End:   %p\n",w->ep);
    printf("Text End:   %p\n",w->et);
« Last Edit: November 18, 2013, 01:43:33 AM by Charles Pegge »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #77 on: November 18, 2013, 01:59:55 AM »
What file are these lines in? They aren't in the Test.c file.

grep isn't working for me for some reason and gives me a > prompt no matter what I try.  :-\

Offline Charles Pegge

  • BASIC Developer
  • Posts: 69
Re: C Basic Class Library
« Reply #78 on: November 18, 2013, 02:02:37 AM »
They are in LexiClass.c. I've reposted now.

http://www.allbasic.info/forum/index.php?topic=283

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #79 on: November 18, 2013, 02:05:59 AM »
I was able to find it with grep finally. The embedded quote got me.

Code: [Select]
jrs@laptop:~/C_BASIC/cbclass/20131118$ gcc Test.c -o cbgcc
jrs@laptop:~/C_BASIC/cbclass/20131118$ gcc -Wall Test.c -o cbgcc
jrs@laptop:~/C_BASIC/cbclass/20131118$ ./cbgcc
LO
HELLO
HELLOHELLOHELLO
9
helloLOhellohello
hellohellohello
42.000000
42.000000
AbcAbcAbcAbcAbcAbcAbc
LOLOLOLOLOLOLO
AbcAbcAbcAbcAbcAbcAbc
<
>
  Hello World!
<HELLO WORLD!>
<<HELLO WORLD!>>
HELLO
HELLOH
abc
       \abc
WORD:       aa
Class Size: 80
Char Width: 1
Word Len:   2
Word Start: 0x171e0d2
Word End:   0x171e0d4
Text End:   0x171e0d8
=
jrs@laptop:~/C_BASIC/cbclass/20131118$

Looks good Charles!

FYI: I gave it a try with g++. Needless to say I can understand why ROOT dislikes you so much.  ;D
« Last Edit: November 18, 2013, 02:11:03 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #80 on: November 18, 2013, 02:18:14 AM »
Quote
We might be able to engage with OSX at the Opengl Level. I've invested some time in exploring OpenGL-GUI possibilities.

I'm surprised no one has done a SDL X11 yet. They did a great job with DOSBox using SDL, a cross platform GUI seems like a natural. Seems Qt has the lead in this area. I can run Qt form based apps on Android now.

« Last Edit: November 18, 2013, 02:24:56 AM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: C Basic Class Library
« Reply #81 on: November 18, 2013, 05:49:01 AM »
Based on our discussions off line, OSX doesn't support a cross platform GUI toolkit worth using. Apple once again has defined their own standards and not willing to share their API on non-Apple products. Just like not being able to run OSX on non-Apple hardware. (legally) They have become an island and worse than Microsoft in this area. This is why I don't own any Apple products or develop exclusively for the platform.

Talk to me when Microsoft makes their GUI legally available on other platforms.

Quote
I'm going to take your advice and not spend any effort on Apple until IUP has a native Cocoa GUI version. (the IUP folks don't seem too motivated and I can see why)

Quote from: IUP site
Why Not Mac? The first Mac driver was developed for MacOS 9 and had several memory limitations so it was abandoned. With Mac OS X we have the opportunity to do something better. Today IUP runs on Mac OS X using X11 with Motif or GTK. We plan for the future to build a native driver, but it is not a Tecgraf priority.

Illustrating the point I was making to you, that implementing something like this is NOT A SIMPLE MATTER! 

I never advised you not to look into Apple, btw. 

Quote
@AIR - I noticed that your Tiny Times JADE Qt4 example was done on the Mac. Is Qt for the Mac a viable cross platform solution?

Yes, that's the reason that I provided that demo. 

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #82 on: November 18, 2013, 10:40:34 AM »
Quote
Talk to me when Microsoft makes their GUI legally available on other platforms.

I can run Windows applications on Wine legally. I can run XP in a VirtualBox. The bottom line is even though Windows isn't my platform of choice, I can still create programs for it without having to buy some over priced hardware that caters to appliance based users.


Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: C Basic Class Library
« Reply #83 on: November 18, 2013, 01:52:55 PM »
Take the time to actually read what I said.  I didn't say APPLICATIONS, I said their GUI.  In response to what you were saying about Apple not making their API available on other platforms.

Emulation is not the same as making the API available across the board.  Last time I checked, Wine was not a Microsoft Product.

This is a dumb discussion anyway, because both companies are in the business of making money, and don't care what we might think.

I chose Apple, simply because my background is in UNIX, on the command line, and that is what OS X is built on. 

Anyway, we've derailed this thread enough.  If you want to continue this discussion, you know how to reach me.

Oh, and take a look at the screenshot on your way out....this is my PC workstation at the job...




« Last Edit: November 18, 2013, 01:55:59 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C Basic Class Library
« Reply #84 on: November 18, 2013, 02:07:17 PM »
PLEASE take your work system down to shipping and tell them you're sending out for repair. (I will send you my shipping address in a private e-mail) I will respond to your company in a month or so indicating that your system was a total loss and not worth repairing. After a couple days of being without a system and your productivity dropping drastically, they will buy you a new and better Apple system and in the end we all will be better off for your efforts.  :-*

You could be Santa this year.  ;D

Seriously, I don't know why companies/employees don't get together during the holiday season and put together PC care packages of outdated gear that could give some kid an early chance at computing.
« Last Edit: November 18, 2013, 03:17:41 PM by John »