I noticed that there is nice protocol description in protocol.xml which is suitable for automatic code generation.
Current libraries are written manually. I attached simple code, which automatically generates frame-classes from xml protocol description. Code is in no way complete and is a dirty hack. In current state it generates non-compilable and incomplete classes which not always follow original API. For example enumerations aren't supported at all. There are several reasons for this. First, protocol.xml contains some errors. For example it contains attribute names with spaces in Resource.Resource ID. Next, manually created libraries sometimes use names which differ from protocol.xml names (say OkFrame/Okay). Next, i doesn't yet understand some protocol.xml intricacies. And last i sending here premature code in hope to hear thoughts and ideas from you. I think with little collaboration it is possible to unify all protocol libraries and protocol.xml. Automatic generation of serialization code enables more flexibility in future protocol modification. How to use generator? Unpack archive, launch protogen.py with 1 argument - path to protocol.xml. It will emit tpproto_cpp/, tpproto_java/, tpproto_py/ in current directory. --- Sergey
pygen.tar.bz2
Description: Binary data
_______________________________________________ tp-devel mailing list [email protected] http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel
