IonicWind Software

Aurora Compiler => Coding Help - Aurora 101 => Topic started by: pistol350 on June 12, 2007, 03:49:21 AM

Title: Ouch!! Stuck on a C synthax problem , any help ?
Post by: pistol350 on June 12, 2007, 03:49:21 AM
Does anyone know how to convert this simple line to Aurora ?

s_bitmap * loadbitmap(char *filename, char *packfile);


I may be wrong,
but what i understand is that a pointer "s_bitmap"
is passed to the loadbitmap() function.
But i also think that s_bitmap is the type that must be returned by the function

So to Aurora,
assuming that a char type can easily be replaced by a string type (not really sure though  >:()
we may have :

Declare  loadbitmap(char *filename, char *packfile),s_bitmap;

But if my suggestion is correct, What happened to the pointer that was passed to the function ???

I need a few explanations please  :-\
thanks!
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: Ionic Wind Support Team on June 12, 2007, 07:16:39 AM
Simpler than you think.  A pointer is returned from the function, and two pointers are passed.   In reality two strings are passed.

declare loadbitmap(string filename, string packfile),pointer;

Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: pistol350 on June 12, 2007, 07:34:50 AM
Thank you Paul!

But i am still a bit head ache  ;D since i wonder why in C it is needed to pass the pointers to the strings and to the function,
I mean does the string type have a native pointer while the char type not ? 
(weird question ) :-\



Edit :  Also ,let's say that the declaration was :  s_bitmap loadbitmap(char *filename, char *packfile);

Would it be this in Aurora ? :                           declare loadbitmap(string filename, string packfile),s_bitmap;

I am pretty sure of the answer but ,better searching for light by asking instead of remaining in doubt  ;D
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: Ionic Wind Support Team on June 12, 2007, 08:00:05 AM
C doesn't have a native string type.  It is handled by an array of CHAR and a pointer to that array is used.

Quote
Edit :  Also ,let's say that the declaration was :  s_bitmap loadbitmap(char *filename, char *packfile);

Then you would have to have the definition of the stucture s_bitmap. and it would be:

declare loadbitmap(string filename, string packfile),s_bitmap
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: pistol350 on June 12, 2007, 09:27:03 AM

QuoteThen you would have to have the definition of the stucture s_bitmap. and it would be:

declare loadbitmap(string filename, string packfile),s_bitmap

Yes , it is exacly what i have. :)
Thanks again!

I got One more troublesome line.This one is the kind of very troublesome LOL :

extern int __near joy_init(void);

What i understand is that there is a function which is "joy_init(void)" . ::)
Probably declared to return a data of int type .
But what "the hell" is " __near "  ? :D
A variable , a structure , another type  ???
And finally, what would be an equivalent for Aurora since i don't see anything by myself  :-\
Thanks!
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: Parker on June 12, 2007, 09:31:32 AM
I think you can just leave it out. There's no Aurora equivalent, and I think that __near has to do with what kind of jump statements are emitted by the compiler.
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: pistol350 on June 12, 2007, 10:56:50 AM
LOL !!!
Thanks Parker!
There must be a way! :-\
Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: Ionic Wind Support Team on June 12, 2007, 12:37:25 PM
__near is ignored in most modern C compilers.   It has to to with memory segments and 16 bit code.

Title: Re: Ouch!! Stuck on a C synthax problem , any help ?
Post by: pistol350 on June 12, 2007, 04:02:11 PM
thanks Paul!
Things are clearer now!