Specifying The Radix Of Numeric Constants - Compaq DEC Text Processing Utility (DECTPU) Guide Manual

Guide to the dec text processing utility
Table of Contents

Advertisement

Lexical Elements of the DEC Text Processing Utility Language
4.10 Lexical Keywords

4.10.2 Specifying the Radix of Numeric Constants

You can specify constants with binary, octal, hexadecimal, and decimal radices.
To specify a numeric constant in binary, precede the number with %B. The
number can consist only of the digits 0 and 1.
To specify a numeric constant in octal, precede the number with %O. The number
can consist only of the digits 0 through 7.
To specify a numeric constant in hexadecimal, precede the number with %X. The
number can consist of digits 0–9 and A–F.
There is no radix specifier for decimal. Any numeric constant without an explicit
radix specifier is assumed to be decimal. The radix specifier may be in uppercase
or lowercase.
The following are examples of correct numeric constants:
!
! Many different ways of saying the same thing.
!
CONSTANT binary_constant := %b11111;
CONSTANT octal_constant := %o37;
CONSTANT decimal_constant := 31;
CONSTANT hex_constant := %x1f;
!
! Compile time expressions work, too.
!
CONSTANT negative_value := -%x1f;
CONSTANT strange_zero := hex_constant - %x1f;
Invalid constructs for numeric constants return the error level message TPU$_
UNKLEXICAL,
examples are not valid:
constant bad_binary := %b123;
constant bad_hex := %x10abg;
constant not_a_radix := %z0123;
4–34 Lexical Elements of the DEC Text Processing Utility Language
Unknown lexical element
"
! only 0's and 1's are legal.
! 'g' is illegal digit.
! No such radix.
during compilation. The following
"

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dec text processing utilityDectpu

Table of Contents