Get list of functions which use pass-by-reference and are candidates for MRS

 This snippet returns a list of pass-by-reference functions which, in most cases, should better be written using multiple return value syntax instead of pass-by-reference.

#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3
#pragma IgorVersion=9.0

// Call with: GetListOfPassByRefFunctions("MyFiles*")
Function GetListOfPassByRefFunctions(string winMatchExpression)

    WAVE/T wins = ListToTextWave(WinList(winMatchExpression, ";", ""), ";")

    string func, win, info
    variable numParams, i, type

    for(win : wins)
        WAVE/T funcs = ListToTextWave(FunctionList("*", ";", "KIND:18,WIN:" + win), ";")
        for(func : funcs)
            info = FunctionInfo(func, win)
            numParams = NumberByKey("N_PARAMS", info)
            for(i = 0; i < numParams; i += 1)
                type = NumberByKey("PARAM_" + num2str(i) + "_TYPE", info)

                if(type & 0x1000 && !(type & 0x200)) // pass-by-ref but no struct
                    print func
                    break
                endif
            endfor
        endfor
    endfor
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More