Download Procedure for Calling C Decode Functions

Transcript
Generated Print Functions
memory held within a specific generated type container. For example, a SEQUENCE type could
contain elements that require dynamic memory. These elements in turn can reference other types
that require dynamic memory. The generated memory free functions make it possible to release all
memory held within a variable of the type with a single call.
Generated memory free functions are written to the main <module>.c file. This file contains common constants, global variables, and functions that are generic to all type of encode/decode functions. If the -cfile command-line option is used, the functions are written to the specified .c or .cpp
file along with all other generated functions. If -maxcfiles is specified, each generated function is
written to a separate .c file.
The format of the name of each generated memory free function is as follows:
asn1Free_[<prefix>]<prodName>
where <prodName> is the name of the ASN.1 production for which the function is being generated
and <prefix> is an optional prefix that can be set via a configuration file setting. The configuration
setting used to set the prefix is the <typePrefix> element. This element specifies a prefix that will
be applied to all generated typedef names and function names for the production.
The calling sequence for each generated memory free function is as follows:
asn1Free_<name> (OSCTXT* pctxt, <name>* pvalue)
In this definition, <name> denotes the prefixed production name defined above.
The pctxt argument is used to hold the context pointer that the memory to be freed was allocated
with. This is a basic "handle" variable that is used to make the function reentrant so it can be used
in an asynchronous or threaded application. The user is required to supply a pointer to a variable
of this type declared somewhere in his or her or her program.
The pvalue argument is used to pass a pointer to a variable of the item that contains the dynamic
memory to be freed.
Generated Print Functions
The following options are available for generating code to print the contents of variables of generated types:
-print - This is the standard print option that causes print functions to be generated that output
data to the standard output device (stdout).
-genPrtToStr - This option causes print functions to be generated that write their output to a
memory buffer.
-genPrtToStrm - This option causes print functions to be generated that write their output to an
output stream via a user-defined print callback function.
240