Here is the problem description, I have a .h file which has all the "macro" flags definition and the .c file uses these macro.
The problem is I need to remove the part of the code which are undefined in the .c file. Here is the example,
Below is the example of "types.h" file,
#include <stdio.h> #include <stdlib.h> #define ALPHA 1 #define BETA #define GAMMA 0
Here is the corresponding C file
The above example is a dummy example from the above code the result has to be like,#include "types.h" void main() { int a, b, c; float d,e,f; #if (ALPHA) c = a+b; #endif #ifdef BETA f = e*d; #if (GAMMA) c = c + 10; #endif #endif }
void main() { int a, b, c; float d,e,f; #if (ALPHA) c = a+b; #endif #ifdef BETA f = e*d; #endif }
I was reading through the XS of perl will this help me, as of now I dont have any code or solution still looking for ideas.
Thanks a lot, -Prassi
In reply to C macro pre processing by prassi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |