Crazy Eddies GUI System 0.7.6
|
00001 /* tolua 00002 ** Support code for Lua bindings. 00003 ** Written by Waldemar Celes 00004 ** TeCGraf/PUC-Rio 00005 ** Apr 2003 00006 ** $Id: tolua++.h 1141 2006-05-18 23:58:45Z lindquist $ 00007 */ 00008 00009 /* This code is free software; you can redistribute it and/or modify it. 00010 ** The software provided hereunder is on an "as is" basis, and 00011 ** the author has no obligation to provide maintenance, support, updates, 00012 ** enhancements, or modifications. 00013 */ 00014 00015 00016 #ifndef TOLUA_H 00017 #define TOLUA_H 00018 00019 /* original code */ 00020 /* 00021 #ifndef TOLUA_API 00022 #define TOLUA_API extern 00023 #endif 00024 */ 00025 00026 /******************************** 00027 ******** CEGUI CHANGES ********** 00028 ********************************/ 00029 00030 // Win32 import/export 00031 #ifndef TOLUA_API 00032 # ifdef _WIN32 00033 # ifdef TOLUA_STATIC 00034 # define TOLUA_API 00035 # elif defined(TOLUA_EXPORTS) 00036 # define TOLUA_API __declspec(dllexport) 00037 # else 00038 # define TOLUA_API __declspec(dllimport) 00039 # endif 00040 # else 00041 # define TOLUA_API extern 00042 # endif 00043 #endif 00044 00045 /******************************** 00046 ******* END CEGUI CHANGES ******* 00047 ********************************/ 00048 00049 #define TOLUA_VERSION "tolua++-1.0.92" 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 #define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) 00056 #define tolua_iscppstring tolua_isstring 00057 00058 #define tolua_iscppstringarray tolua_isstringarray 00059 #define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) 00060 00061 #define TEMPLATE_BIND(p) 00062 #define TOLUA_TEMPLATE_BIND(p) 00063 #define TOLUA_PROTECTED_DESTRUCTOR 00064 #define TOLUA_PROPERTY_TYPE(p) 00065 00066 typedef int lua_Object; 00067 00068 #include "lua.h" 00069 #include "lauxlib.h" 00070 00071 struct tolua_Error 00072 { 00073 int index; 00074 int array; 00075 const char* type; 00076 }; 00077 typedef struct tolua_Error tolua_Error; 00078 00079 #define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ 00080 00081 TOLUA_API const char* tolua_typename (lua_State* L, int lo); 00082 TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); 00083 TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); 00084 TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); 00085 TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); 00086 TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); 00087 TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); 00088 TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); 00089 TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); 00090 TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); 00091 TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); 00092 TOLUA_API int tolua_isvaluearray 00093 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00094 TOLUA_API int tolua_isbooleanarray 00095 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00096 TOLUA_API int tolua_isnumberarray 00097 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00098 TOLUA_API int tolua_isstringarray 00099 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00100 TOLUA_API int tolua_istablearray 00101 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00102 TOLUA_API int tolua_isuserdataarray 00103 (lua_State* L, int lo, int dim, int def, tolua_Error* err); 00104 TOLUA_API int tolua_isusertypearray 00105 (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); 00106 00107 TOLUA_API void tolua_open (lua_State* L); 00108 00109 TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); 00110 TOLUA_API int tolua_register_gc (lua_State* L, int lo); 00111 TOLUA_API int tolua_default_collect (lua_State* tolua_S); 00112 00113 TOLUA_API void tolua_usertype (lua_State* L, const char* type); 00114 TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); 00115 TOLUA_API void tolua_endmodule (lua_State* L); 00116 TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); 00117 TOLUA_API void tolua_class (lua_State* L, char* name, char* base); 00118 TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); 00119 TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); 00120 TOLUA_API void tolua_constant (lua_State* L, const char* name, double value); 00121 TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); 00122 TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); 00123 00124 /* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ 00125 /* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ 00126 00127 TOLUA_API void tolua_pushvalue (lua_State* L, int lo); 00128 TOLUA_API void tolua_pushboolean (lua_State* L, int value); 00129 TOLUA_API void tolua_pushnumber (lua_State* L, double value); 00130 TOLUA_API void tolua_pushstring (lua_State* L, const char* value); 00131 TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); 00132 TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); 00133 TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); 00134 TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); 00135 TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); 00136 TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v); 00137 TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); 00138 TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); 00139 TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); 00140 TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); 00141 00142 TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def); 00143 TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); 00144 TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); 00145 TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); 00146 TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); 00147 TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); 00148 TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def); 00149 TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); 00150 TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); 00151 TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); 00152 TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); 00153 TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); 00154 00155 TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); 00156 00157 TOLUA_API int class_gc_event (lua_State* L); 00158 00159 #ifdef __cplusplus 00160 static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { 00161 00162 const char* s = tolua_tostring(L, narg, def); 00163 return s?s:""; 00164 } 00165 00166 static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { 00167 00168 const char* s = tolua_tofieldstring(L, lo, index, def); 00169 return s?s:""; 00170 } 00171 00172 #else 00173 #define tolua_tocppstring tolua_tostring 00174 #define tolua_tofieldcppstring tolua_tofieldstring 00175 #endif 00176 00177 TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); 00178 00179 #ifdef __cplusplus 00180 } 00181 #endif 00182 00183 #endif