From: John L. <jr...@us...> - 2008-01-08 00:55:39
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/bindings Modified Files: genwxbind.lua Log Message: Allow "%member static int m_var" to work Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** genwxbind.lua 22 Dec 2007 06:07:07 -0000 1.157 --- genwxbind.lua 8 Jan 2008 00:55:35 -0000 1.158 *************** *** 2239,2242 **** --- 2239,2245 ---- lineState.ActionMandatory = true + elseif tag == "static" then + lineState.IsStaticFunction = true + elseif IsDelimiter(tag) or functionAttribTable[tag] then print("ERROR: Expected Member Name, got Tag='"..tag.."'. "..LineTableErrString(lineTable)) *************** *** 2717,2720 **** --- 2720,2730 ---- end + local funcType = "WXLUAMETHOD_METHOD" + local propType = "" + if member.IsStaticFunction then + funcType = "WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC" + propType = "|WXLUAMETHOD_STATIC" + end + local memberPtr = member.DataTypePointer[1] local indirectionCount = #member.DataTypePointer *************** *** 2746,2757 **** CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " wxLuaState wxlState(L);\n") ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList if memberType == "wxString" then CommentBindingTable(codeList, " // push the result string\n") ! table.insert(codeList, " wxlua_pushwxString(L, self->"..member.Name..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then CommentBindingTable(codeList, " // push the result datatype\n") --- 2756,2772 ---- CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! ! local self_name = "self->" ! if member.IsStaticFunction then ! self_name = parseObject.Name.."::" ! else ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! end if memberType == "wxString" then CommentBindingTable(codeList, " // push the result string\n") ! table.insert(codeList, " wxlua_pushwxString(L, "..self_name..member.Name..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then CommentBindingTable(codeList, " // push the result datatype\n") *************** *** 2760,2776 **** -- table.insert(codeList, " wxluaT_pushuserdatatype(L, "..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- else ! table.insert(codeList, " wxluaT_pushuserdatatype(L, &self->"..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- end elseif not numeric then CommentBindingTable(codeList, " // push the result datatype\n") ! table.insert(codeList, " wxluaT_pushuserdatatype(L, self->"..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then CommentBindingTable(codeList, " // push the result flag\n") ! table.insert(codeList, " lua_pushboolean(L, self->"..member.Name..");\n") else CommentBindingTable(codeList, " // push the result number\n") ! table.insert(codeList, " lua_pushnumber(L, self->"..member.Name..");\n") end --- 2775,2791 ---- -- table.insert(codeList, " wxluaT_pushuserdatatype(L, "..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- else ! table.insert(codeList, " wxluaT_pushuserdatatype(L, &"..self_name..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- end elseif not numeric then CommentBindingTable(codeList, " // push the result datatype\n") ! table.insert(codeList, " wxluaT_pushuserdatatype(L, "..self_name..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then CommentBindingTable(codeList, " // push the result flag\n") ! table.insert(codeList, " lua_pushboolean(L, "..self_name..member.Name..");\n") else CommentBindingTable(codeList, " // push the result number\n") ! table.insert(codeList, " lua_pushnumber(L, "..self_name..member.Name..");\n") end *************** *** 2798,2805 **** ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { \""..memberGetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2813,2820 ---- ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = funcType, ! FuncMap = "{ "..funcName..", "..funcType..", 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { \""..memberGetFunc.."\", "..funcType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2809,2814 **** { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2824,2829 ---- { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_GETPROP"..propType, ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP"..propType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2836,2875 **** CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " wxLuaState wxlState(L);\n") if memberType == "wxString" then overload_argList = overload_argList.."&g_wxluatype_TSTRING, " CommentBindingTable(codeList, " // get the string value\n") ! table.insert(codeList, " wxString val = wxlua_getwxStringtype(L, 2);\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, 2, g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif not numeric then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, 2, g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then overload_argList = overload_argList.."&g_wxluatype_TBOOLEAN, " CommentBindingTable(codeList, " // get the boolean value\n") ! table.insert(codeList, " bool val = wxlua_getbooleantype(L, 2);\n") elseif IsDataTypeEnum(memberType) then overload_argList = overload_argList.."&g_wxluatype_TINTEGER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getintegertype(L, 2);\n") else overload_argList = overload_argList.."&g_wxluatype_TNUMBER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getnumbertype(L, 2);\n") end ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " self->"..member.Name.." = *val;\n") else ! table.insert(codeList, " self->"..member.Name.." = val;\n") end --- 2851,2899 ---- CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! ! local stack_idx = iff(member.IsStaticFunction, "1", "2") if memberType == "wxString" then overload_argList = overload_argList.."&g_wxluatype_TSTRING, " CommentBindingTable(codeList, " // get the string value\n") ! table.insert(codeList, " wxString val = wxlua_getwxStringtype(L, "..stack_idx..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, "..stack_idx..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif not numeric then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, "..stack_idx..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then overload_argList = overload_argList.."&g_wxluatype_TBOOLEAN, " CommentBindingTable(codeList, " // get the boolean value\n") ! table.insert(codeList, " bool val = wxlua_getbooleantype(L, "..stack_idx..");\n") elseif IsDataTypeEnum(memberType) then overload_argList = overload_argList.."&g_wxluatype_TINTEGER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getintegertype(L, "..stack_idx..");\n") else overload_argList = overload_argList.."&g_wxluatype_TNUMBER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getnumbertype(L, "..stack_idx..");\n") end ! if member.IsStaticFunction then ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " "..parseObject.Name.."::"..member.Name.." = *val;\n") ! else ! table.insert(codeList, " "..parseObject.Name.."::"..member.Name.." = val;\n") ! end else ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " self->"..member.Name.." = *val;\n") ! else ! table.insert(codeList, " self->"..member.Name.." = val;\n") ! end end *************** *** 2897,2904 **** ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { \""..memberSetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2921,2928 ---- ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = funcType, ! FuncMap = "{ "..funcName..", "..funcType..", 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { \""..memberSetFunc.."\", "..funcType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2908,2913 **** { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2932,2937 ---- { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_SETPROP"..propType, ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP"..propType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 4848,4852 **** if not rulesFilename then print("ERROR: No rules filename set!") ! rulesFilename = "" end --- 4872,4876 ---- if not rulesFilename then print("ERROR: No rules filename set!") ! do return end end *************** *** 4856,4859 **** --- 4880,4886 ---- print("Loaded rules file: "..rulesFilename) CheckRules() + else + print("ERROR: Unable to load rules file: '"..tostring(rulesFilename).."'") + do return end end *************** *** 4866,4870 **** print("Loaded datatypes cache file: "..filename) else ! print("ERROR: Unable to load datatypes cache file: "..filename) end end --- 4893,4897 ---- print("Loaded datatypes cache file: "..filename) else ! print("ERROR: Unable to load datatypes cache file: '"..filename.."'") end end |