HPlogo MPE/iX Intrinsics Reference Manual > Chapter 7 Command Definitions (HP32208-HPLOACNMPROC)

HPENBLTRAP

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701
Edition 7 E0300 ♥
Edition 6 E0195

NM callable only.

Selectively enables or disables arithmetic traps.

Syntax



              I32V  I32
  HPENBLTRAP (mask, oldmask);

Parameters


mask

32-bit signed integer by value (required)

Passes a value indicating which arithmetic traps are enabled and which are not:

  • If a bit is on (=1), the corresponding trap is enabled.

  • If a bit is off (=0), the corresponding trap is disabled.

The bits and their associated arithmetic errors are
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:7

Reserved for MPE/iX

0:1

Assertion trap


NOTE: The following apply to various trap conditions represented in the mask parameter:
  • Native mode supports two floating-point formats: IEEE and 3000 mode. Both execute in native mode, but 3000 mode performs HP 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 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 HPENBLTRAP.

  • Some of the instructions that raise conditional traps are reserved to indicate some of the above trap conditions. A nonreserved instruction is one not generated by a compiler. If a nonreserved instruction causes a conditional trap, this is reported as an unimplemented condition trap.


oldmask

32-bit signed integer by reference (required)

Returns the value of the previous mask to the program.

Operation Notes


Allows selective enabling or disabling of arithmetic traps. It provides more flexibility than the ARITRAP intrinsic, which collectively enables or disables 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 list 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 has been executed, control is passed to the recover block by doing an escape.

    • If a Pascal/XL TRY statement has not been 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.


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. Consequently, most compiler libraries doing floating-point operations result in an inexact trap if the IEEE inexact result trap is enabled.

Condition Codes


CCE (2)

Request granted. All traps were originally disabled.

CCG (0)

Request granted. At least one trap was originally enabled.

CCL (1)

Not returned.

Related Information


Manuals

Trap Handling Programmer's Guide




HPDEVCREATE


HPERRDEPTH