flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > invalid macro arguments. problem.

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Code:
macro test_macro [argument] { db "Test",13,10 }

test_macro (<"1">)
test_macro (test_a,"1")
test_macro  test_a,<"1">
test_macro (<test_a,"1">)
test_macro (test_a,<"1">)  ;why this string shows error?
    


what i miss?
Post 06 Dec 2006, 14:24
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7713
Location: Kraków, Poland
Tomasz Grysztar
First argument is (test_a and the second is <"1"> - preprocessor notices there's something other than comma after the ">" (which ends argument - preprocessors count the occurences of "<" and ">" to determine which one end an argument) and throws an error.
Post 06 Dec 2006, 14:43
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
tomasz: how to include "<" into macro arguments? Wink
Post 06 Dec 2006, 17:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Code:
macro test [arg]
{
       common
       match some<some?,arg \{ display "< included"\}
}


test (0,<"1">,0)
    
Post 06 Dec 2006, 18:34
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
;why here is error?
;macro test must receive one argument.
Code:
macro test [arg]
{
       common
       arg            ;here i want to see: (0,<"1">)
}


test (0,<"1">)
    


;How can I tell to fasm, that I want to receive one argument,
;or how can I receive that argument?
Post 06 Dec 2006, 18:50
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7713
Location: Kraków, Poland
Tomasz Grysztar
"<" at a beginning of parameter has a special meaning to preprocessor, there's no way to come round it.
Post 08 Dec 2006, 09:33
View user's profile Send private message Visit poster's website Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
maybe it is time to do a substring fix?

Code:
>) substring_fix >,)

macro test [arg] ;and here will be normal Wink
{ 
       common 
       arg          
} 


test (0,<"1">) ;after substring fix it will be translated to 
;test (0,<"1">,)
    
Post 08 Dec 2006, 10:42
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
dead body: i still don't get what you want to do with these things
Post 10 Dec 2006, 00:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
vid wrote:
dead body: i still don't get what you want to do with these things


i wrote macroses(for about a month ago) that do something like that:

Code:
change_syntax name_of_function:invoke,name_of_function2:libcall

;and now, you can write something like that:
name_of_function(param1,name_of_function2("1"),other_args)

;and macroses change it to:

invoke name_of_function,param1,<libcall name_of_function2,"1">,other_args
    

like a small script Wink

now i have some free time, and i want to finish them,
but i have a problem listed in my first post.

i think substring fix is a good idea, but Tomasz say nothing about this, maybe for him substring fix is not a good idea, and now i am searching for another ways.
Post 10 Dec 2006, 13:16
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
is there news?
Post 14 Dec 2006, 20:59
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7713
Location: Kraków, Poland
Tomasz Grysztar
Since < and > have this special meaning, you may use some other characters for this purpose (since you anyway need to parse this syntax with "match"), the round brackets seem to be quite good choice.

Oh, well you can also escape those characters like:
Code:
test_macro (test_a,\<"1"\>)    

but perhaps that's not what you need.
Post 14 Dec 2006, 22:16
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
topic continues here
Post 20 Dec 2006, 23:28
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.

Powered by rwasa.