pTAL Reference Manual (H06.08+)
Compiler Directives
HP pTAL Reference Manual—523746-006
17-10
Examples
The USEGLOBALS compilation terminates if the global declarations file:
•
Cannot be found or opened by the compiler
•
Was created using a different version of the compiler
Examples
The source file in Example 17-8 on page 17-10 (MYPROG) is compiled in examples
Example 17-9 on page 17-10 through Example 17-12 on page 17-11, which show how
the SAVEGLOBALS, USEGLOBALS, BEGINCOMPILATION, and SYNTAX directives
interact.
The compilation command in Example 17-9 on page 17-10 compiles myprog (the
source file in Example 17-8) and saves global data declarations and data initializations.
Caution. Be sure the global data declarations in both the SAVEGLOBALS and USEGLOBALS
compilations are identical. If you include new or changed global data declarations anywhere in
the USEGLOBALS source file, results are unpredictable.
Example 17-8. MYPROG Source File for Example 17-9 Through Example 17-12
Source File MYPROG
! Source file MYPROG
! Unless USEGLOBALS is active, compile the entire source file.
?SOURCE SHARGLOB
?BEGINCOMPILATION ! When USEGLOBALS is active, compile
! following code
?PUSHLIST, NOLIST, SOURCE $system.system.extdecs
?POPLIST
PROC my_first_proc;
BEGIN
...
END;
PROC my_last_proc;
BEGIN
...
END;
File of Shared Global Data, SHARGLOB
?SOURCE glbfile1 (section1, section2)
?SOURCE moreglbs
INT ignore_me1;
INT ignore_me2;
Example 17-9. Saving Global Data Declarations and Data Initializations
pTAL /IN myprog/ myobj; SAVEGLOBALS ptalsym










