Stacked defines and undefs

anonymous coward nasm64developer at users.sf.net
Sun Feb 28 23:24:40 PST 2010


> I work with a set of macros, one that creates symbols, the other
> one that destroys them.

You might find SF #1842438 (and its attached files) interesting.

  https://sourceforge.net/tracker/?func=detail&aid=1842438&group_id=6208&atid=306208

I think you have to log into SF to actually be able to see it.

(I'm mentioning it because if you had e.g. %ADDTAIL, then you
wouldn't need your new preprocessor functionality for this. See
the attached file for an example. :-)
-------------- next part --------------
           1                                        <0> %macro end_arguments 0
           2                                        <0> %endmacro
           3                                        <0> 
           4                                        <0> %macro arguments 0-*
           5                                        <0>  %rep %0
           6                                        <0>   %define %1 bp
           7                                        <0>   %addtail end_arguments 0 %undef %1
           8                                        <0>   %rotate 1
           9                                        <0>  %endrep
          10                                        <0> %endmacro
          11                                        <0> 
          12                                        <0> arguments ax,bx
          13                = 0000000000000002h     <1>  %rep %0
          14                                        <1>   %define %1 bp
          15                                        <1>   %addtail end_arguments 0 %undef %1
          16                                        <1>   %rotate 1
          17                                        <1>  %endrep
          18                                        <2>   %define %1 bp
          19                = 0000000000000001h     <2>   %addtail end_arguments 0 %undef %1
          20                = 0000000000000001h     <2>   %rotate 1
          21                                        <2>   %define %1 bp
          22                = 0000000000000001h     <2>   %addtail end_arguments 0 %undef %1
          23                = 0000000000000001h     <2>   %rotate 1
          24                                        <0> 
          25 0000000000000000 89EC                  <0> mov sp,ax
          26 0000000000000002 89EC                  <0> mov sp,bx
          27 0000000000000004 89CC                  <0> mov sp,cx
          28 0000000000000006 89D4                  <0> mov sp,dx
          29                                        <0> 
          30                                        <0> arguments cx,dx
          31                = 0000000000000002h     <1>  %rep %0
          32                                        <1>   %define %1 bp
          33                                        <1>   %addtail end_arguments 0 %undef %1
          34                                        <1>   %rotate 1
          35                                        <1>  %endrep
          36                                        <2>   %define %1 bp
          37                = 0000000000000001h     <2>   %addtail end_arguments 0 %undef %1
          38                = 0000000000000001h     <2>   %rotate 1
          39                                        <2>   %define %1 bp
          40                = 0000000000000001h     <2>   %addtail end_arguments 0 %undef %1
          41                = 0000000000000001h     <2>   %rotate 1
          42                                        <0> 
          43 0000000000000008 89EC                  <0> mov sp,ax
          44 000000000000000A 89EC                  <0> mov sp,bx
          45 000000000000000C 89EC                  <0> mov sp,cx
          46 000000000000000E 89EC                  <0> mov sp,dx
          47                                        <0> 
          48                                        <0> end_arguments
          49                = 0000000000000001h     <1> %undef ax
          50                = 0000000000000001h     <1> %undef bx
          51                = 0000000000000001h     <1> %undef cx
          52                = 0000000000000001h     <1> %undef dx
          53                                        <0> 
          54 0000000000000010 89C4                  <0> mov sp,ax
          55 0000000000000012 89DC                  <0> mov sp,bx
          56 0000000000000014 89CC                  <0> mov sp,cx
          57 0000000000000016 89D4                  <0> mov sp,dx


More information about the yasm-devel mailing list