updated at: 20050315 CET

Rocs Wrapper Generator



top

Introduction:

Wgen generates C-Wrapper Objects from an XML input file.
It generates 3 things:

  1. a public header file
  2. the implementation C file
  3. HTML documentation
And with those files C has got node wrappers:

e.g.:
#include "myapp/wrapper/public/Car.h"
...
void test( iONode carnode ) {
  ...
  const char* cartype = wCar.gettype( carnode );
  if( StrOp.equals( wCar.TYPE_BEETLE, cartype ) ) {
    ...
  }
  ...
  /* Check the contents of the given node to the wrapper definition. */
  Boolean err = wCar.dump( carnode ); 
  ...
}


top

Example XML input file:


<wrapper modulename="myapp" docname="myapp" title="MyApp Wrappers">

  <Car title="Car:" remark="Car wrapper.">
    <const name="TYPE_BEETLE" vt="string" val="Beetle"/>
    <var name="type" vt="string" defval="Beetle" range="*" remark="Car type."/>
  </Ola>

</wrapper>
After running in the directory myapp the command:
../bin/wgen public/wrapper.xml -all
the following directories and files will be generated:
The -all commandline option overwrites the public attribute into true.

top

Commandline options:

The first option must be always the input xml file!
optiondescription
-allcreates all html documents
-lang [en,de,...]language to use in case of an external description file
-desc [descfile]external description file


top

Example description file:


  <?xml version="1.0" encoding="ISO-8859-15"?>
  <descriptions>
    <description id="Car.type">
      <de text="Auto Typ"/>
      <en text="Car type"/>
    </description>
  </descriptions>

Call wgen with options -lang and -desc:
../bin/wgen public/wrapper.xml -all -lang en -desc car-desc.xml


top

Definition of XML input files:

NodeParent node
Attribute/Constant
RemarkDefaultRange
wrapper*root*
modulenameThe real application directory or cvs module.-*
docnameFile name for the HTML documentation.-*
titleHTML documentation title.-*
sourceCVS keyword.-$Source: /cvsroot/rojav/rocs/gen/wgen.html,v $
revisionCVS keyword.-$Revision: 1.6 $
*childnode of wrapperwrapper object name-*
titleHTML documentation title.-*
remarkDescription of the wrapper.-*
cardinalityThe times this node may appear.n1-n
publicDocument this node and all childs.true*
externExternal; not creating a wrapper.false*
requiredRequired child node.falsetrue or false.
structnameOverwrite default structure name.Wrapper object name.*
wrappernameOverwrite default file name.Wrapper object name.*
createwrapperDoes not create a wrapper when set false. (Documentation only.)truetrue or false.
varchildnode of *Wrapper variable.
nameVariable name.-*
vtVariable type.
(all possible C- and typedefs were string is translated in const char*)
-*
defvalDefault value in case attribute not exist.-*
rangeValue range.
("0-*" or "10-20" or "yes,no")
-*
unitValue type.-*
remarkDescription of the variable.-*
constchildnode of *Constant value.
nameConstant name.-*
vtVariable type.
(all possible C- and typedefs were string is translated in const char*)
-*
valValue of constant.
$-Prefix avoid quoting. e.g. "$__DATA__" = __DATE__
-*
remarkDescription of the constant.-*