diff options
-rw-r--r-- | include/Main.h | 3 | ||||
-rw-r--r-- | include/generic.h | 10 | ||||
-rw-r--r-- | lib/BLua.cc | 4 | ||||
-rw-r--r-- | lib/Main.cc | 20 |
4 files changed, 33 insertions, 4 deletions
diff --git a/include/Main.h b/include/Main.h index 8b404dc..8b03a3e 100644 --- a/include/Main.h +++ b/include/Main.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Main.h,v 1.19 2006-02-01 20:39:37 pixel Exp $ */ +/* $Id: Main.h,v 1.20 2006-11-13 22:00:11 pixel Exp $ */ #ifndef __MAIN_H__ #define __MAIN_H__ @@ -40,6 +40,7 @@ class Main : public Base { bool setted; private: void set_args(int, char **, char **); + static void sanity_checks() throw (GeneralException); }; diff --git a/include/generic.h b/include/generic.h index 107ec2b..3c7e7e9 100644 --- a/include/generic.h +++ b/include/generic.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: generic.h,v 1.39 2006-07-17 16:06:17 pixel Exp $ */ +/* $Id: generic.h,v 1.40 2006-11-13 22:00:11 pixel Exp $ */ #ifndef __GENERIC_H__ #define __GENERIC_H__ @@ -69,12 +69,20 @@ typedef u32 DWord; #else #if ! defined SDL_VERSIONNUM && ! defined Uint32 +#ifdef __amd64 +typedef unsigned int Uint32; +#else typedef unsigned long int Uint32; #endif +#endif #ifndef int32 +#ifdef __amd64 +typedef signed int int32; +#else typedef signed long int int32; #endif +#endif #ifndef Uint16 typedef unsigned short int Uint16; 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(); } |