Hello.
Is there anybody to help me with macro constructions?
I'm trying to write a macro which will be used to create other macros from the list of supplied arguments. But during one of development phase I got stuck with a problem, which I'm still not capable to resolve.
Here is short excerpt of the working version:
    
macro MacroBuilder varName, macroName, action {
  macro varName#.#macroName \{
          action
      \}
}
macro DisplayOk {
    display 'Ok', 13, 10
}
MacroBuilder testVar, DisplayOk, DisplayOk
testVar.DisplayOk
     
Then I decided to replace one of the arguments with global constant:
    
macro MacroBuilder varName, macroName {
      macro varName#.#macroName \{
          Action
      \}
}
macro DisplayOk {
    display 'Ok', 13, 10
}
Action equ DisplayOk
MacroBuilder testVar, DisplayOk
testVar.DisplayOk
     
and right away I got first problem in the form of error message which said that 
Action is illegal instruction. After studying preprocessor dumps I realized that macro receives an argument by reference, not by value, so I added a 
match directive to do argument dereferencing which improved the situation (I use here HLL terms because I don't know more appropriate ones). So I got this code, which also worked:
    
macro MacroBuilder varName, macroName {
  macro varName#.#macroName \{
          match act, Action \\{
                        act
         \\}
  \}
}
macro DisplayOk {
    display 'Ok', 13, 10
}
Action equ DisplayOk
MacroBuilder testVar, DisplayOk
testVar.DisplayOk
     
But then I decided to remove 
macroName argument as well and replace it with global constant the same way as with 
action argument. Considering the previous experience with referenced argument the resulting code should look like this:
    
macro MacroBuilder varName {
      match name, MacroName \{
              macro varName#.#name \\{
                     match act, Action \\\{
                              act
                 \\\}
                \\}
  \}
}
macro DisplayOk {
    display 'Ok', 13, 10
}
Action          equ DisplayOk
MacroName      equ DisplayOk
MacroBuilder testVar
testVar.DisplayOk
     
but it doesn't work. I have played a little bit with 
fix directive, and it helped but only when I had it before macro declaration, which doesn't suit my purposes at all.
Is there another way to make it work as intended?
Thank you.