how about x.xml -> x_itf.h x_itf.cpp ?

Added by zhangzhou about 8 years ago

I found some .cpp/.h files' name ends with _itf, such as character_sync_itf.h/character_sync_itf.cpp, and all this files have a line of text "WARNING : this is a generated file, don't change it !" declared at the beginning, and also have a file named character_sync.xml on the same location.

so I think the X_itf.h/X_itf.cpp is generated from the X.xml file, but what's the tool to do the generatation process? and where's it? and what for?

Thanks!


Replies (1)

RE: how about x.xml -> x_itf.h x_itf.cpp ? - Added by sfb about 8 years ago

zhangzhou,

This is performed using XSLT. Using the .xml file (character_sync.xml) and the XSLT transform sheet you generate the resulting .h/.cpp files. The "tool" for doing this is a standard XML tool called xsltproc (apt-get install xsltproc). For the character_sync_itf files you will use the character_sync.xml file in conjunction with the generate_module_interface.xslt transform sheet.

This was written essentially for the module system which was written around the time that Ring was designed. Using the .xml file you can easily generate both the C++ source code for a module as well as the PHP you may need to interact with the module from a web page.

Unless you have a compelling reason for changing the interface it is best advised to leave the .xml template alone and retain the generated module interface code.

Hope that helps.

Thanks!
sfb
/s

(1-1/1)