diff options
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r-- | lib/BLua.cc | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index e70902b..8aba47e 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.31 2005-03-31 15:18:22 pixel Exp $ */ +/* $Id: BLua.cc,v 1.32 2005-10-13 16:00:37 pixel Exp $ */ #include <stdlib.h> #include "BLua.h" @@ -27,21 +27,23 @@ #define BUFFERSIZE 2048 #endif +#undef isnumber + extern "C" { - void do_lua_lock(lua_State * _L) { + void do_lua_lock(lua_State * __L) { Lua * L; try { - L = Lua::find(_L); + L = Lua::find(__L); } catch (GeneralException e) { return; } L->lock(); } - void do_lua_unlock(lua_State * _L) { + void do_lua_unlock(lua_State * __L) { Lua * L; try { - L = Lua::find(_L); + L = Lua::find(__L); } catch (GeneralException e) { return; } @@ -71,8 +73,8 @@ class LuaStatics : public Base { std::map<lua_State *, Lua *> Lua::lualist; -int LuaStatics::luaerror(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::luaerror(lua_State * __L) { + Lua * L = Lua::find(__L); L->push_lua_context(); L->showerror(); return 0; @@ -82,8 +84,8 @@ int LuaStatics::luapanic(lua_State * L) { return trueluapanic(L); } -int LuaStatics::trueluapanic(lua_State * _L) throw (GeneralException) { - Lua * L = Lua::find(_L); +int LuaStatics::trueluapanic(lua_State * __L) throw (GeneralException) { + Lua * L = Lua::find(__L); if (L->is_protected()) return 0; // luaerror will get it for us... L->push_lua_context(); @@ -91,8 +93,8 @@ int LuaStatics::trueluapanic(lua_State * _L) throw (GeneralException) { throw LuaException("Unprotected error running Lua code, bailing out; except unstable lua environment."); } -int LuaStatics::andB(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::andB(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 a, b; @@ -108,8 +110,8 @@ int LuaStatics::andB(lua_State * _L) { return 1; } -int LuaStatics::orB(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::orB(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 a, b; @@ -125,8 +127,8 @@ int LuaStatics::orB(lua_State * _L) { return 1; } -int LuaStatics::xorB(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::xorB(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 a, b; @@ -142,8 +144,8 @@ int LuaStatics::xorB(lua_State * _L) { return 1; } -int LuaStatics::notB(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::notB(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 x; @@ -158,8 +160,8 @@ int LuaStatics::notB(lua_State * _L) { return 1; } -int LuaStatics::shl(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::shl(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 a, b; @@ -178,8 +180,8 @@ int LuaStatics::shl(lua_State * _L) { return 1; } -int LuaStatics::shr(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::shr(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Uint32 a, b; @@ -198,8 +200,8 @@ int LuaStatics::shr(lua_State * _L) { return 1; } -int LuaStatics::hex(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::hex(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); int x; String r; @@ -231,7 +233,7 @@ Lua::Lua() : L(lua_open()) { declarefunc("hex", LuaStatics::hex); } -Lua::Lua(lua_State * _L) : L(_L), _protected(false) { +Lua::Lua(lua_State * __L) : L(__L), _protected(false) { lualist[L] = this; lua_atpanic(L, LuaStatics::luapanic); } @@ -564,10 +566,10 @@ int Lua::resume(int nresults) { return lua_resume(L, nresults); } -Lua * Lua::find(lua_State * _L) throw (GeneralException) { +Lua * Lua::find(lua_State * __L) throw (GeneralException) { std::map<lua_State *, Lua *>::iterator i; - if ((i = lualist.find(_L)) == lualist.end()) { + if ((i = lualist.find(__L)) == lualist.end()) { throw GeneralException("Unable to find the Lua object for this context"); } @@ -689,12 +691,12 @@ void LuaObject::pushmeta(Lua * L, const String & s, lua_CFunction f) { L->setmetatable(); } -int LuaStatics::callwrap(lua_State * _L, lua_CFunction func) { - Lua * L = Lua::find(_L); +int LuaStatics::callwrap(lua_State * __L, lua_CFunction func) { + Lua * L = Lua::find(__L); int n; try { - n = func(_L); + n = func(__L); } catch (LuaException e) { L->error(String("LuaException: ") + e.GetMsg()); @@ -706,8 +708,8 @@ int LuaStatics::callwrap(lua_State * _L, lua_CFunction func) { return n; } -int LuaStatics::collector(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::collector(lua_State * __L) { + Lua * L = Lua::find(__L); void ** u = (void **) L->touserdata(); bool * obj = (bool *) (u + 1); // printm(M_INFO, "From LUA: collecting object\n"); @@ -723,8 +725,8 @@ int LuaStatics::collector(lua_State * _L) { return 0; } -int LuaStatics::destructor(lua_State * _L) { - Lua * L = Lua::find(_L); +int LuaStatics::destructor(lua_State * __L) { + Lua * L = Lua::find(__L); Base * b = (Base *) LuaObject::getme(L); delete b; L->push("__obj"); |