Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pch/src/tolua/tolua++.h @ 3127

Last change on this file since 3127 was 3127, checked in by rgrieder, 15 years ago

Update to tolua 1.0.93

  • Property svn:eol-style set to native
File size: 7.6 KB
Line 
1/* tolua
2** Support code for Lua bindings.
3** Written by Waldemar Celes
4** TeCGraf/PUC-Rio
5** Apr 2003
6** $Id: $
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******* ORXONOX CHANGES *********
28********************************/
29
30#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined( TOLUA_STATIC_BUILD )
31#  ifdef TOLUA_SHARED_BUILD
32#    define TOLUA_API __declspec(dllexport)
33#  else
34#    if defined( __MINGW32__ )
35#      define TOLUA_API
36#    else
37#      define TOLUA_API __declspec(dllimport)
38#    endif
39#  endif
40#else
41#  define TOLUA_API extern
42#endif
43
44/********************************
45****** END ORXONOX CHANGES ******
46********************************/
47
48#define TOLUA_VERSION "tolua++-1.0.92"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#define tolua_pushcppstring(x,y)        tolua_pushstring(x,y.c_str())
55#define tolua_iscppstring       tolua_isstring
56
57#define tolua_iscppstringarray tolua_isstringarray
58#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str())
59
60#ifndef TEMPLATE_BIND
61 #define TEMPLATE_BIND(p)
62#endif
63
64#define TOLUA_TEMPLATE_BIND(p)
65
66#define TOLUA_PROTECTED_DESTRUCTOR
67#define TOLUA_PROPERTY_TYPE(p)
68
69typedef int lua_Object;
70
71#include "lua.h"
72#include "lauxlib.h"
73
74struct tolua_Error
75{
76        int index;
77        int array;
78        const char* type;
79};
80typedef struct tolua_Error tolua_Error;
81
82#define TOLUA_NOPEER    LUA_REGISTRYINDEX /* for lua 5.1 */
83
84TOLUA_API const char* tolua_typename (lua_State* L, int lo);
85TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err);
86TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
87TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
88TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err);
89TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
90TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
91TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
92TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
93TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
94TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
95TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
96TOLUA_API int tolua_isvaluearray
97 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
98TOLUA_API int tolua_isbooleanarray
99 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
100TOLUA_API int tolua_isnumberarray
101 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
102TOLUA_API int tolua_isstringarray
103 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
104TOLUA_API int tolua_istablearray
105 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
106TOLUA_API int tolua_isuserdataarray
107 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
108TOLUA_API int tolua_isusertypearray
109 (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
110
111TOLUA_API void tolua_open (lua_State* L);
112
113TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
114TOLUA_API int tolua_register_gc (lua_State* L, int lo);
115TOLUA_API int tolua_default_collect (lua_State* tolua_S);
116
117TOLUA_API void tolua_usertype (lua_State* L, const char* type);
118TOLUA_API void tolua_beginmodule (lua_State* L, const char* name);
119TOLUA_API void tolua_endmodule (lua_State* L);
120TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar);
121TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base);
122TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col);
123TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func);
124TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value);
125TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set);
126TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set);
127
128/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */
129/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */
130
131TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
132TOLUA_API void tolua_pushboolean (lua_State* L, int value);
133TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value);
134TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
135TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
136TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
137TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
138TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
139TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
140TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v);
141TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
142TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
143TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
144TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
145
146TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def);
147TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
148TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
149TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
150TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
151TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
152TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def);
153TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
154TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
155TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
156TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
157TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
158
159TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
160
161TOLUA_API int class_gc_event (lua_State* L);
162
163#ifdef __cplusplus
164static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
165
166        const char* s = tolua_tostring(L, narg, def);
167        return s?s:"";
168};
169
170static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
171
172        const char* s = tolua_tofieldstring(L, lo, index, def);
173        return s?s:"";
174};
175
176#else
177#define tolua_tocppstring tolua_tostring
178#define tolua_tofieldcppstring tolua_tofieldstring
179#endif
180
181TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
182
183#ifndef Mtolua_new
184#define Mtolua_new(EXP) new EXP
185#endif
186
187#ifndef Mtolua_delete
188#define Mtolua_delete(EXP) delete EXP
189#endif
190
191#ifndef Mtolua_new_dim
192#define Mtolua_new_dim(EXP, len) new EXP[len]
193#endif
194
195#ifndef Mtolua_delete_dim
196#define Mtolua_delete_dim(EXP) delete [] EXP
197#endif
198
199#ifndef tolua_outside
200#define tolua_outside
201#endif
202
203#ifndef tolua_owned
204#define tolua_owned
205#endif
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif
Note: See TracBrowser for help on using the repository browser.