flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > how to use equate as argument to ` operation?

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i have (non-working) macro like this:
Code:
macro export size, [name] {
  common
    first equ 1
  forward
    match =0, first \{
      lib_name    equ lib_name # . # name
      export_name equ export_name # _ # name
    \}
    match =1, first \{
      lib_name    equ name
      export_name equ name
      first equ 0
    \}
  common
    if size eq
      public lib_name as '_' # `export_name
    else
      public lib_name as '_'#`export_name#'@'#`size
    end if
  forward
    restore export_name
    restore lib_name
}    


i am going to use it to export symbols, like this:
Code:
export  4, err          ,text
export  4, process      ,exit
export  8, file         ,open
export   , stream      ,stdout
export 12, stream       ,write, d2dec    


my problem is that i need to create string in form '_err.text@4' from arguments 4, err, text.

I first create equate holding err.text, and then i try to convert it to 'err.text', but this fails and i don't have idea how to do this Sad
Post 06 Nov 2006, 02:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
oh shit... not again...

` and # need to be escaped


GRRRRRRRRRRRRRRRR Wink
Post 06 Nov 2006, 02:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
shit, doesn't work even after escaping \#, because "#" cannot be used in equate definition (at least not in this manner).

grrrr, i think i need some sleep (it's 3:00 AM here)
Post 06 Nov 2006, 02:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Mr_Silent



Joined: 25 Apr 2006
Posts: 30
Mr_Silent
?
Code:
macro export size, [name] {
  common 
    first equ 1 
  forward 
    match =0, first
     \{
      match _lib_name,lib_name \\{
       lib_name    equ _lib_name\\#.\\#name \\}
      match _export_name,export_name \\{
       export_name equ _export_name\\#_\\#name \\}
     \}
    match =1, first
     \{
      lib_name    equ name 
      export_name equ name
      first equ 0 
     \}
  common
   match _export_name,export_name
    \{
     if size eq
      public lib_name as '_' \#\`_export_name
     else
      public lib_name as '_'\#\`_export_name\#'@'\#`size
     end if
    \}
  forward 
    restore export_name 
    restore lib_name 
}

export  4, err          ,text
export  4, process      ,exit
export  8, file         ,open
export   , stream      ,stdout
export 12, stream       ,write, d2dec
    
Post 06 Nov 2006, 05:37
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
hell, right.
i was probably to out-of-sleep then. thanks
Post 06 Nov 2006, 09:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.