In article <QVkqf.40710$> , Mark P
<> writes
>I have a header file and want to expose only a limited portion of that
>file to SWIG (all you need to know is that when SWIG processes a file
>the preprocessor macro SWIG is defined). Otherwise I want to expose
>the entire file. Here's a schematic 5 line example; let's suppose I
>only want to expose lines 2 and 4.
>
>line 1
>line 2
>line 3
>line 4
>line 5
>
>One option is:
>
>#ifndef SWIG
>line 1
>#endif
>
>line 2
>
>#ifndef SWIG
>line 3
>#endif
>
>line 4
>
>#ifndef SWIG
>line 5
>#endif
>
>This works, but what I don't like about it is that's it's phrased in
>the "negative" and highlights all the things that aren't exposed to
>SWIG.
>
>What I'd rather do is something like:
>
>#ifdef SWIG
>"ignore everything except labelled code"
Perhaps ifdef/ifndef is the wrong choice of preprocessor directive, try:
#define SWIG 0
#if SWIG
line 1
#endif
line2
#if SWIG
line 3
#endif
line4
#if SWIG
line 5
#endif
Now you can switch suppression on and off by changing the value
associated with SWIG between 0 and 1
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see
http://www.spellen.org/youcandoit
For project ideas and contributions:
http://www.spellen.org/youcandoit/projects