,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 11
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,,
,ft

,ce 1
4-##
,,
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)

,ce
COMPILATION OPTIONS AND INCLUDE FILES

In OmegaSoft Pascal there is a special syntax used to control various aspects of the compiler. If the open of a comment (a {) is followed by a dollar sign, then the characters that follow are considered to be compiler control toggles.

control-toggles = { $ ((l|s|b|c|a|r|o|i|d) (+|-)) | p | d)
            {,((l|s|b|c|a|r|o|i|d) (+|-)) | p | d)} |
            c (ne|eq|lt|le|gt|ge) (constant | program) |
            cend | celse
            i<file name> rest-of-comment |
            v<vers,rev description>


                  V          string

                                    constant
                  C      option     
                                    program
 
                  I          file name

                  S

                  R  
 
                  O
                               +
    {    $        C                               rest-of-comment
                               -
                  L  

                  A
     
                  B

                  D

                  P
 
                  
                                   ,


Some of the options affect the action of the compiler during the compilation, other options generate code that will modify operation only at runtime and only after the code containing the options is executed.

The first set are the options that affect the operation of the compiler :

INCLUDE FILES
If the I option is followed by a file name, this file is opened and source text is read and compiled until end of file is hit, at which point the original file is used again. This syntax is referred to as an "Include file" and they may not be nested. If compiling an include file the compiler will place an "I" to the left of the line number on the listing. There must be no characters between the "I" and the file name. A suffix of "I" will be used for the file name if none is specified. There must be no other code or options on the source line following the include file option.

VERSION CONTROL
The V option allows you to specify the version, revision, and description of the Pascal program or module. If this option is used, it must be between the Program (or module) name and the parameter list (if used). All characters following the "V" up until the end of the comment (or 40 characters whichever is shorter) will be used for the Assembly language IDNT directive. Example : {$V1,5 test program}.

SUBRANGE CHECKING
If the S option is followed by a + then subrange checks are enabled, if the S option is followed by a - then subrange checks are disabled. If subrange checks are on when doing assignments to subrange variables extra code is emitted to perform this check. 
,pg
,ce
COMPILATION OPTIONS AND INCLUDE FILES

This option also affects the type of code generated for array and string indexing and whether or not code is generated to check for truncation and overflow errors on arithmetic done in inline code rather than a subroutine at runtime. Note that it does no good to have the S option on without the R option on. 

PAGING
If the P option is specified and the listing page size is non-zero then the next line of source will appear on a new page.

SYMBOL TABLE DUMP
If the D option is specified without a following + or -, and the listing is enabled, a symbol table dump will be done for that lexical level. This is mostly for debugging of the compiler at CSC but you might find it to be useful if you think you are having trouble with multiple definitions at different lexical levels.

DEBUGGING
If the D option is specified followed by a + or -, this is used to enable debug information if the command line D option is on. The default at the start of compilation is D+. This is useful when running time critical routines, and should always be turned off during compilation of exception procedures.

LISTING
If the L option is followed by a + and the L command line option is on then listing will be enabled. If the L option is followed by a - and L command line option is on listing will be disabled. Note that these can be nested, If two L- 's are encountered then two L+ 's will be required to enable the listing. Default at start of compilation is L+.

BREAK HANDLING
If the B option is followed by a + then any text devices that are declared after that point will have their "break bit" set during initialization. If the B option is followed by a - then any text devices that are declared after that point will have their "break bit" cleared during initialization. Default at start of compilation is B-. Refer to the section of Chapter 2 dealing with Devices and files for an explanation of the "break bit".
,pg
,ce
COMPILATION OPTIONS AND INCLUDE FILES

AUTO REDIRECT
The A option is only used on a very full implementation of a target system interface. This option requires that command line parameters and standard I/O devices, and disk files are implemented. The A option is only effective during the program parameter list declaration. If enabled (A+) then any standard I/O devices defined there after will be setup for automatic command redirection. If disabled (A-) then any standard I/O devices defined there after will be setup for fixed attachment (they will use their normal devices). The default at the start of compilation is A-. If the A option is enabled then the strings that follow the special symbols in the command line will be the device or file name that will be used for the standard I/O device.

Input uses string following <
Output uses string following >
Auxout uses string following >>

If the string is "P" or "p" then it will connect to the system printer, if the string is "T" or "t" then it will connect to the system terminal, any other string will connect to a disk file with the string as its directory name. 

CONDITIONAL COMPILATION
If the C options is followed by "ne" "eq" "lt" "le" "gt" "ge" and a constant, this is the start of conditional compilation. The constant must either be a numeric one or two byte constant, or an identifier declared in the constant declaration section. This constant value is compared (signed) against zero, if it meets the condition specified then compilation will continue, else compilation will be turned off (source not parsed) until a "CEND" compilation option is encountered. To reverse the value of a previous conditional, you can use the "CELSE" comment. The constant can be replaced by the reserved word "program". This symbol will have a value of one if compiling a program, zero if compiling a module. This is helpful in include files where you need an "entry" for the program and "external" for the modules, such as : 

var
  abc : data {$cne program} entry {$celse} external {$cend}

As a further extension of this idea, inside an include file it is possible to check to see if the include file name matches the program/module name and modify entry/external to match. This concept is covered in chapter 7. Instead of using "program", use "in", as in 

var varib {$cne in} entry {$celse} external {$cend}

Conditional compilation may be nested up to 20 levels deep.

STACK OVERFLOW CHECKING
The O (letter O, not zero) option only affects lexical level 2 (non-nested) procedures. If it is on (default at start of compilation), a subroutine will be called after the procedure's local variables have been allocated to check for stack overflow. If it is off {$o-} then no such check is done. This makes execution faster, and should be done if the procedure is meant to be called as an interrupt handler, since the stack may not be the same one as the main stack.

ERROR MASKS
The other group of options generate runtime code that affects the error mask in the stack frame during execution. These options must be located in a section of the program that will be executed. Although there is sometimes executed code outside of a blocks begin .. end pair, it is not recommended that you put these options anywhere other than in a block's begin .. end pair. 

When a procedure is entered its error mask is copied from its lexical parent, not the caller (unless the same).

I/O CHECKS
If the I option is followed by a + then runtime I/O checks are enabled, if the I option is followed by a - then runtime I/O checks are disabled. Default at start of compilation is I-.

RANGE CHECKS
If the R option is followed by a + then runtime range checks are enabled, if the R option is followed by a - then runtime range checks are disabled. Default at start of compilation is R-.
,pg
,ce
COMPILATION OPTIONS AND INCLUDE FILES

CONVERSION CHECKS
If the C option is followed by a + then runtime conversion checks
are enabled, if the C option is followed by a - then runtime conversion checks are disabled. Note that this only refers to halting the execution on a conversion error, the conversion function will always return the latest status, regardless of the condition of this toggle. Default at start of compilation is C-.

A brief example will more clearly demonstrate the effect of the I, R, and C options. Only the R option will be used since the other two behave exactly the same.

Program A ;
  Procedure B ;
    Procedure C ;
      Begin
        { at this point options are the same as Procedure B
          at the time when Procedure C is called. }
        {$R+ this affects only Procedure C }
        B { its options will reflect Program A's
            because of the lexical levels }
      End ;
    Begin { B }
      { at this point options are the same as Program A
        at the time when Procedure B is called. }
      {$R- this does not affect Program A }
      C  { at entry Procedure C's R flag will be off }
    End ; { B }
  Begin { A }
    { at this point all options are off }
    {$R+ turn on range checks }
    B { at entry Procedure B's R flag will be on until
        set explicitly off }
  End . { A }

