From: John L. <jr...@us...> - 2007-03-23 04:27:27
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24349/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Renamed all 'C' functions from wxLua_lua_XXX to just wxlua_XXX to shorten them and match lua's lua_XXX function convention. Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxlbind.h 16 Mar 2007 21:23:47 -0000 1.38 --- wxlbind.h 23 Mar 2007 04:27:23 -0000 1.39 *************** *** 30,38 **** // memory deallocation function, lua's __gc ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_garbageCollect(lua_State *L); // lua 'set table' tag method handler, lua's __newindex ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_setTableFunc(lua_State *L); // lua 'get table' tag method handler, lua's __index ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_getTableFunc(lua_State *L); // ---------------------------------------------------------------------------- --- 30,38 ---- // memory deallocation function, lua's __gc ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_garbageCollect(lua_State *L); // lua 'set table' tag method handler, lua's __newindex ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_setTableFunc(lua_State *L); // lua 'get table' tag method handler, lua's __index ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_getTableFunc(lua_State *L); // ---------------------------------------------------------------------------- *************** *** 138,144 **** // Garbage collect and free memory associated with the wxLuaFunction class // lua's __gc metatable function. ! int LUACALL wxLua_lua_gc_wxLuaFunction(lua_State *L); // call a wxLuaFunction, lua's __call metatable function. ! int LUACALL wxLua_lua_call_wxLuaFunction(lua_State *L); // ---------------------------------------------------------------------------- --- 138,144 ---- // Garbage collect and free memory associated with the wxLuaFunction class // lua's __gc metatable function. ! int LUACALL wxlua_gc_wxLuaFunction(lua_State *L); // call a wxLuaFunction, lua's __call metatable function. ! int LUACALL wxlua_call_wxLuaFunction(lua_State *L); // ---------------------------------------------------------------------------- Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** wxlstate.h 23 Mar 2007 00:09:35 -0000 1.64 --- wxlstate.h 23 Mar 2007 04:27:23 -0000 1.65 *************** *** 113,158 **** // Create a reference to the object at stack index in the // wxLuaReferences registry table, returns the table index. ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_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_lua_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_lua_tget(lua_State* L, int wxlref_index); // Push the errorMsg on the stack and call lua_error ! WXDLLIMPEXP_WXLUA void LUACALL wxLua_lua_terror(lua_State* L, const char* errorMsg); // Push the object u onto the top of the stack as a userdata of type tag // and set the metatable to the object at tget(tag) ! WXDLLIMPEXP_WXLUA void LUACALL wxLua_lua_tpushusertag(lua_State* L, const void* u, int tag); // Get the tag of the object at the stack index using the metatable's "tag" key. // returns TLUA_NOTAG if no tag ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_ttag(lua_State* L, int stack_idx); // 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. ! WXDLLIMPEXP_WXLUA void* LUACALL wxLua_lua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); // Allocate a new table (metatable) tinsert it into the wxLuaReferences registry table // and return its index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_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 and return its index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to tget(tag) ! WXDLLIMPEXP_WXLUA void LUACALL wxLua_lua_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 class ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_tsettagmethod(lua_State* L, int tag, const char* method, ! lua_CFunction func, void* pClass = NULL); // Push the "wxLuaReferences" string onto the stack. This is the name of a // table in the LUA_REGISTRYINDEX that is indexed on the "tags" and each item // is a metatable for classes or a reference to an object we want to keep a handle to. ! #define wxLua_lua_push_wxLuaReferences(L) lua_pushlstring(L, "wxLuaReferences", 15) // Push the "wxLuaClasses" string onto the stack. This is the name of a // table in the LUA_REGISTRYINDEX that is t[WXLUACLASS.name] = WXLUACLASS // where the WXLUACLASS is a lightuserdata. ! #define wxLua_lua_push_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) --- 113,158 ---- // 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); // Push the object u onto the top of the stack as a userdata of type tag // and set the metatable to the object at tget(tag) ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag); // Get the tag of the object at the stack index using the metatable's "tag" key. // returns TLUA_NOTAG if no tag ! 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 userdata pointer // in lua to NULL so that lua won't gc it. ! WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); // Allocate a new table (metatable) tinsert it into the wxLuaReferences registry table // and return its index into the ref table. ! 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 and return its 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 tget(tag) ! WXDLLIMPEXP_WXLUA void 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 class ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettagmethod(lua_State* L, int tag, const char* method, ! lua_CFunction func, void* pClass = NULL); // Push the "wxLuaReferences" string onto the stack. This is the name of a // table in the LUA_REGISTRYINDEX that is indexed on the "tags" and each item // is a metatable for classes or a reference to an object we want to keep a handle to. ! #define wxlua_pushstring_wxLuaReferences(L) lua_pushlstring(L, "wxLuaReferences", 15) // Push the "wxLuaClasses" string onto the stack. This is the name of a // table in the LUA_REGISTRYINDEX that is t[WXLUACLASS.name] = WXLUACLASS // where the WXLUACLASS is a lightuserdata. ! #define wxlua_pushstring_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) *************** *** 162,176 **** // Note: wxLua has a stricter sense of type than lua and we don't want to // always allow coersion between types since oftentimes there's an error. ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_isstringtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_isbooleantype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_isenumerationtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_isnumbertype(lua_State* L, int stack_idx); ! // After verifying using wxLua_lua_isXXXtype return the value, else call ! // wxLua_lua_terror with a message that's appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) ! WXDLLIMPEXP_WXLUA const char* LUACALL wxLua_lua_getstringtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxLua_lua_getbooleantype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA long LUACALL wxLua_lua_getenumerationtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA double LUACALL wxLua_lua_getnumbertype(lua_State* L, int stack_idx); // Helper functions to get/set tables of strings and ints --- 162,176 ---- // Note: wxLua has a stricter sense of type than lua and we don't want to // always allow coersion between types since oftentimes there's an error. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_isstringtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_isbooleantype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_isenumerationtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_isnumbertype(lua_State* L, int stack_idx); ! // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_terror with a message that's appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) ! WXDLLIMPEXP_WXLUA const char* LUACALL wxlua_getstringtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_getbooleantype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA long LUACALL wxlua_getenumerationtype(lua_State* L, int stack_idx); ! WXDLLIMPEXP_WXLUA double LUACALL wxlua_getnumbertype(lua_State* L, int stack_idx); // Helper functions to get/set tables of strings and ints *************** *** 178,208 **** // This assumes that each numeric entry in the table is a string or number // object or can be converted to a string or number using the ! // wxLua_lua_isstring/numbertype definitions of what is a string or number. // Convert the table at stack index to a "new" array of wxStrings. // Returns a pointer to the array of wxStrings (you need to delete them) // and returns the number of strings in the array in count. ! WXDLLIMPEXP_WXLUA wxString* LUACALL wxLua_lua_getwxStringarray(lua_State* L, int stack_idx, int& count); // Adds the table of number indexed strings at stack index to the wxArrayString // Return the number of strings added to the array in count. ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_getwxArrayString(lua_State* L, int stack_idx, wxArrayString& strArray); // Convert the table at stack index to a "new" array of const char* strings. // Return a pointer to the array of strings (you need to delete them) // returns the number of character strings in the array in count. ! WXDLLIMPEXP_WXLUA const char** LUACALL wxLua_lua_getchararray(lua_State* L, int stack_idx, int& count); // Convert the table at stack index to a "new" array of int* numbers. // Return a pointer to the array of ints (you need to delete them) // returns the number of ints in the array in count. ! WXDLLIMPEXP_WXLUA int* LUACALL wxLua_lua_getintarray(lua_State* L, int stack_idx, int& count); // Adds the table at stack index to the wxArrayInt // Return the number of ints added to the array in count. ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_getwxArrayInt(lua_State* L, int stack_idx, wxArrayInt& intArray); // Creates a lua table and pushes the strings into it, returns the number of items added // The table is left on the stack ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_pushwxArrayStringtable(lua_State* L, const wxArrayString& strArray); // Creates a lua table and pushes the ints into it, returns the number of items added // The table is left on the stack ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_lua_pushwxArrayInttable(lua_State* L, const wxArrayInt& intArray); //---------------------------------------------------------------------------- --- 178,208 ---- // This assumes that each numeric entry in the table is a string or number // object or can be converted to a string or number using the ! // wxlua_isstring/numbertype definitions of what is a string or number. // Convert the table at stack index to a "new" array of wxStrings. // Returns a pointer to the array of wxStrings (you need to delete them) // and returns the number of strings in the array in count. ! WXDLLIMPEXP_WXLUA wxString* LUACALL wxlua_getwxStringarray(lua_State* L, int stack_idx, int& count); // Adds the table of number indexed strings at stack index to the wxArrayString // Return the number of strings added to the array in count. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_getwxArrayString(lua_State* L, int stack_idx, wxArrayString& strArray); // Convert the table at stack index to a "new" array of const char* strings. // Return a pointer to the array of strings (you need to delete them) // returns the number of character strings in the array in count. ! WXDLLIMPEXP_WXLUA const char** LUACALL wxlua_getchararray(lua_State* L, int stack_idx, int& count); // Convert the table at stack index to a "new" array of int* numbers. // Return a pointer to the array of ints (you need to delete them) // returns the number of ints in the array in count. ! WXDLLIMPEXP_WXLUA int* LUACALL wxlua_getintarray(lua_State* L, int stack_idx, int& count); // Adds the table at stack index to the wxArrayInt // Return the number of ints added to the array in count. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_getwxArrayInt(lua_State* L, int stack_idx, wxArrayInt& intArray); // Creates a lua table and pushes the strings into it, returns the number of items added // The table is left on the stack ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayStringtable(lua_State* L, const wxArrayString& strArray); // Creates a lua table and pushes the ints into it, returns the number of items added // The table is left on the stack ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayInttable(lua_State* L, const wxArrayInt& intArray); //---------------------------------------------------------------------------- |