Structures - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

NetLinx Programming Overview
NetLinx expands the capabilities of the assignment operator '
assigned to another array using the '
data type of the array. You cannot assign a two-dimensional long array to a one-dimensional character
array. The
to the
LENGTH_ARRAY
INTEGER ARRAY1[10] = {1, 2, 3, 4}
INTEGER ARRAY2[10] = {5, 6, 7}
INTEGER ARRAY3[10]
INTEGER DIM2ARRAY1[3][4] = { {1, 2, 3}, {4, 5, 6} }
INTEGER DIM2ARRAY2[3][4] = { {7, 8, 9} }
INTEGER DIM2ARRAY3[3][4]
ARRAY3 = ARRAY1
DIM2ARRAY2[2] = ARRAY1
DIM2ARRAY3 = DIM2ARRAY1

Structures

Arrays are limited by their inability to have multiple data-types within one array. NetLinx supports
Structures to remove this limitation. Structures group different data types together as one data unit.
Structures also group arrays of structures together so that each element of the array contains all of the
elements of the structure. This may sound complex, but it is actually very familiar.
A database table is an array of structures. The database table is an array of records. Each record is a
structure. Each record contains data of different types. Let's first consider the elements of a database
table. We then show how to define the structure and create a variable that uses the data structure in an
array. We show how to access the individual elements of the structure.
Employee Number
Employee National Insurance Number (* National Insurance Number - Long *)
Employee First Name
Employee Last Name
Contribution to Pension
The
DEFINE_TYPE
within the
DEFINE_CONSTANT
within the
DEFINE_VARIABLE
DEFINE_VARIABLE
The attributes
elements of the structure, but can be attributed to the instances of the structure as defined in the
DEFINE_VARIABLE
The standard format for structures is:
STRUCTURE <name>
{
[<type>] <data1>
[<type>] <data2>
.
.
}
Using this format, we define our 'employee' structure in the
14
' operator, if the arrays match the number of dimensions and the
=
of the array to the left of the '
MAX_LENGTH_ARRAY
of the array to the right of the '
section is added to the basic structure of a NetLinx Program. Structures are defined
section. The
DEFINE_TYPE
section and the
DEFINE_VARIABLE
section but must be declared before they are used within the
DEFINE_CONSTANT
section, placing
DEFINE_TYPE
is the logical location.
,
NON_VOLATILE
VOLATILE
section.
' to support arrays. Similar array levels are
=
' operator must be greater than or equal
=
' operator.
=
(* ARRAY3 = {1, 2, 3, 4} *)
(* DIM2ARRAY2 = { {7, 8, 9}, {1, 2, 3, 4} } *)
(* DIM2ARRAY3 = { {1, 2, 3}, {4, 5, 6} } *)
(* INDEX - Integer Value *)
(* First Name - Character Array *)
(* Last Name - Character Array *)
(* Contribution in % - Float *)
section appears between the
DEFINE_TYPE
section. Since structures cannot be used
between
DEFINE_CONSTANT
, and
do not apply to the individual data
CONSTANT
DEFINE_TYPE
NetLinx Programming Language Reference Guide
and
section:

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents