pTAL Guidelines for TAL Programmers

Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers527256-002
3-24
ENABLE_OVERFLOW_TRAPS Block Attribute
ENABLE_OVERFLOW_TRAPS Block Attribute
In both TAL and in pTAL, you can use the following syntax to specify whether you want
to enable or disable overflow traps within the scope of a BEGIN-END block:
Program behavior within a block that specifies a block-level attribute is the same in
TAL and in pTAL—that is, in TNS and native processes.
For a pTAL program running as a TNS process, D20 and later releases of the TAL
compiler generate the code required to set or reset the trap-enable bit in the ENV
register when your program enters the block. If necessary, the compiler also generates
the code to set or reset the trap-enable bit when your program exits the block,
according to the trapping state specified by a surrounding BEGIN-END block, an
OVERFLOW_TRAPS or NOOVERFLOW_TRAPS procedure attribute or
OVERFLOW_TRAPS or NOOVERFLOW_TRAPS directive.
Both TAL and pTAL support block-level overflow trapping attributes; therefore, a pTAL
procedure that specifies block-level attributes has the same trapping behavior as a
TNS process or a native process.
Topics:
Considerations on page 3-25
When to Use Overflow Trap Attributes on page 3-26
Example 3-16. ENABLE_OVERFLOW_TRAPS and
DISABLE_OVERFLOW_TRAPS Block Attributes
?OVERFLOW_TRAPS
PROC p;
BEGIN: DISABLE_OVERFLOW_TRAPS
IF i = j THEN
BEGIN: ENABLE_OVERFLOW_TRAPS
... ! Traps are enabled
END ! Traps become disabled when the END is reached
ELSE
BEGIN ! Traps remain disabled
...
END ! Traps remain disabled
END; ! Traps are disabled when the END is reached
BEGIN
: ENABLE_OVERFLOW_TRAPS
DISABLE_OVERFLOW_TRAPS
VST682.vsd