SLAU131V October 2004 – February 2020
The following built-in substitution symbol functions enable you to make decisions on the basis of the string value of substitution symbols. These functions always return a value, and they can be used in expressions. Built-in substitution symbol functions are especially useful in conditional assembly expressions. Parameters of these functions are substitution symbols or character-string constants.
In the function definitions shown in Table 6-1, a and b are parameters that represent substitution symbols or character-string constants. The term string refers to the string value of the parameter. The symbol ch represents a character constant.
Function | Return Value |
---|---|
$symlen(a) | Length of string a |
$symcmp(a,b) | < 0 if a < b; 0 if a = b; > 0 if a > b |
$firstch(a,ch) | Index of the first occurrence of character constant ch in string a |
$lastch(a,ch) | Index of the last occurrence of character constant ch in string a |
$isdefed(a) | 1 if string a is defined in the symbol table |
0 if string a is not defined in the symbol table | |
$ismember(a,b) | Top member of list b is assigned to string a |
0 if b is a null string | |
$iscons(a) | 1 if string a is a binary constant |
2 if string a is an octal constant | |
3 if string a is a hexadecimal constant | |
4 if string a is a character constant | |
5 if string a is a decimal constant | |
$isname(a) | 1 if string a is a valid symbol name |
0 if string a is not a valid symbol name | |
$isreg(a)(1) | 1 if string a is a valid predefined register name |
0 if string a is not a valid predefined register name |
Example 5 shows built-in substitution symbol functions.