johnny@edvvie.at (Johann Schweigl) (10/08/89)
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 I know, sed is the most natural solution, but I want to do all by including a single file. ANSI is not spoken on my system. Any help appreciated. Thanks, johnny -- This does not reflect the | Johann Schweigl | DOS? opinions of my employer. | johnny@edvvie.at | Kind of complicated I am busy enough by talking | | bootstrap loader ... about my own ... | EDVG Vienna |
piet@cs.ruu.nl (Piet van Oostrum) (10/10/89)
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.
--
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31-30-531806 Internet: piet@cs.ruu.nl
Telefax: +31-30-513791 Uucp: uunet!mcsun!hp4nl!ruuinf!piet
dfp@cbnewsl.ATT.COM (david.f.prosser) (10/10/89)
In article <174@eliza.edvvie.at> johnny@edvvie.at (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 >I know, sed is the most natural solution, but I want to do all by including >a single file. ANSI is not spoken on my system. With ANSI C, your example macro definition will work as you desire. Dave Prosser ...not an official X3J11 answer...