Re: Can CPP process only one "conditional" ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 00:47 11.06.2008 -0700, adlv wrote:

>Hello
>
>I want to give the source code of my software (written in C and C++), either
>in a freeware version or in a shareware version.
>
>I could put something like this in my code :
>
>#if FREE_VERSION
> ?code A...
>#else
> ?code B...
>#endif
>
>then source files with the "code A" part would be given with the freeware
>package.
>and source files with the "code B" part would be given with the shareware
>package.
>
>I am wandering if CPP can generate output files corresponding to these two
>different versions of my source code. In other words I would like CPP to
>process only this conditional statement (FREE_VERSION), and _only_ this one!
>
>In other words :) I would like CPP to give the exact same output files as
>it's input files, except for this specific conditional.
>
> From what I have read in the CPP documentation and some faqs, I don't think
>CPP can do the job. But if someone here thinks it can, then it would make
>mine easier :)

You may want to give doxygen a try. It includes a preprocessor and can
be configured what macros to expand. That may give you the processed
source files as you want (and some nice documentation as well :)

I have never used it for that purpose but I think it can do it.

If that doesn't work you may want to write a script to filter the text files.
sed can probably do it.

bye  Fabi




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux