mirror of
				https://github.com/netwide-assembler/nasm.git
				synced 2025-10-10 00:25:06 -04:00 
			
		
		
		
	Add the %map() function which can apply arguments to a macro from a list. Allow the user to specify the desired radix for an evaluated parameter. It doesn't make any direct difference, but can be nice for debugging or turning into strings. As part of this, split expand_one_smacro() into two parts: parameter parsing and macro expansion. This is a very straightforward splitting of two mostly unrelated pieces of functionality. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
		
			
				
	
	
		
			16 lines
		
	
	
		
			320 B
		
	
	
	
		
			NASM
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			320 B
		
	
	
	
		
			NASM
		
	
	
	
	
	
| %define tonum(=x) x
 | |
| 
 | |
| 	dd tonum(1+3)
 | |
| 	dd tonum(5*7)
 | |
| 
 | |
| %define mixed(a,=b,c)		(a + b)
 | |
| %define mixed2(a,=b,)		(a + b)
 | |
| %define mixed3(=a/u,=b/x,=c/ux)	(a + b + c)
 | |
| %define ALPHA (1 + 2)
 | |
| %define BETA  (3 + 4)
 | |
| %define GAMMA (5 + 6)
 | |
| 
 | |
| 	dd mixed(ALPHA, BETA, GAMMA)
 | |
| 	dd mixed2(ALPHA, BETA, GAMMA)
 | |
| 	dd mixed3(-ALPHA, -BETA, -GAMMA)
 |