
Macro Parameters/Substitution Symbols
5-9
Macro Language
In Example 5–4 the .asg directive could be replaced with the .eval directive
without changing the output. In simple cases like this, you can use .eval and
.asg interchangeably. However, you must use .eval if you want to calculate a
value from an expression. While .asg only assigns a character string to a
substitution symbol, the .eval directive evaluates an expression and assigns
the character string equivalent to a substitution symbol.
5.3.3
Built-In Substitution Symbol Functions
The following built-in substitution symbol functions enable you to make
decisions based on 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 to these functions are substitution symbols or
character-string constants.
In Table 5–1 function definitions,
a and b are parameters that represent
substitution symbols or character string constants. The term
string refers to the
string value of the parameter.
Table 5–1. Functions and Return Values
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 if string
a is a valid predefined register name
0 if string
a is not a valid predefined register name
$structsz(a)
size of structure represented by structure tag
a
$structacc(a)
reference point of structure represented by structure tag
a
† For more information about predefined register names, see Section 3.8, Symbols, on page
3-18.
Содержание TMS320C54x
Страница 38: ......
Страница 39: ......
Страница 40: ......
Страница 41: ......
Страница 42: ......
Страница 43: ......
Страница 44: ......
Страница 45: ......
Страница 46: ......
Страница 47: ......
Страница 48: ......
Страница 49: ......
Страница 50: ......
Страница 51: ......
Страница 52: ......
Страница 53: ......
Страница 54: ......
Страница 55: ......
Страница 56: ......
Страница 57: ......
Страница 58: ......
Страница 59: ......
Страница 60: ......
Страница 61: ......
Страница 62: ......
Страница 276: ......
Страница 277: ......
Страница 278: ......
Страница 279: ......
Страница 280: ......
Страница 281: ......
Страница 282: ......
Страница 283: ......
Страница 284: ......
Страница 285: ......
Страница 286: ......
Страница 287: ......
Страница 288: ......
Страница 289: ......
Страница 290: ......
Страница 291: ......
Страница 292: ......
Страница 293: ......
Страница 294: ......
Страница 295: ......
Страница 296: ......
Страница 297: ......
Страница 298: ......
Страница 299: ......
Страница 300: ......
Страница 301: ......
Страница 302: ......