Literals [ System Debug Reference Manual ] MPE/iX 5.0 Documentation
System Debug Reference Manual
Literals
Literals represent specific values of one of the data types supported by
System Debug. This section explains how to construct and interpret
literals.
Numeric Literals
Numeric literals are a sequence of digits that are valid in the indicated
radix. If the digits are not preceded by one of the base prefix
characters, %, #, or $, the current input base is assumed.
Examples of valid numeric literals are the following:
#2048
$fff
%1762
26
The type of a numeric literal is determined by the smallest amount of
storage required to store the value and by whether or not the literal is
treated as being signed. The presence of a preceding minus sign, which
must always precede the base prefix character, does not affect the sign
of the literal. Such minus signs are treated as unary operators and are
not considered to be parts of literals.
Octal and hex literals are considered to be signed if the representation
of the unsigned digits fits into the natural word size of the current
mode of System Debug (16 bits for CM, 32 bits for NM), and the high-order
bit of the word is 1. Decimal literals are always unsigned.
Examples:
$nmdebug > env outbase '#' /* set output base to decimal
#nmdebug > wl $ffffffff /* S32 - sign bit 1, NM word size
#-1
#nmdebug > wl $ffff /* U16 - sign bit 1, but not NM word size
#65535
#nmdebug > cm /* switch to CM
#cmdebug > wl $ffff /* S16 - sign bit 1, CM word size
#-1
#cmdebug > wl $ffffffff /* U32 - sign bit 1, but not CM word size
#4294967295
#cmdebug >
Pointer Literals
Short pointer literals are represented by numeric literals. Essentially,
this means that wherever a short pointer is required, a numeric literal
that fits in 32 bits is accepted and is silently converted to the type
SPTR.
Long pointer literals of type LPTR are entered as a pair of (32-bit)
numbers separated by a dot, forming the so-called dotted pair. Long
pointer literals are entered in the form sid.offset.
Examples are:
$c0002040 short pointer literal
3f.204c long pointer literal (SID=3f, offset=204c)
String Literals
String literals are formed by enclosing an arbitrary sequence of ASCII
characters within either single quotes (') or double quotes (").
The same type of quote used to start the string (single or double) must
be used to terminate it. For example, 'abc' and "abc" are valid string
literals, but 'abc" is not.
A string which is defined with single quotes can contain one or more
double quotes within the string body, and vice versa. For example,
"don't fret" and "SEG'ONE" are valid strings.
In order to include the same quote character that is used as the string
delimiter within the string itself, that quote character should appear
in duplicate within the string. For example, the apostrophe
in'don&'&'t'comes out as don't.
Examples of string literals are:
'Rufus T. Firefly'
"OB'"
'xltypes:pib_type.parent'
'The sun isn"t shining and I"m feeling so sad.'
Regular Expression String Literals
A special class of string literals called regular expressions is formed
by enclosing an arbitrary sequence of characters with the backquote
character (`). Refer to appendix A for a discussion of how patterns and
regular express can be constructed for use in pattern matching.
MPE/iX 5.0 Documentation