I have a header that defines a large number of macros, some of which depend on other macros, however all dependencies are allowed in this header.
I need a single line font to print the macro value defined in this header.
As an example:
#define MACRO_A 0x60000000 #define MACRO_B MACRO_A + 0x00010000
As the first blush:
echo MACRO_B | ${CPREPROCESSOR} --include /path/to/header
... which almost gives me what I want:
... however, I try to keep it from swelling in a huge sequence of "blow it to this, and then connect it to this ...".
I also tried this:
echo 'main(){ printf( "0x%X", MACRO_B ); }' \ | ${CPREPROCESSOR} --include /path/to/header --include /usr/include/stdio.h
... but he (the gcc compiler) complains that -E is required when processing the code on standard input, so I have to write to a temporary file to compile / run this.
Is there a better way?
-Brian
source share