Define_Call (Subroutines) - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

NetLinx Programming Overview

DEFINE_CALL (Subroutines)

Axcess Language
Axcess provides two methods for incorporating sub-
routines into your program.
• DEFINE_CALL subroutines are defined in the
program and support parameter passing into the
call. Changing the parameter value inside the call
changes the value of the variable passed to the
parameter. The DEFINE_CALL can use global
variables or defined local variables.
DEFINE_CALL is for standalone statements and
cannot be used in-line as an expression.
• SYSTEM_CALL is an externally defined subroutine
with a '.LIB' extension. SYSTEM_CALL programs
are produced by AMX and are available on
CD-ROM and on the Tech Support Web site at
www.amx.com.
DEFINE_CALL 'SWITCH' (CARD,IN,OUT)
{
SEND_STRING CARD,
"ITOA(IN),'*',ITOA(OUT),'!'"
}
DEFINE_CALL 'MULTIPLY' (X,Y,RESULT)
{
RESULT = X * Y
}
DEFINE_PROGRAM
PUSH[TP,11]
{
CALL 'SWITCH' (SWITCHER,4,1)
}
PUSH[TP,12]
{
CALL 'MULTIPLY' (3,4,VALUE)
}
SYSTEM_CALL [1] 'VCR1'
(VCR,TP,21,22,23,24,25,26,27,28,0)
6
NetLinx Language
Like Axcess, NetLinx supports DEFINE_CALL and
SYSTEM_CALL. NetLinx also supports functions, which
are similar to a DEFINE_CALL(s). They can be used
standalone or in-line as an expression.
Functions are defined in the DEFINE_CALL section of
the code as a global function.
Defining a function differs slightly from a DEFINE_CALL:
• The data type of the function's return value must be
specified.
• The function name is not enclosed with quotes or case
sensitive.
DEFINE_CALL 'SWITCH' (CARD,IN,OUT)
{
SEND_STRING CARD,
"ITOA(IN),'*',ITOA(OUT),'!'"
}
DEFINE_FUNCTION INTEGER MULTIPLY
(INTEGER X, INTEGER Y)
{
RETURN (X * Y)
}
DEFINE_PROGRAM
PUSH[TP,11]
{
CALL 'SWITCH' (SWITCHER,4,1)
}
PUSH[TP,12]
{
VALUE = MULTIPLY(3, 4)
}
SYSTEM_CALL [1] 'VCR1'
(VCR,TP,21,22,23,24,25,26,27,28,0)
NetLinx Programming Language Reference Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents