flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro1 -> macro2 -> macro1

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
macro1 is 'push'
macro2 is '$invoke'
macro1 use macro2, macro2 use macro1.
So it doesn't work. macro1 doesn't calls in second time.
if I in macro2 purge macro1 and then define macro1 all works. But It is too slow. What can I do?(I can show code it hard to understand me).
Post 07 Mar 2006, 08:15
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Example.
Code:
format PE GUI 4.0

include "C:\fasm\INCLUDE\WIN32AX.INC";standart macro + standart include

macro m1 vl1,w
{
        display "enter the macros m1",13,10
        if w = 5
                push vl1
        else
                m2 vl1
        end if
}
macro m2 vl1
{
        display "enter the macros m2",13,10
        m1 vl1,5
}




.code
__EntryPoint:
        m1 eax,0
        ret
.end __EntryPoint

    
Post 07 Mar 2006, 09:31
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
defining macro1 again in macro2 is only way to do it. And what makes you think it is slow?

btw, you don't need to purge it there... it is no more defined.
Post 07 Mar 2006, 10:48
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:
defining macro1 again in macro2 is only way to do it. And what makes you think it is slow?

btw, you don't need to purge it there... it is no more defined.


i think that there can be more quick way. thank you.
Post 07 Mar 2006, 11:42
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
how can i know that macro is defined?
like "ifndef"?
if push ` defined
include "push.inc"
end if
Post 07 Mar 2006, 12:20
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7751
Location: Kraków, Poland
Tomasz Grysztar
There is no way to know it and it is intended.
The macros in fasm are stacking, that is the new macro when uses the same name inside of itself, uses the previous version of that instruction/macro. So you can redefine macros like in this classic fasm's sample:
Code:
macro mov arg1,arg2,arg3
{ if arg3 eq 
   mov arg1,arg2
  else
   mov arg2,arg3
   mov arg1,arg2
  end if }    

where "mov" inside the macro is the original MOV instruction, but it can also be some previous "mov" macro that extended the syntax in different way.

For this reason the only way to do a macro recursion in fasm is that constructor-macro technique.
Post 07 Mar 2006, 13:31
View user's profile Send private message Visit poster's website 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 YouTube, Twitter.

Website powered by rwasa.