JRT Pascal User's Guide version 3.0 NOT FOR SALE -16- 3. Compiler Directives Compiler directives are instructions to the compiler which are inserted in the Pascal source program. They may be inserted in the program anywhere a comment may appear. (Unlike JRT Pascal Version 1, they must not be followed by a semicolon delimiter.) 3.1 Listing Control Directives When a Pascal program is being compiled, the listing will be displayed on the system console. Five directives are provided to control the program listing. %NOLIST - stop display of program listing %LIST - resume display of program listing %PAGE - start a new page in the compiler listing, %PAGE(n) and optionally set the "lines per page" value to n. %TITLE('string') - print title at top of each page' activated by first %PAGE directive. 3.2 Line Trace Directives JRT Pascal line tracing will optionally display the source program line numbers as the program executes. The size of the output module will be increased by three bytes per line. %LTRACE - generate line trace codes %NOLTRACE - stop generating line trace codes - this allows storage saving by tracing only a portion of the program. JRT Pascal line tracing can be turned on or off under program control by using the SYSTEM builtin procedure. The range of line numbers to be traced can also be modified at run-time by this procedure. WHEN THE PROGRAM BEGINS EXECUTION, THE LINE TRACE IS DISABLED. Copy compliments of Merle Schnick SECTION 3: Compiler Directives JRT Pascal User's Guide version 3.0 NOT FOR SALE -17- SYSTEM( LTRACE ) - activate line trace SYSTEM( NOLTRACE ) - disable line trace SYSTEM( LRANGE, lower, upper ) - set range of line numbers for line trace - lower and upper are integer expressions. When a program is compiled with the %LTRACE directive, then if the run-time system detects an error condition, the line number will be displayed with the error message. 3.3 Procedure Trace Directives When procedure tracing is activated, the name of each procedure or function will be displayed on entry and exit. On entry to a procedure the activation count (total number of times called) for that procedure is also listed. %PTRACE - generated procedure trace codes %NOPTRACE - stop generating procedure trace codes Procedure tracing can be turned on and off under program control by using the SYSTEM builtin procedure. WHEN THE PROGRAM BEGINS EXECUTION, THE PROCEDURE TRACE IS DISABLED. SYSTEM( PTRACE ) - activate procedure trace SYSTEM( NOPTRACE ) - disable procedure trace When a program is compiled with the %PTRACE directive, then if the run-time system detects an error, the name of the procedure most recently activated will be displayed with the error message. NOTE that the procedure most recently activated is not necessarily the currently active procedure. If the procedure being entered is an external procedure then the trace message is flagged with and asterisk. Copy compliments of Merle Schnick SECTION 3: Compiler Directives JRT Pascal User's Guide version 3.0 NOT FOR SALE -18- 3.4 Source file INCLUDE directive A section of source program code is sometimes used by different main programs of external procedures. Rather than enter this common code at each point it is used, it is easier to use a %INCLUDE directive. This has the effect of inserting the named Pascal code file in place of the directive. %INCLUDE('filename.typ') %INCLUDE files may not be nested. This directive should be placed on a line by itself. If the %INCLUDE is indented with spaces, then the entire included file is also indented by the same amount. %INCLUDE('GLOBALS.LIB') %INCLUDE('C:VARDCLS.PAS') %INCLUDE('B:SORTPROC.OLD') Copy compliments of Merle Schnick SECTION 3: Compiler Directives LIB') %INCLUDE('C:VARDCLS.PAS') %INCLUDE('B:SORTPROC.OLD')