
NetLinx Programming Overview
6
NetLinx Programming Language Reference Guide
DEFINE_CALL (Subroutines)
Axcess Language
NetLinx 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)
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)
Summary of Contents for NETLINX PROGRAMMING LANGUAGE
Page 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Page 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Page 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Page 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Page 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Page 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Page 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Page 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Page 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Page 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...