[Kde-bindings] php_qt and smoke

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Nov 21 17:22:17 UTC 2005


Hi Thomas

On Thursday 10 November 2005 20:50, Thomas Moenicke wrote:
> Hi Richard,
>
> first:
> I test kalyptus and it works fine with the headers but when I try it with
> the complete sources the script breaks with the following output:
>
> ...
> unio isn't a known type (type=unio)
> unsigned char QT_FASTCALL isn't a known type (type=unsigned char
> QT_FASTCALL) unsigned int save_yourself_in_progress : isn't a known type
> (type=unsigned int save_yourself_in_progress :)
> unsigned int shutdown_in_progress : isn't a known type (type=unsigned int
> shutdown_in_progress :)
> ushort QT_FASTCALL isn't a known type (type=ushort QT_FASTCALL)
> void *[1] isn't a known type (type=void *[1])
>
> void *[1] isn't a known type (type=void *[1])
> Died at kalyptusCxxToSmoke.pm line 2545.
>
> command was:
> ./kalyptus -fsmoke  qtsrc/gui/widgets/* qtsrc/gui/styles/*
> qtsrc/gui/kernel/* qtsrc/gui/itemviews/* qtsrc/gui/inputmethod/*
> qtsrc/gui/dialogs/*
> qtsrc/gui/accessible/* qtsrc/corelib/kernel/* qtsrc/corelib/tools/*
> qtsrc/corelib/plugin/* -d tmp/
>
> second:
> I looked into kalyptusCxxToJava.pm and it seems to be extensive to write
> such a file from scratch. It does what I want and after I have understood
> it I write such a file for php. I hope it can help me to write most of the
> functions automatically.
>
> third:
> I like the idea to generate subclasses of the Qt classes which allow to
> call protected methods with smoke (I have pseudoclasses to do that) but I
> don't see the meaning of smokedata.cpp. It is hard to read with the numbers
> and, maybe, it is ruby specific? I have just a vague idea how it works.
No, it isn't ruby specific and it does exactly what you want, so you shouldn't 
need to write any new kalyptus/Smoke code generation as it will work fine 
with php too. Both for Qt3 and Qt4 - that's the good news! Smoke has the 
subclasses to call protected methods, and callbacks so you can override 
virtual methods from the scripting language.

On the other hand you will need to understand how QtRuby works and do 
something similar for PHP... It might not be too easy to follow at first, but 
it isn't as hard as it seems. You just need to know how to look up a method 
in the Smoke lib (that's what all the tables with numbers are for), and then 
convert the PHP arguments to C++ ones, and put them on the 'Smoke::Stack'.

It is all based on the 'method_missing()' call in ruby, which is a kind of 
'catch-all' method that gets called if you call a method on a ruby instance, 
and it isn't there. I'm certain there is a similar call in PHP, because 
someone asked about it a year or so ago. They looked into it, and found a 
suitable method - I'm afraid I've forgotten the name.

-- Richard



More information about the Kde-bindings mailing list