TOC PREV NEXT INDEX


Other Generated Functions


In addition to the functions described above, the following other types of functions are generated as part of the code generation process:
Initialization function
Memory free function
Utility functions based on data type
All of these common functions are applicable to both encode and decode operations and, as such, are written to the common base .c file. The format of the name of this file is as follows:

<xsdFileName>.c

where <xsdFileName> is the base name of the XSD file being parsed. For example, if code is being generated for file x.xsd and -test is specified, then the common functions will be written to x.c.
Initialization functions are for initializing a variable of a generated data type before use. This includes setting all fields that contain default or fixed values to the value specified in the schema. All other fields are set to zero. The format of an initialization functions name is as follows:

[<ns>]Init_<typeName>

where <typeName> is the name of the XSD type for which the function is being generated and <ns> is an optional namespace setting that can be used to disambiguate names from multiple sources (note: this should not be confused with XML namespaces which are different).
The calling sequence for each generated initialization function is as follows:

<initFunc> (OSCTXT* pctxt, <typeName>* pvalue)
 

In this definition, <initFunc> denotes the formatted function name defined above.
The pctxt argument is used to hold a context pointer to keep track of global parameters. The pvalue argument is a pointer to a variable of the type to be initialized.
Memory free functions allow memory associated with a specific typed variable instance to be freed. Their use is not required to free memory - the run-time function rtxMemFree can be called directly with a context variable to free all memory associated with a context. There are applications, however, where freeing the memory contents of a specific variable are desirable.
Memory free functions are not generated for all types - only those that contain fields that use dynamic memory. This includes types that contain elements or attributes that reference other types that use dynamic memory. The format of a generated memory free function is as follows:

[<ns>]Free_<typeName>

where <typeName> is the name of the XSD type for which the function is being generated and <ns> is an optional namespace setting that can be used to disambiguate names from multiple sources (note: this should not be confused with XML namespaces which are different).
The calling sequence for each generated initialization function is as follows:

<freeFunc> (OSCTXT* pctxt, <typeName>* pvalue)
 

In this definition, <freeFunc> denotes the formatted function name defined above.
The pctxt argument is used to hold a context pointer to keep track of global parameters. The pvalue argument is a pointer to a variable of the type containing the memory to be freed.
Other utility or "helper" functions are type specific and designed to help the user work with the generated code. The following utility function are generated for the following types:

Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX