News:

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

OR operator in macros

Started by jj2007, February 26, 2009, 03:32:49 PM

Previous topic - Next topic

jj2007

This works in a macro:
  src equ <arg>  ;; a text item
  sc = 3              ;; a number
  ifidn <Test1>, src
   push 1
  elseifidn <Test2>, src
   push 1
  elseif sc eq 5 or sc eq 6
   push 5
  endif

I have googled a lot to find an equivalent or for the text item, e.g.

elseifidn <Test2>, src or idn <Test3>, src

elseif (src idn <gaga>)

etc but nothing works. Any ideas?

qWord

hi,

unfortunately there is no equivalent. Here is my suggestion for a Workaround:


@CmpStr macro str1:=<>,str2:=<>
IFIDN <&str1>,<&str2>
EXITM <1>
ELSE
EXITM <0>
ENDIF
endm
@CmpStrI macro str1:=<>,str2:=<>
IFIDNI <&str1>,<&str2>
EXITM <1>
ELSE
EXITM <0>
ENDIF
endm

...
elseif @CmpStr(<test2>,src>) or @CmpStr(<test3>,src)
...



regards, qWord
FPU in a trice: SmplMath
It's that simple!

jj2007

Quote from: qWord on February 26, 2009, 05:53:03 PM
unfortunately there is no equivalent.

Yeah, Masm is an old beast...

Quote
Here is my suggestion for a Workaround:
...
regards, qWord

Works like a charm - thanks for this elegant solution :U