public void addFunction(string funcName, IRTSFunction func) { if (mFuncs == null) { mFuncs = new System.Collections.Generic.Dictionary <string, IRTSFunction>(); } mFuncs[RTSUtil.keyOfFunc(funcName, func.argSize())] = func; }
public void removeFunction(string funcName, int argCount) { if (mFuncs == null) { return; } else { string key = RTSUtil.keyOfFunc(funcName, argCount); mFuncs.Remove(key); } }
public void aliasFunction(string funcName, int argC, string alias) { if (mFuncs == null) { return; } string fname = RTSUtil.keyOfFunc(funcName, argC); IRTSFunction func; if (mFuncs.TryGetValue(fname, out func)) { mFuncs[RTSUtil.keyOfFunc(alias, argC)] = func; } }
public IRTSDefine.Stack run(IRTSStack stack) { if (mFunc == null) { mFunc = stack.getThread().getEngine().getFunction(mFuncName, mArgC); if (mFunc == null) { stack.getThread().catchError(IRTSDefine.Error.Runtime_NoFunctionDefine, "Don't find function defined:" + RTSUtil.keyOfFunc(mFuncName, mArgC)); return(0); } } while (mArgs != null && mArgCur < mArgs.length()) { IRTSRunner r = mArgs.get(mArgCur++); if (stack.getThread().loadRunner(r)) { return(0); } } if (!mLoaded) { mLoaded = true; object[] args = mArgC > 0 ? new object[mArgC] : null; if (args != null) { for (int i = 0; i < mArgC; i++) { IRTSRunner r = mArgs.get(i); if (r != null) { args[i] = r.getOutput(); } } } mFuncR = mFunc.createRunner(args); if (stack.getThread().loadRunner(mFuncR)) { return(0); } } mValue = mFuncR == null ? null : mFuncR.getOutput(); if (mCast != null) { mValue = mCast.castValue(mValue); } return(0); }
public IRTSFunction getFunction(string funcName, int argCount) { if (mFuncs == null) { return(null); } else { IRTSFunction func; if (!mFuncs.TryGetValue(RTSUtil.keyOfFunc(funcName, argCount), out func) && argCount != -1) { if (!mFuncs.TryGetValue(funcName, out func)) { func = null; } } return(func); } }