You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(191) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(238) |
Dec
(68) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(104) |
Feb
(518) |
Mar
(302) |
Apr
(211) |
May
(311) |
Jun
(55) |
Jul
(6) |
Aug
(35) |
Sep
(76) |
Oct
(50) |
Nov
(37) |
Dec
(340) |
2007 |
Jan
(23) |
Feb
(107) |
Mar
(98) |
Apr
(60) |
May
(136) |
Jun
(371) |
Jul
(175) |
Aug
(74) |
Sep
(3) |
Oct
(2) |
Nov
(53) |
Dec
(129) |
2008 |
Jan
(337) |
Feb
(23) |
Mar
(18) |
Apr
(4) |
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(33) |
Nov
|
Dec
(26) |
2009 |
Jan
(4) |
Feb
(1) |
Mar
(15) |
Apr
|
May
(35) |
Jun
(11) |
Jul
|
Aug
|
Sep
(19) |
Oct
(26) |
Nov
(11) |
Dec
(11) |
2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
(8) |
Dec
(7) |
2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(8) |
Jul
(1) |
Aug
|
Sep
|
Oct
(5) |
Nov
(13) |
Dec
|
From: John L. <jr...@us...> - 2007-11-28 22:55:06
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28670/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: Use wxSIGKILL to kill debuggee process since wxSIGTERM doesn't work in MSW Made wxLuaCheckStack class work a little nicer for easier debugging in C++ Made wxluaT_insert(L, idx) not pop the value that it refs since it may not be the one at the top of the stack. Use wxLuaDebugData::GetTypeValue in wxLuaDebugTarget and other code cleanup in wxLuaDebugTarget Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** wxldebug.cpp 28 Nov 2007 00:20:50 -0000 1.48 --- wxldebug.cpp 28 Nov 2007 22:55:02 -0000 1.49 *************** *** 151,158 **** lua_State* L = wxlState.GetLuaState(); lua_Debug luaDebug = INIT_LUA_DEBUG; ! int nIndex = 0; int count = 0; ! while (lua_getstack(L, nIndex, &luaDebug) != 0) { if (lua_getinfo(L, "Sln", &luaDebug)) --- 151,158 ---- lua_State* L = wxlState.GetLuaState(); lua_Debug luaDebug = INIT_LUA_DEBUG; ! int stack_frame = 0; int count = 0; ! while (lua_getstack(L, stack_frame, &luaDebug) != 0) { if (lua_getinfo(L, "Sln", &luaDebug)) *************** *** 162,166 **** // skip stack frames that do not have line number, always add first int currentLine = luaDebug.currentline; ! if ((count == 0) || (currentLine != -1)) { wxString name; --- 162,166 ---- // skip stack frames that do not have line number, always add first int currentLine = luaDebug.currentline; ! if (1) //(count == 0) || (currentLine != -1)) { wxString name; *************** *** 175,184 **** name = wxString::Format(_("line %u"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, nIndex, 0)); count++; } } ! ++nIndex; } --- 175,184 ---- name = wxString::Format(_("line %u"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, 0)); count++; } } ! ++stack_frame; } *************** *** 186,190 **** } ! int wxLuaDebugData::EnumerateStackEntry(const wxLuaState& wxlState_, int stackRef, wxArrayInt& references) { wxCHECK_MSG(wxlState_.Ok(), 0, wxT("Invalid wxLuaState")); --- 186,190 ---- } ! int wxLuaDebugData::EnumerateStackEntry(const wxLuaState& wxlState_, int stack_frame, wxArrayInt& references) { wxCHECK_MSG(wxlState_.Ok(), 0, wxT("Invalid wxLuaState")); *************** *** 196,236 **** int count = 0; ! if (lua_getstack(L, stackRef, &luaDebug) != 0) { ! int idx = 1; ! wxString name(lua2wx(lua_getlocal(L, &luaDebug, idx))); while (!name.IsEmpty()) { //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_type = WXLUAARG_None; wxString value; wxString source(lua2wx(luaDebug.source)); - int flag_type = 0; ! GetTypeValue(wxlState, -1, &wxl_type, value); ! int nRef = LUA_NOREF; ! if (lua_istable(L, -1)) ! { ! nRef = wxluaT_isrefed(L, -1); // don't duplicate refs ! if (nRef == LUA_NOREF) ! { ! flag_type |= WXLUA_DEBUGITEM_LUAREFED; ! lua_pushvalue(L, -1); ! nRef = wxlState.wxluaT_Insert(-1); ! references.Add(nRef); ! } ! else ! lua_pop(L, 1); ! } ! else ! lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUAARG_None, value, wxl_type, source, nRef, 0, flag_type)); count++; ! name = lua2wx(lua_getlocal(L, &luaDebug, ++idx)); } } --- 196,229 ---- int count = 0; ! if (lua_getstack(L, stack_frame, &luaDebug) != 0) { ! int stack_idx = 1; ! wxString name(lua2wx(lua_getlocal(L, &luaDebug, stack_idx))); while (!name.IsEmpty()) { //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_valuetype = WXLUAARG_None; wxString value; wxString source(lua2wx(luaDebug.source)); ! GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! // FIXME! local tables get the right values for GetTypeValue(...) ! // but when you run wxluaT_insert() to store them they disappear ! // so that the next time wxluaT_insert() is run it reuses the same ! // index as your local table. ! // When using the stack dialog the next wxluaT_insert() is the ! // global table which is very confusing. ! int flag_type = 0; ! int nRef = LUA_NOREF; //RefTable(L, -1, &flag_type, references); ! ! lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUAARG_None, value, wxl_valuetype, source, nRef, 0, flag_type)); count++; ! name = lua2wx(lua_getlocal(L, &luaDebug, ++stack_idx)); } } *************** *** 250,254 **** int wxl_keytype = WXLUAARG_None; int wxl_valuetype = WXLUAARG_None; - int flag_type = 0; wxString value; wxString name; --- 243,246 ---- *************** *** 258,264 **** wxlState.GetGlobals(); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxluaT_insert(L, -1); ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); ! references.Add(nRef); } else if (tableRef == LUA_REGISTRYINDEX) --- 250,259 ---- wxlState.GetGlobals(); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! ! int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); // pop globals table ! ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) *************** *** 266,272 **** wxlState.lua_PushValue(LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxluaT_insert(L, -1); ! Add(new wxLuaDebugItem(wxT("Lua Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); ! references.Add(nRef); } else --- 261,270 ---- wxlState.lua_PushValue(LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! ! int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); // pop registry table ! ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); } else *************** *** 275,283 **** if (wxlState.wxluaT_Get(tableRef)) { ! int nTop = lua_gettop(L); // start iterating lua_pushnil(L); ! while (lua_next(L, nTop) != 0) { // get the index, just want the name=value, type is dummy here --- 273,293 ---- if (wxlState.wxluaT_Get(tableRef)) { ! if (lua_getmetatable(L, -1)) // if no metatable then nothing is pushed ! { ! // get the type and value ! GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! ! int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); ! ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); ! count++; ! ! lua_pop(L, 1); // pop metatable ! } // start iterating lua_pushnil(L); ! while (lua_next(L, -2) != 0) { // get the index, just want the name=value, type is dummy here *************** *** 286,309 **** GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! //wxPrintf(wxT("wxLuaDebugData::EnumerateTable %d type='%s' key='%s' val='%s'\n"), count, type.c_str(), name.c_str(), value.c_str()); ! ! int nRef = LUA_NOREF; ! if (lua_istable(L, -1)) ! { ! nRef = wxluaT_isrefed(L, -1); // don't duplicate refs ! ! if (nRef == LUA_NOREF) ! { ! flag_type |= WXLUA_DEBUGITEM_LUAREFED; ! nRef = wxluaT_insert(L, -1); // pops value ! references.Add(nRef); ! } ! else ! lua_pop(L, 1); ! } ! else ! lua_pop(L, 1); ! Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), nRef, nIndex)); count++; } --- 296,305 ---- GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); ! ! lua_pop(L, 1); ! Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); count++; } *************** *** 316,319 **** --- 312,336 ---- } + + int wxLuaDebugData::RefTable(lua_State* L, int stack_idx, int* flag_type, wxArrayInt& references) + { + wxCHECK_MSG(L, LUA_NOREF, wxT("Invalid lua_State")); + + int nRef = LUA_NOREF; + if (lua_istable(L, stack_idx)) + { + nRef = wxluaT_isrefed(L, stack_idx); // don't duplicate refs + + if (nRef == LUA_NOREF) + { + if (flag_type) *flag_type |= WXLUA_DEBUGITEM_LUAREFED; + nRef = wxluaT_insert(L, -1); + references.Add(nRef); + } + } + + return nRef; + } + int wxLuaDebugData::GetTypeValue(const wxLuaState& wxlState, int stack_idx, int* wxl_type_, wxString& value) { *************** *** 470,541 **** // ---------------------------------------------------------------------------- ! wxLuaCheckStack::wxLuaCheckStack(lua_State *L, const wxString &msg) { m_luaState = L; m_msg = msg; m_top = lua_gettop(m_luaState); } wxLuaCheckStack::~wxLuaCheckStack() { ! TestStack(m_msg); } ! void wxLuaCheckStack::TestStack(const wxString &msg) { ! wxString message(!msg.IsEmpty() ? msg : m_msg); ! wxString s = wxString::Format(wxT("Stack state in '%s': starting top %d ending top %d\n"), ! message.c_str(), m_top, lua_gettop(m_luaState)); OutputMsg(s); } ! void wxLuaCheckStack::DumpGlobals() { ! wxCHECK_RET(m_luaState, wxT("Invalid lua_State")); lua_State* L = m_luaState; wxSortedArrayString tableArray; lua_pushvalue(L, LUA_GLOBALSINDEX); ! DumpTable(lua_gettop(L), wxT("Globals"), tableArray, 0); lua_pop(L, 1); } ! void wxLuaCheckStack::DumpTable(const wxString &name) { ! wxCHECK_RET(m_luaState, wxT("Invalid lua_State")); - lua_State* L = m_luaState; wxSortedArrayString tableArray; ! lua_pushstring(L, wx2lua(name)); ! lua_gettable(L, LUA_GLOBALSINDEX); ! DumpTable(lua_gettop(L), name, tableArray, 0); ! lua_pop(L, 1); } ! void wxLuaCheckStack::DumpTable(int index, const wxString& tablename, wxSortedArrayString& tableArray, int indent) { ! wxCHECK_RET(m_luaState, wxT("Invalid lua_State")); lua_State* L = m_luaState; wxLuaState wxlState(L); wxString indentStr; ! if (indent > 5) ! return; ! for (int i = 0; i < indent; i++) ! indentStr += wxT(" "); ! wxString title = wxString::Format(wxT("%sTable: %s"), indentStr.c_str(), tablename.c_str()); OutputMsg(title); ! if (!indentStr.IsEmpty()) ! indentStr += wxT(">"); lua_pushnil(L); ! while(lua_next(L, index) != 0) { int keyType = 0, valueType = 0; --- 487,641 ---- // ---------------------------------------------------------------------------- ! wxLuaCheckStack::wxLuaCheckStack(lua_State *L, const wxString &msg, bool print_to_console) { m_luaState = L; m_msg = msg; m_top = lua_gettop(m_luaState); + m_print_to_console = print_to_console; } wxLuaCheckStack::~wxLuaCheckStack() { ! if (m_print_to_console) ! TestStack(wxT("~wxLuaCheckStack")); } ! wxString wxLuaCheckStack::TestStack(const wxString &msg) { ! wxString s; ! s.Printf(wxT("wxLuaCheckStack::TestStack(L=%p) '%s':'%s': starting top %d ending top %d\n"), ! m_luaState, m_msg.c_str(), msg.c_str(), m_top, lua_gettop(m_luaState)); OutputMsg(s); + + return s; } ! wxString wxLuaCheckStack::DumpStack(const wxString& msg) { ! wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State")); ! ! lua_State* L = m_luaState; ! int i, count = lua_gettop(L); ! wxString str; ! wxString retStr; ! ! str.Printf(wxT("wxLuaCheckStack::DumpStack(L=%p), '%s':'%s', items %d, starting top %d\n"), L, m_msg.c_str(), msg.c_str(), count, m_top); ! retStr += str; ! OutputMsg(str); ! ! wxLuaState wxlState(L); ! ! for (i = 1; i <= count; i++) ! { ! int wxl_type = 0; ! wxString value; ! int l_type = wxLuaDebugData::GetTypeValue(wxlState, i, &wxl_type, value); ! ! str.Printf(wxT(" idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"), ! i, l_type, wxl_type, wxlua_getwxluatypename(wxl_type).c_str(), value.c_str()); ! retStr += str; ! OutputMsg(str); ! } ! ! return retStr; ! } ! ! wxString wxLuaCheckStack::DumpGlobals(const wxString& msg) ! { ! wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State")); ! ! wxSortedArrayString tableArray; ! ! return DumpTable(LUA_GLOBALSINDEX, wxT("Globals"), msg, tableArray, 0); ! } ! ! wxString wxLuaCheckStack::DumpTable(const wxString &tablename, const wxString& msg) ! { ! wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State")); lua_State* L = m_luaState; wxSortedArrayString tableArray; + wxString s; + // Allow iteration through table1.table2.table3... + wxString tname(tablename); lua_pushvalue(L, LUA_GLOBALSINDEX); ! ! do { ! lua_pushstring(L, wx2lua(tname.BeforeFirst(wxT('.')))); ! lua_rawget(L, -2); ! ! if (lua_isnil(L, -1) || !lua_istable(L, -1)) ! { ! lua_pop(L, 2); // remove table and value ! ! s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s' cannot be found!\n"), L, tablename.c_str()); ! OutputMsg(s); ! return s; ! } ! ! lua_remove(L, -2); // remove previous table ! tname = tname.AfterFirst(wxT('.')); ! } while (tname.Len() > 0); ! ! s = DumpTable(lua_gettop(L), tablename, msg, tableArray, 0); lua_pop(L, 1); + + return s; } ! wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& msg) { ! wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State")); wxSortedArrayString tableArray; ! return DumpTable(stack_idx, wxString::Format(wxT("StackIdx=%d"), stack_idx), msg, tableArray, 0); } ! wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& tablename, const wxString& msg, wxSortedArrayString& tableArray, int indent) { ! wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State")); lua_State* L = m_luaState; wxLuaState wxlState(L); wxString indentStr; + wxString s; ! // We only do tables, return error message ! if (!lua_istable(L, stack_idx)) ! { ! s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) stack idx %d is not a table.\n"), L, stack_idx); ! OutputMsg(s); ! return s; ! } ! if (indent == 0) ! { ! // First time through print header ! s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s'\n"), L, tablename.c_str()); ! OutputMsg(s); ! } ! else if (indent > 10) ! { ! // Don't let things get out of hand... ! s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table depth > 10! Truncating: '%s'\n"), L, tablename.c_str()); ! OutputMsg(s); ! return s; ! } ! else ! { ! indentStr = wxString(wxT(' '), indent*2) + wxT(">"); ! } ! wxString title = wxString::Format(wxT("%sTable Level %d : name '%s'\n"), indentStr.c_str(), indent, tablename.c_str()); ! s += title; OutputMsg(title); ! lua_pushvalue(L, stack_idx); // push the table to read the top of the stack lua_pushnil(L); ! while (lua_next(L, -2) != 0) { int keyType = 0, valueType = 0; *************** *** 545,550 **** wxLuaDebugData::GetTypeValue(wxlState, -1, &valueType, value); ! wxString info = wxString::Format(wxT("%s%-32s\t%d\t%-20s\t%d"), ! indentStr.c_str(), key.c_str(), keyType, value.c_str(), valueType); OutputMsg(info); --- 645,651 ---- wxLuaDebugData::GetTypeValue(wxlState, -1, &valueType, value); ! wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"), ! indentStr.c_str(), key.c_str(), wxlua_getwxluatypename(keyType).c_str(), value.c_str(), wxlua_getwxluatypename(valueType).c_str()); ! s += info; OutputMsg(info); *************** *** 553,561 **** if (valueType == WXLUAARG_Table) { - wxString tname = wxString::Format(wxT("%s.%s"), tablename.c_str(), key.c_str()); tableArray.Add(value); ! int tableIndex = lua_gettop(L); ! // lua_pushvalue(L, lua_gettop(L)); ! DumpTable(tableIndex, tname, tableArray, indent+1); } else --- 654,659 ---- if (valueType == WXLUAARG_Table) { tableArray.Add(value); ! s += DumpTable(lua_gettop(L), tablename + wxT(".") + key, msg, tableArray, indent+1); } else *************** *** 565,608 **** } ! //#if defined(__WXMSW__) ! // OutputDebugString(outputIndex + outputValue); ! //#elif defined(__WXGTK__) ! // fprintf(stderr, wx2lua(outputIndex + outputValue)); ! //#endif ! lua_pop(L, 1); } - lua_pop(L, 1); - - //wxLog::FlushActive(); - } - - void wxLuaCheckStack::DumpStack() - { - wxCHECK_RET(m_luaState, wxT("Invalid lua_State")); - - lua_State* L = m_luaState; - int i, count = lua_gettop(L); - OutputMsg(wxString::Format(wxT("wxLuaCheckStack::DumpStack(%ld) items %d\n"), (long)L, count)); - - wxLuaState wxlState(L); ! for (i = 1; i <= count; i++) ! { ! //int type = lua_type(L, i); ! //wxPrintf(wxT("Stack item %d of %d : type %d '%s'\n"), i, argCount, type, lua2wx(lua_typename(L, type)).c_str()); ! int wxl_type = 0; ! wxString value; ! int l_type = wxLuaDebugData::GetTypeValue(wxlState, i, &wxl_type, value); ! OutputMsg(wxString::Format(wxT("item %d: lua_type %d wxlua_type %d = '%s'\n"), i, l_type, wxl_type, value.c_str())); ! } } void wxLuaCheckStack::OutputMsg(const wxString& msg) const { #if defined(__WXMSW__) ! OutputDebugString(msg.c_str()); #else //if defined(__WXGTK__) || defined(__WXMAC__) ! wxPrintf(wxT("%s\n"), msg.c_str()); #endif } --- 663,684 ---- } ! lua_pop(L, 1); // pop value } ! lua_pop(L, 1); // pop pushed table ! return s; } void wxLuaCheckStack::OutputMsg(const wxString& msg) const { + if (m_print_to_console) + { #if defined(__WXMSW__) ! //OutputDebugString(msg.c_str()); ! wxPrintf(wxT("%s"), msg.c_str()); fflush(stdout); #else //if defined(__WXGTK__) || defined(__WXMAC__) ! wxPrintf(wxT("%s"), msg.c_str()); #endif + } } |
From: John L. <jr...@us...> - 2007-11-28 22:55:06
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28670/wxLua/modules/wxluasocket/include Modified Files: wxldtarg.h Log Message: Use wxSIGKILL to kill debuggee process since wxSIGTERM doesn't work in MSW Made wxLuaCheckStack class work a little nicer for easier debugging in C++ Made wxluaT_insert(L, idx) not pop the value that it refs since it may not be the one at the top of the stack. Use wxLuaDebugData::GetTypeValue in wxLuaDebugTarget and other code cleanup in wxLuaDebugTarget Index: wxldtarg.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldtarg.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** wxldtarg.h 7 Aug 2007 20:23:26 -0000 1.25 --- wxldtarg.h 28 Nov 2007 22:55:02 -0000 1.26 *************** *** 84,87 **** --- 84,88 ---- wxArrayInt m_references; wxCriticalSection m_luaCriticalSection; + mutable wxCriticalSection m_breakPointListCriticalSection; // Enter/Leave critical section for the threaded sockets *************** *** 91,96 **** void ExitThread(); ! mutable wxCriticalSection m_breakPointListCriticalSection; wxString CreateBreakPoint(const wxString &fileName, int lineNumber) const; bool AddBreakPoint(const wxString &fileName, int lineNumber); --- 92,99 ---- void ExitThread(); ! // Return a string ("%d:%s", lineNumber, fileName) for the breakpoint wxString CreateBreakPoint(const wxString &fileName, int lineNumber) const; + // Are we at a set breakpoint? + bool AtBreakPoint(const wxString &fileName, int lineNumber) const; bool AddBreakPoint(const wxString &fileName, int lineNumber); *************** *** 118,129 **** bool NotifyEvaluateExpr(int exprRef, const wxString &strResult); bool DebugHook(int event); - private: bool IsConnected(bool wait_for_connect = true) const; - bool AtBreakPoint(const wxString &fileName, int lineNumber) const; - wxString GetDebugInfo(int &lineNumber) const; static void LUACALL LuaDebugHook(lua_State *L, lua_Debug *debug); static int LUACALL LuaPrint (lua_State *L); }; --- 121,135 ---- bool NotifyEvaluateExpr(int exprRef, const wxString &strResult); + // Handle events from the static wxLuaDebugTarget::LuaDebugHook bool DebugHook(int event); bool IsConnected(bool wait_for_connect = true) const; + // Get the wxLuaDebugTarget that was pushed into Lua + static wxLuaDebugTarget* GetDebugTarget(lua_State* L); + + // Handle the events from lua_sethook() static void LUACALL LuaDebugHook(lua_State *L, lua_Debug *debug); + // Forward the print statements to NotifyPrint() static int LUACALL LuaPrint (lua_State *L); }; |
From: John L. <jr...@us...> - 2007-11-28 00:20:57
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15269/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: Clarify that the "index" parameter really means stack_idx Don't crash if someone calls a wxLua userdata with something other than a string in our __index function Don't use lua_rawset(L, old_top), but -3 to make sure that everything is right and we're not hiding problems Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** wxldebug.cpp 17 Nov 2007 00:15:07 -0000 1.47 --- wxldebug.cpp 28 Nov 2007 00:20:50 -0000 1.48 *************** *** 22,30 **** wxLuaDebugData wxNullLuaDebugData(false); - #define lua_Debug_to_String(ld) \ - wxString::Format(wxT("%p event=%d name='%s' namewhat='%s' what='%s' source='%s' currentline=%d nups=%d linedefined=%d lastlinedefined=%d short_src='%s' i_ci=%d"), \ - &ld, ld.event, lua2wx(ld.name).c_str(), lua2wx(ld.namewhat).c_str(), lua2wx(ld.what).c_str(), lua2wx(ld.source).c_str(), ld.currentline, ld.nups, ld.linedefined, ld.lastlinedefined, lua2wx(ld.short_src).c_str(), ld.i_ci) - - // ---------------------------------------------------------------------------- // wxLuaDebugItem --- 22,25 ---- *************** *** 61,64 **** --- 56,60 ---- public: wxLuaDebugDataRefData() : m_dataArray(wxLuaDebugData::SortFunction) {} + virtual ~wxLuaDebugDataRefData() { *************** *** 162,166 **** if (lua_getinfo(L, "Sln", &luaDebug)) { ! //wxPrintf(wxString(lua_Debug_to_String(luaDebug) + wxT("\n")).c_str()); // skip stack frames that do not have line number, always add first --- 158,162 ---- if (lua_getinfo(L, "Sln", &luaDebug)) { ! //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT("\n")).c_str()); // skip stack frames that do not have line number, always add first *************** *** 206,210 **** while (!name.IsEmpty()) { ! //wxPrintf(wxString(lua_Debug_to_String(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); int wxl_type = WXLUAARG_None; --- 202,206 ---- while (!name.IsEmpty()) { ! //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); int wxl_type = WXLUAARG_None; *************** *** 227,230 **** --- 223,228 ---- references.Add(nRef); } + else + lua_pop(L, 1); } else *************** *** 318,327 **** } ! int wxLuaDebugData::GetTypeValue(const wxLuaState& wxlState, int index, int* wxl_type_, wxString& value) { wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); lua_State* L = wxlState.GetLuaState(); ! int l_type = lua_type(L, index); int wxl_type = wxlua_getwxluatype(l_type); --- 316,325 ---- } ! int wxLuaDebugData::GetTypeValue(const wxLuaState& wxlState, int stack_idx, int* wxl_type_, wxString& value) { wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); lua_State* L = wxlState.GetLuaState(); ! int l_type = lua_type(L, stack_idx); int wxl_type = wxlua_getwxluatype(l_type); *************** *** 337,377 **** case LUA_TBOOLEAN: ! value = MakeBoolean(lua_toboolean(L, index)); break; case LUA_TLIGHTUSERDATA: ! value = GetUserDataInfo(wxlState, index, false); break; case LUA_TNUMBER: ! value = MakeNumber(lua_tonumber(L, index)); break; case LUA_TSTRING: ! value = lua2wx(lua_tostring(L, index)); break; case LUA_TTABLE: ! value = GetTableInfo(wxlState, index); break; case LUA_TFUNCTION: ! if (lua_iscfunction(L, index)) { wxl_type = WXLUAARG_CFunction; ! value.Printf(wxT("%p"), lua_tocfunction(L, index)); } else { ! value.Printf(wxT("%p"), lua_topointer(L, index)); } break; case LUA_TUSERDATA: ! value = GetUserDataInfo(wxlState, index, true); break; case LUA_TTHREAD: ! value.Printf(wxT("%p"), lua_topointer(L, index)); break; --- 335,375 ---- case LUA_TBOOLEAN: ! value = MakeBoolean(lua_toboolean(L, stack_idx)); break; case LUA_TLIGHTUSERDATA: ! value = GetUserDataInfo(wxlState, stack_idx, false); break; case LUA_TNUMBER: ! value = MakeNumber(lua_tonumber(L, stack_idx)); break; case LUA_TSTRING: ! value = lua2wx(lua_tostring(L, stack_idx)); break; case LUA_TTABLE: ! value = GetTableInfo(wxlState, stack_idx); break; case LUA_TFUNCTION: ! if (lua_iscfunction(L, stack_idx)) { wxl_type = WXLUAARG_CFunction; ! value.Printf(wxT("%p"), lua_tocfunction(L, stack_idx)); } else { ! value.Printf(wxT("%p"), lua_topointer(L, stack_idx)); } break; case LUA_TUSERDATA: ! value = GetUserDataInfo(wxlState, stack_idx, true); break; case LUA_TTHREAD: ! value.Printf(wxT("%p"), lua_topointer(L, stack_idx)); break; *************** *** 400,411 **** } ! wxString wxLuaDebugData::GetTableInfo(const wxLuaState& wxlState, int index) { wxCHECK_MSG(wxlState.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); lua_State* L = wxlState.GetLuaState(); ! int nTag = wxluaT_tag(L, index); ! int nItems = luaL_getn(L, index); ! const void *pItem = lua_topointer(L, index); wxString s = wxString::Format(wxT("%p"), pItem); --- 398,409 ---- } ! wxString wxLuaDebugData::GetTableInfo(const wxLuaState& wxlState, int stack_idx) { wxCHECK_MSG(wxlState.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); lua_State* L = wxlState.GetLuaState(); ! int nTag = wxluaT_tag(L, stack_idx); ! int nItems = luaL_getn(L, stack_idx); ! const void *pItem = lua_topointer(L, stack_idx); wxString s = wxString::Format(wxT("%p"), pItem); *************** *** 420,424 **** } ! wxString wxLuaDebugData::GetUserDataInfo(const wxLuaState& wxlState_, int index, bool full) { wxCHECK_MSG(wxlState_.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); --- 418,422 ---- } ! wxString wxLuaDebugData::GetUserDataInfo(const wxLuaState& wxlState_, int stack_idx, bool full) { wxCHECK_MSG(wxlState_.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); *************** *** 426,434 **** lua_State* L = wxlState.GetLuaState(); ! wxString s = wxString::Format(wxT("%p"), lua_touserdata(L, index)); if (!full) { ! void* udata = lua_touserdata(L, index); // Convert our known keys to something more readable --- 424,432 ---- lua_State* L = wxlState.GetLuaState(); ! wxString s = wxString::Format(wxT("%p"), lua_touserdata(L, stack_idx)); if (!full) { ! void* udata = lua_touserdata(L, stack_idx); // Convert our known keys to something more readable *************** *** 453,457 **** else // is full userdata { ! int nTag = wxluaT_tag(L, index); if (nTag != WXLUA_NOTAG) --- 451,455 ---- else // is full userdata { ! int nTag = wxluaT_tag(L, stack_idx); if (nTag != WXLUA_NOTAG) |
From: John L. <jr...@us...> - 2007-11-28 00:20:54
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15269/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Clarify that the "index" parameter really means stack_idx Don't crash if someone calls a wxLua userdata with something other than a string in our __index function Don't use lua_rawset(L, old_top), but -3 to make sure that everything is right and we're not hiding problems Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** wxlstate.cpp 17 Nov 2007 00:15:02 -0000 1.137 --- wxlstate.cpp 28 Nov 2007 00:20:49 -0000 1.138 *************** *** 505,509 **** } ! lua_rawset(L, -3); // t["method_name"] = func lua_pop(L, 1); // pop the table from wxluaT_get we got from the wxLuaReferences registry table return true; --- 505,509 ---- } ! lua_rawset(L, -3); // t["method_name"] = closure of func (and upvalues) lua_pop(L, 1); // pop the table from wxluaT_get we got from the wxLuaReferences registry table return true; Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** wxlbind.cpp 17 Nov 2007 00:15:02 -0000 1.94 --- wxlbind.cpp 28 Nov 2007 00:20:49 -0000 1.95 *************** *** 284,308 **** int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); - const char *name = NULL; ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == *wxlClass->class_tag)) { void *pObject = wxlua_touserdata(L, 1, false); - name = lua_tostring(L, 2); // name of the __index method called in Lua - callbase = (name[0] == '_'); ! if (callbase) ! name++; // skip past "_"[FunctionName] ! else { ! // if there's a derived method, push it onto the stack to be run ! if (wxlua_hasderivedmethod(L, pObject, name, true)) { ! found = true; ! result = 1; // the function for Lua to call } } if (!found) { --- 284,338 ---- int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! ! // // See if the function or value is in our metatable ! // if (lua_getmetatable(L, 1)) ! // { ! // lua_pushvalue(L, 2); ! // lua_rawget(L, -2); ! // ! // if (!lua_isnil(L, -1)) ! // { ! // found = true; ! // result = 1; ! // lua_remove(L, -2); // remove metatable, leave value ! // return result; ! // } ! // else ! // lua_pop(L, 2); // pop nil and metatable ! // } ! ! const char *name = lua_tostring(L, 2); // name of the __index method called in Lua ! ! if (!name) ! { ! // name is NULL if it's not a string ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call a class method using '%s' on a '%s' type."), ! lua2wx(lua_typename(L, lua_type(L, 2))).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); ! } ! else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == *wxlClass->class_tag)) { void *pObject = wxlua_touserdata(L, 1, false); ! // check if we're to call the baseclass function or if it's a Lua derived function ! if (!found) { ! callbase = (name[0] == '_'); ! ! if (callbase) ! name++; // skip past "_"[FunctionName] ! else { ! // if there's a derived method, push it onto the stack to be run ! if (wxlua_hasderivedmethod(L, pObject, name, true)) ! { ! found = true; ! result = 1; // the function for Lua to call ! } } } + // Search through the bindings for the function to call if (!found) { *************** *** 357,361 **** if (!found) ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call an invalid method '%s'."), lua2wx(name).c_str())); return result; --- 387,394 ---- if (!found) ! { ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call an unknown method '%s' on a '%s' type."), ! lua2wx(name).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); ! } return result; *************** *** 608,649 **** luaI_openlib(L, wx2lua(m_nameSpace), wxlualib, 0); - int tableOffset = lua_gettop(L); if (!lua_istable(L, -1)) { lua_pop(L, 1); // pop the nil value - // luaI_openlib should have given error message about why it couldn't - // create the table for us return false; } ! else { ! // leave the table on the stack, it's the one we'll populate ! tableOffset = lua_gettop(L); ! // Find a registered binding with the same namespace, if any, ! // and share the m_luaTable_tag to that of the previously loaded binding ! wxLuaBindingList::compatibility_iterator node = wxlState.GetLuaBindingList()->GetFirst(); ! for (; node; node = node->GetNext()) { ! wxLuaBinding* binding = node->GetData(); ! ! if ((binding->GetLuaNamespace() == m_nameSpace) && (binding->m_luaTable_tag >= 0)) ! { ! m_luaTable_tag = binding->m_luaTable_tag; ! break; ! } } ! // first time adding this namespace table ! if (m_luaTable_tag < 1) ! { ! // create a tag for the wxLua table ! m_luaTable_tag = wxlState.wxluaT_NewTag(); ! // set the table tag ! wxlState.wxluaT_SetTag(m_luaTable_tag); ! } } --- 641,680 ---- luaI_openlib(L, wx2lua(m_nameSpace), wxlualib, 0); + // luaI_openlib should have given error message about why it couldn't + // create the table for us if (!lua_istable(L, -1)) { lua_pop(L, 1); // pop the nil value return false; } ! ! ! // leave the table on the stack, it's the one we'll populate ! int tableOffset = lua_gettop(L); ! ! // Find a registered binding with the same namespace, if any, ! // and share the m_luaTable_tag to that of the previously loaded binding ! wxLuaBindingList::compatibility_iterator node = wxlState.GetLuaBindingList()->GetFirst(); ! for (; node; node = node->GetNext()) { ! wxLuaBinding* binding = node->GetData(); ! if ((binding->GetLuaNamespace() == m_nameSpace) && (binding->m_luaTable_tag >= 0)) { ! m_luaTable_tag = binding->m_luaTable_tag; ! break; } + } ! // first time adding this namespace table ! if (m_luaTable_tag < 1) ! { ! // create a tag for the wxLua table ! m_luaTable_tag = wxlState.wxluaT_NewTag(); ! // set the table tag ! wxlState.wxluaT_SetTag(m_luaTable_tag); } *************** *** 693,708 **** for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass) { ! // Create a new tag if registering types, else use tag already set ! iTag = wxlState.wxluaT_NewTag(); ! *wxlClass->class_tag = iTag; ! ! // store a lookup table for the class tags to wxLuaBindClass structs ! wxluaT_get(L, iTag); ! wxlua_pushkey_metatableClass(L); ! lua_pushlightuserdata(L, (void *)wxlClass); ! lua_rawset(L, -3); // t[name] = tag ! lua_remove(L, -1); // remove wxLua's registry wxLuaClasses table ! ! // store a lookup table for the class names to wxLuaBindClass structs wxlua_pushkey_wxLuaClasses(L); lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the classes table) --- 724,729 ---- for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass) { ! // ------------------------------------------------------------------ ! // Add to the lookup table for "class name" to wxLuaBindClass struct wxlua_pushkey_wxLuaClasses(L); lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the classes table) *************** *** 712,722 **** lua_remove(L, -1); // remove wxLua's registry wxLuaClasses table ! // set the metatable functions for the classes for (size_t i_func = 0; i_func < s_funcCount; ++i_func) { ! wxlState.wxluaT_SetTagMethod(iTag, s_funcTable[i_func].name, s_funcTable[i_func].func, (void *)wxlClass); } // install the table for the class lua_pushstring(L, wxlClass->name); lua_newtable(L); --- 733,763 ---- lua_remove(L, -1); // remove wxLua's registry wxLuaClasses table ! // ------------------------------------------------------------------ ! // Create a new metatable for this class with a numerical tag index ! iTag = wxlState.wxluaT_NewTag(); ! *wxlClass->class_tag = iTag; ! ! // store a lookup in the class metatable to the wxLuaBindClass struct ! wxluaT_get(L, iTag); ! wxlua_pushkey_metatableClass(L); ! lua_pushlightuserdata(L, (void *)wxlClass); ! lua_rawset(L, -3); // t[name] = tag ! ! // set the functions for the class in the metatable for (size_t i_func = 0; i_func < s_funcCount; ++i_func) { ! //wxlState.wxluaT_SetTagMethod(iTag, s_funcTable[i_func].name, s_funcTable[i_func].func, (void *)wxlClass); ! ! lua_pushstring(L, s_funcTable[i_func].name); // push method name ! lua_pushlightuserdata(L, (void *)wxlClass); // push the userdata ! lua_pushcclosure(L, s_funcTable[i_func].func, 1); // push func with wxlClass as upvalue ! lua_rawset(L, -3); // t["method_name"] = closure of func and upvalues } + lua_remove(L, -1); // remove metatable we got from wxluaT_get + + // ------------------------------------------------------------------ // install the table for the class + lua_pushstring(L, wxlClass->name); lua_newtable(L); *************** *** 743,748 **** --- 784,791 ---- } } + lua_rawset(L, -3); // same as lua_settable(L, tableOffset); + // ------------------------------------------------------------------ // Install public functions like constructors or global functions wxlMethod = wxlClass->methods; *************** *** 756,759 **** --- 799,803 ---- // that are of the same class and so they share the same tag. lua_pushstring(L, wxlMethod->name); + if (strcmp(wxlMethod->name, wxlClass->name) != 0) lua_newtable(L); *************** *** 771,775 **** lua_pushstring(L, "__call"); - //lua_pushcfunction(L, wxlMethod->func); lua_pushlightuserdata(L, &wxluabind_checkremovetable); // push tag to recognize table call lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); // push func with tag as upvalue --- 815,818 ---- *************** *** 785,843 **** lua_rawset(L, -3); // same as lua_settable(L, tableOffset); ! #elif 0 // C++ constructors are cfunctions, use metatable for access to items. ! lua_pushstring(L, wxlMethod->name); ! lua_pushcfunction(L, wxlMethod->func); ! ! // Create the metatable for this cfunction ! //luaL_newmetatable(L, wxlMethod->func); // we don't need to register it ! lua_newtable(L); ! ! // create the t[__index] = { table } ! lua_pushstring(L, "__index"); ! lua_newtable(L); ! ! // add the items to the table as t[first pushed] = second pushed ! lua_pushstring(L, "key"); ! lua_pushstring(L, "value"); ! lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") ! ! ! lua_pushstring(L, "key1"); ! lua_pushstring(L, "value1"); ! lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") ! ! ! //set the table ! lua_rawset(L, -3); ! ! ! // create the t[__call] = { table } ! lua_pushstring(L, "__call"); ! lua_newtable(L); ! ! for (size_t i = 0; i < m_functionCount; ++i) ! { ! if (strcmp(m_functionArray[i].name, "wxGetCwd") == 0) ! { ! wxPrintf(wxT("Adding wxGetCwd '%s' %p\n"), lua2wx(m_functionArray[i].name).c_str(), m_functionArray[i].func); ! ! lua_pushstring(L, m_functionArray[i].name); ! lua_pushcfunction(L, m_functionArray[i].func); ! lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") ! break; ! } ! } ! //set the table ! lua_rawset(L, -3); ! //lua_pushstring(L, "__metatable"); ! //lua_pushstring(L, "Metatable is not accessible"); ! //lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawset(L, tableOffset); #else // C++ class constructors are cfunctions only --- 828,845 ---- lua_rawset(L, -3); // same as lua_settable(L, tableOffset); ! #elif 0 // C++ constructors are userdata, use metatable for access to items. ! // This almost works, but we need to add __call to the metatable which means ! // that if you append () to any instance of this class you call the constructor. ! lua_pushstring(L, wxlMethod->name); ! const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); ! *ptr = wxlClass; + wxluaT_get(L, iTag); lua_setmetatable(L, -2); ! lua_rawset(L, -3); #else // C++ class constructors are cfunctions only *************** *** 859,863 **** lua_pushstring(L, wxlMethod->name); lua_pushcfunction(L, wxlMethod->funcs[0].func); ! lua_rawset(L, tableOffset); } --- 861,865 ---- lua_pushstring(L, wxlMethod->name); lua_pushcfunction(L, wxlMethod->funcs[0].func); ! lua_rawset(L, -3); } *************** *** 868,872 **** lua_pushstring(L, wxlDefine->name); lua_pushnumber(L, wxlDefine->value); ! lua_rawset(L, tableOffset); } --- 870,874 ---- lua_pushstring(L, wxlDefine->name); lua_pushnumber(L, wxlDefine->value); ! lua_rawset(L, -3); } *************** *** 877,881 **** lua_pushstring(L, wxlString->name); lua_pushstring(L, wx2lua(wxlString->value)); ! lua_rawset(L, tableOffset); } --- 879,883 ---- lua_pushstring(L, wxlString->name); lua_pushstring(L, wx2lua(wxlString->value)); ! lua_rawset(L, -3); } *************** *** 891,895 **** wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, true); ! lua_rawset(L, tableOffset); } --- 893,897 ---- wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, true); ! lua_rawset(L, -3); } *************** *** 900,904 **** lua_pushstring(L, wxlEvent->name); lua_pushnumber(L, *wxlEvent->eventType); ! lua_rawset(L, tableOffset); } } --- 902,906 ---- lua_pushstring(L, wxlEvent->name); lua_pushnumber(L, *wxlEvent->eventType); ! lua_rawset(L, -3); } } |
From: John L. <jr...@us...> - 2007-11-28 00:20:54
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15269/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h Log Message: Clarify that the "index" parameter really means stack_idx Don't crash if someone calls a wxLua userdata with something other than a string in our __index function Don't use lua_rawset(L, old_top), but -3 to make sure that everything is right and we're not hiding problems Index: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wxldebug.h 17 Nov 2007 00:15:07 -0000 1.41 --- wxldebug.h 28 Nov 2007 00:20:50 -0000 1.42 *************** *** 55,58 **** --- 55,59 ---- wxString GetValueTypeString() const { return wxlua_getwxluatypename(m_itemValueType); } + // The lua_Debug.source value when enumerating the stack or a stack item wxString GetSource() const { return m_itemSource; } *************** *** 69,74 **** wxString ToString() const { ! return wxString::Format(wxT("Key: '%s' KeyType: '%s' Value: '%s' ValueType: '%s' Ref: %d Idx: %d Flag: %d HasSrc: %d"), ! m_itemKey.c_str(), GetKeyTypeString().c_str(), m_itemValue.c_str(), GetValueTypeString().c_str(), m_lua_ref, m_index, m_flag, (int)!m_itemSource.IsEmpty()); } --- 70,77 ---- wxString ToString() const { ! return wxString::Format(wxT("Key: '%s' KeyType: %d '%s' Value: '%s' ValueType: %d '%s' Ref: %d Idx: %d Flag: %d HasSrc: %d"), ! m_itemKey.c_str(), m_itemKeyType, GetKeyTypeString().c_str(), ! m_itemValue.c_str(), m_itemValueType, GetValueTypeString().c_str(), ! m_lua_ref, m_index, m_flag, (int)!m_itemSource.IsEmpty()); } *************** *** 134,149 **** // give a consistent feel to the display of Lua values. ! // Get the WXLUAARG_XXX type of the lua_type(L, index) and the ! // value at the index, returns the value of lua_type ! static int GetTypeValue(const wxLuaState& wxlState, int index, int* wxl_type, wxString& value); // Write the input number as either an int, uint, or as a double static wxString MakeNumber(double dnum); // Convert the number to either "true" or "false" (eg !0 or 0) static wxString MakeBoolean(int num); ! // Get a wxString description about the table at the index in the Lua stack ! static wxString GetTableInfo(const wxLuaState& wxlState, int index); ! // Get a wxString description about user data at the index in the Lua stack // if full then try to look up the name of the user data from the bindings ! static wxString GetUserDataInfo(const wxLuaState& wxlState, int index, bool full = true); // Make a full copy of the array and return it. --- 137,154 ---- // give a consistent feel to the display of Lua values. ! // Get information about the item at the 'stack_idx'. Returns the lua_type(L, stack_idx), ! // fills 'wxl_type' with the WXLUAARG_XXX type and 'value' with a human readable value. ! static int GetTypeValue(const wxLuaState& wxlState, int stack_idx, int* wxl_type, wxString& value); // Write the input number as either an int, uint, or as a double static wxString MakeNumber(double dnum); // Convert the number to either "true" or "false" (eg !0 or 0) static wxString MakeBoolean(int num); ! // Get a wxString description about the table at the stack_idx in the Lua stack ! static wxString GetTableInfo(const wxLuaState& wxlState, int stack_idx); ! // Get a wxString description about user data at the stack_idx in the Lua stack // if full then try to look up the name of the user data from the bindings ! static wxString GetUserDataInfo(const wxLuaState& wxlState, int stack_idx, bool full = true); ! ! //------------------------------------------------------------------------- // Make a full copy of the array and return it. *************** *** 153,157 **** static int SortFunction(wxLuaDebugItem *elem1, wxLuaDebugItem *elem2 ); - //------------------------------------------------------------------------- // operators bool operator == (const wxLuaDebugData& debugData) const --- 158,161 ---- |
From: John L. <jr...@us...> - 2007-11-28 00:20:53
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15269/wxLua/modules/wxlua/include Modified Files: wxldefs.h Log Message: Clarify that the "index" parameter really means stack_idx Don't crash if someone calls a wxLua userdata with something other than a string in our __index function Don't use lua_rawset(L, old_top), but -3 to make sure that everything is right and we're not hiding problems Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** wxldefs.h 17 Nov 2007 00:16:13 -0000 1.35 --- wxldefs.h 28 Nov 2007 00:20:49 -0000 1.36 *************** *** 118,121 **** --- 118,126 ---- #define INIT_LUA_DEBUG { 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0 } + // Create a wxString from the lua_Debug struct for debugging + #define lua_Debug_to_wxString(ld) \ + wxString::Format(wxT("%p event=%d name='%s' namewhat='%s' what='%s' source='%s' currentline=%d nups=%d linedefined=%d lastlinedefined=%d short_src='%s' i_ci=%d"), \ + &ld, ld.event, lua2wx(ld.name).c_str(), lua2wx(ld.namewhat).c_str(), lua2wx(ld.what).c_str(), lua2wx(ld.source).c_str(), ld.currentline, ld.nups, ld.linedefined, ld.lastlinedefined, lua2wx(ld.short_src).c_str(), ld.i_ci) + // ---------------------------------------------------------------------------- // Convert from wxWidgets wxT('') to wxT(""), a string. Copied from wx/filefn.h |
From: John L. <jr...@us...> - 2007-11-25 21:34:08
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23733/wxLua/modules/wxbind/src Modified Files: wxaui_aui.cpp wxaui_bind.cpp Log Message: Updated wxAUI to 2.8.6 and added a sample for it Index: wxaui_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxaui_bind.cpp 17 Nov 2007 00:14:57 -0000 1.2 --- wxaui_bind.cpp 25 Nov 2007 21:34:05 -0000 1.3 *************** *** 37,41 **** --- 37,55 ---- { "wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND", &wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, &s_wxluatag_wxAuiNotebookEvent }, { "wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG", &wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, &s_wxluatag_wxAuiNotebookEvent }, + #endif // wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI + + #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + { "wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK", &wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, &s_wxluatag_wxAuiNotebookEvent }, + #endif // (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + + #if wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI { "wxEVT_COMMAND_AUINOTEBOOK_BUTTON", &wxEVT_COMMAND_AUINOTEBOOK_BUTTON, &s_wxluatag_wxAuiNotebookEvent }, + #endif // wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI + + #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + { "wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE", &wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, &s_wxluatag_wxAuiNotebookEvent }, + #endif // (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + + #if wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI { "wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION", &wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, &s_wxluatag_wxAuiNotebookEvent }, { "wxEVT_COMMAND_AUINOTEBOOK_END_DRAG", &wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, &s_wxluatag_wxAuiNotebookEvent }, *************** *** 45,48 **** --- 59,70 ---- #endif // wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI + #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + { "wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED", &wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, &s_wxluatag_wxAuiNotebookEvent }, + { "wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN", &wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, &s_wxluatag_wxAuiNotebookEvent }, + { "wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP", &wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, &s_wxluatag_wxAuiNotebookEvent }, + { "wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN", &wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, &s_wxluatag_wxAuiNotebookEvent }, + { "wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP", &wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, &s_wxluatag_wxAuiNotebookEvent }, + #endif // (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxCHECK_VERSION(2,8,5)) + { 0, 0, 0 }, *************** *** 125,128 **** --- 147,151 ---- { "wxAUI_NB_DEFAULT_STYLE", wxAUI_NB_DEFAULT_STYLE }, { "wxAUI_NB_LEFT", wxAUI_NB_LEFT }, + { "wxAUI_NB_MIDDLE_CLICK_CLOSE", wxAUI_NB_MIDDLE_CLICK_CLOSE }, { "wxAUI_NB_RIGHT", wxAUI_NB_RIGHT }, { "wxAUI_NB_SCROLL_BUTTONS", wxAUI_NB_SCROLL_BUTTONS }, *************** *** 214,217 **** --- 237,243 ---- { "wxAuiDockUIPart", wxAuiDockUIPart_methods, wxAuiDockUIPart_methodCount, NULL, &s_wxluatag_wxAuiDockUIPart, NULL, NULL ,wxAuiDockUIPart_enums, wxAuiDockUIPart_enumCount, }, { "wxAuiFloatingFrame", wxAuiFloatingFrame_methods, wxAuiFloatingFrame_methodCount, CLASSINFO(wxAuiFloatingFrame), &s_wxluatag_wxAuiFloatingFrame, "wxFrame", NULL ,s_wxluadefineArray_None, 0, }, + { "wxAuiMDIChildFrame", wxAuiMDIChildFrame_methods, wxAuiMDIChildFrame_methodCount, CLASSINFO(wxAuiMDIChildFrame), &s_wxluatag_wxAuiMDIChildFrame, "wxPanel", NULL ,s_wxluadefineArray_None, 0, }, + { "wxAuiMDIClientWindow", wxAuiMDIClientWindow_methods, wxAuiMDIClientWindow_methodCount, CLASSINFO(wxAuiMDIClientWindow), &s_wxluatag_wxAuiMDIClientWindow, "wxAuiNotebook", NULL ,s_wxluadefineArray_None, 0, }, + { "wxAuiMDIParentFrame", wxAuiMDIParentFrame_methods, wxAuiMDIParentFrame_methodCount, CLASSINFO(wxAuiMDIParentFrame), &s_wxluatag_wxAuiMDIParentFrame, "wxFrame", NULL ,s_wxluadefineArray_None, 0, }, { "wxAuiManager", wxAuiManager_methods, wxAuiManager_methodCount, CLASSINFO(wxAuiManager), &s_wxluatag_wxAuiManager, "wxEvtHandler", NULL ,s_wxluadefineArray_None, 0, }, { "wxAuiManagerEvent", wxAuiManagerEvent_methods, wxAuiManagerEvent_methodCount, CLASSINFO(wxAuiManagerEvent), &s_wxluatag_wxAuiManagerEvent, "wxEvent", NULL ,s_wxluadefineArray_None, 0, }, Index: wxaui_aui.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_aui.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxaui_aui.cpp 17 Nov 2007 00:14:57 -0000 1.5 --- wxaui_aui.cpp 25 Nov 2007 21:34:04 -0000 1.6 *************** *** 1853,1856 **** --- 1853,1923 ---- } + static wxLuaArgTag s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging[] = { &s_wxluatag_wxAuiTabCtrl, NULL }; + static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging[1] = {{ wxLua_wxAuiTabCtrl_IsDragging, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging }}; + // bool IsDragging() const + static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L) + { + wxLuaState wxlState(L); [...2340 lines suppressed...] + return wxlState.CallOverloadedFunction(&overload_method); + } + #endif // (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) + + // Map Lua Class Methods to C Binding Functions + wxLuaBindMethod wxAuiMDIClientWindow_methods[] = { + { "CreateClient", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiMDIClientWindow_CreateClient, 1, NULL }, + { "SetSelection", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiMDIClientWindow_SetSelection, 1, NULL }, + + #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) + { "wxAuiMDIClientWindow", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxAuiMDIClientWindow_constructor_overload, s_wxluafunc_wxLua_wxAuiMDIClientWindow_constructor_overload_count, 0 }, + #endif // (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) + + { 0, 0, 0, 0 }, + }; + + int wxAuiMDIClientWindow_methodCount = sizeof(wxAuiMDIClientWindow_methods)/sizeof(wxLuaBindMethod) - 1; + + #endif // wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI + |
From: John L. <jr...@us...> - 2007-11-25 21:34:08
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23733/wxLua/samples Added Files: auidemo.wx.lua Log Message: Updated wxAUI to 2.8.6 and added a sample for it --- NEW FILE: auidemo.wx.lua --- --[[ /////////////////////////////////////////////////////////////////////////////// // Name: auidemo.cpp // Purpose: wxaui: wx advanced user interface - sample/test program // Author: Benjamin I. Williams // Modified by: // Created: 2005-10-03 // RCS-ID: $Id: auidemo.wx.lua,v 1.1 2007/11/25 21:34:05 jrl1 Exp $ // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// --]] --/* XPM */ local sample_xpm = { --/* columns rows colors chars-per-pixel */ "32 32 6 1", " c black", [...1589 lines suppressed...] <p>See README.txt for more information.</p> </body></html> ]] return text; end function MyApp:OnInit() local myframe = MyFrame:create() local frame = myframe.this wx.wxGetApp():SetTopWindow(frame); frame:Show(); return true; end MyApp:OnInit() |
From: John L. <jr...@us...> - 2007-11-25 21:34:08
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23733/wxLua/bindings/wxwidgets Modified Files: wx_datatypes.lua wxaui_aui.i Log Message: Updated wxAUI to 2.8.6 and added a sample for it Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** wx_datatypes.lua 8 Nov 2007 00:06:38 -0000 1.87 --- wx_datatypes.lua 25 Nov 2007 21:34:04 -0000 1.88 *************** *** 353,356 **** --- 353,377 ---- ValueType = "class", }, + wxAuiMDIChildFrame = { + BaseClass = "wxPanel", + Condition = "wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI", + IsNumber = false, + Name = "wxAuiMDIChildFrame", + ValueType = "class", + }, + wxAuiMDIClientWindow = { + BaseClass = "wxAuiNotebook", + Condition = "wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI", + IsNumber = false, + Name = "wxAuiMDIClientWindow", + ValueType = "class", + }, + wxAuiMDIParentFrame = { + BaseClass = "wxFrame", + Condition = "wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI", + IsNumber = false, + Name = "wxAuiMDIParentFrame", + ValueType = "class", + }, wxAuiManager = { BaseClass = "wxEvtHandler", Index: wxaui_aui.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxaui_aui.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxaui_aui.i 16 Jul 2007 19:34:23 -0000 1.1 --- wxaui_aui.i 25 Nov 2007 21:34:04 -0000 1.2 *************** *** 5,9 **** // Copyright: (c) 2007 John Labenski. All rights reserved. // Licence: wxWidgets licence ! // wxWidgets: Updated to 2.8.4 // =========================================================================== --- 5,9 ---- // Copyright: (c) 2007 John Labenski. All rights reserved. // Licence: wxWidgets licence ! // wxWidgets: Updated to 2.8.6 // =========================================================================== *************** *** 35,40 **** wxAUI_NB_CLOSE_ON_ACTIVE_TAB wxAUI_NB_CLOSE_ON_ALL_TABS ! wxAUI_NB_DEFAULT_STYLE //= wxAUI_NB_TOP|wxAUI_NB_TAB_SPLIT|wxAUI_NB_TAB_MOVE|wxAUI_NB_SCROLL_BUTTONS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB %endenum --- 35,41 ---- wxAUI_NB_CLOSE_ON_ACTIVE_TAB wxAUI_NB_CLOSE_ON_ALL_TABS + wxAUI_NB_MIDDLE_CLICK_CLOSE ! wxAUI_NB_DEFAULT_STYLE //= wxAUI_NB_TOP|wxAUI_NB_TAB_SPLIT|wxAUI_NB_TAB_MOVE|wxAUI_NB_SCROLL_BUTTONS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_MIDDLE_CLICK_CLOSE %endenum *************** *** 53,56 **** --- 54,68 ---- %define_event wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND // EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) + %if %wxchkver_2_8_5 + %define_event wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN // EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) + %define_event wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP // EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) + %define_event wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN // EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) + %define_event wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP // EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) + %define_event wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED // + %define_event wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE // EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) + %define_event wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK // EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) + %endif //%wxchkver_2_8_5 + + wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0) wxAuiNotebookEvent(const wxAuiNotebookEvent& c) *************** *** 203,206 **** --- 215,222 ---- void SetTabOffset(size_t offset); + bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd); + void MakeTabVisible(int tabPage, wxWindow* win); + + bool IsDragging() const %endclass *************** *** 265,268 **** --- 281,290 ---- // Gets the height of the notebook for a given page height int GetHeightForPageHeight(int pageHeight); + + // Advances the selection, generation page selection events + void AdvanceSelection(bool forward = true); + + // Shows the window menu + bool ShowWindowMenu(); %endif *************** *** 552,580 **** bool HasFlag(unsigned int flag) const - /* - wxString name; // name of the pane - wxString caption; // caption displayed on the window ! wxWindow* window; // window that is in this pane ! wxFrame* frame; // floating frame window that holds the pane ! unsigned int state; // a combination of wxPaneState values ! int dock_direction; // dock direction (top, bottom, left, right, center) ! int dock_layer; // layer number (0 = innermost layer) ! int dock_row; // row number on the docking bar (0 = first row) ! int dock_pos; // position inside the row (0 = first position) ! wxSize best_size; // size that the layout engine will prefer ! wxSize min_size; // minimum size the pane window can tolerate ! wxSize max_size; // maximum size the pane window can tolerate ! wxPoint floating_pos; // position while floating ! wxSize floating_size; // size while floating ! int dock_proportion; // proportion while docked ! wxAuiPaneButtonArray buttons; // buttons on the pane - wxRect rect; // current rectangle (populated by wxAUI) - */ %endclass --- 574,602 ---- bool HasFlag(unsigned int flag) const ! %member wxString name; // name of the pane ! %member wxString caption; // caption displayed on the window ! %member wxWindow* window; // window that is in this pane ! %member wxFrame* frame; // floating frame window that holds the pane ! %member unsigned int state; // a combination of wxPaneState values ! %member int dock_direction; // dock direction (top, bottom, left, right, center) ! %member int dock_layer; // layer number (0 = innermost layer) ! %member int dock_row; // row number on the docking bar (0 = first row) ! %member int dock_pos; // position inside the row (0 = first position) ! %member wxSize best_size; // size that the layout engine will prefer ! %member wxSize min_size; // minimum size the pane window can tolerate ! %member wxSize max_size; // maximum size the pane window can tolerate ! %member wxPoint floating_pos; // position while floating ! %member wxSize floating_size; // size while floating ! %member int dock_proportion; // proportion while docked ! ! //%member wxAuiPaneButtonArray buttons; // buttons on the pane ! ! %member wxRect rect; // current rectangle (populated by wxAUI) %endclass *************** *** 616,620 **** void SetArtProvider(%ungc wxAuiDockArt* art_provider); ! %gc wxAuiDockArt* GetArtProvider() const; wxAuiPaneInfo& GetPane(wxWindow* window); --- 638,642 ---- void SetArtProvider(%ungc wxAuiDockArt* art_provider); ! wxAuiDockArt* GetArtProvider() const; wxAuiPaneInfo& GetPane(wxWindow* window); *************** *** 703,721 **** bool IsHorizontal() const bool IsVertical() const ! /* ! public: ! wxAuiPaneInfoPtrArray panes; // array of panes ! wxRect rect; // current rectangle ! int dock_direction; // dock direction (top, bottom, left, right, center) ! int dock_layer; // layer number (0 = innermost layer) ! int dock_row; // row number on the docking bar (0 = first row) ! int size; // size of the dock ! int min_size; // minimum size of a dock (0 if there is no min) ! bool resizable; // flag indicating whether the dock is resizable ! bool toolbar; // flag indicating dock contains only toolbars ! bool fixed; // flag indicating that the dock operates on ! // absolute coordinates as opposed to proportional ! bool reserved1; ! */ %endclass --- 725,743 ---- bool IsHorizontal() const bool IsVertical() const ! ! ! //%member wxAuiPaneInfoPtrArray panes; // array of panes - FIXME ! %member wxRect rect; // current rectangle ! %member int dock_direction; // dock direction (top, bottom, left, right, center) ! %member int dock_layer; // layer number (0 = innermost layer) ! %member int dock_row; // row number on the docking bar (0 = first row) ! %member int size; // size of the dock ! %member int min_size; // minimum size of a dock (0 if there is no min) ! %member bool resizable; // flag indicating whether the dock is resizable ! %member bool toolbar; // flag indicating dock contains only toolbars ! %member bool fixed; // flag indicating that the dock operates on ! // absolute coordinates as opposed to proportional ! %member bool reserved1; ! %endclass *************** *** 757,759 **** --- 779,906 ---- + // --------------------------------------------------------------------------- + // --------------------------------------------------------------------------- + + //%include "wx/aui/tabmdi.h" + + //----------------------------------------------------------------------------- + // wxAuiMDIParentFrame + //----------------------------------------------------------------------------- + + %class wxAuiMDIParentFrame, wxFrame + wxAuiMDIParentFrame() + wxAuiMDIParentFrame(wxWindow *parent, wxWindowID winid, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, const wxString& name = "wxAuiMDIParentFrame") + + bool Create(wxWindow *parent, wxWindowID winid, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,const wxString& name = "wxAuiMDIParentFrame" ) + + void SetArtProvider(%ungc wxAuiTabArt* provider); + wxAuiTabArt* GetArtProvider(); + wxAuiNotebook* GetNotebook() const; + + wxMenu* GetWindowMenu() const + void SetWindowMenu(wxMenu* pMenu); + + virtual void SetMenuBar(wxMenuBar *pMenuBar); + + void SetChildMenuBar(wxAuiMDIChildFrame *pChild); + + virtual bool ProcessEvent(wxEvent& event); + + wxAuiMDIChildFrame *GetActiveChild() const; + void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); + + wxAuiMDIClientWindow *GetClientWindow() const; + virtual wxAuiMDIClientWindow *OnCreateClient(); + + virtual void Cascade() //{ /* Has no effect */ } + virtual void Tile(wxOrientation orient = wxHORIZONTAL); + virtual void ArrangeIcons() //{ /* Has no effect */ } + virtual void ActivateNext(); + virtual void ActivatePrevious(); + + %endclass + + //----------------------------------------------------------------------------- + // wxAuiMDIChildFrame + //----------------------------------------------------------------------------- + + %class wxAuiMDIChildFrame, wxPanel + wxAuiMDIChildFrame() + wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, wxWindowID winid, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "wxAuiMDIChildFrame"); + + bool Create(wxAuiMDIParentFrame *parent, wxWindowID winid, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "wxAuiMDIChildFrame"); + + virtual void SetMenuBar(wxMenuBar *menu_bar); + virtual wxMenuBar *GetMenuBar() const; + + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle() const; + + virtual void SetIcons(const wxIconBundle& icons); + virtual const wxIconBundle& GetIcons() const; + + virtual void SetIcon(const wxIcon& icon); + virtual const wxIcon& GetIcon() const; + + virtual void Activate(); + virtual bool Destroy(); + + %if wxUSE_STATUSBAR + // no status bars + //virtual wxStatusBar* CreateStatusBar(int number = 1, long style = 1, wxWindowID winid = 1, const wxString& name = "") //{ return (wxStatusBar*)NULL; } - FIXME + + //virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } + //virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} + //virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} + %endif //wxUSE_STATUSBAR + + // no size hints + //virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW) = wxDefaultCoord, int WXUNUSED(maxH) = wxDefaultCoord, int WXUNUSED(incW) = wxDefaultCoord, int WXUNUSED(incH) = wxDefaultCoord) {} - FIXME + %if wxUSE_TOOLBAR + // no toolbar bars + //virtual wxToolBar* CreateToolBar(long WXUNUSED(style), wxWindowID WXUNUSED(winid), const wxString& WXUNUSED(name)) { return (wxToolBar*)NULL; } + //virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } + %endif //wxUSE_TOOLBAR + + + // no maximize etc + //virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ } + //virtual void Restore() { /* Has no effect */ } + //virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } + //virtual bool IsMaximized() const { return true; } + //virtual bool IsIconized() const { return false; } + //virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } + //virtual bool IsFullScreen() const { return false; } + + //virtual bool IsTopLevel() const { return false; } + + //void OnMenuHighlight(wxMenuEvent& evt); + //void OnActivate(wxActivateEvent& evt); + //void OnCloseWindow(wxCloseEvent& evt); + + void SetMDIParentFrame(wxAuiMDIParentFrame* parent); + wxAuiMDIParentFrame* GetMDIParentFrame() const; + + // This function needs to be called when a size change is confirmed, + // we needed this function to prevent anybody from the outside + // changing the panel... it messes the UI layout when we would allow it. + void ApplyMDIChildFrameRect(); + void DoShow(bool show); + + %endclass + + //----------------------------------------------------------------------------- + // wxAuiMDIClientWindow + //----------------------------------------------------------------------------- + + %class wxAuiMDIClientWindow, wxAuiNotebook + wxAuiMDIClientWindow(); + wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); + + virtual bool CreateClient(wxAuiMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); + + virtual int SetSelection(size_t page); + + %endclass + %endif // wxLUA_USE_wxAUI && %wxchkver_2_8 && wxUSE_AUI |
From: John L. <jr...@us...> - 2007-11-25 21:34:07
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23733/wxLua/modules/wxbind/include Modified Files: wxaui_bind.h Log Message: Updated wxAUI to 2.8.6 and added a sample for it Index: wxaui_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxaui_bind.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxaui_bind.h 17 Nov 2007 00:14:56 -0000 1.5 --- wxaui_bind.h 25 Nov 2007 21:34:04 -0000 1.6 *************** *** 80,83 **** --- 80,92 ---- extern WXDLLIMPEXP_BINDWXAUI wxLuaBindMethod wxAuiFloatingFrame_methods[]; extern WXDLLIMPEXP_DATA_BINDWXAUI(int) wxAuiFloatingFrame_methodCount; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) s_wxluatag_wxAuiMDIChildFrame; + extern WXDLLIMPEXP_BINDWXAUI wxLuaBindMethod wxAuiMDIChildFrame_methods[]; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) wxAuiMDIChildFrame_methodCount; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) s_wxluatag_wxAuiMDIClientWindow; + extern WXDLLIMPEXP_BINDWXAUI wxLuaBindMethod wxAuiMDIClientWindow_methods[]; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) wxAuiMDIClientWindow_methodCount; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) s_wxluatag_wxAuiMDIParentFrame; + extern WXDLLIMPEXP_BINDWXAUI wxLuaBindMethod wxAuiMDIParentFrame_methods[]; + extern WXDLLIMPEXP_DATA_BINDWXAUI(int) wxAuiMDIParentFrame_methodCount; extern WXDLLIMPEXP_DATA_BINDWXAUI(int) s_wxluatag_wxAuiManager; extern WXDLLIMPEXP_BINDWXAUI wxLuaBindMethod wxAuiManager_methods[]; |
From: John L. <jr...@us...> - 2007-11-17 00:17:28
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14622/wxLua/modules/wxlua/include Modified Files: wxldefs.h Log Message: Bump version to 2.8.6.0 Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** wxldefs.h 17 Nov 2007 00:15:00 -0000 1.34 --- wxldefs.h 17 Nov 2007 00:16:13 -0000 1.35 *************** *** 38,44 **** #define wxLUA_MAJOR_VERSION 2 #define wxLUA_MINOR_VERSION 8 ! #define wxLUA_RELEASE_NUMBER 4 ! #define wxLUA_SUBRELEASE_NUMBER 2 ! #define wxLUA_VERSION_STRING wxT("wxLua 2.8.4.2") // For non-Unix systems (i.e. when building without a configure script), --- 38,44 ---- #define wxLUA_MAJOR_VERSION 2 #define wxLUA_MINOR_VERSION 8 ! #define wxLUA_RELEASE_NUMBER 6 ! #define wxLUA_SUBRELEASE_NUMBER 0 ! #define wxLUA_VERSION_STRING wxT("wxLua 2.8.6.0") // For non-Unix systems (i.e. when building without a configure script), |
From: John L. <jr...@us...> - 2007-11-17 00:16:56
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/bindings/wxwidgets Modified Files: wxbase_override.hpp wxbase_rules.lua wxcore_override.hpp wxhtml_override.hpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxhtml_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxhtml_override.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxhtml_override.hpp 16 Jul 2007 19:34:26 -0000 1.1 --- wxhtml_override.hpp 17 Nov 2007 00:14:55 -0000 1.2 *************** *** 87,91 **** default: ! wxlState.terror("wxLua: Expected simple type for parameter 3."); break; } --- 87,91 ---- default: ! wxlState.wxlua_Error("wxLua: Expected simple type for parameter 3."); break; } Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxbase_override.hpp 1 Aug 2007 19:15:31 -0000 1.4 --- wxbase_override.hpp 17 Nov 2007 00:14:55 -0000 1.5 *************** *** 424,428 **** { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.ttouserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); --- 424,428 ---- { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.wxlua_ToUserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); *************** *** 431,446 **** if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.tsettag(*pClass->class_tag); iResult = 1; } else ! wxlState.terror("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.terror("wxObject:DynamicCast: Class not found."); } else ! wxlState.terror("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; --- 431,446 ---- if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.wxluaT_SetTag(*pClass->class_tag); iResult = 1; } else ! wxlState.wxlua_Error("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.wxlua_Error("wxObject:DynamicCast: Class not found."); } else ! wxlState.wxlua_Error("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; Index: wxbase_rules.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_rules.lua,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxbase_rules.lua 19 Jul 2007 03:09:46 -0000 1.3 --- wxbase_rules.lua 17 Nov 2007 00:14:55 -0000 1.4 *************** *** 138,146 **** lua_State* L = wxLS.GetLuaState(); ! if (registerTypes) ! g_wxluatag_NULL = wxLS.tnewtag(); lua_pushlstring(L, "NULL", 4); ! wxLS.tpushusertag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); ]] --- 138,145 ---- lua_State* L = wxLS.GetLuaState(); ! g_wxluatag_NULL = wxLS.wxluaT_NewTag(); lua_pushlstring(L, "NULL", 4); ! wxLS.wxluaT_PushUserTag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); ]] Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxcore_override.hpp 1 Aug 2007 19:15:31 -0000 1.4 --- wxcore_override.hpp 17 Nov 2007 00:14:55 -0000 1.5 *************** *** 413,417 **** } else ! wxlState.terror(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this --- 413,417 ---- } else ! wxlState.wxlua_Error(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this *************** *** 807,811 **** // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.ttouserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); --- 807,811 ---- // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.wxluaT_ToUserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); *************** *** 1157,1161 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 1157,1161 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 1166,1170 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1166,1170 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1182,1186 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1182,1186 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1205,1209 **** else { ! wxlState.terror("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } --- 1205,1209 ---- else { ! wxlState.wxlua_Error("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } *************** *** 1213,1217 **** default: { ! wxlState.terror("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } --- 1213,1217 ---- default: { ! wxlState.wxlua_Error("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } *************** *** 1220,1224 **** if (!lua_isfunction(L, func_idx)) { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; --- 1220,1224 ---- if (!lua_isfunction(L, func_idx)) { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; *************** *** 1229,1233 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 1229,1233 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; *************** *** 1271,1275 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 1271,1275 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 1280,1284 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1280,1284 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1295,1299 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1295,1299 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1310,1314 **** default: { ! wxlState.terror("wxLua: Disconnect: Incorrect number of parameters."); return 0; } --- 1310,1314 ---- default: { ! wxlState.wxlua_Error("wxLua: Disconnect: Incorrect number of parameters."); return 0; } *************** *** 1319,1323 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 1319,1323 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; *************** *** 1453,1457 **** size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.terror("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); --- 1453,1457 ---- size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.wxlua_Error("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); *************** *** 1916,1920 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image --- 1916,1920 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image *************** *** 1938,1942 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image --- 1938,1942 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image *************** *** 1966,1970 **** static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_terror(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* --- 1966,1970 ---- static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_error(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxbind/include Modified Files: wxadv_bind.h wxaui_bind.h wxbase_bind.h wxcore_bind.h wxgl_bind.h wxhtml_bind.h wxmedia_bind.h wxnet_bind.h wxrichtext_bind.h wxstc_bind.h wxxml_bind.h wxxrc_bind.h Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxadv_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxadv_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxadv_bind.h 1 Aug 2007 19:15:31 -0000 1.4 --- wxadv_bind.h 17 Nov 2007 00:14:55 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxadv) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxadv) Index: wxcore_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxcore_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxcore_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxcore_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 38,44 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 38,44 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 51,56 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxcore) --- 51,56 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxcore) Index: wxrichtext_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxrichtext_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxrichtext_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxrichtext_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxrichtext) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxrichtext) Index: wxxrc_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxxrc_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxxrc_bind.h 1 Aug 2007 19:15:35 -0000 1.4 --- wxxrc_bind.h 17 Nov 2007 00:14:57 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxxrc) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxxrc) Index: wxnet_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxnet_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxnet_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxnet_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxnet) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxnet) Index: wxbase_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxbase_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxbase_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxbase_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 20,26 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 20,26 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 33,38 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxbase) --- 33,38 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxbase) Index: wxmedia_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxmedia_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxmedia_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxmedia_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 22,28 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 22,28 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 35,40 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxmedia) --- 35,40 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxmedia) Index: wxgl_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxgl_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxgl_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxgl_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxgl) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxgl) Index: wxstc_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxstc_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxstc_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxstc_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxstc) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxstc) Index: wxaui_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxaui_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxaui_bind.h 1 Aug 2007 19:15:31 -0000 1.4 --- wxaui_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxaui) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxaui) Index: wxhtml_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxhtml_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxhtml_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxhtml_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxhtml) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxhtml) Index: wxxml_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxxml_bind.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxxml_bind.h 1 Aug 2007 19:15:34 -0000 1.4 --- wxxml_bind.h 17 Nov 2007 00:14:56 -0000 1.5 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxxml) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxxml) |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp wxlua_bind.cpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** wxlstate.cpp 8 Nov 2007 23:47:15 -0000 1.136 --- wxlstate.cpp 17 Nov 2007 00:15:02 -0000 1.137 *************** *** 62,66 **** if (s == NULL) { ! // FIXME use terror here? right now terror doesn't do anything special - JL return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); --- 62,66 ---- if (s == NULL) { ! // FIXME use wxlua_error here? right now wxlua_error doesn't do anything special - JL return luaL_error(L, LUA_QL("tostring") " must return a string to " [...1105 lines suppressed...] } --- 3927,3931 ---- else { ! int tag = wxluaT_Tag(arg+1+lua_argStart); fnCall += GetLuaTagName(tag); } *************** *** 3981,3985 **** } ! terror(errmsg); return 0; --- 3973,3977 ---- } ! wxlua_Error(errmsg); return 0; Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** wxlbind.cpp 8 Nov 2007 23:47:15 -0000 1.93 --- wxlbind.cpp 17 Nov 2007 00:15:02 -0000 1.94 *************** *** 69,75 **** { // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. ! //if (wxlua_iswxuserdata(L, 1) && (wxlua_ttag(L, 1) == g_wxluatag_wxLuaFunction)) { ! wxLuaFunction *wxlFunction = (wxLuaFunction *)wxlua_ttouserdata(L, 1, true); if (wxlFunction != NULL) delete wxlFunction; --- 69,75 ---- { // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. ! //if (wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == g_wxluatag_wxLuaFunction)) { ! wxLuaFunction *wxlFunction = (wxLuaFunction *)wxlua_touserdata(L, 1, true); if (wxlFunction != NULL) delete wxlFunction; *************** *** 81,87 **** { // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. ! //if (wxlua_iswxuserdata(L, 1) && (wxlua_ttag(L, 1) == g_wxluatag_wxLuaFunction)) { ! wxLuaFunction *f = (wxLuaFunction *)wxlua_ttouserdata(L, 1, false); return f->CallMethod(L); } --- 81,87 ---- { // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. ! //if (wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == g_wxluatag_wxLuaFunction)) { ! wxLuaFunction *f = (wxLuaFunction *)wxlua_touserdata(L, 1, false); return f->CallMethod(L); } *************** *** 101,105 **** { // set up the reference to the item on the stack ! m_reference = m_wxlState->tinsert(stack_idx); } --- 101,105 ---- { // set up the reference to the item on the stack ! m_reference = m_wxlState->wxluaT_Insert(stack_idx); } *************** *** 113,117 **** // If a refererence exists, remove it, but don't bother if Lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) ! m_wxlState->tremove(m_reference); delete m_wxlState; --- 113,117 ---- // If a refererence exists, remove it, but don't bother if Lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) ! m_wxlState->wxluaT_Remove(m_reference); delete m_wxlState; *************** *** 148,152 **** return true; } ! else if (m_wxlState->tget(m_reference)) return true; --- 148,152 ---- return true; } ! else if (m_wxlState->wxluaT_Get(m_reference)) return true; *************** *** 159,165 **** if (m_reference != LUA_NOREF) // FIXME should this error out? ! m_wxlState->tremove(m_reference); ! m_reference = m_wxlState->tinsert(stack_idx); } --- 159,165 ---- if (m_reference != LUA_NOREF) // FIXME should this error out? ! m_wxlState->wxluaT_Remove(m_reference); ! m_reference = m_wxlState->wxluaT_Insert(stack_idx); } *************** *** 231,235 **** static int LUACALL wxlua_tableErrorHandler(lua_State *L) { ! wxlua_terror(L, "Cannot modify read-only wxLua table"); return 0; } --- 231,235 ---- static int LUACALL wxlua_tableErrorHandler(lua_State *L) { ! wxlua_error(L, "Cannot modify read-only wxLua table"); return 0; } *************** *** 243,252 **** wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxlua_ttag(L, 1) == *wxlClass->class_tag)) { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); ! void* key = wxlua_ttouserdata(L, 1, true); //wxPrintf(wxT("__gcClass '%s' %p\n"), wxlState.GetLuaTagName(*wxlClass->class_tag).c_str(), key); --- 243,252 ---- wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == *wxlClass->class_tag)) { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); ! void* key = wxlua_touserdata(L, 1, true); //wxPrintf(wxT("__gcClass '%s' %p\n"), wxlState.GetLuaTagName(*wxlClass->class_tag).c_str(), key); *************** *** 286,292 **** const char *name = NULL; ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxlua_ttag(L, 1) == *wxlClass->class_tag)) { ! void *pObject = wxlua_ttouserdata(L, 1, false); name = lua_tostring(L, 2); // name of the __index method called in Lua --- 286,292 ---- const char *name = NULL; ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == *wxlClass->class_tag)) { ! void *pObject = wxlua_touserdata(L, 1, false); name = lua_tostring(L, 2); // name of the __index method called in Lua *************** *** 323,327 **** wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, pObject); // Don't track the wxLuaFunction for speed ! wxlua_tpushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); } } --- 323,327 ---- wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, pObject); // Don't track the wxLuaFunction for speed ! wxluaT_pushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); } } *************** *** 357,361 **** if (!found) ! wxlua_terror(L, wxString::Format(_("wxLua: Attempt to call an invalid method '%s'."), lua2wx(name).c_str())); return result; --- 357,361 ---- if (!found) ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call an invalid method '%s'."), lua2wx(name).c_str())); return result; *************** *** 376,380 **** bool found = false; ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxlua_ttag(L, 1) == *wxlClass->class_tag)) { // See if there is a WXLUAMETHOD_SETPROP in the wxLuaBindClass's wxLuaBindMethods --- 376,380 ---- bool found = false; ! if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_tag(L, 1) == *wxlClass->class_tag)) { // See if there is a WXLUAMETHOD_SETPROP in the wxLuaBindClass's wxLuaBindMethods *************** *** 407,411 **** if (!found) { ! void *pObject = wxlua_ttouserdata(L, 1, false); wxLuaObject* wxlObj = new wxLuaObject(wxlState, 3); wxlua_setderivedmethod(L, pObject, name, wxlObj); --- 407,411 ---- if (!found) { ! void *pObject = wxlua_touserdata(L, 1, false); wxLuaObject* wxlObj = new wxLuaObject(wxlState, 3); wxlua_setderivedmethod(L, pObject, name, wxlObj); *************** *** 432,436 **** str = wxString::Format(wxT("userdata: %p"), lua_touserdata(L, 1)); ! int nTag = wxlua_ttag(L, 1); if (nTag != WXLUA_NOTAG) { --- 432,436 ---- str = wxString::Format(wxT("userdata: %p"), lua_touserdata(L, 1)); ! int nTag = wxluaT_tag(L, 1); if (nTag != WXLUA_NOTAG) { *************** *** 581,633 **** } ! void wxLuaBinding::RegisterBinding(const wxLuaState& wxlState, bool registerTypes) { ! wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); ! ! int luaTable = RegisterFunctions(wxlState, registerTypes); lua_State *L = wxlState.GetLuaState(); ! // create a global table for the namespace if it doesn't already exist ! // Note: we have to do it a second time to set the table RegisterFunctions created ! lua_getglobal(L, wx2lua(m_nameSpace)); ! ! if (!lua_istable(L, -1)) { ! // The first time this namespace is used we need to create it ! lua_pop(L, 1); // pop the nil value ! lua_pushstring(L, wx2lua(m_nameSpace)); ! lua_pushvalue(L, luaTable); ! lua_rawset(L, LUA_GLOBALSINDEX); } - else - lua_pop(L, 1); // pop the already created namespace table - - lua_pop(L, 1); // pop the table created by RegisterFunctions - } - - void wxLuaBinding::UnRegisterBinding(const wxLuaState& wxlState_) - { - wxLuaState wxlState(wxlState_); // unconst the state - wxlState.lua_PushString(m_nameSpace); - wxlState.lua_PushNil(); - wxlState.lua_RawSet(LUA_GLOBALSINDEX); - } - - int LUACALL wxLuaBinding::RegisterFunctions(const wxLuaState& wxlState_, bool registerTypes) - { - wxCHECK_MSG(wxlState_.Ok(), 0, wxT("Invalid wxLuaState")); - wxLuaState wxlState(wxlState_); // unconst the state ! if (!registerTypes && !m_bindings_registered) ! wxlState.terror("wxLua: First time registration must register types"); ! ! lua_State *L = wxlState.GetLuaState(); ! ! int tableOffset = 0; ! // create a global table for the namespace if it doesn't already exist ! lua_getglobal(L, wx2lua(m_nameSpace)); if (!lua_istable(L, -1)) --- 581,612 ---- } ! bool wxLuaBinding::RegisterBinding(const wxLuaState& wxlState_) { ! wxCHECK_MSG(wxlState_.Ok(), false, wxT("Invalid wxLuaState")); ! wxLuaState wxlState(wxlState_); // unconst the state lua_State *L = wxlState.GetLuaState(); ! if (m_bindings_registered) { ! wxString s; ! s.Printf(wxT("wxLua: Bindings '%s' in Lua namespace '%s' are already registered."), m_bindingName.c_str(), m_nameSpace.c_str()); ! wxlState.wxlua_Error(wx2lua(s)); ! return false; } ! // Let Lua create a new table for us and add it to these places. ! // We use an empty luaL_Reg since we just want luaI_openlib to create the ! // tables for us, but we want to install the elements ourselves since ! // wxLua is too large to follow the luaI_openlib method without being ! // wasteful of memory and slow down the initialization. ! // LUA_REGISTRYINDEX["_LOADED"][m_nameSpace] = table ! // LUA_GLOBALSINDEX[m_nameSpace] = table ! // LUA_GLOBALSINDEX["package"]["loaded"][m_nameSpace] = table ! static const luaL_Reg wxlualib[] = { {NULL, NULL} }; ! luaI_openlib(L, wx2lua(m_nameSpace), wxlualib, 0); ! int tableOffset = lua_gettop(L); if (!lua_istable(L, -1)) *************** *** 635,661 **** lua_pop(L, 1); // pop the nil value ! // create a tag for the wxLua table ! if (registerTypes) ! m_luaTable_tag = wxlState.tnewtag(); ! ! // create the wxLua table ! lua_newtable(L); ! tableOffset = lua_gettop(L); ! ! // set the table tag ! wxlState.tsettag(m_luaTable_tag); ! ! // prevent changes from Lua scripts ! //wxlState.tsettagmethod(m_luaTable_tag, "__newindex", wxlua_tableErrorHandler); // FIXME allow this? } else { ! // leave the global table on the stack tableOffset = lua_gettop(L); ! // remember the last good binding with the same namespace ! wxLuaBinding* namedBinding = NULL; ! ! // find the m_luaTable_tag of the previously loaded binding (start at last) wxLuaBindingList::compatibility_iterator node = wxlState.GetLuaBindingList()->GetFirst(); for (; node; node = node->GetNext()) --- 614,628 ---- lua_pop(L, 1); // pop the nil value ! // luaI_openlib should have given error message about why it couldn't ! // create the table for us ! return false; } else { ! // leave the table on the stack, it's the one we'll populate tableOffset = lua_gettop(L); ! // Find a registered binding with the same namespace, if any, ! // and share the m_luaTable_tag to that of the previously loaded binding wxLuaBindingList::compatibility_iterator node = wxlState.GetLuaBindingList()->GetFirst(); for (; node; node = node->GetNext()) *************** *** 664,685 **** if ((binding->GetLuaNamespace() == m_nameSpace) && (binding->m_luaTable_tag >= 0)) ! namedBinding = binding; } ! if (namedBinding) ! m_luaTable_tag = namedBinding->m_luaTable_tag; } ! PreRegister(wxlState, registerTypes, tableOffset); // register all our classes etc. in the wxLua table ! RegisterGeneratedClasses(wxlState, tableOffset, registerTypes); ! PostRegister(wxlState, registerTypes, tableOffset); m_bindings_registered = true; ! return tableOffset; } ! void LUACALL wxLuaBinding::RegisterGeneratedClasses(const wxLuaState& wxlState_, int tableOffset, bool registerTypes) { // Replace the metatable functions for the classes we push into Lua --- 631,672 ---- if ((binding->GetLuaNamespace() == m_nameSpace) && (binding->m_luaTable_tag >= 0)) ! { ! m_luaTable_tag = binding->m_luaTable_tag; ! break; ! } } ! // first time adding this namespace table ! if (m_luaTable_tag < 1) ! { ! // create a tag for the wxLua table ! m_luaTable_tag = wxlState.wxluaT_NewTag(); ! ! // set the table tag ! wxlState.wxluaT_SetTag(m_luaTable_tag); ! } } ! PreRegister(wxlState, tableOffset); // register all our classes etc. in the wxLua table ! DoRegisterBinding(wxlState, tableOffset); ! PostRegister(wxlState, tableOffset); ! ! lua_pop(L, 1); // pop the table created above m_bindings_registered = true; ! return true; } ! void wxLuaBinding::UnRegisterBinding(const wxLuaState& wxlState_) ! { ! wxLuaState wxlState(wxlState_); // unconst the state ! wxlState.lua_PushString(m_nameSpace); ! wxlState.lua_PushNil(); ! wxlState.lua_RawSet(LUA_GLOBALSINDEX); ! } ! ! void wxLuaBinding::DoRegisterBinding(const wxLuaState& wxlState_, int tableOffset) { // Replace the metatable functions for the classes we push into Lua *************** *** 697,702 **** lua_State *L = wxlState.GetLuaState(); ! if (registerTypes) ! m_start_tag = wxlState.tnewtag(); int iTag = m_start_tag; --- 684,688 ---- lua_State *L = wxlState.GetLuaState(); ! m_start_tag = wxlState.wxluaT_NewTag(); int iTag = m_start_tag; *************** *** 708,721 **** { // Create a new tag if registering types, else use tag already set ! if (registerTypes) ! { ! iTag = wxlState.tnewtag(); ! *wxlClass->class_tag = iTag; ! } ! else ! iTag = *wxlClass->class_tag; // store a lookup table for the class tags to wxLuaBindClass structs ! wxlua_tget(L, iTag); wxlua_pushkey_metatableClass(L); lua_pushlightuserdata(L, (void *)wxlClass); --- 694,702 ---- { // Create a new tag if registering types, else use tag already set ! iTag = wxlState.wxluaT_NewTag(); ! *wxlClass->class_tag = iTag; // store a lookup table for the class tags to wxLuaBindClass structs ! wxluaT_get(L, iTag); wxlua_pushkey_metatableClass(L); lua_pushlightuserdata(L, (void *)wxlClass); *************** *** 734,738 **** for (size_t i_func = 0; i_func < s_funcCount; ++i_func) { ! wxlState.tsettagmethod(iTag, s_funcTable[i_func].name, s_funcTable[i_func].func, (void *)wxlClass); } --- 715,719 ---- for (size_t i_func = 0; i_func < s_funcCount; ++i_func) { ! wxlState.wxluaT_SetTagMethod(iTag, s_funcTable[i_func].name, s_funcTable[i_func].func, (void *)wxlClass); } *************** *** 906,912 **** if (wxlObject->objPtr != 0) ! wxlState.tpushusertag(wxlObject->objPtr, *wxlObject->class_tag, true); else ! wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag, true); lua_rawset(L, tableOffset); --- 887,893 ---- if (wxlObject->objPtr != 0) ! wxlState.wxluaT_PushUserTag(wxlObject->objPtr, *wxlObject->class_tag, true); else ! wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, true); lua_rawset(L, tableOffset); Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wxlcallb.cpp 7 Aug 2007 20:23:25 -0000 1.41 --- wxlcallb.cpp 17 Nov 2007 00:15:02 -0000 1.42 *************** *** 46,50 **** wxString msg = wxString::Format(wxT("Invalid or unknown wxEventType : %d, winIds %d %d."), (int)eventType, win_id, last_id); ! m_wxlState.terror(msg); return; } --- 46,50 ---- wxString msg = wxString::Format(wxT("Invalid or unknown wxEventType : %d, winIds %d %d."), (int)eventType, win_id, last_id); ! m_wxlState.wxlua_Error(msg); return; } *************** *** 52,56 **** // create a reference to the Lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) ! m_routine = m_wxlState.tinsert(lua_func_stack_idx); m_evtHandler->Connect(win_id, last_id, eventType, --- 52,56 ---- // create a reference to the Lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) ! m_routine = m_wxlState.wxluaT_Insert(lua_func_stack_idx); m_evtHandler->Connect(win_id, last_id, eventType, *************** *** 64,68 **** if (m_wxlState.Ok()) { ! m_wxlState.tremove(m_routine); // delete the reference to this handler m_wxlState.RemoveTrackedCallback(this); --- 64,68 ---- if (m_wxlState.Ok()) { ! m_wxlState.wxluaT_Remove(m_routine); // delete the reference to this handler m_wxlState.RemoveTrackedCallback(this); *************** *** 131,135 **** wxlState.lua_CheckStack(LUA_MINSTACK); int oldTop = wxlState.lua_GetTop(); ! if (wxlState.tget(m_routine)) { wxlState.lua_PushValue(LUA_GLOBALSINDEX); --- 131,135 ---- wxlState.lua_CheckStack(LUA_MINSTACK); int oldTop = wxlState.lua_GetTop(); ! if (wxlState.wxluaT_Get(m_routine)) { wxlState.lua_PushValue(LUA_GLOBALSINDEX); *************** *** 138,149 **** // don't track this since we didn't create it // Tracking this causes clashes in the object registry table ! wxlState.tpushusertag(event, event_tag, false); wxlState.LuaPCall(1, 0); } else ! wxlState.terror("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function is not a Lua function."); } else ! wxlState.terror("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function has been garbage collected."); wxlState.lua_SetTop(oldTop); // pop function from the stack (if it's there) --- 138,149 ---- // don't track this since we didn't create it // Tracking this causes clashes in the object registry table ! wxlState.wxluaT_PushUserTag(event, event_tag, false); wxlState.LuaPCall(1, 0); } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function is not a Lua function."); } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function has been garbage collected."); wxlState.lua_SetTop(oldTop); // pop function from the stack (if it's there) *************** *** 200,204 **** { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxlua_tcleartrackedmetatable(m_wxlState.GetLuaState(), m_window); // Now remove the object since it's gone m_wxlState.RemoveTrackedObject(m_window, wxLuaState::CLEAR_TRACKED_OBJECT|wxLuaState::CLEAR_DERIVED_METHODS); --- 200,204 ---- { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxluaT_cleartrackedmetatable(m_wxlState.GetLuaState(), m_window); // Now remove the object since it's gone m_wxlState.RemoveTrackedObject(m_window, wxLuaState::CLEAR_TRACKED_OBJECT|wxLuaState::CLEAR_DERIVED_METHODS); *************** *** 227,231 **** // remove the ref to the routine since we're clearing the wxLuaState // See ~wxLuaCallback ! m_wxlState.tremove(wxlCallback->GetLuaRoutine()); wxlCallback->ClearwxLuaState(); } --- 227,231 ---- // remove the ref to the routine since we're clearing the wxLuaState // See ~wxLuaCallback ! m_wxlState.wxluaT_Remove(wxlCallback->GetLuaRoutine()); wxlCallback->ClearwxLuaState(); } Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlua_bind.cpp 19 Jul 2007 03:09:47 -0000 1.8 --- wxlua_bind.cpp 17 Nov 2007 00:15:03 -0000 1.9 *************** *** 718,724 **** lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxlState.tpushusertag(wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); --- 718,724 ---- lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxlState.wxluaT_PushUserTag(wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); *************** *** 864,868 **** // this may a wxLua data if (ltype == LUA_TUSERDATA) ! wxluaarg_tag = wxlua_ttag(L, 1); // I guess it wasn't or isn't a userdata --- 864,868 ---- // this may a wxLua data if (ltype == LUA_TUSERDATA) ! wxluaarg_tag = wxluaT_tag(L, 1); // I guess it wasn't or isn't a userdata *************** *** 1020,1027 **** } ! void wxLuaBinding_wxlua::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxlua::PostRegister(const wxLuaState& , bool , int ) { } --- 1020,1027 ---- } ! void wxLuaBinding_wxlua::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxlua::PostRegister(const wxLuaState&, int ) { } |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wxlstack.cpp 8 Nov 2007 23:47:15 -0000 1.16 --- wxlstack.cpp 17 Nov 2007 00:15:07 -0000 1.17 *************** *** 1025,1029 **** { int lua_ref = debugItem->GetReference(); ! int ok = m_wxlState.tremove(lua_ref); debugItem->SetReference(LUA_NOREF); --- 1025,1029 ---- { int lua_ref = debugItem->GetReference(); ! int ok = m_wxlState.wxluaT_Remove(lua_ref); debugItem->SetReference(LUA_NOREF); *************** *** 1039,1043 **** for (i = 0; i < (int)m_luaReferences.GetCount(); ++i) { ! bool ok = m_wxlState.tremove(m_luaReferences[i]); wxCHECK_RET(ok, wxT("Unable to remove a reference in Lua")); //wxPrintf(wxT("Extra Lua reference in listctrl #%d ok %d ref %d count %d\n"), i, ok, m_luaReferences[i], m_luaReferences.GetCount()); --- 1039,1043 ---- for (i = 0; i < (int)m_luaReferences.GetCount(); ++i) { ! bool ok = m_wxlState.wxluaT_Remove(m_luaReferences[i]); wxCHECK_RET(ok, wxT("Unable to remove a reference in Lua")); //wxPrintf(wxT("Extra Lua reference in listctrl #%d ok %d ref %d count %d\n"), i, ok, m_luaReferences[i], m_luaReferences.GetCount()); Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** wxldebug.cpp 8 Nov 2007 23:47:15 -0000 1.46 --- wxldebug.cpp 17 Nov 2007 00:15:07 -0000 1.47 *************** *** 218,222 **** if (lua_istable(L, -1)) { ! nRef = wxlua_tisrefed(L, -1); // don't duplicate refs if (nRef == LUA_NOREF) --- 218,222 ---- if (lua_istable(L, -1)) { ! nRef = wxluaT_isrefed(L, -1); // don't duplicate refs if (nRef == LUA_NOREF) *************** *** 224,228 **** flag_type |= WXLUA_DEBUGITEM_LUAREFED; lua_pushvalue(L, -1); ! nRef = wxlState.tinsert(-1); references.Add(nRef); } --- 224,228 ---- flag_type |= WXLUA_DEBUGITEM_LUAREFED; lua_pushvalue(L, -1); ! nRef = wxlState.wxluaT_Insert(-1); references.Add(nRef); } *************** *** 260,264 **** wxlState.GetGlobals(); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxlua_tinsert(L, -1); Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); --- 260,264 ---- wxlState.GetGlobals(); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxluaT_insert(L, -1); Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); *************** *** 268,272 **** wxlState.lua_PushValue(LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxlua_tinsert(L, -1); Add(new wxLuaDebugItem(wxT("Lua Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); --- 268,272 ---- wxlState.lua_PushValue(LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); ! int nRef = wxluaT_insert(L, -1); Add(new wxLuaDebugItem(wxT("Lua Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); *************** *** 275,279 **** { // push the table onto the stack to iterate through ! if (wxlState.tget(tableRef)) { int nTop = lua_gettop(L); --- 275,279 ---- { // push the table onto the stack to iterate through ! if (wxlState.wxluaT_Get(tableRef)) { int nTop = lua_gettop(L); *************** *** 293,302 **** if (lua_istable(L, -1)) { ! nRef = wxlua_tisrefed(L, -1); // don't duplicate refs if (nRef == LUA_NOREF) { flag_type |= WXLUA_DEBUGITEM_LUAREFED; ! nRef = wxlua_tinsert(L, -1); // pops value references.Add(nRef); } --- 293,302 ---- if (lua_istable(L, -1)) { ! nRef = wxluaT_isrefed(L, -1); // don't duplicate refs if (nRef == LUA_NOREF) { flag_type |= WXLUA_DEBUGITEM_LUAREFED; ! nRef = wxluaT_insert(L, -1); // pops value references.Add(nRef); } *************** *** 405,409 **** lua_State* L = wxlState.GetLuaState(); ! int nTag = wxlua_ttag(L, index); int nItems = luaL_getn(L, index); const void *pItem = lua_topointer(L, index); --- 405,409 ---- lua_State* L = wxlState.GetLuaState(); ! int nTag = wxluaT_tag(L, index); int nItems = luaL_getn(L, index); const void *pItem = lua_topointer(L, index); *************** *** 453,457 **** else // is full userdata { ! int nTag = wxlua_ttag(L, index); if (nTag != WXLUA_NOTAG) --- 453,457 ---- else // is full userdata { ! int nTag = wxluaT_tag(L, index); if (nTag != WXLUA_NOTAG) |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxluasocket/include Modified Files: wxluasocket_bind.h Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxluasocket_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxluasocket_bind.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wxluasocket_bind.h 1 Aug 2007 19:15:38 -0000 1.26 --- wxluasocket_bind.h 17 Nov 2007 00:15:11 -0000 1.27 *************** *** 21,27 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 21,27 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 34,39 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxluasocket) --- 34,39 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxluasocket) |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h wxlua_bind.h Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wxldefs.h 7 Aug 2007 20:23:25 -0000 1.33 --- wxldefs.h 17 Nov 2007 00:15:00 -0000 1.34 *************** *** 67,71 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 17 // ---------------------------------------------------------------------------- --- 67,71 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 18 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** wxlbind.h 8 Nov 2007 23:47:15 -0000 1.62 --- wxlbind.h 17 Nov 2007 00:15:00 -0000 1.63 *************** *** 67,71 **** #define WXLUAARG_TO_POSINDEX(wxlua_arg) (-(wxlua_arg)) ! // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for // common types. The binding generator will use these and generate others // as specified in the bindings. --- 67,71 ---- #define WXLUAARG_TO_POSINDEX(wxlua_arg) (-(wxlua_arg)) ! // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for // common types. The binding generator will use these and generate others // as specified in the bindings. *************** *** 121,125 **** }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc { lua_CFunction func; // C function that implements the method or property --- 121,125 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc { lua_CFunction func; // C function that implements the method or property *************** *** 137,141 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindMethod { const char *name; // name of the method or property --- 137,141 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindMethod { const char *name; // name of the method or property *************** *** 152,156 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindDefine { const char *name; // name --- 152,156 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindDefine { const char *name; // name *************** *** 164,168 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindString { const char *name; // name --- 164,168 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindString { const char *name; // name *************** *** 174,178 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindEvent { const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" --- 174,178 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindEvent { const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" *************** *** 185,189 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindObject { const char *name; // the name of the object or pointer --- 185,189 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindObject { const char *name; // the name of the object or pointer *************** *** 197,201 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char *name; // name of the class --- 197,201 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char *name; // name of the class *************** *** 394,398 **** // Binds C Functions/Defines/Object/Events to namespace Lua Table ! virtual void RegisterBinding(const wxLuaState& wxlState, bool registerTypes); // Unbinds C Functions/Defines/Object/Events by clearing namespace Lua table virtual void UnRegisterBinding(const wxLuaState& wxlState); --- 394,398 ---- // Binds C Functions/Defines/Object/Events to namespace Lua Table ! virtual bool RegisterBinding(const wxLuaState& wxlState); // Unbinds C Functions/Defines/Object/Events by clearing namespace Lua table virtual void UnRegisterBinding(const wxLuaState& wxlState); *************** *** 478,489 **** // to sort the bindings appropriately ! // Registers binding, returns Lua table reference to binding ! virtual int LUACALL RegisterFunctions(const wxLuaState& wxlState, bool registerTypes); ! // Register the classes, definitions, objects and pointers generated by the binding ! // Sort the event list into order for faster event handler processing. ! virtual void LUACALL RegisterGeneratedClasses(const wxLuaState& wxlState, int tableOffset, bool registerTypes); ! virtual void PreRegister(const wxLuaState& WXUNUSED(wxlState), bool WXUNUSED(registerTypes), int WXUNUSED(luaTable)) {} ! virtual void PostRegister(const wxLuaState& WXUNUSED(wxlState), bool WXUNUSED(registerTypes), int WXUNUSED(luaTable)) {} // binding objects --- 478,490 ---- // to sort the bindings appropriately ! // Register the classes, defines, strings, events, objects, and functions generated by the binding ! virtual void DoRegisterBinding(const wxLuaState& wxlState, int tableOffset); ! // Before registering anything from this binding this function is called ! // at the beginning of RegisterBinding(...) ! virtual void PreRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(luaTable)) {} ! // After registering everything from this binding this function is called ! // at the end of RegisterBinding(...) ! virtual void PostRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(luaTable)) {} // binding objects Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** wxlstate.h 4 Sep 2007 22:21:10 -0000 1.94 --- wxlstate.h 17 Nov 2007 00:15:00 -0000 1.95 *************** *** 82,87 **** #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 ! #define WXLUA_METATABLE_TAG 8 ! #define WXLUA_METATABLE_CLASS 9 // Light user data used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. --- 82,87 ---- #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 ! #define WXLUA_METATABLE_TAG 7 ! #define WXLUA_METATABLE_CLASS 8 // Light user data used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. *************** *** 127,134 **** #define wxlua_pushkey_metatableClass(L) lua_pushlightuserdata(L, &wxlua_lreg_metatable_class_key) - //---------------------------------------------------------------------------- - // C functions for Lua used by the wxLuaState - //---------------------------------------------------------------------------- - // ---------------------------------------------------------------------------- // Lua C helper functions - These functions are also part of the wxLuaState --- 127,130 ---- *************** *** 139,196 **** // ---------------------------------------------------------------------------- // Create a reference to the object at stack index in the ! // wxLuaReferences registry table, returns the table index. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tinsert(lua_State* L, int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tremove(lua_State* L, int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tget(lua_State* L, int wxlref_index); ! // Push the errorMsg on the stack and call lua_error ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const char* errorMsg); ! wxLUA_UNICODE_ONLY(inline WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const wxString& errorMsg) { wxlua_terror(L, wx2lua(errorMsg)); }) // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the // tag is known and the metatable was set. If track=true then push the // object as a lightuser data key into the wxlua_pushkey_wxLuaObjects table of // the Lua registry so that if we need to push it again we just push the full // userdata value. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag, bool track); ! // If an object was pushed into Lua using wxlua_tpushusertag with track=true // then this function will remove the object from being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tuntrackuserdata(lua_State* L, const void* u); ! // If an object was pushed into Lua using wxlua_tpushusertag with track=true // then this function will remove the metable of the object being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tcleartrackedmetatable(lua_State* L, const void* u); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_ttag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the pointer wrapped // by Lua's userdata to NULL to clear it. ! WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from tinsert // and store it in the wxLuaReferences registry table. ! // Returns the index into the ref table, the "tag" from tinsert. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is tinsert into the wxLuaReferences // registry table. Returns the created index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to the table stored in the ! // wxLuaReferences registry table using tget(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // If pClass is non-null set the upvalue of the function to the supplied wxLuaBindClass. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettagmethod(lua_State* L, int tag, const char* method, lua_CFunction func, void* pClass = NULL); // Is the item at the stack_idx in the wxLuaReferences table already? // returns the tag or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tisrefed(lua_State* L, int stack_idx); // ---------------------------------------------------------------------------- --- 135,199 ---- // ---------------------------------------------------------------------------- + // Push the errorMsg on the stack and call luaL_error + WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const char* errorMsg); + wxLUA_UNICODE_ONLY(inline WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const wxString& errorMsg) { wxlua_error(L, wx2lua(errorMsg)); }) + + //---------------------------------------------------------------------------- + // wxluaT_XXX - the 'T' stands for Tag which is a numerical index in the + // Lua registry table for determining userdata type (it's class) + //---------------------------------------------------------------------------- + // Create a reference to the object at stack index in the ! // wxLuaReferences registry table, returns the table index or LUA_REFNIL ! // if the item on the stack is none or nil (an error). ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_insert(lua_State* L, int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_remove(lua_State* L, int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_get(lua_State* L, int wxlref_index); // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from wxluaT_get(tag). Returns true if the // tag is known and the metatable was set. If track=true then push the // object as a lightuser data key into the wxlua_pushkey_wxLuaObjects table of // the Lua registry so that if we need to push it again we just push the full // userdata value. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_pushusertag(lua_State* L, const void* u, int tag, bool track); ! // If an object was pushed into Lua using wxluaT_pushusertag with track=true // then this function will remove the object from being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaT_untrackuserdata(lua_State* L, const void* u); ! // If an object was pushed into Lua using wxluaT_pushusertag with track=true // then this function will remove the metable of the object being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaT_cleartrackedmetatable(lua_State* L, const void* u); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_tag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the pointer wrapped // by Lua's userdata to NULL to clear it. ! WXDLLIMPEXP_WXLUA void* LUACALL wxlua_touserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from wxluaT_insert // and store it in the wxLuaReferences registry table. ! // Returns the index into the ref table, the "tag" from wxluaT_insert. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is wxluaT_insert into the wxLuaReferences // registry table. Returns the created index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newweaktag(lua_State* L, bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to the table stored in the ! // wxLuaReferences registry table using wxluaT_get(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // If pClass is non-null set the upvalue of the function to the supplied wxLuaBindClass. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settagmethod(lua_State* L, int tag, const char* method, lua_CFunction func, void* pClass = NULL); // Is the item at the stack_idx in the wxLuaReferences table already? // returns the tag or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_isrefed(lua_State* L, int stack_idx); // ---------------------------------------------------------------------------- *************** *** 201,208 **** // Gets the wxLuaBindClass from the metatable stored in the wxLuaReferences registry table // for the classes that have been installed into Lua. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, int class_tag); // Get the wxLuaBindClass* for this class_name or NULL if the name is invalid. // Gets the wxLuaBindClass from the "wxLuaClasses" table in the Lua registry. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, const char* class_name); // Is a class with the class_tag equal to or derived from a class with the base_class_tag. // 0 means same class, +1 means base is parent, +2 base is grandparent, ... --- 204,211 ---- // Gets the wxLuaBindClass from the metatable stored in the wxLuaReferences registry table // for the classes that have been installed into Lua. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, int class_tag); // Get the wxLuaBindClass* for this class_name or NULL if the name is invalid. // Gets the wxLuaBindClass from the "wxLuaClasses" table in the Lua registry. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, const char* class_name); // Is a class with the class_tag equal to or derived from a class with the base_class_tag. // 0 means same class, +1 means base is parent, +2 base is grandparent, ... *************** *** 248,252 **** // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_terror with a message that is appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) // Note: The function wxLuaState::GetwxStringType does automatic conversion --- 251,255 ---- // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_error with a message that is appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) // Note: The function wxLuaState::GetwxStringType does automatic conversion *************** *** 449,454 **** // ----------------------------------------------------------------------- ! // Destroy the refed data, use this instead of wxObject::UnRef(). ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. // Note: if you have a top level window (wxFrame) open in Lua and exit the --- 452,457 ---- // ----------------------------------------------------------------------- ! // Destroy the refed data, use this instead of wxObject::UnRef(). ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. // Note: if you have a top level window (wxFrame) open in Lua and exit the *************** *** 461,465 **** // Close the lua_State and if 'force' close all attached wxWindows // if !force then popup a dialog to ask if windows should be destroyed. ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. bool CloseLuaState(bool force); --- 464,468 ---- // Close the lua_State and if 'force' close all attached wxWindows // if !force then popup a dialog to ask if windows should be destroyed. ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. bool CloseLuaState(bool force); *************** *** 546,550 **** // Break a currently running Lua program by setting the Lua debug hook to // be called for anything and breaking as soon as possible by calling ! // terror() with the message void DebugHookBreak(const wxString &message = wxT("Lua interpreter stopped")); // Clear a previously set DebugHookBreak(), resetting the debug hook --- 549,553 ---- // Break a currently running Lua program by setting the Lua debug hook to // be called for anything and breaking as soon as possible by calling ! // wxlua_error() with the message void DebugHookBreak(const wxString &message = wxT("Lua interpreter stopped")); // Clear a previously set DebugHookBreak(), resetting the debug hook *************** *** 584,588 **** // Register all the bindings in the wxLuaStateData, this is done // automatically by default on creation. (internal use) ! void RegisterBindings(bool registerTypes); // Get the installed wxLuaBinding with the given --- 587,591 ---- // Register all the bindings in the wxLuaStateData, this is done // automatically by default on creation. (internal use) ! void RegisterBindings(); // Get the installed wxLuaBinding with the given *************** *** 610,614 **** // Get the wxLuaBinding list of classes/objects installed into Lua. ! // You may add or remove bindings before the creation of any wxLuaStates // or once they have all been Destroy()ed. However, while any wxLuaStates // are created they must have the same bindings in the same order! --- 613,617 ---- // Get the wxLuaBinding list of classes/objects installed into Lua. ! // You may add or remove bindings before the creation of any wxLuaStates // or once they have all been Destroy()ed. However, while any wxLuaStates // are created they must have the same bindings in the same order! *************** *** 684,726 **** // ----------------------------------------------------------------------- // wxLua Lua Registry Table Functions // Create a reference to the object at stack index in the // wxLuaReferences registry table, returns the table index. ! int tinsert(int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! bool tremove(int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! bool tget(int wxlref_index); ! // Push the errorMsg on the stack and call lua_error ! void terror(const char *errorMsg) const; ! wxLUA_UNICODE_ONLY(void terror(const wxString& errorMsg) const { terror(wx2lua(errorMsg)); }) // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the // tag is known and the metatable was set. ! bool tpushusertag(const void *u, int tag, bool track); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! int ttag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in Lua to NULL so that Lua won't gc it. ! void* ttouserdata(int stack_idx, bool null_ptr = false) const; ! // Create a new table (metatable) tinsert it into the wxLuaReferences registry table // and return its index into the ref table. ! int tnewtag(); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is tinsert into the wxLuaReferences // registry table and return its index into the ref table. ! int tnewweaktag(bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to tget(tag) ! bool tsettag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class ! bool tsettagmethod(int tag, const char *method, lua_CFunction func, void *pClass = NULL); // ----------------------------------------------------------------------- --- 687,732 ---- // ----------------------------------------------------------------------- + + // Push the errorMsg on the stack and call wxlua_error() + void wxlua_Error(const char *errorMsg) const; + wxLUA_UNICODE_ONLY(void wxlua_Error(const wxString& errorMsg) const { wxlua_Error(wx2lua(errorMsg)); }) + + // ----------------------------------------------------------------------- // wxLua Lua Registry Table Functions // Create a reference to the object at stack index in the // wxLuaReferences registry table, returns the table index. ! int wxluaT_Insert(int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! bool wxluaT_Remove(int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! bool wxluaT_Get(int wxlref_index); // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from wxluaT_Get(tag). Returns true if the // tag is known and the metatable was set. ! bool wxluaT_PushUserTag(const void *u, int tag, bool track); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! int wxluaT_Tag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in Lua to NULL so that Lua won't gc it. ! void* wxlua_ToUserdata(int stack_idx, bool null_ptr = false) const; ! // Create a new table (metatable) wxluaT_Insert it into the wxLuaReferences registry table // and return its index into the ref table. ! int wxluaT_NewTag(); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is wxluaT_Insert into the wxLuaReferences // registry table and return its index into the ref table. ! int wxluaT_NewWeakTag(bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to wxluaT_Get(tag) ! bool wxluaT_SetTag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class ! bool wxluaT_SetTagMethod(int tag, const char *method, lua_CFunction func, void *pClass = NULL); // ----------------------------------------------------------------------- *************** *** 739,743 **** // system allocated tag. // If the data type does not have the correct tag, or if the parameter ! // stack_idx is nil, NULL is returned, otherwise terror is called. void* GetUserDataType(int stack_idx, int iTag) const; // Push a data type onto the stack and set its tag --- 745,749 ---- // system allocated tag. // If the data type does not have the correct tag, or if the parameter ! // stack_idx is nil, NULL is returned, otherwise wxlua_error is called. void* GetUserDataType(int stack_idx, int iTag) const; // Push a data type onto the stack and set its tag *************** *** 748,752 **** // Validate that the object at the stack index specified is a string object // or that the object can be converted to a string and return the string, ! // calls terror if the value is not of the right type. const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be --- 754,758 ---- // Validate that the object at the stack index specified is a string object // or that the object can be converted to a string and return the string, ! // calls wxlua_error if the value is not of the right type. const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be *************** *** 755,767 **** // Validate that the object at the stack index specified is a boolean object // or that the object can be converted to a boolean and return the boolean. ! // calls terror if the value is not of the right type. bool GetBooleanType(int stack_idx); // Validate that the object at the stack index specified is an integer object // or that the object can be converted to an integer and return the integer value. ! // calls terror if the value is not of the right type. long GetIntegerType(int stack_idx); // Validate that the object at the stack index specified is a number object // or that the object can be converted to a number and return the number value. ! // calls terror if the value is not of the right type. double GetNumberType(int stack_idx); --- 761,773 ---- // Validate that the object at the stack index specified is a boolean object // or that the object can be converted to a boolean and return the boolean. ! // calls wxlua_error if the value is not of the right type. bool GetBooleanType(int stack_idx); // Validate that the object at the stack index specified is an integer object // or that the object can be converted to an integer and return the integer value. ! // calls wxlua_error if the value is not of the right type. long GetIntegerType(int stack_idx); // Validate that the object at the stack index specified is a number object // or that the object can be converted to a number and return the number value. ! // calls wxlua_error if the value is not of the right type. double GetNumberType(int stack_idx); Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxlua_bind.h 1 Aug 2007 19:15:37 -0000 1.5 --- wxlua_bind.h 17 Nov 2007 00:15:01 -0000 1.6 *************** *** 17,23 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 17,23 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 30,35 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) --- 30,35 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) |
From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/docs Modified Files: changelog.txt Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: changelog.txt =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/changelog.txt,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** changelog.txt 10 Aug 2007 21:23:38 -0000 1.45 --- changelog.txt 17 Nov 2007 00:14:55 -0000 1.46 *************** *** 2,5 **** --- 2,17 ---- =============== + version 2.8.6.0 + -------------------------------------------------------------------- + + - Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool + "registerClasses" since it didn't do anything useful anyway. + If there needs to be a way to reregister the wxLua functions it should + to be implemented from the ground up. + - Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to + search for their usage. The functions in the wxLuaState used to be + called just "txxx" and are now called wxluaT_Xxx where the first + letter or each word is capitalized (camel-case); again for searching. + version 2.8.4.2 -------------------------------------------------------------------- *************** *** 9,22 **** - Allow bool = 1/0 and 1/0 = bool in wxlua_getboolean/integer/number. ! - Fix bug in prematurely garbage collecting userdata. ! The userdata was previously keyed on the pointer to the data instead of a pointer to the Lua userdata that wraps the data. - Moved wxLUA_VERSION... bindings into the 'wxlua' table. ! - Applied patch to lparser.c "Too many variables in an assignment may cause a C stack overflow" - Streamline creation of a wxLuaState and finding the wxLuaState from an existing lua_State, ! See wxlstate.h for changes to the enum WXLUASTATE_ATTACH/SETSTATE ! to be more complete. version 2.8.4.1 --- 21,34 ---- - Allow bool = 1/0 and 1/0 = bool in wxlua_getboolean/integer/number. ! - Fix bug in prematurely garbage collecting userdata. ! The userdata was previously keyed on the pointer to the data instead of a pointer to the Lua userdata that wraps the data. - Moved wxLUA_VERSION... bindings into the 'wxlua' table. ! - Applied patch to lparser.c "Too many variables in an assignment may cause a C stack overflow" - Streamline creation of a wxLuaState and finding the wxLuaState from an existing lua_State, ! See wxlstate.h for changes to the enum WXLUASTATE_ATTACH/SETSTATE ! to be more complete. version 2.8.4.1 |
From: John L. <jr...@us...> - 2007-11-17 00:16:52
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/bindings Modified Files: genwxbind.lua Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** genwxbind.lua 8 Nov 2007 00:06:38 -0000 1.149 --- genwxbind.lua 17 Nov 2007 00:14:54 -0000 1.150 *************** *** 18,22 **** -- --------------------------------------------------------------------------- ! WXLUA_BINDING_VERSION = 17 -- Used to verify that the bindings are updated -- This must match modules/wxlua/include/wxldefs.h -- otherwise a compile time error will be generated. --- 18,22 ---- -- --------------------------------------------------------------------------- ! WXLUA_BINDING_VERSION = 18 -- Used to verify that the bindings are updated -- This must match modules/wxlua/include/wxldefs.h -- otherwise a compile time error will be generated. *************** *** 3179,3183 **** argItem = "("..argTypeWithAttrib..") wxlState.GetUserDataType("..argNum..", s_wxluatag_"..MakeClassVar(argType)..")" else ! argItem = "("..argTypeWithAttrib..") wxlState.ttouserdata("..argNum..")" end elseif (indirectionCount == 1) and (argPtr == "*") then --- 3179,3183 ---- argItem = "("..argTypeWithAttrib..") wxlState.GetUserDataType("..argNum..", s_wxluatag_"..MakeClassVar(argType)..")" else ! argItem = "("..argTypeWithAttrib..") wxlState.wxlua_ToUserdata("..argNum..")" end elseif (indirectionCount == 1) and (argPtr == "*") then *************** *** 3220,3224 **** else overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " ! argItem = "("..argTypeWithAttrib..")wxlState.ttouserdata("..argNum..")" end --- 3220,3224 ---- else overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " ! argItem = "("..argTypeWithAttrib..")wxlState.wxlua_ToUserdata("..argNum..")" end *************** *** 3242,3246 **** overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " argTypeWithAttrib = argTypeWithAttrib.." *" ! argItem = "("..argTypeWithAttrib..")wxlState.ttouserdata("..argNum..")" end elseif (indirectionCount == 1) and (argPtr == "&") then --- 3242,3246 ---- overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " argTypeWithAttrib = argTypeWithAttrib.." *" ! argItem = "("..argTypeWithAttrib..")wxlState.wxlua_ToUserdata("..argNum..")" end elseif (indirectionCount == 1) and (argPtr == "&") then *************** *** 3266,3270 **** else overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " ! argItem = "("..argTypeWithAttrib..")wxlState.ttouserdata("..argNum..")" end --- 3266,3270 ---- else overload_argList = overload_argList.."&s_wxluaarg_LightUserData, " ! argItem = "("..argTypeWithAttrib..")wxlState.wxlua_ToUserdata("..argNum..")" end *************** *** 4009,4014 **** table.insert(fileData, "\n") table.insert(fileData, "protected:\n") ! table.insert(fileData, " virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable);\n") ! table.insert(fileData, " virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable);\n") table.insert(fileData, "\n") table.insert(fileData, " DECLARE_DYNAMIC_CLASS("..hook_cpp_binding_classname..")\n") --- 4009,4014 ---- 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") *************** *** 4226,4232 **** -- 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, bool registerTypes, int luaTable)\n") else ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PreRegister(const wxLuaState& , bool , int )\n") end table.insert(fileData, "{\n") --- 4226,4232 ---- -- 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") *************** *** 4235,4241 **** -- 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, bool registerTypes, int luaTable)\n") else ! table.insert(fileData, "void "..hook_cpp_binding_classname.."::PostRegister(const wxLuaState& , bool , int )\n") end table.insert(fileData, "{\n") --- 4235,4241 ---- -- 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") |
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxbind/src Modified Files: wxadv_bind.cpp wxaui_aui.cpp wxaui_bind.cpp wxbase_bind.cpp wxbase_data.cpp wxcore_bind.cpp wxcore_controls.cpp wxcore_event.cpp wxcore_gdi.cpp wxcore_image.cpp wxcore_wxlprint.cpp wxgl_bind.cpp wxhtml_bind.cpp wxhtml_html.cpp wxhtml_wxlhtmlwin.cpp wxmedia_bind.cpp wxnet_bind.cpp wxrichtext_bind.cpp wxstc_bind.cpp wxstc_stc.cpp wxxml_bind.cpp wxxrc_bind.cpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxstc_stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_stc.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxstc_stc.cpp 1 Aug 2007 19:15:37 -0000 1.3 --- wxstc_stc.cpp 17 Nov 2007 00:15:00 -0000 1.4 *************** *** 35,39 **** wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.ttouserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); --- 35,39 ---- wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.wxlua_ToUserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); *************** *** 4861,4865 **** wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.ttouserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); --- 4861,4865 ---- wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.wxlua_ToUserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); *************** *** 5388,5392 **** wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.ttouserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); --- 5388,5392 ---- wxLuaState wxlState(L); // void docPointer ! void * docPointer = (void *)wxlState.wxlua_ToUserdata(2); // get this wxStyledTextCtrl * self = (wxStyledTextCtrl *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextCtrl); Index: wxhtml_html.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxhtml_html.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxhtml_html.cpp 1 Aug 2007 19:15:36 -0000 1.3 --- wxhtml_html.cpp 17 Nov 2007 00:14:59 -0000 1.4 *************** *** 166,170 **** default: ! wxlState.terror("wxLua: Expected simple type for parameter 3."); break; } --- 166,170 ---- default: ! wxlState.wxlua_Error("wxLua: Expected simple type for parameter 3."); break; } Index: wxcore_event.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_event.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_event.cpp 1 Aug 2007 19:15:35 -0000 1.3 --- wxcore_event.cpp 17 Nov 2007 00:14:58 -0000 1.4 *************** *** 95,99 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 95,99 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 104,108 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 104,108 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 120,124 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 120,124 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 143,147 **** else { ! wxlState.terror("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } --- 143,147 ---- else { ! wxlState.wxlua_Error("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } *************** *** 151,155 **** default: { ! wxlState.terror("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } --- 151,155 ---- default: { ! wxlState.wxlua_Error("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } *************** *** 158,162 **** if (!lua_isfunction(L, func_idx)) { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; --- 158,162 ---- if (!lua_isfunction(L, func_idx)) { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; *************** *** 167,171 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 167,171 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; *************** *** 212,216 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 212,216 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 221,225 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 221,225 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 236,240 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 236,240 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 251,255 **** default: { ! wxlState.terror("wxLua: Disconnect: Incorrect number of parameters."); return 0; } --- 251,255 ---- default: { ! wxlState.wxlua_Error("wxLua: Disconnect: Incorrect number of parameters."); return 0; } *************** *** 260,264 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 260,264 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; Index: wxcore_gdi.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_gdi.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxcore_gdi.cpp 8 Nov 2007 00:06:39 -0000 1.4 --- wxcore_gdi.cpp 17 Nov 2007 00:14:58 -0000 1.5 *************** *** 7670,7674 **** size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.terror("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); --- 7670,7674 ---- size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.wxlua_Error("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); Index: wxaui_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxaui_bind.cpp 16 Jul 2007 19:35:17 -0000 1.1 --- wxaui_bind.cpp 17 Nov 2007 00:14:57 -0000 1.2 *************** *** 266,273 **** } ! void wxLuaBinding_wxaui::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxaui::PostRegister(const wxLuaState& , bool , int ) { } --- 266,273 ---- } ! void wxLuaBinding_wxaui::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxaui::PostRegister(const wxLuaState&, int ) { } Index: wxhtml_wxlhtmlwin.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxhtml_wxlhtmlwin.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxhtml_wxlhtmlwin.cpp 31 Jul 2007 23:30:57 -0000 1.3 --- wxhtml_wxlhtmlwin.cpp 17 Nov 2007 00:15:00 -0000 1.4 *************** *** 60,68 **** lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.tpushusertag(cell, s_wxluatag_wxHtmlCell, true); lua_pushnumber(L, x); lua_pushnumber(L, y); ! m_wxlState.tpushusertag((void *) &event, s_wxluatag_wxMouseEvent, true); m_wxlState.LuaPCall(5, 1); --- 60,68 ---- lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.wxluaT_PushUserTag(cell, s_wxluatag_wxHtmlCell, true); lua_pushnumber(L, x); lua_pushnumber(L, y); ! m_wxlState.wxluaT_PushUserTag((void *) &event, s_wxluatag_wxMouseEvent, true); m_wxlState.LuaPCall(5, 1); *************** *** 99,104 **** lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.tpushusertag(cell, s_wxluatag_wxHtmlCell, true); lua_pushnumber(L, x); lua_pushnumber(L, y); --- 99,104 ---- lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.wxluaT_PushUserTag(cell, s_wxluatag_wxHtmlCell, true); lua_pushnumber(L, x); lua_pushnumber(L, y); *************** *** 120,125 **** lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.tpushusertag((void *) &link, s_wxluatag_wxHtmlLinkInfo, true); m_wxlState.LuaPCall(2, 0); --- 120,125 ---- lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaHtmlWindow, true); ! m_wxlState.wxluaT_PushUserTag((void *) &link, s_wxluatag_wxHtmlLinkInfo, true); m_wxlState.LuaPCall(2, 0); *************** *** 139,143 **** lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaHtmlWindow, true); m_wxlState.lua_PushString(title); --- 139,143 ---- lua_State *L = m_wxlState.GetLuaState(); int nOldTop = lua_gettop(L); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaHtmlWindow, true); m_wxlState.lua_PushString(title); Index: wxaui_aui.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_aui.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxaui_aui.cpp 8 Nov 2007 00:06:38 -0000 1.4 --- wxaui_aui.cpp 17 Nov 2007 00:14:57 -0000 1.5 *************** *** 1139,1143 **** wxLuaState wxlState(L); // int x_extent ! int * x_extent = (int *)wxlState.ttouserdata(9); // wxRect out_button_rect wxRect * out_button_rect = (wxRect *)wxlState.GetUserDataType(8, s_wxluatag_wxRect); --- 1139,1143 ---- wxLuaState wxlState(L); // int x_extent ! int * x_extent = (int *)wxlState.wxlua_ToUserdata(9); // wxRect out_button_rect wxRect * out_button_rect = (wxRect *)wxlState.GetUserDataType(8, s_wxluatag_wxRect); *************** *** 1220,1224 **** wxSize *returns; // int x_extent ! int * x_extent = (int *)wxlState.ttouserdata(8); // int close_button_state int close_button_state = (int)wxlua_getnumbertype(L, 7); --- 1220,1224 ---- wxSize *returns; // int x_extent ! int * x_extent = (int *)wxlState.wxlua_ToUserdata(8); // int close_button_state int close_button_state = (int)wxlua_getnumbertype(L, 7); *************** *** 5912,5918 **** wxLuaState wxlState(L); // double height_pct ! double * height_pct = (double *)wxlState.ttouserdata(3); // double width_pct ! double * width_pct = (double *)wxlState.ttouserdata(2); // get this wxAuiManager * self = (wxAuiManager *)wxlState.GetUserDataType(1, s_wxluatag_wxAuiManager); --- 5912,5918 ---- wxLuaState wxlState(L); // double height_pct ! double * height_pct = (double *)wxlState.wxlua_ToUserdata(3); // double width_pct ! double * width_pct = (double *)wxlState.wxlua_ToUserdata(2); // get this wxAuiManager * self = (wxAuiManager *)wxlState.GetUserDataType(1, s_wxluatag_wxAuiManager); Index: wxxrc_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxrc_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxxrc_bind.cpp 16 Jul 2007 19:35:23 -0000 1.1 --- wxxrc_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 157,164 **** } ! void wxLuaBinding_wxxrc::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxxrc::PostRegister(const wxLuaState& , bool , int ) { } --- 157,164 ---- } ! void wxLuaBinding_wxxrc::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxxrc::PostRegister(const wxLuaState&, int ) { } Index: wxgl_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxgl_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxgl_bind.cpp 16 Jul 2007 19:35:21 -0000 1.1 --- wxgl_bind.cpp 17 Nov 2007 00:14:59 -0000 1.2 *************** *** 171,178 **** } ! void wxLuaBinding_wxgl::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxgl::PostRegister(const wxLuaState& , bool , int ) { } --- 171,178 ---- } ! void wxLuaBinding_wxgl::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxgl::PostRegister(const wxLuaState&, int ) { } Index: wxmedia_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxmedia_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxmedia_bind.cpp 16 Jul 2007 19:35:22 -0000 1.1 --- wxmedia_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 201,208 **** } ! void wxLuaBinding_wxmedia::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxmedia::PostRegister(const wxLuaState& , bool , int ) { } --- 201,208 ---- } ! void wxLuaBinding_wxmedia::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxmedia::PostRegister(const wxLuaState&, int ) { } Index: wxcore_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxcore_bind.cpp 7 Aug 2007 20:23:25 -0000 1.4 --- wxcore_bind.cpp 17 Nov 2007 00:14:58 -0000 1.5 *************** *** 3849,3853 **** // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.ttouserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); --- 3849,3853 ---- // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.wxluaT_ToUserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); *************** *** 5154,5158 **** } ! void wxLuaBinding_wxcore::PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable) { #if defined(__MINGW32__) || defined(__GNUWIN32__) --- 5154,5158 ---- } ! void wxLuaBinding_wxcore::PreRegister(const wxLuaState& wxlState, int luaTable) { #if defined(__MINGW32__) || defined(__GNUWIN32__) *************** *** 5210,5214 **** } } ! void wxLuaBinding_wxcore::PostRegister(const wxLuaState& , bool , int ) { } --- 5210,5214 ---- } } ! void wxLuaBinding_wxcore::PostRegister(const wxLuaState&, int ) { } Index: wxcore_controls.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_controls.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_controls.cpp 1 Aug 2007 19:15:35 -0000 1.3 --- wxcore_controls.cpp 17 Nov 2007 00:14:58 -0000 1.4 *************** *** 4540,4544 **** } else ! wxlState.terror(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this --- 4540,4544 ---- } else ! wxlState.wxlua_Error(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this Index: wxxml_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxml_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxxml_bind.cpp 16 Jul 2007 19:35:23 -0000 1.1 --- wxxml_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 169,176 **** } ! void wxLuaBinding_wxxml::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxxml::PostRegister(const wxLuaState& , bool , int ) { } --- 169,176 ---- } ! void wxLuaBinding_wxxml::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxxml::PostRegister(const wxLuaState&, int ) { } Index: wxbase_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_bind.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxbase_bind.cpp 19 Jul 2007 03:09:46 -0000 1.2 --- wxbase_bind.cpp 17 Nov 2007 00:14:57 -0000 1.3 *************** *** 2487,2494 **** } ! void wxLuaBinding_wxbase::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxbase::PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable) { wxLuaState wxLS(wxlState); --- 2487,2494 ---- } ! void wxLuaBinding_wxbase::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxbase::PostRegister(const wxLuaState& wxlState, int luaTable) { wxLuaState wxLS(wxlState); *************** *** 2496,2504 **** lua_State* L = wxLS.GetLuaState(); ! if (registerTypes) ! g_wxluatag_NULL = wxLS.tnewtag(); lua_pushlstring(L, "NULL", 4); ! wxLS.tpushusertag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); } --- 2496,2503 ---- lua_State* L = wxLS.GetLuaState(); ! g_wxluatag_NULL = wxLS.wxluaT_NewTag(); lua_pushlstring(L, "NULL", 4); ! wxLS.wxluaT_PushUserTag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); } Index: wxstc_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxstc_bind.cpp 16 Jul 2007 19:35:23 -0000 1.1 --- wxstc_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 1536,1543 **** } ! void wxLuaBinding_wxstc::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxstc::PostRegister(const wxLuaState& , bool , int ) { } --- 1536,1543 ---- } ! void wxLuaBinding_wxstc::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxstc::PostRegister(const wxLuaState&, int ) { } Index: wxcore_wxlprint.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_wxlprint.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_wxlprint.cpp 19 Jul 2007 03:09:46 -0000 1.2 --- wxcore_wxlprint.cpp 17 Nov 2007 00:14:59 -0000 1.3 *************** *** 56,60 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 4); --- 56,60 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 4); *************** *** 86,90 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(pageNum); --- 86,90 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(pageNum); *************** *** 135,139 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(startPage); m_wxlState.lua_PushNumber(endPage); --- 135,139 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(startPage); m_wxlState.lua_PushNumber(endPage); *************** *** 164,168 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); --- 164,168 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); *************** *** 180,184 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); --- 180,184 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); *************** *** 196,200 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); --- 196,200 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); *************** *** 212,216 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); --- 212,216 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.LuaPCall(1, 0); m_wxlState.lua_SetTop(nOldTop); *************** *** 230,234 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(pageNum); --- 230,234 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushNumber(pageNum); *************** *** 252,256 **** { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.tpushusertag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushString(val); --- 252,256 ---- { int nOldTop = m_wxlState.lua_GetTop(); ! m_wxlState.wxluaT_PushUserTag(this, s_wxluatag_wxLuaPrintout, true); m_wxlState.lua_PushString(val); Index: wxhtml_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxhtml_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxhtml_bind.cpp 16 Jul 2007 19:35:21 -0000 1.1 --- wxhtml_bind.cpp 17 Nov 2007 00:14:59 -0000 1.2 *************** *** 242,249 **** } ! void wxLuaBinding_wxhtml::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxhtml::PostRegister(const wxLuaState& , bool , int ) { } --- 242,249 ---- } ! void wxLuaBinding_wxhtml::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxhtml::PostRegister(const wxLuaState&, int ) { } Index: wxcore_image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_image.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_image.cpp 1 Aug 2007 19:15:36 -0000 1.3 --- wxcore_image.cpp 17 Nov 2007 00:14:58 -0000 1.4 *************** *** 1449,1453 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image --- 1449,1453 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image *************** *** 1495,1499 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image --- 1495,1499 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image *************** *** 2456,2460 **** static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_terror(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* --- 2456,2460 ---- static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_error(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* Index: wxnet_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxnet_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxnet_bind.cpp 16 Jul 2007 19:35:23 -0000 1.1 --- wxnet_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 247,254 **** } ! void wxLuaBinding_wxnet::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxnet::PostRegister(const wxLuaState& , bool , int ) { } --- 247,254 ---- } ! void wxLuaBinding_wxnet::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxnet::PostRegister(const wxLuaState&, int ) { } Index: wxbase_data.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_data.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxbase_data.cpp 1 Aug 2007 19:15:35 -0000 1.4 --- wxbase_data.cpp 17 Nov 2007 00:14:58 -0000 1.5 *************** *** 610,614 **** { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.ttouserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); --- 610,614 ---- { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.wxlua_ToUserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); *************** *** 617,632 **** if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.tsettag(*pClass->class_tag); iResult = 1; } else ! wxlState.terror("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.terror("wxObject:DynamicCast: Class not found."); } else ! wxlState.terror("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; --- 617,632 ---- if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.wxluaT_SetTag(*pClass->class_tag); iResult = 1; } else ! wxlState.wxlua_Error("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.wxlua_Error("wxObject:DynamicCast: Class not found."); } else ! wxlState.wxlua_Error("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; Index: wxadv_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxadv_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxadv_bind.cpp 16 Jul 2007 19:35:15 -0000 1.1 --- wxadv_bind.cpp 17 Nov 2007 00:14:57 -0000 1.2 *************** *** 465,472 **** } ! void wxLuaBinding_wxadv::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxadv::PostRegister(const wxLuaState& , bool , int ) { } --- 465,472 ---- } ! void wxLuaBinding_wxadv::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxadv::PostRegister(const wxLuaState&, int ) { } Index: wxrichtext_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxrichtext_bind.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxrichtext_bind.cpp 16 Jul 2007 19:35:23 -0000 1.1 --- wxrichtext_bind.cpp 17 Nov 2007 00:15:00 -0000 1.2 *************** *** 156,163 **** } ! void wxLuaBinding_wxrichtext::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxrichtext::PostRegister(const wxLuaState& , bool , int ) { } --- 156,163 ---- } ! void wxLuaBinding_wxrichtext::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxrichtext::PostRegister(const wxLuaState&, int ) { } |
From: John L. <jr...@us...> - 2007-11-17 00:16:33
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlua.i 15 Oct 2007 21:27:42 -0000 1.8 --- wxlua.i 17 Nov 2007 00:14:55 -0000 1.9 *************** *** 102,106 **** // Given any type of object, returns four values: // wxlua name of the type - wxLuaState::GetLuaTagName(wxlua_type) ! // wxlua number of the type - wxlua_getwxluatype(lua_type(L, stack_idx)) or wxlua_ttag // lua name of the type - lua_typename(L, lua_type(L, stack_idx)) // lua number of the type - lua_type(L, stack_idx) --- 102,106 ---- // Given any type of object, returns four values: // wxlua name of the type - wxLuaState::GetLuaTagName(wxlua_type) ! // wxlua number of the type - wxlua_getwxluatype(lua_type(L, stack_idx)) or wxluaT_tag // lua name of the type - lua_typename(L, lua_type(L, stack_idx)) // lua number of the type - lua_type(L, stack_idx) Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** override.hpp 19 Jul 2007 03:09:45 -0000 1.7 --- override.hpp 17 Nov 2007 00:14:55 -0000 1.8 *************** *** 133,137 **** // this may a wxLua data if (ltype == LUA_TUSERDATA) ! wxluaarg_tag = wxlua_ttag(L, 1); // I guess it wasn't or isn't a userdata --- 133,137 ---- // this may a wxLua data if (ltype == LUA_TUSERDATA) ! wxluaarg_tag = wxluaT_tag(L, 1); // I guess it wasn't or isn't a userdata *************** *** 735,741 **** lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxlState.tpushusertag(wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); --- 735,741 ---- lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxlState.wxluaT_PushUserTag(wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); |
From: John L. <jr...@us...> - 2007-11-17 00:16:32
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h wxlstack.h Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** wxldebug.h 8 Nov 2007 23:47:15 -0000 1.40 --- wxldebug.h 17 Nov 2007 00:15:07 -0000 1.41 *************** *** 30,34 **** WXLUA_DEBUGITEM_EXPANDED = 0x0400, // for wxLuaStackDialog WXLUA_DEBUGITEM_LUAREFED = 0x0800 // This item was created with a ! // new tinsert() reference // rather than using an existing one. }; --- 30,34 ---- WXLUA_DEBUGITEM_EXPANDED = 0x0400, // for wxLuaStackDialog WXLUA_DEBUGITEM_LUAREFED = 0x0800 // This item was created with a ! // new wxluaT_insert() reference // rather than using an existing one. }; *************** *** 54,61 **** int GetValueType() const { return m_itemValueType; } wxString GetValueTypeString() const { return wxlua_getwxluatypename(m_itemValueType); } ! wxString GetSource() const { return m_itemSource; } ! int GetReference() const { return m_lua_ref; } // ttag reference int GetIndex() const { return m_index; } // stack index or table level index int GetFlag() const { return m_flag; } // see wxLuaDebugItem_Type --- 54,61 ---- int GetValueType() const { return m_itemValueType; } wxString GetValueTypeString() const { return wxlua_getwxluatypename(m_itemValueType); } ! wxString GetSource() const { return m_itemSource; } ! int GetReference() const { return m_lua_ref; } // wxluaT_tag reference int GetIndex() const { return m_index; } // stack index or table level index int GetFlag() const { return m_flag; } // see wxLuaDebugItem_Type *************** *** 64,68 **** void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetReference(int lua_ref) { m_lua_ref = lua_ref; } // only if you're tremoved it // Get a human readable string for debugging --- 64,68 ---- void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetReference(int lua_ref) { m_lua_ref = lua_ref; } // only if you're wxluaT_removed it // Get a human readable string for debugging Index: wxlstack.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxlstack.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxlstack.h 8 Nov 2007 23:47:15 -0000 1.7 --- wxlstack.h 17 Nov 2007 00:15:07 -0000 1.8 *************** *** 184,188 **** wxLuaState m_wxlState; // lua_State to show stack for ! wxArrayInt m_luaReferences; // references from m_wxlState.tinsert wxImageList* m_imageList; // image list for listctrl --- 184,188 ---- wxLuaState m_wxlState; // lua_State to show stack for ! wxArrayInt m_luaReferences; // references from m_wxlState.wxluaT_Insert wxImageList* m_imageList; // image list for listctrl |
From: John L. <jr...@us...> - 2007-11-17 00:16:19
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/apps/wxluacan/src Modified Files: wxluacan.h wxluacan_bind.cpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxluacan_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan_bind.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wxluacan_bind.cpp 16 Jul 2007 19:34:12 -0000 1.24 --- wxluacan_bind.cpp 17 Nov 2007 00:14:53 -0000 1.25 *************** *** 184,191 **** } ! void wxLuaBinding_wxluacan::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxluacan::PostRegister(const wxLuaState& , bool , int ) { } --- 184,191 ---- } ! void wxLuaBinding_wxluacan::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxluacan::PostRegister(const wxLuaState&, int ) { } Index: wxluacan.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** wxluacan.h 1 Aug 2007 19:15:30 -0000 1.34 --- wxluacan.h 17 Nov 2007 00:14:53 -0000 1.35 *************** *** 18,24 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 18,24 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 31,36 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxluacan) --- 31,36 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxluacan) |
From: John L. <jr...@us...> - 2007-11-17 00:15:44
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxluasocket/src Modified Files: wxldtarg.cpp wxluasocket_bind.cpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxldtarg.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldtarg.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wxldtarg.cpp 26 Jul 2007 18:56:40 -0000 1.39 --- wxldtarg.cpp 17 Nov 2007 00:15:11 -0000 1.40 *************** *** 322,326 **** { int iItem = m_references.Item(idx); ! m_wxlState.tremove(iItem); } m_references.Clear(); --- 322,326 ---- { int iItem = m_references.Item(idx); ! m_wxlState.wxluaT_Remove(iItem); } m_references.Clear(); *************** *** 503,507 **** lua_pushliteral(L, "OK"); ! nReference = m_wxlState.tinsert(-1); lua_settop(L, nOldTop); } --- 503,507 ---- lua_pushliteral(L, "OK"); ! nReference = m_wxlState.wxluaT_Insert(-1); lua_settop(L, nOldTop); } *************** *** 520,524 **** if (strExpr == name) { ! nReference = m_wxlState.tinsert(-1); fFound = true; break; --- 520,524 ---- if (strExpr == name) { ! nReference = m_wxlState.wxluaT_Insert(-1); fFound = true; break; *************** *** 546,550 **** if (strExpr == name) { ! nReference = m_wxlState.tinsert(-1); // reference value and pop it. lua_pop(L, 1); // pop index fFound = true; --- 546,550 ---- if (strExpr == name) { ! nReference = m_wxlState.wxluaT_Insert(-1); // reference value and pop it. lua_pop(L, 1); // pop index fFound = true; *************** *** 561,567 **** } ! if (m_wxlState.tget(nReference)) { ! m_wxlState.tremove(nReference); switch (lua_type(L, -1)) { --- 561,567 ---- } ! if (m_wxlState.wxluaT_Get(nReference)) { ! m_wxlState.wxluaT_Remove(nReference); switch (lua_type(L, -1)) { Index: wxluasocket_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket_bind.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wxluasocket_bind.cpp 16 Jul 2007 19:35:31 -0000 1.22 --- wxluasocket_bind.cpp 17 Nov 2007 00:15:12 -0000 1.23 *************** *** 174,181 **** } ! void wxLuaBinding_wxluasocket::PreRegister(const wxLuaState& , bool , int ) { } ! void wxLuaBinding_wxluasocket::PostRegister(const wxLuaState& , bool , int ) { } --- 174,181 ---- } ! void wxLuaBinding_wxluasocket::PreRegister(const wxLuaState& , int ) { } ! void wxLuaBinding_wxluasocket::PostRegister(const wxLuaState&, int ) { } |
From: John L. <jr...@us...> - 2007-11-08 23:47:20
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10188/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Add storage for key and value datatype in wxLuaDebugItem and show it in the stack dialog Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** wxlstate.cpp 4 Sep 2007 22:21:10 -0000 1.135 --- wxlstate.cpp 8 Nov 2007 23:47:15 -0000 1.136 *************** *** 676,679 **** --- 676,682 ---- ret = (luatype == LUA_TNUMBER) ? 1 : 0; break; + case WXLUAARG_CFunction : + ret = (luatype == LUA_TFUNCTION) ? 1 : 0; + break; } *************** *** 684,688 **** { // try to use wxString's ref counting and return this existing copy ! static wxString s[11] = { wxT("none"), wxT("nil"), --- 687,691 ---- { // try to use wxString's ref counting and return this existing copy ! static wxString s[12] = { wxT("none"), wxT("nil"), *************** *** 695,699 **** wxT("userdata"), wxT("thread"), ! wxT("integer") }; --- 698,703 ---- wxT("userdata"), wxT("thread"), ! wxT("integer"), ! wxT("cfunction"), }; *************** *** 712,715 **** --- 716,720 ---- case WXLUAARG_Integer : return s[10]; + case WXLUAARG_CFunction : return s[11]; } *************** *** 732,735 **** --- 737,741 ---- case LUA_TTHREAD : return WXLUAARG_Thread; //case LUA_T??? : return WXLUAARG_Integer; + //case LUA_T??? : return WXLUAARG_CFunction; } *************** *** 752,755 **** --- 758,762 ---- case WXLUAARG_Thread : return LUA_TTHREAD; case WXLUAARG_Integer : return LUA_TNUMBER; + case WXLUAARG_CFunction : return LUA_TFUNCTION; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** wxlbind.cpp 7 Aug 2007 20:23:25 -0000 1.92 --- wxlbind.cpp 8 Nov 2007 23:47:15 -0000 1.93 *************** *** 39,42 **** --- 39,43 ---- int s_wxluaarg_Thread = WXLUAARG_Thread; int s_wxluaarg_Integer = WXLUAARG_Integer; + int s_wxluaarg_CFunction = WXLUAARG_CFunction; int g_wxluatag_wxLuaFunction = 0; |