lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi, I am currently writing a tool to analyse C++ code (possibly with user defined extensions) and generate user defined informations from it (something a bit similar to openc++, but output is not necessarily C++ code). This tool will be written with lua so that user extensions will be easy to write.

One application will be to generate bindings for scripting languages.

I have the feeling that all the problems you are pointing out when creating a binding from original header files may be solved by using correctly defined user extensions and rules (for example regexp rules on function names). However, my stuff is experimental and not yet functional, so we will see how it goes :)

Nick Trout wrote:

Tolua can't make up its mind what you want to expose to the script
though. I think you can already put (something like) // TOLUA on ... expose this bit ...
// TOLUA off

in your code, so you can do this in header files already. Personally I
think your code just ends up looking a mess though. Downside is you have
to go to 2 different files when the interface changes but its not
exactly a major overhead. I suppose you could put something like #if 0
// TOLUA on ... #endif in the same header - I've seen this with a fair
amount of SWIG code.

If you're binding to 3rd party code you end up commenting out lots of
stuff or altering the syntax until it works (eg. glColor3f @ glColor) so
its not practical to comment or reuse the header.

The other issue is dependencies, you don't want to end up touching a
header file repeatedly and recompiling all dependent files when it's the
binding you're altering, not the interface client implementation.