The interface provides information about the parameters of a Natural subprogram or method
in a structure named parameter_description
. The structure is defined
in the header file natuser.h. This file is contained in the directory
<install-dir>/natural/samples/sysexnni.
An array of parameter_description
structures is passed to the
interface with each call to nni_callnat
and similar functions. A
parameter_description
structure is created from a parameter in a
parameter set using the function nni_get_parm_info
.
The relevant elements of the structure contain the following information. All elements not listed in this table are for internal use only.
Format | Element Name | Content |
---|---|---|
void* | address | Address of the parameter value. Must not be reallocated or freed. The address
element is a null pointer for arrays of dynamic variables and for x-arrays. In these
cases, the array data cannot be accessed as a whole, but can only be accessed
elementwise through the parameter access function nni_get_parm .
|
int | format | Natural data type of the parameter. Refer to Natural Data Types for further information. |
int | length | Natural length of the parameter value. In the case of the data types
NNI_TYPE_ALPHA and NNI_TYPE_UNICODE , the number of
characters. In the case of the data types NNI_TYPE_PACK and
NNI_TYPE_NUM , the number of digits before the decimal character. In
the case of an array, the length of a single occurrence. In the case of an array of
dynamic variables, the length is indicated with 0. The length of an individual
occurrence must then be determined with the function nni_get_parm_array_length .
|
int | precision | In the case of the data types NNI_TYPE_PACK and
NNI_TYPE_NUM the number of digits after the decimal character, 0
otherwise.
|
int | byte_length | Length of the parameter value in bytes. In the case of an array the byte length
of a single occurrence. In the case of an array of dynamic variables the byte length
is indicated with 0. The length of an individual occurrence must then be determined
with the function nni_get_parm_array_length .
|
int | dimensions | Number of dimensions. 0 in the case of a scalar. The maximum number of dimensions is 3. |
int | length_all | Total length of the parameter value in bytes. In the case of an array the byte
length of the whole array. In the case of an array of dynamic variables the total
length is indicated with 0. The length of an individual occurrence must then be
determined with the function nni_get_parm_array_length .
|
int | flags | Parameter flags, see Flags. |
int | occurrences[10] | Number of occurrences in each dimension. Only the first three occurrences are used. |
int | indexfactors[10] | Array index factors for each dimension. Only the first three occurrences are used. |
In the case of arrays with fixed bounds of variables with fixed length, the array contents
can be accessed directly using the structure element address
. In these cases
the following applies:
The address of the element (i,j,k) of a three dimensional array is computed as follows:
elementaddress = address + i * indexfactors[0] + j * indexfactors[1] + k * indexfactors[2]
The address of the element (i,j) of a two dimensional array is computed as follows:
elementaddress = address + i * indexfactors[0] + j * indexfactors[1]
The address of the element (i) of a one dimensional array is computed as follows:
elementaddress = address + i * indexfactors[0]