The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jimg on December 25, 2008, 07:51:00 PM

Title: macro help
Post by: Jimg on December 25, 2008, 07:51:00 PM
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.
Title: Re: macro help
Post by: qWord on December 25, 2008, 09:20:36 PM
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



Title: Re: macro help
Post by: Jimg on December 25, 2008, 10:07:17 PM
Thanks, that works.  Anyone else?
Title: Re: macro help
Post by: Jimg on December 26, 2008, 12:16:07 AM
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
Title: Re: macro help
Post by: MichaelW on December 26, 2008, 01:15:16 AM
How about:

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