Subroutines; Define_Call Subroutines; System_Call Subroutines - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Language Elements

Subroutines

A subroutine is a section of code that stands alone, and can be called from anywhere else in the program.

DEFINE_CALL subroutines

The
DEFINE_CALL
DEFINE_CALL '<subroutine name>' [(Param1,Param2,...)]
{
}
where
(Param1, Param2, ...)
pairs. For example,
DEFINE_CALL
names. Unlike identifiers,
A subroutine may accept parameters. To do this, each parameter and its type must be listed within the set
of parentheses to the right of the subroutine name, as shown below:
DEFINE_CALL 'Read Input' (CHAR Buffer)[ ]
{
}
To invoke a user-defined subroutine, use the
required calling parameters.
CALL 'Read Input' (Buf1)
In NetLinx,
although return values are not supported.
DEFINE_CALL 'Read Input' (CHAR Buffer)
{
}

SYSTEM_CALL subroutines

A
SYSTEM_CALL
program file called a LIB file with a
PROGRAM_NAME = 'COSX'
DEFINE_CALL 'COSX' (FLOAT X)
{
}
To invoke a system call, use the
calling parameters, as shown below:
SYSTEM_CALL 'COSX' (45)
System calls are resolved automatically at compile time, without requiring an
include the system call source file.
56
is the standard method provided by NetLinx for defining subroutines.
(* statements *)
refers to a comma-separated list of
would be one pair.
"INTEGER Size"
names must not conflict with previously defined constants, variables, buffers, or wait
DEFINE_CALL
supports the
DEFINE_CALL
if (nChars = 0)
{
RETURN
// exit subroutine
}
(* read input *)
subroutine is a special type of
PROGRAM_NAME
(* body of subroutine *)
SYSTEM_CALL
names are case sensitive.
keyword plus the name of subroutine and any
CALL
statement (as shown in the following example),
RETURN
subroutine defined in a separate
DEFINE_CALL
entry matching the subroutine name.
keyword followed by the name in single quotes and any
NetLinx Programming Language Reference Guide
<datatype><variable>
instruction to
INCLUDE

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents