flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Macroinstructions > Question: Conversion to string constant | 
  
| Author | 
  | 
              
| 
                  
                   baldr 16 Mar 2010, 19:14 
                  Siberian,
 
                  Backtick converts only one following token to string. You need to irps over symbols in symchain. Code: struc reequ [arg] { common restore . . equ arg } struc equ" [arg] { common . equ "" irps s, arg \{ match v,.\\#\\`s \\{ . reequ v \\} \} } a equ" ! \\\# $ % & ( ) * + , - . / : < = > ? @ [ ] ^ _ \\\` \\\{ | \\\} ~ db a Last edited by baldr on 16 Mar 2010, 19:19; edited 1 time in total  | 
              |||
                  
  | 
              
| 
                  
                   Siberian 16 Mar 2010, 19:17 
                  Already found the way myself. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   Siberian 16 Mar 2010, 19:24 
                  Thank you baldr. I knew about irps, but just didn't realize that concatenating two string constants with # sign will produce new string constant. I tried several things, but couldn't find a solution, so I posted a message and went to a shower. While being there, I got an idea to try this concatenation, and it worked. The same time, you posted a reply, so you just reassured me that this is the right way. One thing bothers me though. This reequ structure is it really necessary? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   baldr 16 Mar 2010, 20:02 
                  Siberian,
 
                  
                reequ is an utility macro: it replaces current value of symbolic constant. Code: mov equ "hello" mov reequ "world" restore mov ; Now «mov» is not a symbolic constant  | 
              |||
                  
  | 
              
| 
                  
                   Siberian 16 Mar 2010, 20:06 
                  So then we also need utility macros for struc and for macro directives? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   baldr 16 Mar 2010, 20:26 
                  Siberian,
 
                  
                I've used struc-macro because that way reequ will look like equ directive. There are differences though, due to macro operators. struc and macro are reserved words, they can't be used as a macro name.  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.