User Guide
Include Files and System_Calls
96
Axcess Programming Language
! Place each definition section in its own include file
! Group sections of the main program into include files
! Place all subroutines into an include file
! Place routines that you want to share between multiple programs into an include file
! Place code you wish to re-use in other systems into include files
Include files are loaded and edited using the Axcess editor much like normal program files. Like
program files, the Axcess name (not the DOS name) of the include file is stored on the first line of
the file as a PROGRAM_NAME declaration.
System_Calls and Library files
Using include files makes it convenient to share pre-written code between multiple programs. For
example, if you had created a subroutine to handle an audio/video switcher, and the subroutine was
saved into an include file. If you need to use the subroutine in another program, you could insert the
include file into the new program as a pre-written piece of code.
Library files are special types of include files which have the DOS extension .LIB. The difference
between library files and include files is that library files must contain a DEFINE_CALL
subroutine with the same name as the PROGRAM_NAME on the first line of the library file. This
DEFINE_CALL can then be called from within a program using the SYSTEM_CALL keyword.
Here is an example of a small library file listing:
PROGRAM_NAME = 'SQUARE'
DEFINE_CALL 'SQUARE' (NUMBER)
{
NUMBER = NUMBER * NUMBER
}
This is the entire contents of a library file. Now, if you have a variable X which you want to square
within a program, use the following line:
SYSTEM_CALL 'SQUARE' (X)
This line generates a call to the subroutine SQUARE. This is because a SYSTEM_CALL statement
is identical to a CALL statement, except that the actual DEFINE_CALL is in a library file instead
of the main program.
In this example, after Axcess compiles the main program, it searches through all available library
files for the one that has the following statement on the first line:
PROGRAM_NAME = 'SQUARE'
When Axcess finds this file, it is compiled. Since the library file contains a DEFINE_CALL with
the same name as the PROGRAM_NAME in the file, the SYSTEM_CALL to SQUARE actually
calls the DEFINE_CALL SQUARE in this library file, as shown in FIG. 27.