ESQL/C Preprocessor
Posted in 1993
Hi. I'm having a problem with the esql/c preprocessor. Anyone out there able to help? Here's the problem: One programmer writes source code in a directory /project/source/level1 A second programmer writes source code in /project/source/level1/level2 Each programmer wants to include lots of header files from /project/headers and other directories. So a main header file exists in /project/headers that has lots of $include statements. Each programmer would like to be able to just specify at what depth in the tree their source code resides at, and the main header file is intelligent enough to give the right relative paths to all the included files. The main header file might look like: $ifdef LEVEL_TWO; $include "../../headers/hdr1.h"; . . Lots more files at level 2... . $endif; $ifdef LEVEL_THREE; $include "../../../headers/hdr1.h"; . . Lots more files at level 3... . $endif; Thus, for programmer to get all the needed include files, they would just write in their .ec files, $define LEVEL_THREE; /* or whatever is approriate */ $include "/project/headers/main_header.h"; BUT, (here's the problem/bug) the esql compiler will report: esqlc: "../../../headers/hdr1.h", <last line #>: Error -33062: Missing ENDIF. It says this even if hdr1.h has zero lines in it! A simplification to illustrate the problem: (all files are in the same directory) -----------file test.ec---------------- $define LEVEL_ONE; $include "t1.h"; main() { printf("Hello World\\n"); } -----------file t1.h------------------ $ifdef LEVEL_ONE; $include "t2.h"; $endif; -----------file t2.h------------------ $define SOME_USEFULL_DEFINE; at the prompt: esql -o test test.ec produces: esqlc: "t2.h", line 2: Error -33062: Missing ENDIF. Is this a bug? Am I missing something? Help! I'd really like this to work as it will save a lot of future maintaince of many header files for people to work at different levels. Please email responces (but posting is ok too). Chris Lawton clawton@tfs.com