From: John L. <jr...@us...> - 2008-01-25 23:51:27
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1159/wxLua/bindings Modified Files: genwxbind.lua Log Message: - Removed the wxLuaBinding::PreRegister() and PostRegister() functions and made RegisterBinding() virtual Note: wxLuaBinding::RegisterBinding() now leaves the Lua table that the binding objects were installed into on the stack. You must pop it. * The rules.lua for genwxbind.lua now uses wxLuaBinding_class_declaration and wxLuaBinding_class_implementation to replace wxLuaBinding_preregister and wxLuaBinding_postregister. You may now add whatever you like to the class declaration and implementation source code. Updated to Lua 5.1.3 official Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** genwxbind.lua 24 Jan 2008 00:18:14 -0000 1.161 --- genwxbind.lua 25 Jan 2008 23:50:46 -0000 1.162 *************** *** 85,88 **** --- 85,91 ---- assert(type(hook_lua_namespace) == "string", "Rules file ERROR: 'hook_lua_namespace' is not a string") assert(type(hook_cpp_namespace) == "string", "Rules file ERROR: 'hook_cpp_namespace' is not a string") + + assert(wxLuaBinding_PreRegister == nil, "Rules file ERROR: 'wxLuaBinding_PreRegister' is deprecated") + assert(wxLuaBinding_PostRegister == nil, "Rules file ERROR: 'wxLuaBinding_PreRegister' is deprecated") end *************** *** 1457,1460 **** --- 1460,1465 ---- local time1 = os.time() + local updated_files = 0 + -- generatelanguage binding, binding is stored in objectList for i = 1, #interfaceList do *************** *** 1467,1475 **** -- create c/c++ file local fileData = GenerateBindingFileTable(interface) ! WriteTableToFile(interface.CPPFileName, fileData, false) end local fileData = GenerateHookHeaderFileTable() ! WriteTableToFile(GetCPPHeaderFileName(hook_cpp_header_filename), fileData, false) local fileData = {} -- reset to empty table --- 1472,1486 ---- -- create c/c++ file local fileData = GenerateBindingFileTable(interface) ! local written = WriteTableToFile(interface.CPPFileName, fileData, false) ! if written then ! updated_files = updated_files + 1 ! end end local fileData = GenerateHookHeaderFileTable() ! local written = WriteTableToFile(GetCPPHeaderFileName(hook_cpp_header_filename), fileData, false) ! if written then ! updated_files = updated_files + 1 ! end local fileData = {} -- reset to empty table *************** *** 1481,1488 **** fileData = GenerateHookCFunctionFileTable(fileData) fileData = GenerateHookClassFileTable(fileData) ! WriteTableToFile(GetCPPFileName(hook_cpp_binding_filename), fileData, false) local time2 = os.time() --print("Timing: GenerateLuaLanguageBinding and write files "..os.difftime(time2, time1).." seconds.") end --- 1492,1503 ---- fileData = GenerateHookCFunctionFileTable(fileData) fileData = GenerateHookClassFileTable(fileData) ! written = WriteTableToFile(GetCPPFileName(hook_cpp_binding_filename), fileData, false) ! if written then ! updated_files = updated_files + 1 ! end local time2 = os.time() --print("Timing: GenerateLuaLanguageBinding and write files "..os.difftime(time2, time1).." seconds.") + return updated_files end *************** *** 4032,4041 **** table.insert(fileData, "public:\n") table.insert(fileData, " "..hook_cpp_binding_classname.."();\n") - table.insert(fileData, " virtual wxLuaBinding* Clone() const { return new "..hook_cpp_binding_classname.."; }\n") - table.insert(fileData, "\n") - table.insert(fileData, "protected:\n") - table.insert(fileData, " virtual void PreRegister(const wxLuaState& wxlState, int luaTable);\n") - table.insert(fileData, " virtual void PostRegister(const wxLuaState& wxlState, int luaTable);\n") table.insert(fileData, "\n") table.insert(fileData, " DECLARE_DYNAMIC_CLASS("..hook_cpp_binding_classname..")\n") table.insert(fileData, "};\n") --- 4047,4053 ---- table.insert(fileData, "public:\n") table.insert(fileData, " "..hook_cpp_binding_classname.."();\n") table.insert(fileData, "\n") + table.insert(fileData, wxLuaBinding_class_declaration or "") + table.insert(fileData, "\nprivate:\n") table.insert(fileData, " DECLARE_DYNAMIC_CLASS("..hook_cpp_binding_classname..")\n") table.insert(fileData, "};\n") *************** *** 4247,4268 **** table.insert(fileData, "}\n\n") ! -- load preregister fn from rules file ! if wxLuaBinding_PreRegister and string.len(wxLuaBinding_PreRegister) then ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PreRegister(const wxLuaState& wxlState, int luaTable)\n") ! else ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PreRegister(const wxLuaState& , int )\n") ! end ! table.insert(fileData, "{\n") ! table.insert(fileData, wxLuaBinding_PreRegister or "") ! table.insert(fileData, "}\n") ! -- load postregister fn from rules file ! if wxLuaBinding_PostRegister and string.len(wxLuaBinding_PostRegister) then ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PostRegister(const wxLuaState& wxlState, int luaTable)\n") ! else ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PostRegister(const wxLuaState&, int )\n") ! end ! table.insert(fileData, "{\n") ! table.insert(fileData, wxLuaBinding_PostRegister or "") ! table.insert(fileData, "}\n\n") table.insert(fileData, "// ---------------------------------------------------------------------------\n\n") --- 4259,4263 ---- table.insert(fileData, "}\n\n") ! table.insert(fileData, (wxLuaBinding_class_implementation or "").."\n\n") table.insert(fileData, "// ---------------------------------------------------------------------------\n\n") *************** *** 4890,4896 **** end if #interface_fileTable > 0 then local interfaceList = GenerateInterfaceData() ! WriteWrapperFiles(interfaceList) end --- 4885,4893 ---- end + local updated_files = 0 + if #interface_fileTable > 0 then local interfaceList = GenerateInterfaceData() ! updated_files = WriteWrapperFiles(interfaceList) end *************** *** 4907,4912 **** end ! print("Timing: "..os.difftime(os.time(), time1).." seconds.") ! print("Done\n") end --- 4904,4908 ---- end ! print("Done. "..updated_files.." Files were updated in "..os.difftime(os.time(), time1).." seconds.\n") end |