Skip to content

Development Code Generator

Jefferson González edited this page Mar 17, 2014 · 3 revisions

Inside tools/source_maker directory resides the php script in charge of all the C/C++ code generation (code_generator.php) that forms the wxPHP extension. As said before this script depends on the json files generated by json_generator.php. The source maker will read the json files and create a set of headers and source files wrapping the wxWidgets classes defined on classes.json

It starts by decoding all json files and cleaning methods with unsupported parameter types as other features not handled correctly by the generator (like c++ templates). All the cleaning activity is logged on a file named discarded.log. Then it process each class using a php template system. The templates directory holds the source of what will form the skeleton of the wrapping code.

After generating the classes binding code it generates binding code to the global wxWidgets functions and store them on functions.cpp. Then it populates the files on source_templates directory with all the code needed to initialize each binded class, function, global variable, etc... At the final stage, it uses the config_templates directory to retrieve the configuration files skeleton and populate it with the list of files that need to be compiled.

Use the go.sh/bat utility script to automate some of the steps necessary or regen.sh script on the wxPHP root directory.

NOTE: For more information about the code generator check the README file on tools/source_maker directory.