← Back to team overview

kicad-developers team mailing list archive

Re: Python binding of enums

 

2012/8/9 Dick Hollenbeck <dick@xxxxxxxxxxx>

> On 08/09/2012 09:07 AM, Dick Hollenbeck wrote:
> > http://www.swig.org/Doc1.3/Python.html#Python_nn17
> >
> > Suggests that named objects are created in python by swig for each
> unique enum value.
> >
> > Don't know that there is any problem if *.i is done right.
>
>
> I think this means including more C++ headers into the *.i files to pick
> up the C++ enums
> and defines.
>

swig is picking up the C++ enums correctly, I promise I checked it :-), the
problem is internall swig typechecking,
not the enums being unknown by swig.


>
> As a means of surgically controlling which specific items are exported by
> SWIG, I think
> this means we have to tolerate at least the
>
>
> #ifndef SWIG
> #endif
>
> construct.
>
>
Yes, that can be good to avoid exposing unwanted parts.



>
>
> SWIG should not be #define-d when C++ is compiling, so one way to tell the
> swig compiler
> to ignore something is the
>
> #ifndef SWIG
> #endif
>
>
> construct, like you see at line 80 in dsnlexer.h, which I put in there
> back when I was young.
>


You stopped being young recently? :)


>
> This much, seems like a reasonable concession to use SWIG, but any more of
> an imposition
> we need to talk about, and I would want to get Jean-Pierre's opinion and
> Waynes in that,
> should more be needed.
>

Of course, it makes sense to think about it. and weight pros/cons for all
the reasonable solutions. One unreasonable would be: rewriting swig type
checks ;-)



> The tail should not start wagging the dog.
>

In this case: the snake should not start wagging the dog ;-)


>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>



-- 

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo

References