Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!uunet!mcsun!hp4nl!phigate!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c Subject: Re: preprocessor question (non-ANSI) Keywords: #define C ANSI Message-ID: <1093@philmds.UUCP> Date: 12 Oct 89 11:56:17 GMT References: <174@eliza.edvvie.at> <1679@ruuinf.cs.ruu.nl> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 24 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? | `Example: | `EXEC SQL select * from emp; __curline = 23; EXEC SQL select * from emp; | `before ^^^^^^^^^^^^^^^^^^^^ after ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ` | `#define EXEC __curline = __LINE__; EXEC | `is not the solution, cpp would try to resolve EXEC recursively | |If your preprocessor is non-ANSI, you might try: | | #define EXEC __curline = __LINE__; EX/**/EC | |or something similar. Note that this is very unportable. Agreed; it does not work e.g. in Ultrix 2.x 8-) (recursive macro). For the original poster: seems you want to know the current line of an embedded SQL statement; if you happen to use Oracle as your DBMS, you can include oraca.h and inspect the value of oraca.oraslnr (this is the line number in the original source code, not the precompiled one). Leo.