Commit of New Version

Created by: wxphp
Date: 01/19/2012 @ 12:31:10 am
Views: 964

Today I commited the newest code based on wxWidgets 2.9.3 to the main trunk directory and created a tag of the old code based on wxWidgets 2.8.12

This new version binds about 471 classes including new additions to wxWidgets like wxRibbon. Also the new source maker generates code for global functions sow now about 100+ functions are binded. We have implemented a custom zend function to register global object variables so now we have constant access support for variables like wxNORMAL_FONT and others.

Summarized list of new features

  • Code generation for global functions
  • Code generation for global object variables
  • Automatic addition of needed header files to common.h
  • Template system to write custom code for functions and class methods
  • Better handling of virtual functions
  • Now wxWidgets functions that returned references are handled correctly
  • Set of unified functions to generate the code for class methods and global functions
  • Use of json format to enable manual editing of input files for code generator and making patching humanly possible
  • The code is better documented
  • Added a couple of samples on the examples directory
  • New reference generator
  • and many changes i forgot...

Other details

Another new feature is that parameters and return types declared as wxArrayString can be worked out using php builtin array syntax. As wxWidgets parameters defined like const type*  where the type could be bool, float, int, etc... are treated as arrays. New code generation was introduced to handle functions that get parameters as reference for example int*, int&. This kind of functions now modify the php user space value since it's treated as a reference.

Theres a new xml parser as I wrote in some older news that extract the details of wxWidgets doxoygen documentation. The old parser generated the output files that feed the source maker using serialize and unserialize php functions, making it impossible to manually edit them. I changed this behaviour and now the files are generated in pretty printed json format. After thinking which format was better json or xml, the first one was more easy to work and assembled better php associative arrays.

The config.m4 file was modified in order to enable passing the installation directory of wxWidgets and to enable debugging messages of the executed code. So to build you use something like ./configure --with-wxwidgets=/opt/wxWidgets-2.9.3 --enable-wxwidgets-debug

Source Maker

The almost rewritten from scratch new source maker is more friendlier to work now and supports a simple template system were one can define custom template files for functions and class methods. With some small tweaks this new code generator can create the source code of any c/c++ library that document it's code using doxygen or by manually creating json files that feed it. The source maker generated more than 500,000 lines of code for wxPHP, something that would take a lot of time and man power to do.

There are some areas were the source maker can still be improved as handling the correct destruction of objects and parameters passed as object** A feature in progress is the initialization of references to class variables declared on doxygen as public or private.

If you want to test this new version checkout the source at the sourceforge project page and compile wxWidgets 2.9.3. A README file is included with some details about it. For now it has only be tested on linux and compilation testing is needed on windows.

This new code brings the php binding of wxwidgets more near to completion :D