• Aucun résultat trouvé

Error Messages

Dans le document USERS' MANUAL SUPPLEMENT (Page 87-92)

o PatRec = Record

D.4 Error Messages

Users' Manual Supplement, Version IV New and Upgraded Standard Facilities

Execution error messages are displayed by the p-System under certain circumstances. If a code segment is needed and the disk containing it is not in the appropriate drive, the user is prompted to replace the disk and type <space> to continue. If a program attempts to divide by zero, or access outside the bounds of a Pascal array, a message indicates this and the user is prompted to type

<space>, at which point the p-System is re-initialized. These and other execution errors are listed in the Users Manual, Version IV .0.

It is now possible for a program to alter the message that is displayed when certain errors occur. This should be useful for applications developers, especially those whose customers speak languages other than English.

Also, the display format of p-System error messages has been changed in a way that should assist applications developers.

D.4.1 Format of Error Messages

Formerly, error messages were displayed on three lines beginning at the current cursor position. They are now displayed on one specified aD-column line. For example, when a code segment is needed from a disk that is not present in the appropriate drive, the following prompt is displayed.

Need segment SEGNAME: Put volume VOLNAME in unit U then type <space>

This indicates that the segment SEGNAME was not found on volume VOLNAME in device U. By placing the correct volume in the correct unit and typing space, execution should continue normally.

The following example shows the error message that occurs when a user presses the p-System BREAK key.

Program Interrupted by user--Seg PASCALIO PII 17 011 310 <space> continues A fter a space is typed, the p-System will be re-initialized ..

System error messages such as these will always appear at a fixed position on the screen. The default posi tion is the bottom lin eo (Any line can be specified, however.) A BEL character (audible beep) will be written to the console device when the message is written out.

II-75

New and Upgraded Standard Facilities

(*$1-*)

Reset (Fid, Name);

wrrteln(1oresult ',ioresult:6);

if f open(fid) then Begin

F Volume (Fid, Volume);

Is-Blocked := F Is Blocked (Fid);

unit num :

=

F Dnltnumber (FId );

F File Title (Fid, Title);

F-Oate (Fid, Date);

BTocks : = F Length (Fid);

Start :

=

F Start (F id);

"'WrIteln;

-Write (Volume, ': (Unit " Unit Num);

If Is Blocked Then -Begin

Writeln (' blocked)');

Writeln (Title, Blocks:7,

Date.Month:4, -Date.Day, -Date. Year, Start:6);

End {of If Is Blocked}

-Else

-Writeln (' seria!)');

End {of If F Volume}

Else

-Writeln ('No such file');

End {of File_Demo}.

11-74

Users' Manual Supplement, Version IV New and Upgraded Facilities

Then, if a code segment is required from a mlsslng disk in the unit for which the user program has designated a special error message, that message will be displayed. The p-System will then wait for the user to enter a <space> whether or not the message actually indicates that a <space> is needed. The message line will subsequently be erased, the cursor will be returned to its former position if possible, and execution will continue.

For other kinds of execution errors, a standard p-System message will be displayed on the message line. A fatal error will always cause the p-System to fail. For non-fatal errors, the p-System will wait for the user to enter a <space>. The message line will then be erased, the cursor will return to its former position, and execution will continue (most likely the p-System will re-initialize itself).

To proceed from a non-fatal error, press <esc>.

WARNING: Escaping from a non-fatal error is a dangerous practice since system data may be corrupted.

Error message values set by the user will remain in effect throughout the execution of the program, but will be reset at program termination or whenever p-System re-initialization occurs.

The user program may reset the error handling values to their default values at any time if special output is no longer desired. The missing code segment message can be reset by passing a null string to SET_USER_MESSAGE.

Unknown results may 'occur on console devices whose screen width is narrower than the message to be displayed.

II-77

New and Upgraded Standard Facilities

u.s

Pascal Compiler Enhancements

This section describes the· new enhancements to the Pascal Compiler and contains examples of their use.

The first section describes an enhancement of the Pascal USES construct. It is now possible to select, from within the client compilation unit, the constants, types, variables, and routines that are needed from the unit. Compile-time symbol table space will not be allocated for the rest of the unit's interface section. If the unit has a Large interface section, and the host requires only a small portion of it, a selective USES statement can eliminate the unnecessary symbols and increase the available memory space, thereby increasing the size of a program or" unit that can be co mpiled.

The last section describes enhancements to compiled listings, an additional compiler promptline, and the significance of compiler version numbers in terms of the size of real numbers.

ILS.l Selective Uses

This enhancement allows users to select certain items from a unit's interface section. The following diagram explains the syntax.

II-78

mIt

Identifier Icfent I--..-...

,(j)

-po--o&-¥

'----' t

IE---.-l:)

Users' Manual Supplement, Version IV New and Upgraded Facilities

Where ident can be a constant, type, variable, or procedure/process/function, any constant or type used in a selected declaration must be included in the selective USES list. If a selected declaration is not present in the interface text, an error will result during compilation. Most identifiers must be named explicitly in the identifier list if they are to be made available by the USES statement. Some identifiers are available implicitly:

* When an enumerated constant type is explicitly listed, all the constant identifiers of the enumeration are implicitly available.

*

When a record type is explici tly listed, all its field names are implicitly available (for example, see the following listing under unit A, line 12, info_rec.)

F in all y, list only the name of a routine to make it available. No explicit listing of parameters is needed.

NOTE: The types and constants that these parameters use must be explicitly included.

The first of the following compiled listings is unit A, which is selectively used by units Band C, shown in the second and third compiled listing. '

---Pascal Compiler IV.l c5s-0 3/24/82 Page 1

=======~============================================== ====

1 2 l:d 1 un itA;

2 2 l:d 1 interface

3 2 l:d 1 const

4 2 l:d 1 maxnum=1000;

5 2 l:d 1 maxchar=7;

6 2 l:d 1

7 2 l:d 1 type

8 2 l:d 1 byte=0 •• 255;

9 2 l:d 1 codeblock=packed array

[0 •• maxn um] of byte;

10 2 l:d 1 alpha=packed array

[0 •• maxchar] of char;

11 2 l:d 1 ptr_ in fo rec= A info rec·

rec;record

- ,

12 2 l:d 1 info

II-79

Users' Manual Supplement, Version IV

Dans le document USERS' MANUAL SUPPLEMENT (Page 87-92)

Documents relatifs