Marco P. Guest
|
Macro prescan question |
Posted: Fri Apr 04, 2008 1:54 pm |
|
|
I need to get a symbol containing the c source line number of its declaration.
Then I need to concatenate the __LINE__ result to another symbol.
For example I want to do
#define X ??????
so that where in the code appears
int X;
it becomes
int a12;
where 12 is the line numer of then "int X;" expression.
GNU preprocessor suggests to nest two macro calls in order to obtain the prescan and use its result in the second macro definition
Actually the following defines to the work into GNU C preprocessor
#define Z(l) a ## l
#define Y(l) Z(l)
#define X Y(__LINE__)
but in CCS the result is always a__LINE__ instead of a12.
Is this a bug or the desired behaviour? How can I solve my problem?
The final task is to use protothreads into CCS, but, due to the fact that CCS does not support the "case" statements put inside blocks nested into the switch block, I was trying to substitute the switch strategy using the goto_address and the label_address functions, but to do so, I need to define a label that contains the line number of its decalration.
Thank you. |
|