Re: ESQL/C Preprocessor
Posted in 1993
>From: clawton@tfs.com (Chris Lawton) >Subject: ESQL/C Preprocessor >Date: 8 Oct 93 07:50:30 GMT >X-Informix-List-Id: <news.4539> >I'm having a problem with the esql/c preprocessor. > ... >BUT, (here's the problem/bug) the esql compiler will report: >esqlc: "../../../headers/hdr1.h", <last line #>: Error -33062: Missing ENDIF. > >A simplification to illustrate the problem: > >-----------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; >-----------EOF------------------ >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? Yes, this seems like a bug, and No, you aren't missing anything that I can see. I tested your simple example on INFORMIX-ESQL Version 5.01.UC1 on a Sun and got exactly your error. >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. Ummm. I'd love to help. But there is no -EI option analogous to the -I option for C (which is a known oversight -- a major one in my view), so the clean solution of using $include "t1.h" and letting the pre-processor worry about locating the files is not available. I dislike embedding path names, even relative path names, in code, because when the source is moved, it won't compile without changes. Maybe the best solution is to pre-process the ESQL/C with CPP to get your headers included by that (which will understand #include and -I), and then lob it at the ESQL/C compiler. I'd trust that, but it may be more trouble than it is worth to you. If I did use CPP, I'd probably define my own esql script which did that processing automatically, and make sure that script got used instead of the Informix-supplied script. However, you should be aware that the guts of the script change from release to release of ESQL -- things like the libraries change -- so you would have to revise (or at least check) your replacement script whenever you upgraded ESQL/C. This solution also has some file naming problems, and some line numbering problems. Maybe the best way of handling it is to have a script called syzygy (call it whatever seems appropriate to you) which does the cpp phase and then invokes the supplied esql script to finish the job. But this may require a change of extension (.ep for "to be preprocessed" which is translated by syzygy into a .ec file, which is converted to .c and .o by esql), and then we are getting back to a large set of changes. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>