> From: Niki Spahiev <[hidden email]>
> Toby Perkins <[hidden email]> wrote:
> > ...
> > How about a cross-parser-documenter script (in Python, natch)? A littl
> Such beast exist and is called SWIG. IMHO it will be hard to make minimal
Thanks to Niki. (...and apologies to all the other folks on the list
while us newbies fumble around trying to help each other.)
Dear fellow newbies:
SWIG seems to work well as the tool I had in mind. I downloaded SWIG
(www.swig.org), maked it, and installed it, following the clear
instructions, and read a few pages of how-to. Then I picked (with no
rhyme/reason) some C++ functions out of the wxWindows/wxPython
documentation. Happened to be BitMap. I copied a handful of C++
functions, eliminating overloaded functions (function names appearing
more than once, with different stuff inside their parentheses), two
extremely nasty C++ keywords ("static" and "virtual") and the C++
destructor function (which has a tilde), all of which made SWIG choke.
Then I mechanically put an "extern" at the front of every function
declaration and a semicolon at the end. I didn't have to generate any
Python constructors, because the doc already shows them. Here is my
final SWIG ".i" file:
All nasty stuff you can't read, right? I saved this file as
"BitMap.i". Then I typed "swig -python -c++ BitMap.i" on the command
line, opened the "BitMap_wrap.doc" file that swig created, and walla. I
don't know if the functions in the .doc file actually work in wxPython,
come to think of it, but they sure look Pythonish. Try it out.
> Thanks to Niki. (...and apologies to all the other folks on the list
> while us newbies fumble around trying to help each other.)
> Dear fellow newbies:
> SWIG seems to work well as the tool I had in mind. I downloaded SWIG
> (www.swig.org), maked it, and installed it, following the clear
> instructions, and read a few pages of how-to.
For an introduction to swig and python, you may also have a look at the
february issue of the linux gazette (www.linuxgazette.com)
(o- Hi, I'm a deadly e-mail virus, please copy me into your .signature
/\ file to help me spread. :: Bonjour, je suis un dangereux virus. SVP
Y_/_ copiez-moi dans votre fichier .signature pour m'aider à me propager.