News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Using conditional compilation in a macro

Started by donkey, January 20, 2010, 05:48:41 PM

Previous topic - Next topic

donkey

Hi Jeremy,

I was thinking of using macros to replace some typing and I'm wondering if it is possible to use a parameter of the macro with conditional compilation. The following is an example of what I mean:

TEST(%object,%type,%data1,%data2,%data3,%data4,%data5,%data6) MACRO
push eax
#IF %type = 1
mov eax,%object
#ELSEIF %type = 2
mov eax,%object
#ELSEIF %type = 3
mov eax,%object
#ENDIF
pop eax
ENDM


As you can see the macro has to be switched based on a constant passed in %type. Its not overly important but I was wondering if it was possible using the current macro engine (the example above doesn't work but I thought maybe there was another syntax for this)

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable