diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BLua.cc | 4 | ||||
-rw-r--r-- | lib/Main.cc | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index 7d70bb9..92ef214 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.37 2006-07-16 12:24:54 pixel Exp $ */ +/* $Id: BLua.cc,v 1.38 2006-11-13 22:00:12 pixel Exp $ */ #include <stdlib.h> #include "BLua.h" @@ -943,6 +943,7 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) { Lua * Lua::thread(bool saveit) { lua_State * L1 = lua_newthread(L); Lua * Lt = find(L1); +#if 0 if (saveit) { push("BLUA_THREADS"); // -2 = thread, -1 = "BLUA_THREADS" copy(); // -3 = thread, -2 = "BLUA_THREADS", -1 = "BLUA_THREADS" @@ -952,6 +953,7 @@ Lua * Lua::thread(bool saveit) { settable(); // -3 = thread, -2 = "BLUA_THREADS", -1 = BLUA_THREADS settable(LUA_REGISTRYINDEX); // -1 = thread } +#endif return Lt; } diff --git a/lib/Main.cc b/lib/Main.cc index d5048ba..5555e90 100644 --- a/lib/Main.cc +++ b/lib/Main.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Main.cc,v 1.13 2004-12-12 23:01:08 pixel Exp $ */ +/* $Id: Main.cc,v 1.14 2006-11-13 22:00:12 pixel Exp $ */ #ifdef _WIN32 #include <windows.h> @@ -50,10 +50,28 @@ _open_osfhandle CreateFileMapping */ +#define size_assert(c, s) if (!(sizeof(c) == (s))) { throw GeneralException(String("Sanity Check failure: sizeof(" # c ") == ") + (int) sizeof(c) + " and not " # s " as expected."); } +#define s_assert(c) if (!(c)) { throw GeneralException("Sanity Check failed: " # c " is false"); } + +void Main::sanity_checks() throw (GeneralException) { + size_assert(int8, 1); + size_assert(int16, 2); + size_assert(int32, 4); + size_assert(int64, 8); + size_assert(Uint8, 1); + size_assert(Uint16, 2); + size_assert(Uint32, 4); + size_assert(Uint64, 8); + size_assert(Byte, 1); + size_assert(Word, 2); + size_assert(DWord, 4); +} + int Main::truemain(Main * Application, int argc, char ** argv, char ** enve) { int r; try { + sanity_checks(); Application->set_args(argc, argv, enve); r = Application->startup(); } |