HP Pascal/iX Programmer's Guide (31502-90023)
11- 8
The default for the ASSERT_HALT compiler option is OFF (see the
HP
Pascal/iX Reference Manual
or
HP Pascal/HP-UX Reference Manual
for more
information).
Example
PROCEDURE my_assert (value : integer);
BEGIN
writeln('my_assert #', value);
END;
PROCEDURE x (p : ptrtype; n : integer);
BEGIN
assert(p <> nil, 80101, my_assert);
assert(n >= 0, 80102);
END;
Traps
Your HP Pascal program can use these MPE/iX traps:
* MPE/iX intrinsic XLIBTRAP, which traps library errors.
* MPE/iX intrinsic XARITRAP (the MPE/iX version of the MPE intrinsic
XARITRAP), which traps arithmetic errors.
* MPE/iX intrinsics ARITRAP and HPENBLTRAP, which allow you to
enable and disable trap conditions.
* MPE intrinsic XCONTRAP, which specifies a user-defined routine to
handle the subsystem break (CONTROL Y).
The subsections of this section explain how to use these traps.
NOTE The user trap-handling routines whose addresses are passed to the
traps in this section must be level-one routines.
ARITRAP and HPENBLTRAP Intrinsics
The MPE/iX intrinsics ARITRAP and HPENBLTRAP are supported by the Trap
Subsystem. ARITRAP allows a user program to enable or disable traps
collectively. HPENBLTRAP is a new MPE/iX intrinsic that allows a user
program to enable selected trap conditions.
These terms apply to trap conditions:
Term Meaning
enable
To allow a trap to be raised if the trap condition occurs.
arm
To specify that a particular trap handler is to be called if a
certain trap is raised (the trap must be enabled to be
raised).
disable
To prevent a trap from being raised, even if the trap
condition occurs.
By default, all traps except IEEE floating-point traps are enabled.
(This complies with the IEEE floating-point standard, which stipulates
that IEEE traps are to remain disabled by default.)
Syntax
ARITRAP (
flag
);