Article View: comp.lang.c.moderated
Article #2026Re: [HELP] TOOL FOR REMOVING TOO MANY #ifdef's
From: Shaun Flisakowski
Date: Fri, 16 Feb 1996 15:25
Date: Fri, 16 Feb 1996 15:25
54 lines
2277 bytes
2277 bytes
In article <4g16vd$mp0@solutions.solon.com>, ACS <acs@aracnet.com> wrote:
>Hi,
>
>I was given a huge "PORTABLE" C/C++ source code that's supposed to
>compile under DOS, Unix, Windows, etc. I am currently adding some
>features while porting the source set to Windows95. Of course I
>am having quite a bit of problems.
>
>The task of adding new features and building a new Win95 port is
>IMMENSELY exacerbated because the source set has a huge number
>of #ifdef's for various OS/Version/features builds.
>And frankly, I have no idea at all what some of these #ifdef's mean
>(Ex. #ifdef _PRACTICAL).
>
>What I would like to do is "SELECTIVELY PREPROCESS THE SOURCE
>WITHOUT SUBSTITUTING MACROS". This way I figure I could reduce
>the size of the source set by 50%, and make it more intellible.
>I tried GNU CPP, but I could not find a way "NOT TO SUBSTITUTE MACROS".
>
>Could anyone point me to a tool that does
> "SELECTIVELY PREPROCESS THE SOURCE WITHOUT SUBSTITUTING MACROS"
>
>Thanks, Adrian
I have a perl script that does something like that, (perl is
available for MSDOS).
ftp.cs.wisc.edu:/coral/tmp/elim
Usage: elim [-p <defined name>] [-n <defined name>] files
-p: Save the positive (defined) version of the ifdef.
-n: Save the negative (not defined) version of the ifdef.
Example:
#ifdef BLAH
for(i=0; i<5; i++){
# else
for(i=5; i>0; i-){
#endif
Running this code through 'elim -p BLAH' will result in:
for(i=0; i<5; i++){
Note that the other version would have resulted if the test was #ifndef
Shaun
--
Shaun flisakow@cs.wisc.edu
"In your heart you know its flat."
-Flat Earth Society
Technical Details
Message-ID:
<4g27ko$q92@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4g16vd$mp0@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: flisakow@cs.wisc.edu (Shaun Flisakowski) Newsgroups: comp.lang.c.moderated Subject: Re: [HELP] TOOL FOR REMOVING TOO MANY #ifdef's Date: 16 Feb 1996 09:25:12 -0600 Organization: U of Wisconsin CS Dept Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4g27ko$q92@solutions.solon.com> References: <4g16vd$mp0@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com