Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/tolua/tolua++.h @ 1810

Last change on this file since 1810 was 1810, checked in by rgrieder, 16 years ago

merged ceguilua branch back to trunk

  • Property svn:eol-style set to native
File size: 7.0 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#define TEMPLATE_BIND(p)
61#define TOLUA_TEMPLATE_BIND(p)
62#define TOLUA_PROTECTED_DESTRUCTOR
63#define TOLUA_PROPERTY_TYPE(p)
64
65typedef int lua_Object;
66
67#include "lua/lua.h"
68#include "lua/lauxlib.h"
69
70struct tolua_Error
71{
72        int index;
73        int array;
74        const char* type;
75};
76typedef struct tolua_Error tolua_Error;
77
78#define TOLUA_NOPEER    LUA_REGISTRYINDEX /* for lua 5.1 */
79
80TOLUA_API const char* tolua_typename (lua_State* L, int lo);
81TOLUA_API void tolua_error (lua_State* L, char* msg, tolua_Error* err);
82TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
83TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
84TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
85TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
86TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
87TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
88TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
89TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
90TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
91TOLUA_API int tolua_isvaluearray
92 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
93TOLUA_API int tolua_isbooleanarray
94 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
95TOLUA_API int tolua_isnumberarray
96 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
97TOLUA_API int tolua_isstringarray
98 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
99TOLUA_API int tolua_istablearray
100 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
101TOLUA_API int tolua_isuserdataarray
102 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
103TOLUA_API int tolua_isusertypearray
104 (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
105
106TOLUA_API void tolua_open (lua_State* L);
107
108TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
109TOLUA_API int tolua_register_gc (lua_State* L, int lo);
110TOLUA_API int tolua_default_collect (lua_State* tolua_S);
111
112TOLUA_API void tolua_usertype (lua_State* L, char* type);
113TOLUA_API void tolua_beginmodule (lua_State* L, char* name);
114TOLUA_API void tolua_endmodule (lua_State* L);
115TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar);
116TOLUA_API void tolua_class (lua_State* L, char* name, char* base);
117TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col);
118TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func);
119TOLUA_API void tolua_constant (lua_State* L, char* name, double value);
120TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set);
121TOLUA_API void tolua_array (lua_State* L,char* name, lua_CFunction get, lua_CFunction set);
122
123/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */
124/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */
125
126TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
127TOLUA_API void tolua_pushboolean (lua_State* L, int value);
128TOLUA_API void tolua_pushnumber (lua_State* L, double value);
129TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
130TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
131TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
132TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
133TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
134TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
135TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v);
136TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
137TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
138TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
139TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
140
141TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def);
142TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
143TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
144TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
145TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
146TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
147TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def);
148TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
149TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
150TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
151TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
152TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
153
154TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
155
156TOLUA_API int class_gc_event (lua_State* L);
157
158#ifdef __cplusplus
159static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
160
161        const char* s = tolua_tostring(L, narg, def);
162        return s?s:"";
163};
164
165static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
166
167        const char* s = tolua_tofieldstring(L, lo, index, def);
168        return s?s:"";
169};
170
171#else
172#define tolua_tocppstring tolua_tostring
173#define tolua_tofieldcppstring tolua_tofieldstring
174#endif
175
176TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif
Note: See TracBrowser for help on using the repository browser.