pTAL Guidelines for TAL Programmers

Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers527256-002
3-21
Overflow Trapping Considerations for TAL and pTAL
Overflow Trapping Considerations for TAL and pTAL
In a pTAL program that you run as a native process, the overflow trapping directives,
procedure attributes, and BEGIN-END block attributes directly control the trapping
behavior of your program. For example, if you specify an OVERFLOW_TRAPS
directive, overflow trapping is enabled throughout your program unless you specify a
NOOVERFLOW_TRAPS directive or procedure attribute or a
DISABLE_OVERFLOW_TRAPS block attribute.
In a TAL program that you run either as a TNS process or as a native process, the
overflow trapping directives and procedure attributes do not affect the trapping
behavior of your program except at the end of a BEGIN-END block that specifies a
block-level trapping attribute. That is, unlike a pTAL program running as a native
process, in a TAL program that you run as a TNS process, neither the current value of
the overflow trapping directive nor an overflow trapping procedure attribute changes
the trapping state of the code within the procedure.
In D40 and later releases of TAL, when your code reaches the end of a BEGIN-END
block for which you have specified a trapping attribute, TAL generates code to set or
reset the trap enable bit in the ENV register if the trapping state specified for the
BEGIN-END block and the trapping state of the code that surrounds the BEGIN-END
block are different. For this purpose, the trapping state of the surrounding code is
defined by:
A block-level attribute on a surrounding BEGIN-END block that specifies a trapping
attribute, if present
A procedure attribute, if present, and there is no surrounding BEGIN-END block
that specifies a trapping attribute
A directive—explicit or default—if neither a block-level attribute nor a procedure
attribute is present
OVERFLOW_TRAPS Directive
OVERFLOW_TRAPS
enables overflow traps for procedures and BEGIN-END blocks that do not specify
an attribute to disable overflow traps. This is the default for the TAL and pTAL
compilers.
OVERFLOW_TRAPS
POPOVERFLOW_TRAPS
NOOVERFLOW_TRAPS
VST697.vsd
PUSHOVERFLOW_TRAPS