mname macro param:vararg
       ;some code
 endm

 what does VARARG do?
Posted on 2001-05-11 15:19:00 by disease_2000
It means VARiable ARGuments. It if to suport macro structure where an unknown number of parameters are passed. In this case all extra arguments are grouped under the tag name. Ernie's Coinvoke is a good example of its usage, he uses VARARG and checks if 'edx' is in the parameter list before passing the arguments along to the invoke call:

coinvoke MACRO pInterface:REQ, Interface:REQ, Function:REQ, args:VARARG
    LOCAL istatement, arg
    FOR arg,      ;; run thru args to see if edx is lurking in there
        IFIDNI <&arg>, 
            .ERR 
        ENDIF
    ENDM
    IFIDNI <&pInterface>, 
        .ERR 
    ENDIF
    istatement CATSTR ,<_>,<&Function, pInterface>
    IFNB      ;; add the list of parameter arguments if any
        istatement CATSTR istatement, <, >, <&args> 
    ENDIF 
    mov edx, pInterface
    mov edx, 
    ;% echo istatement
    istatement
ENDM
To use this macro, you MUST have 3 parameters, and 4+ are variable. The 4+ are grouped in the tag name 'arg'. The pre-compile command IFIDNI basically compares each successive argument with "edx" and returns error is found in the argument list. L8r on if no edx is found, it is eventually copied into the variable arguments of an invoke macro. Hope this helps. NaN
Posted on 2001-05-11 17:05:00 by NaN