Advertisement

Getting string with all declarations

Started by June 26, 2010 04:26 AM
3 comments, last by WitchLord 14 years, 5 months ago
Can AngelScript generate a string with all declarations of objects, methods and functions that were bound from C++ to AngelScript?
If it doesn't have this feature yet, it would be an interesting thing to add bacause it would ease the documentation writing since we won't have to make that list manually.
...
Do you mean like inline documentation? If so, since Angelscript uses C++ comments (/**/ and //) anyway, you could always just use doxygen. Then on the C++ side, just leave notes saying "This class is exposed to Angelscript".
Advertisement
No, I mean a list with declarations of objects and functions bound from C++, like:
bindFunctionToAngelScript(myFunctionHandle1, "int functionInAs1()");bindFunctionToAngelScript(myFunctionHandle2, "int functionInAs2()");bindFunctionToAngelScript(myFunctionHandle3, "int functionInAs3()");bindFunctionToAngelScript(myFunctionHandle4, "int functionInAs4()");bindFunctionToAngelScript(myFunctionHandle5, "int functionInAs5()");string str = retrieveFunctionsString();/* str equals:int functionInAs1();int functionInAs2();int functionInAs3();int functionInAs4();int functionInAs5();*/
And then I could copy this string to write the documentation. In this case I could just write the names in the html doc file... but my app has hundreds of functions and methods that were written in C++ and bound to AS.

I could document the actual C++ functions and objects and use doxygen, but since the syntaxes are slightly different, the user could be confused.
...
Then what I would do is specifically note the syntactical differences in your documentation. For example, I wrote a ubytebuffer (basically a wrapper for std::vector<unsigned char>) class for angelscript that a sockets interface takes as input to be sent over the tubes that works quite well. However, the underlying sockets lib I am exposing expects a pointer to an array of unsigned chars and a value denoting how many bytes to send. Here, I would just note the differences in syntax ie: socket::send(ubytebuffer@) as opposed to socket::Send(uint8*,int) and let the description of the function take care of the rest. It's all in how well you write your documentation and how well functions map outbetween AngelScript and C++.
You can quite easily enumerate the registered interface if you wish.

Take a look at the code in the tests/test_feature/source/test_dump.cpp test. It shows how the interface can be enumerated and printed to the console.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement