HPlogo 900 Series HP 3000 Computer Systems: MPE/iX Intrinsics Reference Manual > Chapter 4 Command Definitions

XARITRAP

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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.

ValueMeaning
1Corresponding trap condition is armed
0Corresponding trap condition is disarmed

The bits and their associated arithmetic errors are:

(NM)

BitsValue/Meaning
31:13000 mode floating-point divide by zero
30:1Integer divide by zero
29:13000 mode floating-point underflow
28:13000 mode floating-point overflow
27:1Integer overflow
26:13000 mode double-precision overflow
25:13000 mode double-precision underflow
24:13000 mode double-precision divide by zero
23:1Decimal overflow
22:1Invalid ASCII digit
21:1Invalid decimal digit
19:2Reserved for the operating system
18:1Decimal divide by zero
17:1IEEE floating-point inexact result
16:1IEEE floating-point underflow
15:1IEEE floating-point overflow
14:1IEEE floating-point divide by zero
13:1IEEE floating-point invalid operation
12:1Range errors
11:1Software-detected NIL pointer reference
10:1Software-detected misaligned result of pointer arithmetic or error in conversion from long pointer to short pointer
9:1Unimplemented condition traps
8:1Paragraph stack overflow
7:13000 mode packed decimal error
1:6Reserved for the operating system
0:1Assertion trap

(CM)

BitsValue/Meaning
15:13000 mode floating-point divide by zero
14:1Integer divide by zero
13:13000 mode floating-point underflow
12:13000 mode floating-point overflow
11:1Integer overflow
10:13000 mode double-precision overflow
9:13000 mode double-precision underflow
8:13000 mode double-precision divide by zero
7:1Decimal overflow
6:1Invalid ASCII digit
5:1Invalid decimal digit
4:2Reserved for the operating system
2:1Decimal 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

Intrinsics

None

Commands

None

Manuals

Trap Handling Programmer's Guide (32650-90026)

Feedback to webmaster