From: Andrew Lunn <andrew@lunn.ch>
To: Samie Hassan Ghauri <samiehg@hotmail.com>
CC: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Macro declarations
Date: Mon, 30 Aug 2004 20:09:07 +0200
On Mon, Aug 30, 2004 at 05:44:42PM +0000, Samie Hassan Ghauri wrote:
> I have defined the macro as follows in my header file:
>
> typedef struct lcd_funs lcd_funs;
> struct lcd_funs {
> void (*decode_image)(cyg_uint32 imageWidth,
> cyg_uint32 imageHeight,
> Palette_element *paletteData,
> cyg_uint8 *imageData,
> cyg_uint16 bitsPerPixel
> );
> };
>
> #define LCD_FUNS ( _l, \
> _decode_image) \
> lcd_funs _l = { \
> _decode_image \
> };
>
> struct view_info{
> lcd_funs *funs;
> }; //view_info
>
> #define VIEW_INFO (_l, \
> _funs ) \
> view_info _l = { \
> &_funs \
> };
>
> I include it in my code file like this:
>
> LCD_FUNS (nec_lcd_funs, // line 87
> nec_decode_image // line 88
> );
Some compilers don't like comments inside macros invocations :-)
>
> VIEW_INFO (nec_view_info, //label
> nec_lcd_funs
> );
>
> On compilation, it gives parse error on line 87. Any idea?
What is the exact error? The error message is trying to tell you what
i wrong, so use the information.
What context are you invoking the macro? Inside a function or for a
global variable?
> Also, when using eCos config tool, we just point to the folder where
host
> and target compilers reside. Where can we change the make scripts that
are
> used in compiling the code in the repository? Eg. to add the switch -E
to
> gcc?
I don't use the gui tool so have another way of doing this.
cd down the work tree to the package directory for the package you want to
compile.
make clean
make
Scroll back and find the gcc invocation for the file you want to compile
-E.
Cut and paste the command.
Edit it and add -E
Andrew