pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
1. Put an ASSERTION directive in the source code, specifying an assertion-level and an
error-handling procedure.
2. Put an ASSERT statement at each place where you want to execute the error-handling procedure
when an error occurs. In each ASSERT statement, specify:
• An assert-level that is greater than or equal to the assertion-level
• A condition that will be true when an error occurs
During program execution, if an assert-level is greater than or equal to the active
assertion-level and the associated condition is true, the program calls the error-handling
procedure.
Example 142 (page 201) calls PROCESS_DEBUG_ whenever a carry or overflow condition occurs.
Example 142 ASSERTION Directive and ASSERT Statement
?SOURCE $SYSTEM.SYSTEM.EXTDECS (PROCESS_DEBUG_)
?ASSERTION 5, PROCESS_DEBUG_ ! Activates all ASSERT conditions
SCAN array WHILE " " -> @pointer;
ASSERT 10 : LOCAL_CARRY_FLAG;
!Lots of code
ASSERT 10 : LOCAL_CARRY_FLAG;
!More code
ASSERT 20 : LOCAL_OVERFLOW_FLAG; ! $OVERFLOW routine tests for
! arithmetic overflow
In Example 142 (page 201):
• If you change the assertion-level from 5 to 15, you nullify the two ASSERT statements
that specify assert-level 10 and the LOCAL_CARRY_FLAG condition.
• If you change the assertion-level from 5 to 30, you nullify all the ASSERT statements.
If all ASSERT statements that cover a particular condition have the same assert-level, it is
easier to nullify specific levels of ASSERT statements.
Assignment
The assignment statement assigns a value to a previously declared variable.
variable
is the identifier of a simple variable, array element, simple pointer, structure pointer, or structure
data item, with or without a bit deposit field and/or index. To update a pointer’s content, prefix
the pointer identifier with @.
expression
is either:
• An arithmetic expression of the same data type as variable
• A conditional expression, which always has an INT result
expression can be a bit extraction value or an identifier prefixed with @ (the address of a
variable). expression cannot be a constant list.
In general, the data types of variable and expression must match. To convert the data type
of expression to match the data type of variable, use a type-transfer routine, described in
Chapter 15 (page 274).
Assignment 201