Crazy Eddies GUI System  0.7.2
tolua++.h
1 /* tolua
2 ** Support code for Lua bindings.
3 ** Written by Waldemar Celes
4 ** TeCGraf/PUC-Rio
5 ** Apr 2003
6 ** $Id: tolua++.h 1141 2006-05-18 23:58:45Z lindquist $
7 */
8 
9 /* This code is free software; you can redistribute it and/or modify it.
10 ** The software provided hereunder is on an "as is" basis, and
11 ** the author has no obligation to provide maintenance, support, updates,
12 ** enhancements, or modifications.
13 */
14 
15 
16 #ifndef TOLUA_H
17 #define TOLUA_H
18 
19 /* original code */
20 /*
21 #ifndef TOLUA_API
22 #define TOLUA_API extern
23 #endif
24 */
25 
26 /********************************
27 ******** CEGUI CHANGES **********
28 ********************************/
29 
30 // Win32 import/export
31 #ifndef TOLUA_API
32 # ifdef _WIN32
33 # ifdef TOLUA_STATIC
34 # define TOLUA_API
35 # elif defined(TOLUA_EXPORTS)
36 # define TOLUA_API __declspec(dllexport)
37 # else
38 # define TOLUA_API __declspec(dllimport)
39 # endif
40 # else
41 # define TOLUA_API extern
42 # endif
43 #endif
44 
45 /********************************
46 ******* END CEGUI CHANGES *******
47 ********************************/
48 
49 #define TOLUA_VERSION "tolua++-1.0.92"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str())
56 #define tolua_iscppstring tolua_isstring
57 
58 #define tolua_iscppstringarray tolua_isstringarray
59 #define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str())
60 
61 #define TEMPLATE_BIND(p)
62 #define TOLUA_TEMPLATE_BIND(p)
63 #define TOLUA_PROTECTED_DESTRUCTOR
64 #define TOLUA_PROPERTY_TYPE(p)
65 
66 typedef int lua_Object;
67 
68 #include "lua.h"
69 #include "lauxlib.h"
70 
72 {
73  int index;
74  int array;
75  const char* type;
76 };
77 typedef struct tolua_Error tolua_Error;
78 
79 #define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */
80 
81 TOLUA_API const char* tolua_typename (lua_State* L, int lo);
82 TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err);
83 TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
84 TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
85 TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
86 TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
87 TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
88 TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
89 TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
90 TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
91 TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
92 TOLUA_API int tolua_isvaluearray
93  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
94 TOLUA_API int tolua_isbooleanarray
95  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
96 TOLUA_API int tolua_isnumberarray
97  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
98 TOLUA_API int tolua_isstringarray
99  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
100 TOLUA_API int tolua_istablearray
101  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
102 TOLUA_API int tolua_isuserdataarray
103  (lua_State* L, int lo, int dim, int def, tolua_Error* err);
104 TOLUA_API int tolua_isusertypearray
105  (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
106 
107 TOLUA_API void tolua_open (lua_State* L);
108 
109 TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
110 TOLUA_API int tolua_register_gc (lua_State* L, int lo);
111 TOLUA_API int tolua_default_collect (lua_State* tolua_S);
112 
113 TOLUA_API void tolua_usertype (lua_State* L, const char* type);
114 TOLUA_API void tolua_beginmodule (lua_State* L, const char* name);
115 TOLUA_API void tolua_endmodule (lua_State* L);
116 TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar);
117 TOLUA_API void tolua_class (lua_State* L, char* name, char* base);
118 TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col);
119 TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func);
120 TOLUA_API void tolua_constant (lua_State* L, const char* name, double value);
121 TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set);
122 TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set);
123 
124 /* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */
125 /* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */
126 
127 TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
128 TOLUA_API void tolua_pushboolean (lua_State* L, int value);
129 TOLUA_API void tolua_pushnumber (lua_State* L, double value);
130 TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
131 TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
132 TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
133 TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
134 TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
135 TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
136 TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v);
137 TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
138 TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
139 TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
140 TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
141 
142 TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def);
143 TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
144 TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
145 TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
146 TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
147 TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
148 TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def);
149 TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
150 TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
151 TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
152 TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
153 TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
154 
155 TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
156 
157 TOLUA_API int class_gc_event (lua_State* L);
158 
159 #ifdef __cplusplus
160 static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
161 
162  const char* s = tolua_tostring(L, narg, def);
163  return s?s:"";
164 }
165 
166 static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
167 
168  const char* s = tolua_tofieldstring(L, lo, index, def);
169  return s?s:"";
170 }
171 
172 #else
173 #define tolua_tocppstring tolua_tostring
174 #define tolua_tofieldcppstring tolua_tofieldstring
175 #endif
176 
177 TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif