Re: #defines in 4gl
Posted in 1993
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
In article <1993Jun17.211022.14326@informix.com>, dranney@informix.com (David Ranney) writes: |> In article <1ttg96INNiat@emory.mathcs.emory.edu> archer!ciesla@stairs.att.com writes: |> >Fellow 4GL developers: |> > |> >For years, I've wished 4GL had a feature that would allow the |> >use of #define, #ifdef, #else, #include, . . . |> > |> >Has anyone figured out a way to do this in spite of Informix? And you folks |> >at Informix: Why has this feature never been supported in the language? |> |> We have a little trick we use around here, and it goes a little like this: |> |> - Pick a convention which substitutes for # in regular C code (we usually |> pick ! ) which will act as the first character of the line. For example |> you might have !include filename in a 4gl program. |> |> - Write an awk or sed script which puts a blank line at the beginning of |> every line which starts with "#". Thus "# comment" would become " # comment". |> After that the script should substitute every occurance of "!" at the |> beginning of a line with a "#", thus "!define" becomes "#define". The script |> should then save the contents into a new file. |> |> - run cpp on the new file which will now see the #define's created by your |> script and act on them accordingly. |> |> - Compile your 4gl program and have a nice day You can also use m4 macro processor available on unix to do the preprocessing. see "man m4" Have a nice day