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 IEnumerable <VarType> GetArguments(string eventName) { FunctionSig sig = _supportedEvents[eventName]; return(sig.ParamTypes); }
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} } ); }
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 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 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; }