moved the generator to source root
[lqt.git] / lqt_common.hpp
blob2af305a5de7c415165348e36c1de991af6aa4e68
1 /*
2 * Copyright (c) 2007-2008 Mauro Iazzi
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef __LQT_COMMON_HPP
28 #define __LQT_COMMON_HPP
30 extern "C" {
31 #include <lua.h>
32 #include <lualib.h>
33 #include <lauxlib.h>
36 //#include <iostream>
38 //#define lqtL_register(L, p, n) ( (void)L, (void)p, (void)n )
39 //#define lqtL_unregister(L, p) ( (void)L, (void)p )
41 #define LQT_POINTERS "Registry Pointers"
42 #define LQT_ENUMS "Registry Enumerations"
44 extern void lqtL_register(lua_State *, const void *);
45 extern void lqtL_unregister(lua_State *, const void *);
47 //extern int& lqtL_tointref (lua_State *, int);
49 //extern void lqtL_pusharguments (lua_State *, char**);
50 //extern char** lqtL_toarguments (lua_State *, int);
51 //extern bool lqtL_testarguments (lua_State *, int);
53 //extern void lqtL_manageudata (lua_State *, int);
54 //extern void lqtL_unmanageudata (lua_State *, int);
55 extern void lqtL_pushudata (lua_State *, const void *, const char *);
56 extern void lqtL_passudata (lua_State *, const void *, const char *);
57 extern void * lqtL_toudata (lua_State *, int, const char *);
58 extern bool lqtL_testudata (lua_State *, int, const char *);
59 //#define lqtL_checkudata(a...) luaL_checkudata(a)
60 extern void * lqtL_checkudata (lua_State *, int, const char *);
61 #define lqtL_isudata lqtL_testudata
63 extern void lqtL_pushenum (lua_State *, int, const char *);
64 extern bool lqtL_isenum (lua_State *, int, const char *);
65 extern int lqtL_toenum (lua_State *, int, const char *);
67 extern bool lqtL_isinteger (lua_State *, int);
68 extern bool lqtL_isnumber (lua_State *, int);
69 extern bool lqtL_isstring (lua_State *, int);
70 extern bool lqtL_isboolean (lua_State *, int);
72 extern bool lqtL_missarg (lua_State *, int, int);
73 //extern int lqtL_baseindex (lua_State *, int, int);
75 //extern int lqtL_gc (lua_State *);
76 //extern int lqtL_index (lua_State *);
77 //extern int lqtL_newindex (lua_State *);
79 typedef struct {
80 const char *name;
81 int value;
82 } lqt_Enum;
84 typedef struct {
85 lqt_Enum *enums;
86 const char *name;
87 } lqt_Enumlist;
89 extern int lqtL_createenumlist (lua_State *, lqt_Enumlist[]);
91 typedef struct {
92 const char *basename;
93 } lqt_Base;
95 typedef struct {
96 luaL_Reg *mt;
97 lqt_Base *bases;
98 const char * name;
99 } lqt_Class;
101 extern int lqtL_createclasses (lua_State *, lqt_Class *);
104 #endif // __LQT_COMMON_HPP