Re: Fwd: Re: [AD] [AL] Problems with dat2c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


onsdagen den 9 oktober 2002 16.34 wrote Laurence Withers:
...
> struct _anonymous_FONT_GLYPH_n {
>   int w, h;
>   char data[<number of bytes for this object goes here>];
> }
> struct _anonymous_FONT_GLYPH_n some_object = {
>   8, 8,
>   "fontdata"
> };
Remove both '_anonymous_FONT_GLYPH_n' and the second 'struct', they have no 
meaning, make them anonymous instead of name them anonymous.

> /* and then in the header file: */
> extern FONT_GLYPH some_object;
Great idea! And similar for the bitmaps etc. (but rememer that it is not the 
glyphs that should be exported, only the font, bitmap etc).

> This means that compiling the dat2c-generated source file will generate
> warnings, but otherwise we should be alright. It also depends on the C
> compiler not changing the offsets of members within structures - this
> is an assumption, but it should hold.
No, there will no warnings as long as we don't include the header in the 
generated c-file (which we shouldn't).

> Yep. You can't declare a global variable like this:
> int* some_global_ptr = p;
>
> but you can like this:
> int* some_global_ptr = &global;
...
> to use dat2c objects *at compile time* (for instance, to initialise a
> DIALOG[] array with bitmaps, etc).
Yes, you are right.

Again: drop the lines int grabber.txt that fools the user to be satisfied with 
warnings.
/C



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/