TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-132
#DELTA Built-In Function
The \ Command
The backslash command converts a value in the X register to a number in text and vice
versa.
If there is no value in the X register and the text to the right of the pointer is a number,
#DELTA converts the text to a numeric value and loads it into the X register. For
example, if the text is 123ABC, the \ command loads 123 into the X register. If the text
is nonnumeric or is empty, an error occurs.
If there is a value in the X register, #DELTA inserts the textual representation of the
value into the buffer at the current position, moving the pointer to the right of the
inserted number.
If there is a value in the Y register, #DELTA inserts the value from the X register (zero,
if there is none) and right-justifies the inserted number in a field y characters wide. If y
is zero or greater, #DELTA fills the field with leading spaces; if y is less than zero,
leading zeros are used instead. If the absolute value of y is less than or equal to the
number of digits in the value to be inserted, #DELTA simply inserts it.
The ^\ Command
This command terminates a #DELTA macro begun by the M command.
Conditional Processing (? and ’ Commands)
Conditional processing is controlled by a construct that begins with a question mark (?)
followed by a letter indicating the condition to be tested for, then the command(s) to be
conditionally executed, and ends with an apostrophe (’). All tests are done on the
contents of the X register. If the test is successful, #DELTA executes the command or
commands between the test letter and the apostrophe. The test letters are:
The : flag, placed before the question mark, is the NOT operator. For example, 1?E is
false, but 1:?E is true.
In this example, the character before the pointer is converted into its ASCII value and
is loaded into the X register. The conditional test then tests whether the character is an
alphabetic character. If it is not, #DELTA replaces it with a space (-D I $ deletes the
character and inserts a space):
0A :?A -D I $'
Letter Condition to be Tested
A Is X the ASCII value of an alphabetic character?
D Is X the ASCII value of a numeric character?
E Is X equal to zero?
G Is X greater than zero?
L Is X less than zero?
N Is X not equal to zero?