flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How can I reorder arguments of macroses?

Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 09 Aug 2005, 03:44
Hi, I'm trying to do a pascal invoke macro relaying on the standard invoke

I tried this but does not work:
Code:
macro pascall name, [args]
{
common
  invoke name\

reverse
  ,args\
}    


Note I want to use invoke and actually I'm insterested in how can I pass arguments in a diferent order that I recieve in my macro to another.
Post 09 Aug 2005, 03:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 09 Aug 2005, 06:15
I think this may do what you want (but not tested)
Code:
macro pascall name,[args]
{
common
local   arg_list
        arg_list equ
reverse arg_list equ arg_list,args
common  invoke name,arg_list
}    
Post 09 Aug 2005, 06:15
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 09 Aug 2005, 12:21
revolution, I already tried something like that but it throws the error "Error: invalid count of parameters for MessageBox." and with your code too:
Code:
macro pascall name,[args]
{
common
local   arg_list
        arg_list equ
reverse arg_list equ arg_list,args
common  invoke name,arg_list
}
pascall MessageBox,0,0,0,0    


Apparently the invoke macro treates "arg_list" as one argument instead of for I think
Post 09 Aug 2005, 12:21
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 09 Aug 2005, 13:24
Well, I did a macro to test how invoke recieves the params and it appear to treat the equate as one argument:
Code:
macro docall name, [args]
{
forward
  display args, 13, 10
common
  display args, 13, 10
;  invoke name, args
}

macro pascall name,[args]
{
common
local   arg_list, first
        first    equ 1
reverse
  match =0, first\{arg_list equ arg_list,args\}
  match =1, first\{
    arg_list equ args
    first equ 0
  \}
common docall name,arg_list, "test"
}
pascall MessageBox, "H","E","L","O"    


Displays:
OLEH
test
OLEHtest

So how can I do this in other way? I'm using FASMW 1.64
Post 09 Aug 2005, 13:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 09 Aug 2005, 15:37
Sorry, you are right. Here is one possible solution (I tested it this time):
Code:
macro invoke name,[args]
{
common display `name
forward display ',',args+'0'
common display 13,10
}

macro pascall name,[args]
{
common  arg_list equ
reverse arg_list equ arg_list,args
common  match =,arg,arg_list \{invoke name,arg\}
}

pascall MessageBox,1,1,1,1
pascall MessageBox,2,2,2,2
pascall MessageBox,1,2,3,4    
Post 09 Aug 2005, 15:37
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 09 Aug 2005, 16:21
Yeah it's works now, thanks a lot revolution Very Happy
Post 09 Aug 2005, 16:21
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 10 Aug 2005, 08:11
Shouldn't this thread be moved to "Macroinstructions" section?
Post 10 Aug 2005, 08:11
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.