OPTION and GLOBAL OPTION Statements [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
OPTION and GLOBAL OPTION Statements
The OPTION and GLOBAL OPTION statements set options for interpreted
programs (see chapter 2). The compiler ignores the options these
statements set, with the exceptions given in Table 9-5.
Table 9-5. Interpreter Options That Affect Compiled Programs
---------------------------------------------------------------------------------------------
| | |
| Option | Effect on Compiled Program |
| | |
---------------------------------------------------------------------------------------------
| | |
| DECIMAL | Same as effect on interpreted program. |
| | |
| REAL | |
| | |
| BASE 0 | |
| | |
| BASE 1 | |
| | |
| INIT | |
| | |
---------------------------------------------------------------------------------------------
| | |
| NOINIT | The compiler does not generate code to initialize numeric variables |
| | (string lengths are still initialized to zero). If the compiled |
| | program accesses a variable before assigning a value to it, no error |
| | occurs, but the value of the variable is indeterminate. |
| | |
---------------------------------------------------------------------------------------------
| | |
| MAIN | Defines this as the main program of a multi-program application. |
| | Outer block is generated. |
| | |
---------------------------------------------------------------------------------------------
| | |
| SUBPROGRAM | Identifies this program as a module of a multi-program application. |
| | Code is produced for the main subunit, but no outer block is |
| | generated. |
| | |
---------------------------------------------------------------------------------------------
| | |
| NEWCOM | The compiled main subunit deallocates undefined COM blocks when |
| | called, and allocates new defined commons. |
| | |
---------------------------------------------------------------------------------------------
| | |
| NO NEWCOM | The compiler only generates code to check common name and sizes. |
| | Commons are not allocated or deallocated. When used with option |
| NONEWCOM | MAIN, code for initial allocation goes in the outer block instead of |
| | the code for the main subunit. |
| | |
---------------------------------------------------------------------------------------------
The defaults are: REAL, BASE 0, INIT, MAIN, NEWCOM
Examples
10 GLOBAL COPTION LABEL TABLES, ID TABLES
20 INTEGER I
30 DIM Deck(52), Suit$(4)[8], Ranks$(13)[6]
35 TRACE VARS Deck
40 COPTION TITLE="Start of initialization", PAGE
50 Suit$(1)="spades"
:
200 COPTION NORANGE CHECKING
210 FOR I=1 TO 62
220 Deck(I)=I
230 NEXT I
:
1000 DEF FNPrint$(INTEGER Row, Col, S$)
1010 COPTION TITLESUB="Function FNPrint",PAGESUB,NOWARN,NOLABEL TABLES
1015 PAUSE
1020 Move_to(Row, Col)
1030 RETURN S$
1090 FNEND
1095 !***** Subprogram to move the cursor.
2000 SUB Move_to (INTEGER Row, Col)
2005 COPTION TITLESUB="Subprogram Move_to", PAGESUB
2010 PRINT '27"&a";VAL$(Row);"r";VAL$(Col);"C";
2020 SUBEND
The compiler listing for the above program is:
PAGE 1 HP Business BASIC/XL Compiler HP32115B.00.00 (c) Hewlett-Packard
1985-1987 TUE, AUG 25, 1987, 11:19 AM
10 GLOBAL COPTION LABEL TABLES, ID TABLES
20 INTEGER I
30 DIM Deck(52), Suit$(4)[8], Ranks$(13)[6]
35 TRACE VARS Deck
WARNING 2050: TRACE or PAUSE statement found and ignored.
40 COPTION TITLE="Start of initialization", PAGE
PAGE 2 Start of initialization
50 Suit$(1)="spades"
60 Suit$(2)="hearts"
70 Suit$(3)="clubs"
80 Suit$(4)="diamonds"
.
.
.
200 COPTION NORANGE CHECKING
210 FOR I=1 TO 62
220 Deck(I)=I
230 NEXT I
.
.
.
I D E N T I F I E R T A B L E
IDENTIFIER CLASS TYPE ADDRESS
Deck ARRAY REAL SP- $774,I
I SIMPLE INTEGER SP- $778
Ranks$ ARRAY STRING SP- $76C,I
Suits$ ARRAY STRING SP- $770,I
PAGE 3 function fnprint
1000 DEF FNPrint$(SHORT INTEGER Row, Col, S$)
1010 COPTION TITLESUB="Function FNPrint",PAGESUB,NO WARN,NO LABEL TABLES
1015 PAUSE
1020 Move_to(Row, Col)
1030 RETURN S$
1090 FNEND
1095 !***** Subprogram to move the cursor.
I D E N T I F I E R T A B L E
IDENTIFIER CLASS TYPE ADDRESS
Col SIMPLE PARAMETER INTEGER PSP-$28,I
FNPrint$ FUNCTION STRING
Move_to SUBPROGRAM
Row SIMPLE PARAMETER INTEGER PSP-$24,I
S$ SIMPLE PARAMETER STRING PSP-$2C,I
PAGE 4 move_to
2000 SUB Move_to (INTEGER Row, Col)
2005 COPTION TITLESUB="Subprogram Move_to", PAGESUB
2010 PRINT '27"&a";VAL$(Row);"r";VAL$(Col);"C";
2020 SUBEND
I D E N T I F I E R T A B L E
IDENTIFIER CLASS TYPE ADDRESS
Col SIMPLE PARAMETER INTEGER PSP-$28,I
Move_to SUBPROGRAM
Row SIMPLE PARAMETER INTEGER PSP-$24,I
C O D E O F F S E T S
LINE OFFSET LINE OFFSET LINE OFFSET LINE OFFSET LINE OFFSET
MAIN
10=000001EC 20=000001EC 30=000001EC 35=000001EC 40=000001EC
50=000001EC 60=00002A8 70=00000364 80=00000420 90=000004DC
200=00000594 210=00000594 220=000005C4 230=000005FC
FNPrint$
1000=000000D4 1010=000000D4 1015=000000D4 1020=000000D4 1030=00000100
1090=00000118 1095=00000150
move_to
2000=000000D0 2005=000000D0 2010=000000D0 2020=000002C0
Number of errors = 0 Number of warnings = 2
Processor time = 00:00:01 Elapsed time = 00:00:02
Number of lines = 26 Lines / CPU minute = 1560.0
END OF PROGRAM
Notes on the Example
LINE COMMENT
---------------------------------------------------------------------------------------
10 Makes LABEL TABLES and ID TABLES the default throughout the program.
40 Changes the title and starts a new page.
200 Turns off range checking in the lines that follow. Because the FOR
loop limit value is mistyped (62 when it should have been 52), the
result of line 220 is unpredictable.
1010 Sets the title, prints the first line of the function on a new page,
suppresses compile-time warning messages, and suppresses the label
table for the current subunit.
The PAUSE statement on line 1015 causes a compile-time warning.
Although there is no warning message, the final statistics reflect
the warning.
1095 This line illustrates the problem of putting comments before the
subunit to which they apply. Although an interpreter listing would
look right, the comment at line 1095 actually belongs to the function
FNPrint$. Therefore, in the compiler listing, it appears before the
identifier map, the code offsets table, and the page break that the
PAGESUB option causes.
MPE/iX 5.0 Documentation