Difference between revisions of "ARRAY DEFINE()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
m (Text replace - "lianjaapi.h" to "lianja_api.h")
 
Line 7: Line 7:
 
==SYNOPSIS==
 
==SYNOPSIS==
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
int ARRAY_DEFINE(arrayname, level, dim1, dim2)
 
int ARRAY_DEFINE(arrayname, level, dim1, dim2)
Line 41: Line 41:
  
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
lianjaapi_array_define()
 
lianjaapi_array_define()

Latest revision as of 06:44, 11 April 2013

PURPOSE

Define an array

SYNONYM

api_array_define()

SYNOPSIS

#include "lianja_api.h"
 
int	ARRAY_DEFINE(arrayname, level, dim1, dim2)
 
<input parameters>
char	arrayname;	/* Address of a buffer containing the name of a array	*/
int	level;		/* Declaration level of array					*/
int	dim 1;		/* Dimension value 1						*/
int	dim 2;		/* Dimension value 2						*/
 
<output parameters>
none

DESCRIPTION

The ARRAY_DEFINE() function will define a two dimensional array with number of elements specified. 'dim 1' represents the number of rows and 'dim2' represents the number of columns. If 'dim2' is zero then a one dimensional array is defined. Two dimensional arrays can be accessed as one dimensional using a single element number.

NOTE: array elements start at 1 and not 0 as in 'C'.

The declaration level specifies how the array is declared and can be one of the following:

VALUE DESCRIPTION
API_PRIVATE Private to the calling procedure
API_PUBLIC Public to all higher level procedures

EXAMPLE

The following example creates a public two dimensional array called value.

#include "lianja_api.h"
 
lianjaapi_array_define()
{
    int	dim1;
    int	dim2;
 
    dim1 = 10;
    dim2 = 20;
 
    ARRAY_DEFINE("value", API_PUBLIC, dim1, dim2);
 
    _retl(-1);
}

SEE ALSO

_parinfa(), ALENGTH(), ISARRAY(), ARRAY_ALEN(), ARRAY_LOOKUP(), ARRAY_UPDATE()