Macro Generation Numbers
You can use macro generation numbers to avoid the multiple symbol definition that can occur with multiple macro expansions. To avoid this problem, specify a macro generation number marker as part of any symbol used in a macro. This results in symbols that are unique to each macro call.
The macro generation number marker is expanded as a 5-digit decimal number between 00000 and 99999 that is unique to a macro expansion. The syntax for specifying the macro generation number marker is as follows:
\@
Two or more macro generation number markers can be written in a macro body, and they will be expanded to the same number in the same macro call. The following example shows how to specify macro generation numbers for #str and end_str.
.MACRO RES STR, Rn
MOV.L #str\@,\Rn
BRA end_str\@
NOP
str\@ .SDATA "\STR"
.ALIGN 2
end_str\@
.ENDM
RES "ONE",R0 ; Different symbols are generated each time
RES "TWO",R1 ; RES_STR is expanded.
Expanded results are as follows:
MOV.L #str00000,R0
BRA end_str00000
NOP
str00000 .SDATA "ONE"
.ALIGN 2
end_str00000
MOV.L #str00001,R1
BRA end_str00001
NOP
str00001 .SDATA "TWO"
.ALIGN 2
end_str00001
See Also
SHASM Macro Directives | SHASM Macro Definition
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.