[Kde-bindings] PerlQt bindings ans SWIG ?
Richard Dale
rdale at foton.es
Mon Jun 8 09:41:03 UTC 2009
On Monday 08 June 2009 08:49:01 am Dominique Dumont wrote:
> Richard Dale <rdale at foton.es> writes:
> >> How about providing Smoke bindings with SWIG ? (I've looked at smoke.h,
> >> it should not be a big deal...)
> >
> > If you were to use SWIG you would be starting again. It isn't possible
> > to combine SWIG generated code with Smoke generated code is they are
> > functionally equivalent, although the way they work is very different.
>
> Err, I may have not been clear.
>
> I was thinking about generating Perl/Smoke bindings with SWIG. So that
> the Smoke magic code using Smoke API would be written in Perl instead of
> C++.
>
> This Smoke magic code (in Perl) would generate the bindings for Perl/Qt
> API.
>
> Does that make sense ?
At the moment the C++ code for the Smoke libraries (smokedata.cpp, x_1.cpp,
x_2.cpp etc) is generated with a perl script called 'kalyptus'. However, Arno
Rehn is rewriting the bindings generation compiler for a Google Summer of Code
project at the moment. If we rewrite it in C++ it means we can use a common
C++ parser shared by the KDevelop, QtScript bindings and QtJambi bindings
projects. The perl one works quite well, but it is a bit hackish in places and
we hope the C++ one will be more 'industrial strength' and allow ordinary KDE
developers to add bindings to their projects instead of needing language
bindings experts to do all the work.
The PerlQt runtime itself (Qt.xs and accompanying Perl code) was entirely
written by humans and couldn't be automated.
If you want to learn more about SWIG, my suggestion would be to experiment
with developing a Perl binding for a simple self contained class such as
'QPoint' and see what is involved, and exactly what SWIG does. I'm not sure
whether it has and option to parse header files directly, or whether it always
parses interface files that the bindings developer needs to create. Perhaps it
can be driven from a combination of both - I don't know.
-- Richard
More information about the Kde-bindings
mailing list