AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual page 107

Programming language
Table of Contents

Advertisement

The number in the brackets is the instance number. The instance number tells the compiler to
compile multiple copies of the routine, and have the different SYSTEM_CALLs each call a
separate copy. The compiler does this by using the instance number to modify the actual name of
the DEFINE_CALL before compiling it. When compiling a library file called with an instance
number, Axcess converts the number to ASCII and appends it to the DEFINE_CALL name, as
shown in FIG. 28.
FIG. 28 How Axcess modifies the DEFINE_CALL name in the library file using the instance number
The process of converting the instance number to ASCII and appending it to the DEFINE_CALL
name is called name mangling. When an instance number is used in a SYSTEM_CALL, Axcess
mangles the names of the DEFINE_CALL and any WAITs, WAIT_UNTILS, and variables inside
the subroutine. When the SYSTEM_CALL subroutine SEND is called with an instance number of
1, Axcess generates a call to SEND1. Then it compiles the library file, adding a 1 to the end of the
DEFINE_CALL name and the WAIT name. For example, if a SYSTEM_CALL were made with
the instance number equal to 1ØØ, the DEFINE_CALL would be named 'SEND1ØØ', and the
WAIT would be named 'SS WAIT1ØØ'.
All SYSTEM_CALLS using the same instance number call the same copy of the library file. For
example:
SYSTEM_CALL [1] 'SEND' (SWT1,'HOW','FEE') (* calls copy 1 *)
SYSTEM_CALL [2] 'SEND' (SWT2,'DO','FI') (* calls copy 2 *)
SYSTEM_CALL [2] 'SEND' (SWT2,'YOU','FO') (* calls copy 2 *)
SYSTEM_CALL [3] 'SEND' (SWT3,'DO','FUM') (* calls copy 3 *)
For example, if there is a DEFINE_CALL SEND1 in your program, and you attempt the following
line of code:
SYSTEM_CALL [1] 'SEND' (SWT1,'LETS','GO')
After name mangling, this generates a call to SEND1, which will actually call the subroutine
SEND1 in the program file, not the library file. In fact, since the call to SEND1 is resolved (that is,
a subroutine SEND1 was found) the library file is never compiled. However, if the instance number
was 2, the SEND1 subroutine would not be called, and the SEND library file would be compiled
with the names mangled using the character 2.
Axcess Programming Language
Include Files and System_Calls
99

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Axcess

Table of Contents