flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > Append "epilog" for "constant" (EQU)

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
Append "epilog" for "constant" (EQU)
Hi,

I have defined the following:

FUNCTION_NAME EQU FunctionPoly

I want to create something like the following but using "FUNCTION_NAME":

public FunctionPoly_Handler

So, I have tried different approaches like:


Code:

public FUNCTION_NAME_Handler
public FUNCTION_NAME#_Handler
public #FUNCTION_NAME#_Handler
etc.




But all of them are incorrect. Is that possible?

Thanks![/b]
Post 06 Jan 2017, 19:31
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6673
Location: Kraków, Poland
You need to use MATCH to extract the value of FUNCTION_NAME into a parameter, then the value of parameter can be concatenated with #:

Code:
match nameFUNCTION_NAME {
    public name#_Handler
}

Post 06 Jan 2017, 19:35
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Hi Tomasz,

Thanks again! That works as expected!

The problem is that I'm using it inside a macro and I don't get it to work. I have tried the following:


Code:


FUNCTION_NAME EQU FunctionPoly1

macro POLY_FUNCTION
{
   match nameFUNCTION_NAME \{
   public name#_handler
   proc name#_handler param1
   \}

        mov     eaxeax 
        ret

    endp
}

; Testing the waters....

POLY_FUNCTION

mov     eaxFunctionPoly1_handler ; FASM ERROR: undefined symbol 'FunctionPoly1_handler'.

mov     eaxname_handler ; it assembles correctly!!!





When the "match" is inside the macro, it does not get defined as expected. If I put the "match" ouside the "macro" it works fine. How can I make it work from inside the macro?

Thanks!
Post 06 Jan 2017, 20:05
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6673
Location: Kraków, Poland
You need to escape the "#" operator the same way as you escape the "{" and "}", otherwise it is processed by the outer macro.
Post 06 Jan 2017, 20:17
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Thanks a lot! I have it working as expected now Very Happy
Post 07 Jan 2017, 01:19
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Hi,

I have done some changes. When I put in the above example:


Code:

...
public name#_handler 
...




It's processed correctly and generates "public Function1Poly_handler"

But if I put the following:


Code:

...
public name#_handler as '_name#_handler@8'

or 

public name#_handler as '_#name#_handler@8'




it seems to be processed as:

public Function1Poly_handler as '_name#_handler@8'

That is, the second part is not processed.

Any help?

Thanks!
Post 08 Jan 2017, 07:41
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.