HPlogo MPE/iX Intrinsics Reference Manual > Chapter 10 Command Definitions (QUIT-ZSIZE)

XARITRAP

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701
Edition 7 E0300 ♥
Edition 6 E0195

NM and CM callable (differences noted below).

Arms or disarms the user-written arithmetic trap handling procedure.

Syntax



            I*V   I32V    I32      I32
  XARITRAP (mask, plabel, oldmask, oldplabel);


NOTE: By default, all traps except IEEE floating-point exceptions are enabled, and the system trap handler is armed. Many floating-point operations result in an inexact result. Most compiler libraries doing floating-point operations result in an inexact trap if the IEEE inexact result trap is enabled. Therefore, enable the IEEE inexact result trap only if absolutely necessary.

Parameters


mask

(NM) 32-bit signed integer by value (required)

(CM) 16-bit signed integer by value (required)

Determines which trap conditions, if enabled, invoke the user-written software trap handler, and which do not.

The bits and their associated arithmetic errors are:

(NM)

Bits

Value/Meaning

31:1

3000 mode floating-point divide by zero

30:1

Integer divide by zero

29:1

3000 mode floating-point underflow

28:1

3000 mode floating-point overflow

27:1

Integer overflow

26:1

3000 mode double-precision overflow

25:1

3000 mode double-precision underflow

24:1

3000 mode double-precision divide by zero

23:1

Decimal overflow

22:1

Invalid ASCII digit

21:1

Invalid decimal digit

19:2

Reserved for the operating system

18:1

Decimal divide by zero

17:1

IEEE floating-point inexact result

16:1

IEEE floating-point underflow

15:1

IEEE floating-point overflow

14:1

IEEE floating-point divide by zero

13:1

IEEE floating-point invalid operation

12:1

Range errors

11:1

Software-detected NIL pointer reference

10:1

Software-detected misaligned result of pointer arithmetic or error in conversion from long pointer to short pointer

9:1

Unimplemented condition traps

8:1

Paragraph stack overflow

7:1

3000 mode packed decimal error

1:6

Reserved for the operating system

0:1

Assertion trap

(CM)

Bits

Value/Meaning

15:1

3000 mode floating-point divide by zero

14:1

Integer divide by zero

13:1

3000 mode floating-point underflow

12:1

3000 mode floating-point overflow

11:1

Integer overflow

10:1

3000 mode double-precision overflow

9:1

3000 mode double-precision underflow

8:1

3000 mode double-precision divide by zero

7:1

Decimal overflow

6:1

Invalid ASCII digit

5:1

Invalid decimal digit

4:2

Reserved for the operating system

2:1

Decimal divide by zero


NOTE: The following apply to the preceding trap conditions represented in the mask:
  • NM supports IEEE and 3000 mode formats. Both execute in NM, but 3000 mode performs Hewlett-Packard 3000 type manipulations. Since it is possible to use both formats during program execution, there are separate bits in the mask for enabling/disabling traps of these formats.

  • Some error conditions specified here are not strictly arithmetic traps (for example, range errors, nil pointers, and paragraph stack overflow). However, many arithmetic traps are caught by reserved instructions that raise the conditional traps. For this reason, all are enabled/disabled by XARITRAP.

  • Some instructions that raise conditional traps are reserved to indicate the above trap conditions. A nonreserved instruction is one not generated by a compiler. If a nonreserved instruction causes a conditional trap, it is reported as an unimplemented condition trap. Only assembly language programmers can generate such a trap.


plabel

(NM) 32-bit signed integer by value (required)

(CM) 16-bit signed integer by value (required)

Passes the address of the trap handling procedure. If the value is 0, the user-written arithmetic trap handler is disabled.

oldmask

(NM) 32-bit signed integer by reference (required)

(CM) 16-bit signed integer by reference (required)

Returns the value of the previous mask.

oldplabel

(NM) 32-bit signed integer by reference (required)

(CM) 16-bit signed integer by reference (required)

Returns the plabel of the process's previous arithmetic trap handler. If no plabel was previously configured, 0 is returned.

Operation Notes


This trap can be armed for any combination of events; at any given time, there is only one user-written trap handler for all armed traps.

There is a difference between arming and enabling traps:
  • Enabling a trap means that the occurrence of a trap condition is not ignored.

  • Arming a trap is required so that, on a trap condition, a user-written routine is invoked and can take appropriate recovery actions.

The following summarizes what can occur when an arithmetic trap condition arises:
  • If a trap is both enabled and armed, the user-written trap handler is invoked whenever a trap condition occurs.

  • If a trap is enabled but not armed, one of two situations applies:

    • If a Pascal XL TRY statement is executed, control is passed to the RECOVER block by doing an ESCAPE.

    • If a Pascal XL TRY statement is executed, an error message is output and the process aborts.

  • If a trap is disabled, irrespective of whether it is armed, the trap is ignored, and execution of the process continues without any interruption.

Condition Codes


CCE (2)

Request granted. The desired traps are now armed.

CCG (0)

Request granted. All traps are now disarmed.

CCL (1)

Not returned.

Related Information


Manual

Trap Handling Programmer's Guide




WRITELOG


XCONTRAP