Ogen generates C-Objects from an XML input file.
It generates 4 to 5 things:
#include "myapp/public/item.h" ... iOItem item = ItemOp.inst( "id007" ); const char* id = ItemOp.getId( item ); ...The ItemOp structure is filled with the right function addresses in the item.fm file.
<Project name="myapp" title="MyApp API" tolower="true" docname="myappapi" source="$Source: /cvsroot/rojav/rocs/gen/ogen.html,v $" revision="$Revision: 1.3 $">
<object name="Item" use="node" remark="An Item object.">
<const name="version" vt="string" val="0.10"/>
<fun name="inst" vt="this" remark="">
<param name="id" vt="const char*" range="*" unit="-" remark="ID for this new item."/>
</fun>
<fun name="getId" vt="void" remark="Get the item ID.">
<param name="inst" vt="this" remark="Item instance."/>
</fun>
<data>
<var name="id" vt="const char*" remark="The ID."/>
</data>
</object>
</Project>
After running in the directory myapp the command ../bin/ogen myapp.xml the following directories and files will be generated:| Node | Parent node Attribute/Constant | Remark | Default | Range |
|---|---|---|---|---|
| project | *root* | |||
| name | The real application directory or cvs module. | - | * | |
| docname | File name for the HTML documentation. | - | * | |
| title | HTML documentation title. | - | * | |
| tolower | Make all C files lower case. | false | true,false | |
| source | CVS keyword. | - | $Source: /cvsroot/rojav/rocs/gen/ogen.html,v $ | |
| revision | CVS keyword. | - | $Revision: 1.3 $ | |
| object | childnode of project | Object definition. | ||
| name | Object name. | - | * | |
| interface | Interface to implement. Should be defined first, or external: "$../module/xmlfile:interfacename" | - | * | |
| nobase | Object does not implements the base interface if set true. | false | true,false | |
| filename | Overwrite the default generated filename. | - | * | |
| use | Public headers from the librocs to include in the public header.(csv) Use $-prefix to include from other modules, or #-prefix for stdlib. | - | * | |
| include | Public headers from the module to include in the public header.(csv) Use $-prefix to include from other modules, or #-prefix for stdlib. | - | * | |
| remark | Object description. | - | * | |
| const | childnode of object | Constant value. | ||
| name | Constant name. | - | * | |
| vt | Variable type. (all possible C- and typedefs were string is translated in const char*) | - | * | |
| val | Value of constant. | - | * | |
| remark | Description of the constant. | - | * | |
| typedef | childnode of object | Type definition. | ||
| def | Valid C typedef. | - | * | |
| def | childnode of object | A define. | ||
| name | Define name. | - | * | |
| val | Define value. | - | * | |
| fun | childnode of object | Function definition. | ||
| name | Function name. | - | * | |
| vt | Return type. | - | this-* | |
| remark | Description of the function. | - | * | |
| param | childnode of fun | Function parameter definition. | ||
| name | Parameter name. | - | * | |
| vt | Variable type. | - | this-* | |
| remark | Description of the parameter. | - | * | |
| data | childnode of object | Object private data definition. | ||
| include | Public headers from the module to include in the impl header.(csv) Use $-prefix to include from other modules, or #-prefix for stdlib. | - | * | |
| var | childnode of data | Data variable. | ||
| name | Variable name. | - | * | |
| vt | Variable type. (all possible C- and typedefs were string is translated in const char*) | - | * | |
| remark | Description of the variable. | - | * | |
| struct | childnode of object | Object structure definition. | ||
| name | Structure name. | - | * | |
| typedef | Optional struct typedef. | - | * | |
| remark | Description of structure. | - | * | |
| var | childnode of struct | Structure variable. | ||
| name | Variable name. | - | * | |
| vt | Variable type. (all possible C- and typedefs were string is translated in const char*) | - | * | |
| remark | Description of the variable. | - | * | |
| interface | childnode of project | Interface definition. | ||
| name | Interface name. | - | * |
obj o = (obj)item; char* str = o->toString( o );or:
char* str = item->base.toString( item );
| Method Summary of obj | |
|---|---|
| void | del( obj inst ); Free this object. |
| const char* | name( void ); Returns name of object. |
| int | count( void ); Returns object count. |
| obj | clone( obj inst ); Clones this object. |
| Boolean | equals( obj inst1, obj inst2 ); Compairs both objects at contents. |
| byte* | serialize( obj inst1, long* size ); Serializes object contents. |
| void | deserialize( obj inst1, byte* bytes ); Serializes object contents. |
| char* | toString( obj inst ); String representation of this obj. |
| const void* | properties(obj inst ); If object has properties this should return an iONode. |