swig/swig — pull request #104 by v-for-vandal (2013-11-11 15:32:46+00:00)
Title: Updates to lua bindings, part 1.

This is first part of updated lua bindings.
Main changes:
1. Class inheritance. Now, instead of merging functions/constants etc from all class bases into its table, class maintains a lua array with SWIG names of its bases. Getter/setter then traverse this list in depth-first manner.
2. Code refactoring. The main structure was retained, but some code was moved into separate functions and process of generating C-arrays with names of all functions/getters/setters etc was improved. IMHO it is now more understandable and maintainable.
3. Namespaces now fully supported. Each namespace is treated like a module. Module is just a table in lua. Global namespace becomes main module table, all other namespaces - subtable.
4. Changes to lang.cxx: original implementations of membervariableHandler set an attribute(flag) "memberget"/"memberset" before calling functionWrapper. I added same thing to variableWrapper, flags are called "varget"/"varset".

Drawbacks:
There were (and still are) an options (-elua/-eluac) that make SWIG generate methods/functions arrays in a way that was compatible with embeded lua. The code for this was taken directly from current bindings. Unfortunatelly I have failed to test them. Couldn't find any way to build and setup elua for usual PC. After brief review of elua code I am not even sure that it can be properly done. I will try to tackle this problem, but I would like to know your opinion on whether it is acceptable to mark elua support as experimental/use-on-your-own-risk-and-send-us-patches. All I can guarantee now is that elua bindings compile.
On the other hand, I have improved elua bindings and in theory they should now pass usual tests.

Compatibility:
New bindings maintains compatibility with previous version - old names are generated by default(verified by tests) A new cmd option was introduced that allows user to enable/disable compatibility.

Tests:
all tests are ok.

Current state:
All changes that were planned for this pull request were implemented. There is some debugging code inside, it is marked with comments '// TODO:REMOVE' in case some further changes will be necessary. And I didn't made any changes to documentation.

If the idea of the patch is ok with you:
1. I am ready to fix any issues that may arise and feedback is always welcome
2. If you give me preliminary approvement of request, I will start updating documentation.

Patch acts as prerequisite to:
1. Moving to standard typemaps library. (WIP)
2. Directors support. (WIP)