Tool/Editor to interprete #if(Switch == ValueA) available ?

F

Frank Miller

Hello,

I have project written in C where are a lot of code looks like:

#define Vaule A 1
#define Value B 2
#define Value X 9

#define Switch ValueA

#if (Switch == ValueB)
code1
#endif

#if (Switch != ValueX)
code2
#endif


#defines are checked thousands of times within the whole project, this
makes the code nearly unreadable.

Ist there a tool or an editor out there which takes the current value
of the #defines and then copies
or shows only the part of the sourcecode, which is valid for the
current switch setting?
In my brief example above, it shold take/show only the code below #if
(Switch != ValueX)

This would it make much more easier to read the code.
I have to work on a project which has some dozends sourcecode files.

Many thanks for any hint!

Regards

Frank
 
E

Eric Sosman

Frank said:
Hello,

I have project written in C where are a lot of code looks like:

#define Vaule A 1
#define Value B 2
#define Value X 9

#define Switch ValueA

#if (Switch == ValueB)
code1
#endif

#if (Switch != ValueX)
code2
#endif


#defines are checked thousands of times within the whole project, this
makes the code nearly unreadable.

Ist there a tool or an editor out there which takes the current value
of the #defines and then copies
or shows only the part of the sourcecode, which is valid for the
current switch setting?
In my brief example above, it shold take/show only the code below #if
(Switch != ValueX)

This would it make much more easier to read the code.
I have to work on a project which has some dozends sourcecode files.

This isn't exactly Question 10.18 in the comp.lang.c
Frequently Asked Questions (FAQ) list <http://www.c-faq.com/>,
but it's close enough that the leads might be worth pursuing.
Also, the Gnu Emacs editor has a facility that's supposed to
do something like this. (The only time I tried to use it,
though, it got even more confused by the source's snarl of
conditionals than I was. Caveat emptor.)
 
F

Frank Miller

Hello Eric,
... Question 10.18 in the comp.lang.c

Thanks for your hint, the tools mentioned there may help me a lot.
But I was not able to find/download a Windows executable for unifdef,
rmifdef or scpp('selective C preprocessor').

Do you (or anybody else) know, where I can get this tools as
executable running under Windows XP OS?

Thanks for any hint!
Regards

Frank
 
R

Richard Bos

Ira Baxter said:
Semantic Designs has

....a nasty habit of posting advertisements where they're not wanted. And
never posting anything else at all. Beware of doing business with
companies with such low morals.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top