From 0b7cc6372fd55d7f97122db97f6f8a2f5ef33809 Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 13 Oct 2005 16:00:37 +0000 Subject: Fixing various (fucking) macos X issues. --- include/BLua.h | 8 +++--- lib/BLua.cc | 68 +++++++++++++++++++++++----------------------- lib/LuaHandle.cc | 82 ++++++++++++++++++++++++++++---------------------------- 3 files changed, 81 insertions(+), 77 deletions(-) diff --git a/include/BLua.h b/include/BLua.h index f416c80..da09ef4 100644 --- a/include/BLua.h +++ b/include/BLua.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.h,v 1.24 2005-03-31 16:23:05 pixel Exp $ */ +/* $Id: BLua.h,v 1.25 2005-10-13 16:00:37 pixel Exp $ */ #ifndef __BLUA_H__ #define __BLUA_H__ @@ -37,6 +37,8 @@ extern "C" { #include #include +#undef isnumber + //!Basic LUA engine. /*! This will create an LUA context, and provide mechanisms to interact with it. @@ -217,8 +219,8 @@ struct lua_functypes_t { template class LuaHelpers : public Base { public: - static int method_multiplex(int caller, lua_State * _L, int (*proceed)(Lua * L, int n, T * obj, int caller), int (*proceed_static)(Lua * L, int n, int caller), lua_functypes_t * tab, bool method) { - Lua * L = Lua::find(_L); + static int method_multiplex(int caller, lua_State * __L, int (*proceed)(Lua * L, int n, T * obj, int caller), int (*proceed_static)(Lua * L, int n, int caller), lua_functypes_t * tab, bool method) { + Lua * L = Lua::find(__L); int add = method ? 1 : 0; int n = L->gettop() - add; T * obj = 0; 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 #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::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::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"); diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 40b24be..bcade6f 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaHandle.cc,v 1.15 2004-11-27 21:46:04 pixel Exp $ */ +/* $Id: LuaHandle.cc,v 1.16 2005-10-13 16:00:37 pixel Exp $ */ #include "LuaHandle.h" @@ -95,8 +95,8 @@ void LuaBuffer::pushconstruct(Lua * L) { L->declarefunc("Buffer", sLuaHandle::newbuffer); } -int sLuaHandle::newinput(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::newinput(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); if ((n != 1) || !L->isstring()) { @@ -109,8 +109,8 @@ int sLuaHandle::newinput(lua_State * _L) { return 1; } -int sLuaHandle::newoutput(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::newoutput(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); if ((n != 1) || !L->isstring()) { @@ -123,8 +123,8 @@ int sLuaHandle::newoutput(lua_State * _L) { return 1; } -int sLuaHandle::newbuffer(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::newbuffer(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); bool seekable = false; @@ -141,8 +141,8 @@ int sLuaHandle::newbuffer(lua_State * _L) { return 1; } -int sLuaHandle::read(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::read(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(), i; size_t t; ssize_t r; @@ -150,7 +150,7 @@ int sLuaHandle::read(lua_State * _L) { Byte * b; if (n == 1) { - return readstring(_L); + return readstring(__L); } if ((n != 2) || !L->isnumber()) { @@ -178,8 +178,8 @@ int sLuaHandle::read(lua_State * _L) { return 2; } -int sLuaHandle::readstring(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::readstring(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(), i; Handle * h; String r; @@ -209,8 +209,8 @@ int sLuaHandle::readU32(lua_State * L) { return read(L, U32); } -int sLuaHandle::write(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::write(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(), i; size_t t; ssize_t r; @@ -218,7 +218,7 @@ int sLuaHandle::write(lua_State * _L) { Byte * b; if ((n == 2) && L->isstring()) { - return writestring(_L); + return writestring(__L); } if ((n != 3) || !L->isnumber() || !L->istable(2)) { @@ -245,8 +245,8 @@ int sLuaHandle::write(lua_State * _L) { return 1; } -int sLuaHandle::writestring(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::writestring(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(), i; Handle * h; String r; @@ -275,8 +275,8 @@ int sLuaHandle::writeU32(lua_State * L) { return write(L, U32); } -int sLuaHandle::read(lua_State * _L, int t) { - Lua * L = Lua::find(_L); +int sLuaHandle::read(lua_State * __L, int t) { + Lua * L = Lua::find(__L); int n = L->gettop(); lua_Number r; Handle * h; @@ -298,8 +298,8 @@ int sLuaHandle::read(lua_State * _L, int t) { return 1; } -int sLuaHandle::write(lua_State * _L, int t) { - Lua * L = Lua::find(_L); +int sLuaHandle::write(lua_State * __L, int t) { + Lua * L = Lua::find(__L); int n = L->gettop(); lua_Number r; Handle * h; @@ -328,8 +328,8 @@ int sLuaHandle::copyto(lua_State * L) { return copy(L, to); } -int sLuaHandle::copy(lua_State * _L, int dir) { - Lua * L = Lua::find(_L); +int sLuaHandle::copy(lua_State * __L, int dir) { + Lua * L = Lua::find(__L); int n = L->gettop(); lua_Number r; Handle * s, * d; @@ -380,8 +380,8 @@ int sLuaHandle::canwatch(lua_State * L) { return getcaps(L, capcanwatch); } -int sLuaHandle::getcaps(lua_State * _L, int cap) { - Lua * L = Lua::find(_L); +int sLuaHandle::getcaps(lua_State * __L, int cap) { + Lua * L = Lua::find(__L); int n = L->gettop(); bool r; Handle * h; @@ -434,8 +434,8 @@ int sLuaHandle::flush(lua_State * L) { return action(L, Aflush); } -int sLuaHandle::action(lua_State * _L, int act) { - Lua * L = Lua::find(_L); +int sLuaHandle::action(lua_State * __L, int act) { + Lua * L = Lua::find(__L); int n = L->gettop(); int r = 1; Handle * h; @@ -459,8 +459,8 @@ int sLuaHandle::action(lua_State * _L, int act) { return r; } -int sLuaHandle::setz(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::setz(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); int z = 9; Handle * h; @@ -480,8 +480,8 @@ int sLuaHandle::setz(lua_State * _L) { return 0; } -int sLuaHandle::seek(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::seek(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); off_t off; int wheel; @@ -506,8 +506,8 @@ int sLuaHandle::seek(lua_State * _L) { return 1; } -int sLuaHandle::bindex(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::bindex(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); const Buffer * b; @@ -527,8 +527,8 @@ int sLuaHandle::bindex(lua_State * _L) { return 1; } -int sLuaHandle::bnewindex(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::bnewindex(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Buffer * b; @@ -552,8 +552,8 @@ int sLuaHandle::bnewindex(lua_State * _L) { return 0; } -int sLuaHandle::btell(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::btell(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); Buffer * h; @@ -566,8 +566,8 @@ int sLuaHandle::btell(lua_State * _L) { return 1; } -int sLuaHandle::bseek(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::bseek(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); off_t off; int wheel; @@ -592,8 +592,8 @@ int sLuaHandle::bseek(lua_State * _L) { return 1; } -int sLuaHandle::exists(lua_State * _L) { - Lua * L = Lua::find(_L); +int sLuaHandle::exists(lua_State * __L) { + Lua * L = Lua::find(__L); int n = L->gettop(); bool r = true; -- cgit v1.2.3