flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Compiler Internals > break macro definition makes fasm g freeze | 
  
| Author | 
  | 
              
| 
                  
                   zhak 23 Oct 2017, 21:19 
                  I tried a workaround which P. Batard used in his macros, but it seems that it doesn't work for me
 
                  
                Code: macro BREAK? operand1 match , operand1 break else emit 1: 0x00, operand1 end match end macro I changed while loop as follows: Code: local finish finish = 0 while ~ finish match :, arg_disp finish = 1 . . . and it resolved the issue. But I don't think that it is a good solution as break fasmg directive seems to be unavailable I must note, that BREAK macro is defined inside a namespace (probably this matters)  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 24 Oct 2017, 08:28 
                  zhak wrote: I must note, that BREAK macro is defined inside a namespace (probably this matters) What causes the freeze is the infinite recursion. Whenever this happens and you need to diagnose where it comes from, you can use the "-r" switch from command line to reduce the maximum allowed depth of macro call stack to get the error message about where the recursion occured.  | 
              |||
                  
  | 
              
| 
                  
                   zhak 25 Oct 2017, 22:20 
                  How do I force it into a variable status? I tried a number of variants like defining other macros inside and outside namespaces, like __break__ and calling it - without any success.
 
                  
                The only solution I found by now is: I define namespace for selected cpu and all instructions are defined in this namespace: Code: macro cpu name match =ebc, name @cpu.target = CPU_EBC namespace __ebc__ end match end macro ------ namespace __ebc__ macro BREAK? operand . . . end macro something like this, very simplified. So, if I define BREAK EBC instruction outside any namespaces like Code: macro BREAK? operand1 match , operand1 if @cpu.target = CPU_EBC break end if else emit 1: 0x00, operand1 end match end macro then it works. But I don't like this kind of solution  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 26 Oct 2017, 06:46 
                  zhak wrote: How do I force it into a variable status? I tried a number of variants like defining other macros inside and outside namespaces, like __break__ and calling it - without any success.  | 
              |||
                  
  | 
              
| 
                  
                   zhak 26 Oct 2017, 07:53 
                  Thanks a lot! 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.