mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
4b58ec1b8f
1. %xdefine was broken because the code used i as a loop, which is a standard use for the name i. To avoid that confusion in the future, use "op" rather than "i" to hold the directive constant. 2. Once (1) was fixed, the smacro expansion code would fail because of parameter token numbers being indistinguishable between the ongoing expansion and the %xdefine parameters. In a first pass, mark the parameters with a new TOK_XDEF_PARAM token number, and change them to proper parameter token numbers in a second pass, which is now moved into define_smacro() which is where it arguably belongs. 3. Add a few tests for token pasting and xdefine with and without parameters. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
12 lines
246 B
NASM
12 lines
246 B
NASM
%idefine d dword
|
|
%define _1digits_nocheck(d) (((d)% 10)+'0')
|
|
%xdefine _1digits(d) (!!(d/10)*(1<<32)+ _1digits_nocheck(d))
|
|
|
|
db _1digits(8) ; Should be 0x38
|
|
|
|
%define n 0x21
|
|
%xdefine ctr n
|
|
%define n 0x22
|
|
|
|
db ctr, n ; Should be 0x21, 0x22
|