From: John L. <jr...@us...> - 2006-12-01 06:25:51
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1213/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: removed TRUE/FALSE pushed into lua since lua has true/false now removed pointers to functions in wxLuaBinding, just use the member vars Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** wxlstate.cpp 28 Sep 2006 22:26:05 -0000 1.77 --- wxlstate.cpp 1 Dec 2006 06:25:47 -0000 1.78 *************** *** 386,404 **** // txxx functions to make lua calls easier // ---------------------------------------------------------------------------- - /* - int LUACALL wxLua_lua_tinsert(lua_State *L, int iParam) - { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - return wxlState.tinsert(iParam); - } - - bool LUACALL wxLua_lua_tremove(lua_State *L, int iReference) - { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), false, wxT("Invalid wxLuaState")); - return wxlState.tremove(iReference); - } - */ bool LUACALL wxLua_lua_tget(lua_State *L, int iIndex) { --- 386,389 ---- *************** *** 533,550 **** return pdata; } - /* - int LUACALL wxLua_lua_tnewtag(lua_State *L) - { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - return wxlState.tnewtag(); - } - int LUACALL wxLua_lua_tnewweaktag(lua_State *L, bool fWeakKey, bool fWeakData) - { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - return wxlState.tnewweaktag(fWeakKey, fWeakData); - } - */ void LUACALL wxLua_lua_tsettag(lua_State *L, int tag) --- 518,521 ---- *************** *** 640,644 **** //case LUA_TNIL: //case LUA_TSTRING: ! case LUA_TNUMBER: return true; default: --- 611,615 ---- //case LUA_TNIL: //case LUA_TSTRING: ! case LUA_TNUMBER: // make sure it's only a number for an enum return true; default: Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wxlbind.cpp 6 Nov 2006 06:11:44 -0000 1.41 --- wxlbind.cpp 1 Dec 2006 06:25:47 -0000 1.42 *************** *** 219,223 **** //bool tracked = false; ! if ((pClass != NULL) && lua_isuserdata(L, 1) && (lua_islightuserdata(L, 1) == 0) && (wxlState.ttag(1) == *pClass->class_tag)) { long key = (long)wxlState.ttouserdata(1, true); --- 219,224 ---- //bool tracked = false; ! if ((pClass != NULL) && lua_isuserdata(L, 1) && ! (lua_islightuserdata(L, 1) == 0) && (wxlState.ttag(1) == *pClass->class_tag)) { long key = (long)wxlState.ttouserdata(1, true); *************** *** 273,277 **** // ---------------------------------------------------------------------------- ! static const char baseString[] = "base_"; int LUACALL wxLua_lua_getTableFunc(lua_State *L) --- 274,279 ---- // ---------------------------------------------------------------------------- ! #define CALL_BASECLASS_FUNC "base_" ! #define CALL_BASECLASS_FUNC_LEN 5 int LUACALL wxLua_lua_getTableFunc(lua_State *L) *************** *** 296,308 **** if ((pClass != NULL) && lua_isuserdata(L, 1) && ! (lua_islightuserdata(L, 1) == 0) && ! (wxlState.ttag(1) == *pClass->class_tag)) { void *pObject = wxlState.ttouserdata(1); ! cpIndex = lua_tostring(L, 2); - bool fCallbase = (memcmp(cpIndex, baseString, sizeof(baseString)-1) == 0); if (fCallbase) ! cpIndex += sizeof(baseString)-1; else { --- 298,311 ---- if ((pClass != NULL) && lua_isuserdata(L, 1) && ! (lua_islightuserdata(L, 1) == 0) && (wxlState.ttag(1) == *pClass->class_tag)) { void *pObject = wxlState.ttouserdata(1); ! wxCharBuffer funcName(lua_tostring(L, 2)); // make a copy of the string ! cpIndex = funcName.data(); ! ! bool fCallbase = (memcmp(cpIndex, CALL_BASECLASS_FUNC, CALL_BASECLASS_FUNC_LEN) == 0); if (fCallbase) ! cpIndex += CALL_BASECLASS_FUNC_LEN; // skip past "base_" else { *************** *** 445,461 **** IMPLEMENT_DYNAMIC_CLASS(wxLuaBinding, wxObject) ! wxLuaBindingList wxLuaBinding::sm_bindings; wxLuaBinding::wxLuaBinding() : wxObject(), ! pfGetClassList(NULL), ! pfGetDefineList(NULL), ! pfGetEventList(NULL), ! pfGetObjectList(NULL), ! pfGetBuiltinList(NULL), ! m_classCount(0), m_classList(NULL), ! m_defineCount(0), m_defineList(NULL), ! m_eventCount(0), m_eventList(NULL), ! m_objectCount(0), m_objectList(NULL), ! m_builtinCount(0), m_builtinList(NULL), m_typesRegistered(false), m_startTag(0), --- 448,459 ---- IMPLEMENT_DYNAMIC_CLASS(wxLuaBinding, wxObject) ! wxLuaBindingList wxLuaBinding::sm_bindingList; wxLuaBinding::wxLuaBinding() : wxObject(), ! m_classCount(0), m_classList(NULL), ! m_defineCount(0), m_defineList(NULL), ! m_eventCount(0), m_eventList(NULL), ! m_objectCount(0), m_objectList(NULL), ! m_functionCount(0), m_functionList(NULL), m_typesRegistered(false), m_startTag(0), *************** *** 465,478 **** } - void wxLuaBinding::Initialize() - { - m_classList = (*pfGetClassList)(m_classCount); - m_defineList = (*pfGetDefineList)(m_defineCount); - m_stringList = (*pfGetStringList)(m_stringCount); - m_eventList = (*pfGetEventList)(m_eventCount); - m_objectList = (*pfGetObjectList)(m_objectCount); - m_builtinList = (*pfGetBuiltinList)(m_builtinCount); - } - void wxLuaBinding::RegisterBinding(const wxLuaState& wxlState, bool registerTypes) { --- 463,466 ---- *************** *** 506,510 **** --- 494,500 ---- int LUACALL wxLuaBinding::RegisterFunctions(const wxLuaState& wxlState_, bool registerTypes) { + wxCHECK_MSG(wxlState_.Ok(), 0, wxT("Invalid wxLuaState")); wxLuaState wxlState(wxlState_); + if (!registerTypes && !m_typesRegistered) wxlState.terror("wxLua: First time registration must register types"); *************** *** 576,579 **** --- 566,570 ---- static const size_t s_funcCount = sizeof(s_funcTable)/sizeof(s_funcTable[0]); + wxCHECK_RET(wxlState_.Ok(), wxT("Invalid wxLuaState")); wxLuaState wxlState(wxlState_); lua_State *L = wxlState.GetLuaState(); *************** *** 612,618 **** // register all the builtin functions ! for (size_t iBuiltin = 0; iBuiltin < m_builtinCount; ++iBuiltin) { ! WXLUAMETHOD *pMethod = m_builtinList + iBuiltin; lua_pushstring(L, pMethod->name); lua_pushcfunction(L, pMethod->func); --- 603,609 ---- // register all the builtin functions ! for (size_t iFunction = 0; iFunction < m_functionCount; ++iFunction) { ! WXLUAMETHOD *pMethod = m_functionList + iFunction; lua_pushstring(L, pMethod->name); lua_pushcfunction(L, pMethod->func); *************** *** 620,631 **** } ! // for backward compatibility ! lua_pushliteral(L, "FALSE"); ! lua_pushboolean(L, false); ! lua_rawset(L, tableOffset); ! lua_pushliteral(L, "TRUE"); ! lua_pushboolean(L, true); ! lua_rawset(L, tableOffset); // install the definitions --- 611,622 ---- } ! // for backward compatibility - removed, lua has bool now ! //lua_pushliteral(L, "FALSE"); ! //lua_pushboolean(L, false); ! //lua_rawset(L, tableOffset); ! //lua_pushliteral(L, "TRUE"); ! //lua_pushboolean(L, true); ! //lua_rawset(L, tableOffset); // install the definitions |