[PySide] Shiboken in python -- was PySide - Qt5 - Swig

Hugo Parente Lima hugo.lima at openbossa.org
Tue Jan 15 15:01:36 CET 2013


On Monday, January 14, 2013 08:35:39 PM Lucas Tanure wrote:
> *Hugo*, Can you help on this ?

Yes, I'm still thinking if I should or shouldn't start to write something in 
python to replace the current generator, I'm just afraid of do a lot of 
promises and not finish anything due to lack of time.
 
> What generator\shiboken\cppgenerator.cpp eats? What's supposed to be the
> output ?

First the APIExtractor preprocess a header file including all C++ header files 
form the library you want to bind, the output of the ApiExtractor goes to a 
temporary file, then we feed ApiExtractor again with this preprocessed file and 
a typesystem file.

ApiExtractor has a C++ parser, it uses that to create a code model of the C++ 
code found in the file, after the code model have been created it parses the 
typesystem and create another (confuse and with an ugly API) model, they are 
the classes AbstractMeta*, there's also another entity, the TypeEntries that 
IIRC represent a code model type type declared in the typesystem.

When ApiExtractor finishes, it have a collection of AbstractMetaClasses and a 
collection of AbstractMetaFunctions (the global functions), so it iterate over 
this objects calling the generator.

There are at least two generators, the HeaderGenerator and the CppGenerator, 
one to create header files other to create the implementation, these classes 
inherit ShibokenGenerator that just have common routines used by both.

About the C++ code generated:

- I'm not the better person to explain the current code being generated, 
Setanta (Marcelo Lira) did a huge refactor on "Converters" in the generated 
code few months before I stop working full time on PySide, and I never stop to 
careful read the changes.

The design of the whole generator stack have some flaws, and the ugliness of 
the code is mainly due to the bad API of APIExtractor, so what if really 
needed to have a good generator is a very good API to expose what's in the C++ 
code you want to bind and what are the changes the user want to that function 
(e.g. what's on typesystem). 

> I know that the output should some cpp code, but can you give more details?
> 
> The generator\shiboken\cppgenerator.cpp  should be the place where I answer
> my doubts. And for this I need a goal ?
> Like write an python code that can read this and output some cpp code. And
> if you compile this code something happen .
> 
> Don't take me by a fool , or stupid, I just want to understand the start
> and the end, and then I design some python software between them.
> 
> 
> Lucas A. Tanure Alves
> +55 (19) 88176559
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130115/311a0d1d/attachment-0001.sig>


More information about the PySide mailing list