flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Macroinstructions > LOCAL directive and generated names | 
  
| Author | 
  | 
              
| 
                  
                   Tomasz Grysztar 10 Jul 2017, 09:16 
                  Normally LOCAL is processed with higher priority than operators like #, so to get it working you need nested macros. Either you can define external wrapper that would parse parameters and generate this line:     
                  
                Code: __defineLocals a_b, a_c, d_e, d_f, d_g The other option is to use nested single-use macro with escaping, like: Code: macro defineLocals parameters& { ; ... rept 1 \{ \local prefix#suffix ; ... \} }  | 
              |||
                  
  | 
              
| 
                  
                   DimonSoft 11 Jul 2017, 20:42 
                  Tomasz Grysztar wrote: Normally LOCAL is processed with higher priority than operators like #, so to get it working you need nested macros. Either you can define external wrapper that would parse parameters and generate this line: Got it, thanks. A few more questions if you don’t mind. 1. Am I right that the scope of local-definitions is the closest macro/struc/rept containing the local directive? 2. So, I need to save the generated unique name to a “more global” symbolic constant to use it later, right? 3. Is there any easy way (that I can’t see) to extend the defineLocals macro so that it could be used like: Code: defineLocals a_b, a_c, a_d ; Defines all of them and creates a_b?XX and a_c?XX macros macro a_d?XX params { ... }  | 
              |||
                  
  | 
              
| 
                  
                   DimonSoft 17 Jul 2017, 12:15 
                  Solved the problem. Turned out to be quite easy even though my solution implied that the answers to the first two questions were “yes”. 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.