public StringTemplate ToShimFunc(FunctionSig sig) { return(TemplateGroup.GetInstanceOf("shimfunc", new Dictionary <string, object> { { "funcname", sig.FunctionName }, { "parameterpops", this.ToCallParmPops(sig) }, { "syscall", this.ToSyscall(sig) } })); }
public StringTemplate ToApiDef(FunctionSig sig) { List <StringTemplate> apiParms = this.ToApiParms(sig); return(TemplateGroup.GetInstanceOf("apidef", new Dictionary <string, object> { { "returntype", GetCSharpTypeName(sig.ReturnType) }, { "funcname", sig.FunctionName }, { "paramlist", apiParms } } )); }
private FunctionSig MakeSig() { VarType[] types = this.ToVarTypes(parmTypes); FunctionSig sig = new FunctionSig { FunctionName = id, ParamNames = parmNames.ToArray(), ParamTypes = types, ReturnType = this.ToVarType(type), TableIndex = _index++ }; return(sig); }
public List <StringTemplate> ToApiParms(FunctionSig sig) { List <StringTemplate> retParms = new List <StringTemplate>(); for (int i = 0; i < sig.ParamNames.Length; i++) { retParms.Add( TemplateGroup.GetInstanceOf("apiparam", new Dictionary <string, object> { { "type", GetCSharpTypeName(sig.ParamTypes[i]) }, { "name", this.FixApiParmName(sig.ParamNames[i]) } }) ); } return(retParms); }
public bool PostScriptEvent(OpenMetaverse.UUID itemID, OpenSim.Region.ScriptEngine.Shared.EventParams parms) { FunctionSig eventInfo = _eventList.GetEventByName(parms.EventName); VM.DetectVariables[] detectVars = this.DetectParamsArrayToDetectVariablesArray(parms.DetectParams); VM.PostedEvent evt = new VM.PostedEvent { EventType = (SupportedEventList.Events)eventInfo.TableIndex, Args = parms.Params, DetectVars = detectVars }; evt.Normalize(); _exeScheduler.PostEvent(itemID, evt); return(true); }
public StringTemplate ToSyscall(FunctionSig sig) { List <string> parmNames = new List <string>(); for (int i = 0; i < sig.ParamTypes.Length; i++) { parmNames.Add("p" + i); } string returnType = null; if (sig.ReturnType != VarType.Void) { returnType = GetCSharpTypeName(sig.ReturnType); } return(TemplateGroup.GetInstanceOf("syscall", new Dictionary <string, object> { { "returntype", returnType }, { "functionname", sig.FunctionName }, { "paramnames", parmNames } })); }
public List <StringTemplate> ToCallParmPops(FunctionSig sig) { VarType[] paramsR = sig.ParamTypes; List <string> csTypes = new List <string>(); foreach (VarType param in paramsR) { csTypes.Add(GetCSharpTypeName(param)); } List <string> convFuncs = new List <string>(); foreach (VarType param in paramsR) { convFuncs.Add(GetConvFuncName(param)); } List <StringTemplate> outPops = new List <StringTemplate>(); for (int i = paramsR.Length - 1; i >= 0; i--) { outPops.Add( TemplateGroup.GetInstanceOf("parmpop", new Dictionary <string, object> { { "type", csTypes[i] }, { "parmnum", i }, { "convfunc", convFuncs[i] } } ) ); } return(outPops); }
//#endif private static void AddFunction(string name, string sname, FunctionSig sig) { name=name.ToLowerInvariant(); functionList.Add(name, sig); TokenStream.AddFunction(name); if(sname!=null) { sname=sname.ToLowerInvariant(); functionList.Add(sname, sig); TokenStream.AddFunction(sname); } }
private static void AddFunction(string name, string sname, FunctionSig sig) { name = name.ToLowerInvariant(); if (functionList.ContainsKey(name)) { MessageBox.Show("Function " + name + " has already been added."); } functionList.Add(name, sig); TokenStream.AddFunction(name); if (sname != null) { sname = sname.ToLowerInvariant(); if (functionList.ContainsKey(sname)) { MessageBox.Show("Function short name " + sname + " has already been added."); } functionList.Add(sname, sig); TokenStream.AddFunction(sname); } }