[PyKDE] Any tools to generate sip files?

Jim Bublitz jbublitz at nwinternet.com
Fri Mar 14 02:35:00 GMT 2003


On 13-Mar-03 Vio wrote:
> On conversion tools topic, I am also writing a tool to convert
> more broadly cpp -> pyqt/pykde (don't ask me why I need that :).
> Reading your post, the thought occured that I may be
> reinventing the wheel right now. Hence, anybody aware if such a
> cpp2py tool already exists?

I haven't ever looked for one - not aware of any.
 
> Secondly, I'd also like to have a look at your 'h2sip' tool, if
> posible.

Sure. I'll package up a tarball (and try to remember to put
switches around the KDE specific stuff) and write up a brief
README. I'll try to get to it this weekend.

It uses a handwritten predictive parser, and the tokenizer is
subclassed from the Python Tokenizer module. I've found it pretty
easy to extend/modify, but then again it's my code - YMMV. It might
be possible to extend it to cpp, but the stuff that handles
expressions and preprocessor stuff is really crappy at the moment
(don't need much of that for PyKDE h files fortunately). 

The way it stores data would be a nightmare for translating code
(you can't really look up a symbol in the symbol table very easily,
for example, unless you already know its scope, version, signature,
etc). However, that stuff is pretty well decoupled from the parser
and could be replaced without a lot of trouble. Without giving it a
lot of thought, I'd look at outputting some intermediate code (like
XML) and then working from that.

The tarball will probably run about 130K after endoding for email.
If you can't handle an attachment that size, let me know. Otherwise
I'll send you a copy in a few days.

If anyone else is curious, let me know. This isn't high quality
software at the moment.

Jim




More information about the PyQt mailing list