The dimension table is organized as follows:
Name Size Description
elen 2 bytes Element Length
tae 4 bytes NOD/Total Allocated Elements
cae 4 bytes Current Allocated Elements
sbs[0] 4 bytes Base and Size Elements (first subscript)
. . . . . . .
sbs[5] 4 bytes Base and Size Elements (sixth subscript)
The elen item defines the element length. It is 2 for INTEGER, 8 for REAL, 16 for COMPLEX, or the string dimensioned length. Only the elen item is defined for simple string variables.
The tae item defines the total number of allocated elements in the lower 24 bits and the number of dimensions in the upper 8 bits. Use the NOD macro defined in csub.h to extract this value.
The cae item defines the current number or elements in use. This value can be different from the value of tae if the program has executed a REDIM statement.
The sbs item defines the base and size values for each dimension. Only the dimensioned number of sbs items are allocated and defined. For example: If an array is defined with one subscript, only one sbs item is allocated and defined.
INTEGER Arguments
For INTEGER arguments the CSUB routine requires a pointer to the integer data value. This is defined as follows:
100 SUB TEST1(INTEGER A)
int test1( int NPAR, intptr a)
Where NPAR is the number of arguments in the CALL and a is a pointer to the integer data.
REAL Arguments
For REAL arguments the CSUB routine requires a pointer to the real data value. This is defined as follows:
110 SUB TEST2(REAL B)
int test2( int NPAR, realptr b)
Where NPAR is the number of arguments in the CALL and b is a pointer to the real data.
COMPLEX Arguments
For COMPLEX arguments the CSUB routine requires a pointer to the complex data value. This is defined as follows:
120 SUB TEST3(COMPLEX C)
int test3( int NPAR, cpxptr c)
Where NPAR is the number of arguments in the CALL and c is a pointer to the complex data.
Array Arguments
For Array arguments the CSUB routine requires two pointers, one for the data and one for the array dimension table. This is defined as follows:
130 SUB TEST4(INTEGER A(*))
int test4( int NPAR, intptr a, dimptr ad )
Where NPAR is the number of arguments in the CALL, a is a pointer to the array data, and ad is a pointer to the array dimension table. The array data elements are stored in row-major order.
String Arguments
For string arguments the CSUB routine requires two pointers, one for the string data structure and one for the string dimension table. This is defined as follows:
140 SUB TEST5( C$ )
int test5( int NPAR, strptr c, dimptr cd )
Where c is a pointer to the string data, cd is a pointer to the string dimension table.
The string data is made up of two parts, the current string length followed by the string data. See the csub.h include file for detailed information about string data.
String Array Arguments
For string array arguments the CSUB routine requires two pointers, one for the string data structure and one for the string array dimension table. This is defined as follows:
150 SUB TEST6( D$(*) )
int test6( int NPAR, strptr d, dimptr dd)
Where d is a pointer to the string array data, and dd is a pointer to the string array dimension table. The string array elements are stored in row-major order.