Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!oliveb!mipos3!omepd!merlyn From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.wizards Subject: Re: Need help using /usr/lib/cpp for generic text Message-ID: <4970@omepd.UUCP> Date: 26 Sep 89 01:47:48 GMT References: <838@pacific.mps.ohio-state.edu> Sender: news@omepd.UUCP Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA Lines: 38 In-reply-to: verber@pacific.mps.ohio-state.edu (Mark A. Verber) In article <838@pacific.mps.ohio-state.edu>, verber@pacific (Mark A. Verber) writes: [wanting to use cpp for macros and conditionals, and has problems with:] | (1) Bloody "# line-number file-name" lines [example deleted] | (2) Leavingin the text | | When I run text like: I get the output like: I would like: | | #define foo before before | before test | #ifdef foo test after | test | #endif after | after | | Any suggestions on getting cpp to eat the at the end of the control | lines? Is there a PD cpp or other macro processor that will do the | job for me... or should I pull out ye old perl manual. My first inclination would be "yeah, write what you want in Perl", just because it'd help the sale of my forthcoming book (:-), but really, cpp is NOT what you want. Both of your problems are because cpp output is expected to be fed into the C compiler, and the compiler wants to keep track of where the source lines were coming from *before* they were processed. If you don't want to do it from scratch, how about m4(1)? You can get pretty much EXACT control over your input-to-output translation, and except for the handful of well-defined commands, *nothing* else is defined. (Did'ja Ever try to have a variable named "vax" on a vax? I did. Sigh. :-) Just another Perl hacker, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel, Hillsboro, Oregon, USA | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/