Xref: news2.mv.net comp.os.msdos.djgpp:1069 From: Steve Higgins Newsgroups: comp.os.msdos.djgpp Subject: More Complex preprocessors Date: Tue, 13 Feb 1996 11:16:01 +0000 Lines: 60 Message-ID: <312072F1.41C6@alphdyn.demon.co.uk> NNTP-Posting-Host: alphdyn.demon.co.uk MIME-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hi All, Every so often I keep wishing that C/C++ had a decent macro preprocessor of the order of most macro-assemblers. I've had a play around with the different tools available and cannot find anything that really suits me. Can anyone suggest anything? Here is what I have looked at so far. 1) m4 This does give me much of what I want, however the m4 commands use words which could easily be used in the c code (shift, eval, index, len, etc...) causing all kinds of possible bugs. I would prefer each preprocessor line to be obvious ie starting with # or some other flag. 2) perl, awk These are all useful however there are a couple of problems I have with them. The most important of which is that I would need to create a command file which would recognise my own preprocessor directives in the c code and execute them. This command file is not such a trivial thing to create. (c source includes headers with our macros in it, there would also be a requirement for an expression parser for preprocesor arithmetic constructs like, #define NUM 1 #rept 20 int var_NUM; #define NUM NUM+1 #endr or #define CELLS ROWS*COLS #rept CELLS /* some initialiser */ #endr 3) sh UNIX shells have a similar problem to (2) with the restriction of unix platforms (has anyone found a decent MSDOS shell which doesn't require me to install LINUX?). 4) emacs lisp It would be quite nice to be able to use this as I could then expand the C source inside my editor and see the resultant code, however I would also need a command line equivelent to run in makefiles and of course all of the issues in (2) would apply here as well. What does anyone else think. Steve. -- Steve Higgins