SWIG Swings into another Successful Summer
November 30th, 2012 | Published in Google Open Source
SWIG is a software development tool that connects programs written in C/C++ with a variety of high-level programming languages.These so called ‘target languages’ vary enormously. The most popular being the scripting languages Python, Perl, Ruby, PHP & Tcl and the strongly typed languages, Java & C#. The full list of target languages also includes various Scheme and Common Lisp languages as well as XML.
This year was SWIG's third Google Summer of Code, and out of our five students, four completed the program successfully with valuable additions to SWIG base.
Dmitry Kabak worked on SWIG internals to parse the source code documentation comments within the C/C++ header files and use them to document the target language wrapper classes/functions. Dmitry's efforts complemented the existing support added in Google Summer of Code 2008. In summary, all previously known bugs have been fixed and original source code for comment translation re-factored to improve performance and maintainability. Parsing of C/C++ source code has been improved, so that every declaration/definition can now be commented. Translation of Doxygen tags to Javadoc and Python docstrings has been improved and corresponding regression tests have been implemented. The work can be tried out on the branch gsoc2012-doxygen.
Leif Middelschulte worked on C module for SWIG. Initially this project was supposed to be about implementing missing support for "advanced" C++ features because this module was thought to already be in very good shape. Unfortunately, this was not the case so Leif's task was changed to achieve at least a minimal level of module functionality which he accomplished. Leif also rationalized and documented the use of C typemaps and more generally improved documentation and testing support. Finally, the generated C bindings were made more type-safe to disallow passing objects of different types without so much as a warning from the compiler. Leif's Google Summer of Code work can be accessed in the subversion branch gsoc2012-c.
Neha Narang worked on a JavaScript module for SWIG, particularly addressing the JavaScript Core engine. Based on the prototypical work of Ashish Sharma and Oliver Buchtala, Neha implemented basic features: global functions and variables, classes, single inheritance, constants, enums, exception handling. She added 12 common examples and started the test-suite, currently having 32 tests. Additionally, Neha created detailed documentation describing design rationale and module usage. The module is in good shape but more tasks are left to complement the test-suite and add director support. Neha's work in Google Summer of Code is available in the branch gsoc2012-javascript.
Swati Sharma spent her summer working on the Objective C module for SWIG. SWIG had an initial support for generating Objective C wrappers over C++ which was added in Google Summer of Code 2009. These wrappers will be used to make C/C++ objects available to MacOS X, iPhone, and iPad applications. Swati’s goal for the summer was to have a cleaner implementation over the existing source code and get the code ready to merge into trunk. Swati finished close to the goal with almost completely rewritten, clean implementation. Much of the source code is new and fixes a lot of rough edges. We now have a more comprehensive set of typemaps for Objective- C and C++ type conversions. Almost 90% of the test-suite works and a number of new runtime tests have been added. Makefiles have been reorganized and the structure of the generated code re-designed to equally support Apple’s cocoa framework on Macos x and GNUStep on Linux/ Windows. Swati is very keen to add more features in coming months, especially the director support, support for clang, and updated module documentation. Swati’s work can be accessed in the branch gsoc2012-objc.
We would like to thank Google for sponsoring the Google Summer of Code. A special thanks to all the mentors for their hard work and William Fulton, the co-administrator, for his guidance and support.
By Ashish Sharma, SWIG Organization administrator