News:

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

macro help

Started by Jimg, December 25, 2008, 07:51:00 PM

Previous topic - Next topic

Jimg

Is there some way to write this more simply?
    for arg,<baddr>
        quote SUBSTR <arg>,1,1
        isquote=0
        IFIDN quote , <">
            isquote=1
        elseifidn quote,<'>
            isquote=1
        endif
        if isquote
            .data
               tmpoffset = $
               db arg,0
            .code
            mov esi,tmpoffset
It works, but it's kinda ugly.
I have tried every combination of

   if ( (quote eq <"> )  or (quote eq <'>) )

that I could think of with no luck.

qWord

hi,

come this closer to your taste:

        IF (@InStr(1,<&arg>,<!">) EQ 1) OR (@InStr(1,<&arg>,<!'>) EQ 1)
            .data
                tmpoffset = $
                db arg,0
            .code
            mov esi,tmpoffset
        ELSE
            ;...
        ENDIF


regards, qWord



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

Jimg

Thanks, that works.  Anyone else?

Jimg

And with your hint, I got a little furthur-

    for arg,<baddr>
        quote SUBSTR <arg>,1,1
        IF (@InStr(1,<!"!'>,<%quote>))
            .data
               tmpoffset = $
               db arg,0
            .code
            mov esi,tmpoffset

MichaelW

How about:

    IF (@InStr(1,<!"!'>,@SubStr(<arg>,1,1)))
      .data
        tmpoffset = $
        db arg,0
      .code
      mov esi,tmpoffset
    ENDIF
eschew obfuscation