• Keine Ergebnisse gefunden

10. 1 Introduction to Compiler Controls

Im Dokument PASCAL-a6 USER'S GUIDE (Seite 161-164)

You can specify a control in the command line used to invoke the compiler, or in control lines that appear as part of the source file. In your specific host-system appen-dix, you will find information on the command line used to invoke the compiler.

When you specify a control in the invocation command line, the control remains active unless another control overrides it. A discussion of the types of controls and the rules governing them follows; specific cases of controls overriding other controls are discussed in 10.2. These cases are summarized in table 10-2.

To override the controls specified in the invocation line, controls must appear in the source file itself. For example, if the invocation line specified only the NOLIST control (all others being set to their default values), then the control to override NOLIST is its opposite form: LIST. It would appear in the source file as follows:

$ LIS T

A control line is a source line starting with a dollar sign ($) in the leftmost column.

In this example, the compiler will now list the source program lines until the next occurrence, if any, of NOLIST. (All controls are described in 10.3.)

You use control lines to selectively control the compilation of sections of your source file. For example, you might want to suppress the listing of sections of your program or cause page ejects to start listings on new pages. Whenever the compiler sees a dollar sign ($) in the leftmost column of a source line, it assumes that the line is a control line, even if the dollar sign is embedded within a comment.

Pascal-86 User's Guide Compiler Controls

There are two types of controls: primary and general. Primary controls must occur either in the invocation command line or in a control line that precedes the first noncontrol line of the source file. You specify primary controls in the invocation line or put an initial set of primary control lines before the first source program line. You use primary controls as "global" controls that must be set before any compiling begins.

These controls cannot be changed during compilation.

General controls may occur either in the invocation command line or in a control line located anywhere in the source file. These controls may be changed during opposite values. In typical compilations, you might not specify any controls and employ only the default values.

If the compiler detects an error caused by a primary control in the invocation line or in the initial set of primary control lines in the source file, it stops compiling and issues an error message to the console. If the compiler detects an error in general control lines (after the first set of primary control lines), it reports the error in the same manner as other compiler errors. Chapter 13 provides a discussion of all compiler error messages.

Table 10-2. Summary of the Effects of Controls on Other Controls

Control Control(s)

Control(s) that Control(s) that Affected or

Used

Overridden by It Affect It Override It

CHECK NOCHECK *OBJECT 'NOOBJECT

NOCHECK

CODE NOCODE *PRINT(file) NOCODE

*OBJECT 'NOPRINT

COMPACT SMALL, LARGE 'NOOBJECT

COND NO COND NOLIST

*NOPRINT

'DEBUG 'NODEBUG *OBJECT(file) *NODEBUG

*NOOBJECT

'EJECT 'TITLE(' title') *PRINT(file) *NOPRINT

SU BTITLE(' subtitle') NOLIST

'ERRORPRINT(file) 'ERRORPRINT(:CO:) 'NOERRORPRINT

'NOERRORPRINT

'NOERRORPRINT 'ERRORPRINT(file) 'ERRORPRINT(file)

'NOPRINT

'NOEXTENSIONS 'EXTENSIONS *ERRORPRINT(file) *EXTENSIONS

*NOERRORPRINT

*PRINT(file) INCLUDE(file)

INTERRUPT(proc [, ... ]) *NOOBJECT

LARGE SMALL, COMPACT 'NOOBJECT

NOLIST LIST *PRINT(file) LIST

SUBTITLE(' subtitle') *NOPRINT

EJECT

'OBJECT(file) 'OBJECT(source.OBJ) *NOOBJECT

INTERRUPT(proc [, ... ]) 'DEBUG

'TYPE

Compiler Controls Pascal-86 User's Guide

10-4

Table 10-2. Summary of the Effects of Controls on Other Controls (Cont'd.)

Control Control(s)

Control(s) that Control(s) that Affected or

Used

Overridden by It Affect It Override It

*NOOBJECT *OBJECT(fiIe) *OBJECT(file)

INTERRUPT(proc [, ... ])

*PRINT(file) CODE *NOPRINT

*NOEXTENSIONS

*NOPRINT *PRINT(file) *PRINT(file)

*PR I NT(source. LST) *PRINT(source.LST)

CODE

SMALL COMPACT, LARGE *NOOBJECT

SU BTITLE(' subtitle') NOLIST *NOPRINT

EJECT PRINT(file)

*SYMBOLSPACE(n)

*TITLE('title') NOLIST *NOPRINT

PRINT(file)

*TYPE *NOTYPE *OBJECT(file) *NOOBJECT

*NOTYPE

*XREF *NOXREF *PRINT(file) *NOXREF

*NOPRINT

*Primary control (all others are general).

10.2 Using Controls

Controls to the compiler govern the format, processing, and content of both the input source file(s) and the output file(s). Certain controls in their default forms override other controls that are explicitly stated. This section describes the use of controls according to the areas they govern, and suggests which controls should be used during specific stages of program development.

In the following sections, an asterisk (*) denotes a primary control (or control pair).

All other controls are general controls.

10.2.1 Listing Device or File Selection

The following controls govern the selection of the device or file to receive compiler listings and error/warning messages:

* P R I N T [ ( file) ] / N 0 P R I N T

* ERR 0 R P R I N T [ ( file) ] / N 0 ERR 0 R P R I N T

Pascal-86 User's Guide Compiler Controls

Use the PRINT control to select the device or file to receive all printed output. Under NOPRINT, only error messages will be output to either the console or the ERROR-PRINT file, which you select with the ERRORERROR-PRINT control.

The N OPRINT control overrides all of the listing format controls described in 10.2.2, since it governs all printed output. You can, however, select a different file or device to receive error messages. Even if the NOPRINT control is active, error messages will always appear somewhere-either in a different file specified in an ERROR-PRINT control, or at the console if the ERRORERROR-PRINT control is not specified (or if NOERRORPRINT is specified).

To generate a listing that includes error messages and the complete (or partial) source listing (as governed by format controls discussed below), use the PRINT control to specify the listing file, or allow the default PRINT control to send the listing to source.LST. If you select an ERRORPRINT file, error messages will appear twice:

once in the ERRORPRINT file, and once in the listing file governed by the PRINT control.

10.2.2 Controlling Listing Format and Content

If PRINT is active, the following controls govern the format and content of printed output. The default value of a control pair is listed first:

NOCODE/CODE

Im Dokument PASCAL-a6 USER'S GUIDE (Seite 161-164)