Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!ogccse!schaefer From: schaefer@ogccse.ogc.edu (Barton E. Schaefer) Newsgroups: comp.lang.c Subject: Re: preprocessor question (non-ANSI) Keywords: #define C ANSI Message-ID: <5060@ogccse.ogc.edu> Date: 10 Oct 89 16:52:02 GMT References: <174@eliza.edvvie.at> <1679@ruuinf.cs.ruu.nl> Reply-To: schaefer@ogccse.UUCP (Barton E. Schaefer) Organization: Oregon Graduate Center, Beaverton, OR Lines: 23 In article <1679@ruuinf.cs.ruu.nl> piet@cs.ruu.nl (Piet van Oostrum) writes: } In article <174@eliza.edvvie.at>, johnny@edvvie (Johann Schweigl) writes: } `How can I replace a text token by itself, along with some additional text? } `EXEC SQL select * from emp; __curline = 23; EXEC SQL select * from emp; } `before ^^^^^^^^^^^^^^^^^^^^ after ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } If your preprocessor is non-ANSI, you might try: } } #define EXEC __curline = __LINE__; EX/**/EC This doesn't quite work; cpp apparently re-evaluates the token as soon as it has stripped the /**/, so it becomes recursive. To completely fool cpp, you must use the horrible #define EXEC __curline = __LINE__; EX//**/**/**//EC } Note that this is very unportable. No kidding. -- Bart Schaefer "A Yellowbeard is never so dangerous as when he's dead." -- Graham Chapman, 1941-1989 CSNET / Internet schaefer@cse.ogc.edu UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer