COPTION and GLOBAL COPTION Statements
The COPTION and GLOBAL COPTION statements gives you control over the code
and listing that the compiler generates.
The GLOBAL COPTION statement is allowed only in the main block of a
program. It establishes defaults to be used throughout the program. The
COPTION statement can be used in any program unit.
Syntax
{i_option}[ {i_option}]
[GLOBAL] COPTION {s_option}[, {s_option}]...
Parameters
GLOBAL Allowed only if the statement is in the main block of
the program. If GLOBAL appears, the statement is a
GLOBAL COPTION statement; if GLOBAL is omitted, it is a
COPTION statement. A GLOBAL COPTION statement affects
every program unit in the program. A COPTION statement
affects only the program unit that contains it.
A COPTION statement overrides a GLOBAL COPTION
statement, but only while the program unit that contains
it is being compiled or executed.
i_option One of the in-line options listed in Table 9-2.
s_option One of the subunit options listed in Table 9-3, with the
restriction that USLINIT can appear only in a GLOBAL
COPTION statement.
A GLOBAL COPTION statement is allowed only in the main block of a
program. It changes the default options in the main program and in every
subunit. If two GLOBAL COPTION statements contain opposite options (for
example, ID TABLES and NO ID TABLES), the statement with the higher line
number sets the option. If a GLOBAL COPTION statement contains opposite
options, the rightmost reference sets the option.
A COPTION statement is allowed in the main program and in subunits. It
sets program unit options only in the program unit containing it. See
Table 9-1 and Table 9-3 for more information.
If two COPTION statements contain opposite options, the statement with
the higher line number sets the option. If a COPTION statement contains
opposite options, the rightmost reference sets the option.
In-Line verses Program Unit Options
Compiler options take effect in one of two methods: in-line or program
unit. In-line options take effect when the COPTION or GLOBAL COPTION
statement is processed normally; that is, when the statement is compiled
in line number order. They remain in effect until another in-line option
changes the setting of the option.
Program unit compiler options are processed before a program unit is
compiled. Before the first line of a program unit is compiled, the
compiler searches for and processes all of the program unit options. If
a COPTION statement does not specify a particular program unit option,
the setting of the GLOBAL COPTION statement applies. Program unit
options normally apply ONLY to the subunit in which they occur.
The Compiler Options
The compiler options are split into four general categories. Each of the
following categories control specific portions of the compilation
process:
* Listing.
* Code Space and Performance.
* Data Space.
* Miscellaneous.
Table 9-1. Listing Options
------------------------------------------------------------------------------------------------
| | | | |
| Option 12 | Effect | Type | Default |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| LINES [=] num_lit (10 <= num_lit | Sets the number of lines | INLINE | 60 |
| <= 9999) | per page for the compiler | | |
| | listing. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Enables and disables | INLINE | LIST |
| | compiler source listing | | |
| { NOLIST } | and requested tables. ID | | |
| LIST { NO LIST} | TABLES and LABEL TABLES | | |
| | can be listed only if | | |
| | listing is enabled. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Prints identifiers, their | PROGRAM UNIT | NO ID TABLES |
| | types and their | | |
| { NO ID} | hexidecimal addresses at | | |
| ID [ TABLES] { NOID } [ TABLES] | the end of each program | | |
| | unit (provided LIST is | | |
| | active). The NOID option | | |
| | suppresses this | | |
| | information. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Prints each program line | PROGRAM UNIT | NO LABEL |
| | number and the code | | TABLES |
| { NO LABEL} | offset of the beginning | | |
| LABEL [ TABLES] { NOLABEL } | of that line (provided | | |
| | that LIST is also | | |
| [ TABLES] | active). | | |
| | | | |
| | Suppresses what LABEL | | |
| | TABLES would print. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Causes page eject. The | INLINE | None. |
| | next line of the compiler | | |
| PAGE | listing prints on a new | | |
| | page. (Compare to | | |
| | PAGESUB.) | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Generates a page break | PROGRAM UNIT | Program |
| | and page header before | | units do not |
| PAGESUB | the first line of the | | start on new |
| | program unit is printed. | | pages. |
| | If used in a GLOBAL | | |
| | COPTION statement, every | | |
| | program starts on a new | | |
| | page; otherwise, only the | | |
| | current subunit starts on | | |
| | a new page. | | |
| | | | |
------------------------------------------------------------------------------------------------
Table 9-1. Listing Options(cont.)
------------------------------------------------------------------------------------------------
| | | | |
| Option 12 | Effect | Type | Default |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| TITLE [=] quoted_str_lit | Replaces the standard HP | INLINE | See Note 1. |
| | Business BASIC/XL | | |
| | compiler pagetitle with | | |
| | quoted_str_lit at the top | | |
| | of each page of the | | |
| | compiler listing. | | |
| | (Compare to TITLESUB | | |
| | below.) | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| TITLESUB [=] quoted_str_lit | Substitutes | PROGRAM UNIT | See Note 2. |
| | quoted_str_lit in the | | |
| | page title at the | | |
| | beginning of the subunit. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| | Enable or suppress | INLINE | WARN |
| | compile-time warning | | |
| { NOWARN } | messages. The final | | |
| WARN { NO WARN} | statistics includes a | | |
| | count of warnings even | | |
| | when warnings are | | |
| | suppressed. | | |
| | | | |
------------------------------------------------------------------------------------------------
Table 9-1 Notes
1 An HP Business BASIC/XL compiler page header consists of a page
number followed by a page title; For example:
HP Business BASIC/XL Compiler HP32715A.00.00 Copyright Hewlett-Packard Co. 1989
SUN, JAN 1, 1989, 2:01 PM
2 If included in a subunit, HP Business BASIC/XL replaces the page
title in the page header with quoted_str_lit on the next page break.
The difference between TITLE and TITLESUB is that with the latter,
the title change takes place the instant a subunit is entered. Thus
if there are any page breaks within the subunit before the COPTION
TITLESUB = "quoted_str_lit" statement, the new title is in effect.
With COPTION TITLE = "quoted_str_lit", the title will not change
until after the actual statement.
Table 9-2. Code and Performance COPTIONS
-------------------------------------------------------------------------------------------------
| | | | |
| Option | Meaning | Type & Defaults | Effects on |
| | | | Compiled Program |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Emits or suppresses code | PROGRAM UNIT | NO ERROR saves |
| | to trap errors. When | | approximately 3 |
| ERROR [ HANDLING] | NOERROR is in effect, an | ERROR HANDLING | words per line. |
| | ON ERROR statement causes | | (Not all |
| { NOERROR } | a compile-time error. If | | statements |
| { NO ERROR} [ HANDLING] | a run-error occurs (with | | perform ERROR |
| | NO ERROR), HP Business | | checking); |
| | BASIC/XL prints an error | | performance |
| | message. If the compiled | | increases also. |
| | program was called from | | |
| | the interpreter, control | | |
| | returns to the | | |
| | interpreter; otherwise, | | |
| | the program aborts. | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Emits or suppresses code | INLINE | NO HALT saves |
| | to check for the HALT key | | approximately 3 |
| HALT [ CHECKING] | at the end of each line. | HALT checking | words per line. |
| | | | (Not all |
| { NOHALT } | | | statements |
| { NO HALT} [ CHECKING] | | | perform HALT |
| | | | checking); |
| | | | performance |
| | | | increases also. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Level of optimization. | Subprogram | 0 = No |
| | | | optimization. |
| { 0} | | | 1 = Local |
| OPTIMIZE { 1} | | | optimization. |
| | | | |
| | | | |
| | | | The default is 1. |
| | | | |
-------------------------------------------------------------------------------------------------
Table 9-2. Code and Performance COPTIONS(cont.)
-------------------------------------------------------------------------------------------------
| | | | |
| Option | Meaning | Type Defaults | Effects on |
| | | | Compiled Program |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Emit or suppress code | INLINE | Code savings |
| | that causes a run-time | | vary, but option |
| RANGE [ CHECKING] | error when one of the | RANGE CHECKING | NORANGE can save |
| | following occurs: | | 12 to 16 words |
| { NO RANGE} | | | per array or |
| { NORANGE } [ CHECKING] | 1. An array index or | | substring access. |
| | a substring index | | |
| | is out of bounds. | | |
| | | | |
| | 2. An integer to | | |
| | short integer | | |
| | conversion | | |
| | overflows. | | |
| | 3. The nested GOSUB | | |
| | level is greater | | |
| | than the default | | |
| | MAXGOSUB level or | | |
| | the value | | |
| | specified in | | |
| | COPTION MAXGOSUB. | | |
| | 4. The file number | | |
| | used is greater | | |
| | than the default | | |
| | MAXFILES or the | | |
| | MAXFILES value in | | |
| | the COPTION | | |
| | MAXFILES. | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Allows or disallows array | PROGRAM UNIT | Reduces code for |
| REDIM | redimensioning. Not | | array access |
| | allowing dimensions to | REDIM | (unless array is |
| NO REDIM | change allows for more | | variably |
| | compile-time and less | | dimensioned). |
| | run-time checking of | | Performance |
| | array bounds. GLOBAL | | improves |
| | COPTION [NO] REDIM | | corresponding to |
| | affects arrays in COM. | | code reduction. |
| | | | |
-------------------------------------------------------------------------------------------------
Table 9-3. Dataspace COPTIONS
------------------------------------------------------------------------------------------------
| | | | |
| Option | Meaning | Type | Default |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| MAXFILES [=] num_lit | Specifies the largest | Program Unit | 16 |
| | file number used in this | | |
| | subunit. Each invocation | | |
| | of a subunit allocates 1 | | |
| | word for each legal file | | |
| | number. | | |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| MAXGOSUBS [=] num_lit | Allows GOSUB statements | None | 10 |
| | to be nested to a depth | | |
| | of num_lit. A run-time | | |
| | error occurs if more than | | |
| | num_lit GOSUB statements | | |
| | execute before a RETURN | | |
| | (in one subunit). Each | | |
| | invocation of a subunit | | |
| | allocates one word for | | |
| | each possible GOSUB. | | |
| | | | |
------------------------------------------------------------------------------------------------
Table 9-4. Other COPTIONS
-------------------------------------------------------------------------------------------------
| | | | |
| Option | Meaning | Type | Default |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Allows you to insert a | Program Unit | none |
| | copyright statement in | | |
| COPYRIGHT=quoted_str | the program. No effect | | |
| | on program execution. | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Allows you to compile | Program | Compile current |
| | each of the main block | | program as |
| RLFILE | and each subunit as a | | individual object |
| | separate object file into | | file into an |
| | an RL file. You can | | NMOBJ file. |
| | compile more than one | | |
| | program subunit into an | | |
| | RL. | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Directs the compiler to | Program | RL not |
| | initialize the RL before | | initialized. |
| RLINIT | compiling code into it. | | |
| | | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| | Allows you to group | Program Unit | No locality set |
| | multiple object modules | | specified. |
| LOCALITY= quoted_str | into a locality set when | | |
| | they are compiled into an | | |
| | RL. This will help in | | |
| | maintaining and using RL | | |
| | commands such as PURGERL. | | |
| | | | |
-------------------------------------------------------------------------------------------------
Table 9-4 NOTE For a detailed description of relocatable libraries (RLs)
see the HPLINK EDITOR/XL Reference Manual.