annotate GUI/NewUI/Core/UIControlModule_wrap.cxx @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 0ff6a9e9bf7f
children
rev   line source
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1 /* ----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2 * This file was automatically generated by SWIG (http://www.swig.org).
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
3 * Version 2.0.11
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
4 *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
5 * This file is not intended to be easily readable and contains a number of
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
6 * coding conventions designed to improve portability and efficiency. Do not make
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
7 * changes to this file unless you know what you are doing--modify the SWIG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
8 * interface file instead.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
9 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
10
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
11 #define SWIGLUA
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
12 #define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
13 #define SWIG_LUA_MODULE_GLOBAL
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
14
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
15
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
16 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
17 /* SwigValueWrapper is described in swig.swg */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
18 template<typename T> class SwigValueWrapper {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
19 struct SwigMovePointer {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
20 T *ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
21 SwigMovePointer(T *p) : ptr(p) { }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
22 ~SwigMovePointer() { delete ptr; }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
23 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
24 } pointer;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
25 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
26 SwigValueWrapper(const SwigValueWrapper<T>& rhs);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
27 public:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
28 SwigValueWrapper() : pointer(0) { }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
29 SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
30 operator T&() const { return *pointer.ptr; }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
31 T *operator&() { return pointer.ptr; }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
32 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
33
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
34 template <typename T> T SwigValueInit() {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
35 return T();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
36 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
37 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
38
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
39 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
40 * This section contains generic SWIG labels for method/variable
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
41 * declarations/attributes, and other compiler dependent labels.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
42 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
43
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
44 /* template workaround for compilers that cannot correctly implement the C++ standard */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
45 #ifndef SWIGTEMPLATEDISAMBIGUATOR
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
46 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
47 # define SWIGTEMPLATEDISAMBIGUATOR template
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
48 # elif defined(__HP_aCC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
49 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
50 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
51 # define SWIGTEMPLATEDISAMBIGUATOR template
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
52 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
53 # define SWIGTEMPLATEDISAMBIGUATOR
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
54 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
55 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
56
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
57 /* inline attribute */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
58 #ifndef SWIGINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
59 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
60 # define SWIGINLINE inline
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
61 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
62 # define SWIGINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
63 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
64 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
65
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
66 /* attribute recognised by some compilers to avoid 'unused' warnings */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
67 #ifndef SWIGUNUSED
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
68 # if defined(__GNUC__)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
69 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
70 # define SWIGUNUSED __attribute__ ((__unused__))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
71 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
72 # define SWIGUNUSED
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
73 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
74 # elif defined(__ICC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
75 # define SWIGUNUSED __attribute__ ((__unused__))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
76 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
77 # define SWIGUNUSED
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
78 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
79 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
80
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
81 #ifndef SWIG_MSC_UNSUPPRESS_4505
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
82 # if defined(_MSC_VER)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
83 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
84 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
85 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
86
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
87 #ifndef SWIGUNUSEDPARM
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
88 # ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
89 # define SWIGUNUSEDPARM(p)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
90 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
91 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
92 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
93 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
94
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
95 /* internal SWIG method */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
96 #ifndef SWIGINTERN
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
97 # define SWIGINTERN static SWIGUNUSED
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
98 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
99
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
100 /* internal inline SWIG method */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
101 #ifndef SWIGINTERNINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
102 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
103 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
104
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
105 /* exporting methods */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
106 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
107 # ifndef GCC_HASCLASSVISIBILITY
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
108 # define GCC_HASCLASSVISIBILITY
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
109 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
110 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
111
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
112 #ifndef SWIGEXPORT
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
113 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
114 # if defined(STATIC_LINKED)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
115 # define SWIGEXPORT
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
116 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
117 # define SWIGEXPORT __declspec(dllexport)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
118 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
119 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
120 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
121 # define SWIGEXPORT __attribute__ ((visibility("default")))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
122 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
123 # define SWIGEXPORT
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
124 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
125 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
126 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
127
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
128 /* calling conventions for Windows */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
129 #ifndef SWIGSTDCALL
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
130 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
131 # define SWIGSTDCALL __stdcall
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
132 # else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
133 # define SWIGSTDCALL
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
134 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
135 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
136
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
137 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
138 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
139 # define _CRT_SECURE_NO_DEPRECATE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
140 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
141
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
142 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
143 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
144 # define _SCL_SECURE_NO_DEPRECATE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
145 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
146
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
147
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
148 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
149 * swigrun.swg
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
150 *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
151 * This file contains generic C API SWIG runtime support for pointer
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
152 * type checking.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
153 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
154
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
155 /* This should only be incremented when either the layout of swig_type_info changes,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
156 or for whatever reason, the runtime changes incompatibly */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
157 #define SWIG_RUNTIME_VERSION "4"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
158
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
159 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
160 #ifdef SWIG_TYPE_TABLE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
161 # define SWIG_QUOTE_STRING(x) #x
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
162 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
163 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
164 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
165 # define SWIG_TYPE_TABLE_NAME
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
166 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
167
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
168 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
169 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
170 creating a static or dynamic library from the SWIG runtime code.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
171 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
172
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
173 But only do this if strictly necessary, ie, if you have problems
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
174 with your compiler or suchlike.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
175 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
176
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
177 #ifndef SWIGRUNTIME
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
178 # define SWIGRUNTIME SWIGINTERN
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
179 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
180
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
181 #ifndef SWIGRUNTIMEINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
182 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
183 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
184
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
185 /* Generic buffer size */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
186 #ifndef SWIG_BUFFER_SIZE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
187 # define SWIG_BUFFER_SIZE 1024
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
188 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
189
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
190 /* Flags for pointer conversions */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
191 #define SWIG_POINTER_DISOWN 0x1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
192 #define SWIG_CAST_NEW_MEMORY 0x2
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
193
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
194 /* Flags for new pointer objects */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
195 #define SWIG_POINTER_OWN 0x1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
196
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
197
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
198 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
199 Flags/methods for returning states.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
200
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
201 The SWIG conversion methods, as ConvertPtr, return an integer
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
202 that tells if the conversion was successful or not. And if not,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
203 an error code can be returned (see swigerrors.swg for the codes).
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
204
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
205 Use the following macros/flags to set or process the returning
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
206 states.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
207
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
208 In old versions of SWIG, code such as the following was usually written:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
209
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
210 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
211 // success code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
212 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
213 //fail code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
214 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
215
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
216 Now you can be more explicit:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
217
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
218 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
219 if (SWIG_IsOK(res)) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
220 // success code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
221 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
222 // fail code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
223 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
224
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
225 which is the same really, but now you can also do
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
226
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
227 Type *ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
228 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
229 if (SWIG_IsOK(res)) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
230 // success code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
231 if (SWIG_IsNewObj(res) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
232 ...
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
233 delete *ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
234 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
235 ...
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
236 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
237 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
238 // fail code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
239 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
240
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
241 I.e., now SWIG_ConvertPtr can return new objects and you can
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
242 identify the case and take care of the deallocation. Of course that
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
243 also requires SWIG_ConvertPtr to return new result values, such as
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
244
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
245 int SWIG_ConvertPtr(obj, ptr,...) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
246 if (<obj is ok>) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
247 if (<need new object>) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
248 *ptr = <ptr to new allocated object>;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
249 return SWIG_NEWOBJ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
250 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
251 *ptr = <ptr to old object>;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
252 return SWIG_OLDOBJ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
253 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
254 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
255 return SWIG_BADOBJ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
256 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
257 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
258
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
259 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
260 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
261 SWIG errors code.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
262
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
263 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
264 allows to return the 'cast rank', for example, if you have this
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
265
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
266 int food(double)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
267 int fooi(int);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
268
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
269 and you call
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
270
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
271 food(1) // cast rank '1' (1 -> 1.0)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
272 fooi(1) // cast rank '0'
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
273
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
274 just use the SWIG_AddCast()/SWIG_CheckState()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
275 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
276
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
277 #define SWIG_OK (0)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
278 #define SWIG_ERROR (-1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
279 #define SWIG_IsOK(r) (r >= 0)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
280 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
281
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
282 /* The CastRankLimit says how many bits are used for the cast rank */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
283 #define SWIG_CASTRANKLIMIT (1 << 8)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
284 /* The NewMask denotes the object was created (using new/malloc) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
285 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
286 /* The TmpMask is for in/out typemaps that use temporal objects */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
287 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
288 /* Simple returning values */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
289 #define SWIG_BADOBJ (SWIG_ERROR)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
290 #define SWIG_OLDOBJ (SWIG_OK)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
291 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
292 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
293 /* Check, add and del mask methods */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
294 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
295 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
296 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
297 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
298 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
299 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
300
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
301 /* Cast-Rank Mode */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
302 #if defined(SWIG_CASTRANK_MODE)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
303 # ifndef SWIG_TypeRank
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
304 # define SWIG_TypeRank unsigned long
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
305 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
306 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
307 # define SWIG_MAXCASTRANK (2)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
308 # endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
309 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
310 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
311 SWIGINTERNINLINE int SWIG_AddCast(int r) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
312 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
313 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
314 SWIGINTERNINLINE int SWIG_CheckState(int r) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
315 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
316 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
317 #else /* no cast-rank mode */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
318 # define SWIG_AddCast(r) (r)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
319 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
320 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
321
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
322
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
323 #include <string.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
324
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
325 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
326 extern "C" {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
327 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
328
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
329 typedef void *(*swig_converter_func)(void *, int *);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
330 typedef struct swig_type_info *(*swig_dycast_func)(void **);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
331
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
332 /* Structure to store information on one type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
333 typedef struct swig_type_info {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
334 const char *name; /* mangled name of this type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
335 const char *str; /* human readable name of this type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
336 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
337 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
338 void *clientdata; /* language specific type data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
339 int owndata; /* flag if the structure owns the clientdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
340 } swig_type_info;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
341
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
342 /* Structure to store a type and conversion function used for casting */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
343 typedef struct swig_cast_info {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
344 swig_type_info *type; /* pointer to type that is equivalent to this type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
345 swig_converter_func converter; /* function to cast the void pointers */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
346 struct swig_cast_info *next; /* pointer to next cast in linked list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
347 struct swig_cast_info *prev; /* pointer to the previous cast */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
348 } swig_cast_info;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
349
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
350 /* Structure used to store module information
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
351 * Each module generates one structure like this, and the runtime collects
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
352 * all of these structures and stores them in a circularly linked list.*/
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
353 typedef struct swig_module_info {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
354 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
355 size_t size; /* Number of types in this module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
356 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
357 swig_type_info **type_initial; /* Array of initially generated type structures */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
358 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
359 void *clientdata; /* Language specific module data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
360 } swig_module_info;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
361
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
362 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
363 Compare two type names skipping the space characters, therefore
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
364 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
365
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
366 Return 0 when the two name types are equivalent, as in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
367 strncmp, but skipping ' '.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
368 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
369 SWIGRUNTIME int
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
370 SWIG_TypeNameComp(const char *f1, const char *l1,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
371 const char *f2, const char *l2) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
372 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
373 while ((*f1 == ' ') && (f1 != l1)) ++f1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
374 while ((*f2 == ' ') && (f2 != l2)) ++f2;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
375 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
376 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
377 return (int)((l1 - f1) - (l2 - f2));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
378 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
379
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
380 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
381 Check type equivalence in a name list like <name1>|<name2>|...
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
382 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
383 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
384 SWIGRUNTIME int
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
385 SWIG_TypeCmp(const char *nb, const char *tb) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
386 int equiv = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
387 const char* te = tb + strlen(tb);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
388 const char* ne = nb;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
389 while (equiv != 0 && *ne) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
390 for (nb = ne; *ne; ++ne) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
391 if (*ne == '|') break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
392 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
393 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
394 if (*ne) ++ne;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
395 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
396 return equiv;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
397 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
398
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
399 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
400 Check type equivalence in a name list like <name1>|<name2>|...
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
401 Return 0 if not equal, 1 if equal
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
402 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
403 SWIGRUNTIME int
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
404 SWIG_TypeEquiv(const char *nb, const char *tb) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
405 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
406 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
407
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
408 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
409 Check the typename
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
410 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
411 SWIGRUNTIME swig_cast_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
412 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
413 if (ty) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
414 swig_cast_info *iter = ty->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
415 while (iter) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
416 if (strcmp(iter->type->name, c) == 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
417 if (iter == ty->cast)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
418 return iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
419 /* Move iter to the top of the linked list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
420 iter->prev->next = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
421 if (iter->next)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
422 iter->next->prev = iter->prev;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
423 iter->next = ty->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
424 iter->prev = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
425 if (ty->cast) ty->cast->prev = iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
426 ty->cast = iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
427 return iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
428 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
429 iter = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
430 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
431 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
432 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
433 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
434
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
435 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
436 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
437 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
438 SWIGRUNTIME swig_cast_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
439 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
440 if (ty) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
441 swig_cast_info *iter = ty->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
442 while (iter) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
443 if (iter->type == from) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
444 if (iter == ty->cast)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
445 return iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
446 /* Move iter to the top of the linked list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
447 iter->prev->next = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
448 if (iter->next)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
449 iter->next->prev = iter->prev;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
450 iter->next = ty->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
451 iter->prev = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
452 if (ty->cast) ty->cast->prev = iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
453 ty->cast = iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
454 return iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
455 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
456 iter = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
457 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
458 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
459 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
460 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
461
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
462 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
463 Cast a pointer up an inheritance hierarchy
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
464 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
465 SWIGRUNTIMEINLINE void *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
466 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
467 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
468 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
469
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
470 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
471 Dynamic pointer casting. Down an inheritance hierarchy
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
472 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
473 SWIGRUNTIME swig_type_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
474 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
475 swig_type_info *lastty = ty;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
476 if (!ty || !ty->dcast) return ty;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
477 while (ty && (ty->dcast)) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
478 ty = (*ty->dcast)(ptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
479 if (ty) lastty = ty;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
480 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
481 return lastty;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
482 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
483
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
484 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
485 Return the name associated with this type
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
486 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
487 SWIGRUNTIMEINLINE const char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
488 SWIG_TypeName(const swig_type_info *ty) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
489 return ty->name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
490 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
491
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
492 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
493 Return the pretty name associated with this type,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
494 that is an unmangled type name in a form presentable to the user.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
495 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
496 SWIGRUNTIME const char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
497 SWIG_TypePrettyName(const swig_type_info *type) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
498 /* The "str" field contains the equivalent pretty names of the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
499 type, separated by vertical-bar characters. We choose
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
500 to print the last name, as it is often (?) the most
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
501 specific. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
502 if (!type) return NULL;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
503 if (type->str != NULL) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
504 const char *last_name = type->str;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
505 const char *s;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
506 for (s = type->str; *s; s++)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
507 if (*s == '|') last_name = s+1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
508 return last_name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
509 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
510 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
511 return type->name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
512 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
513
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
514 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
515 Set the clientdata field for a type
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
516 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
517 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
518 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
519 swig_cast_info *cast = ti->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
520 /* if (ti->clientdata == clientdata) return; */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
521 ti->clientdata = clientdata;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
522
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
523 while (cast) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
524 if (!cast->converter) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
525 swig_type_info *tc = cast->type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
526 if (!tc->clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
527 SWIG_TypeClientData(tc, clientdata);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
528 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
529 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
530 cast = cast->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
531 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
532 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
533 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
534 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
535 SWIG_TypeClientData(ti, clientdata);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
536 ti->owndata = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
537 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
538
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
539 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
540 Search for a swig_type_info structure only by mangled name
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
541 Search is a O(log #types)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
542
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
543 We start searching at module start, and finish searching when start == end.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
544 Note: if start == end at the beginning of the function, we go all the way around
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
545 the circular list.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
546 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
547 SWIGRUNTIME swig_type_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
548 SWIG_MangledTypeQueryModule(swig_module_info *start,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
549 swig_module_info *end,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
550 const char *name) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
551 swig_module_info *iter = start;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
552 do {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
553 if (iter->size) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
554 register size_t l = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
555 register size_t r = iter->size - 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
556 do {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
557 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
558 register size_t i = (l + r) >> 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
559 const char *iname = iter->types[i]->name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
560 if (iname) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
561 register int compare = strcmp(name, iname);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
562 if (compare == 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
563 return iter->types[i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
564 } else if (compare < 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
565 if (i) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
566 r = i - 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
567 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
568 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
569 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
570 } else if (compare > 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
571 l = i + 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
572 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
573 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
574 break; /* should never happen */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
575 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
576 } while (l <= r);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
577 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
578 iter = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
579 } while (iter != end);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
580 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
581 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
582
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
583 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
584 Search for a swig_type_info structure for either a mangled name or a human readable name.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
585 It first searches the mangled names of the types, which is a O(log #types)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
586 If a type is not found it then searches the human readable names, which is O(#types).
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
587
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
588 We start searching at module start, and finish searching when start == end.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
589 Note: if start == end at the beginning of the function, we go all the way around
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
590 the circular list.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
591 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
592 SWIGRUNTIME swig_type_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
593 SWIG_TypeQueryModule(swig_module_info *start,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
594 swig_module_info *end,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
595 const char *name) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
596 /* STEP 1: Search the name field using binary search */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
597 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
598 if (ret) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
599 return ret;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
600 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
601 /* STEP 2: If the type hasn't been found, do a complete search
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
602 of the str field (the human readable name) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
603 swig_module_info *iter = start;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
604 do {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
605 register size_t i = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
606 for (; i < iter->size; ++i) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
607 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
608 return iter->types[i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
609 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
610 iter = iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
611 } while (iter != end);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
612 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
613
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
614 /* neither found a match */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
615 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
616 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
617
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
618 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
619 Pack binary data into a string
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
620 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
621 SWIGRUNTIME char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
622 SWIG_PackData(char *c, void *ptr, size_t sz) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
623 static const char hex[17] = "0123456789abcdef";
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
624 register const unsigned char *u = (unsigned char *) ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
625 register const unsigned char *eu = u + sz;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
626 for (; u != eu; ++u) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
627 register unsigned char uu = *u;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
628 *(c++) = hex[(uu & 0xf0) >> 4];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
629 *(c++) = hex[uu & 0xf];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
630 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
631 return c;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
632 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
633
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
634 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
635 Unpack binary data from a string
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
636 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
637 SWIGRUNTIME const char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
638 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
639 register unsigned char *u = (unsigned char *) ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
640 register const unsigned char *eu = u + sz;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
641 for (; u != eu; ++u) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
642 register char d = *(c++);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
643 register unsigned char uu;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
644 if ((d >= '0') && (d <= '9'))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
645 uu = ((d - '0') << 4);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
646 else if ((d >= 'a') && (d <= 'f'))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
647 uu = ((d - ('a'-10)) << 4);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
648 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
649 return (char *) 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
650 d = *(c++);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
651 if ((d >= '0') && (d <= '9'))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
652 uu |= (d - '0');
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
653 else if ((d >= 'a') && (d <= 'f'))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
654 uu |= (d - ('a'-10));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
655 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
656 return (char *) 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
657 *u = uu;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
658 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
659 return c;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
660 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
661
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
662 /*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
663 Pack 'void *' into a string buffer.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
664 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
665 SWIGRUNTIME char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
666 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
667 char *r = buff;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
668 if ((2*sizeof(void *) + 2) > bsz) return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
669 *(r++) = '_';
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
670 r = SWIG_PackData(r,&ptr,sizeof(void *));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
671 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
672 strcpy(r,name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
673 return buff;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
674 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
675
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
676 SWIGRUNTIME const char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
677 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
678 if (*c != '_') {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
679 if (strcmp(c,"NULL") == 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
680 *ptr = (void *) 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
681 return name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
682 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
683 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
684 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
685 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
686 return SWIG_UnpackData(++c,ptr,sizeof(void *));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
687 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
688
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
689 SWIGRUNTIME char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
690 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
691 char *r = buff;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
692 size_t lname = (name ? strlen(name) : 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
693 if ((2*sz + 2 + lname) > bsz) return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
694 *(r++) = '_';
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
695 r = SWIG_PackData(r,ptr,sz);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
696 if (lname) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
697 strncpy(r,name,lname+1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
698 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
699 *r = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
700 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
701 return buff;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
702 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
703
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
704 SWIGRUNTIME const char *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
705 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
706 if (*c != '_') {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
707 if (strcmp(c,"NULL") == 0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
708 memset(ptr,0,sz);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
709 return name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
710 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
711 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
712 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
713 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
714 return SWIG_UnpackData(++c,ptr,sz);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
715 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
716
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
717 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
718 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
719 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
720
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
721 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
722 * luarun.swg
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
723 *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
724 * This file contains the runtime support for Lua modules
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
725 * and includes code for managing global variables and pointer
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
726 * type checking.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
727 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
728
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
729 #include "lib/lua/lua.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
730 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
731 extern "C" {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
732 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
733
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
734 //#include "lua.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
735 //#include "lauxlib.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
736 #include <stdlib.h> /* for malloc */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
737 #include <assert.h> /* for a few sanity tests */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
738
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
739 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
740 * Lua flavors
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
741 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
742
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
743 #define SWIG_LUA_FLAVOR_LUA 1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
744 #define SWIG_LUA_FLAVOR_ELUA 2
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
745 #define SWIG_LUA_FLAVOR_ELUAC 3
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
746
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
747 #if !defined(SWIG_LUA_TARGET)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
748 # error SWIG_LUA_TARGET not defined
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
749 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
750
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
751 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
752 # define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
753 # define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
754 # define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
755 # define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
756 #else /* SWIG_LUA_FLAVOR_LUA */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
757 # define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
758 # define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
759 # define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
760 # define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
761 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
762
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
763 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
764 # define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
765 # define LSTRVAL LRO_STRVAL
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
766 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
767
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
768 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
769 * compatibility defines
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
770 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
771
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
772 /* History of Lua C API length functions: In Lua 5.0 (and before?)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
773 there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
774 but a compatibility define of "lua_strlen" was added. In Lua 5.2,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
775 this function was again renamed, to "lua_rawlen" (to emphasize that
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
776 it doesn't call the "__len" metamethod), and the compatibility
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
777 define of lua_strlen was removed. All SWIG uses have been updated
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
778 to "lua_rawlen", and we add our own defines of that here for older
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
779 versions of Lua. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
780 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
781 # define lua_rawlen lua_strlen
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
782 #elif LUA_VERSION_NUM == 501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
783 # define lua_rawlen lua_objlen
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
784 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
785
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
786
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
787 /* lua_pushglobaltable is the recommended "future-proof" way to get
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
788 the global table for Lua 5.2 and later. Here we define
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
789 lua_pushglobaltable ourselves for Lua versions before 5.2. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
790 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
791 # define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
792 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
793
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
794
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
795 /* --------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
796 * Helper functions for error handling
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
797 * -------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
798
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
799 /* Push the string STR on the Lua stack, like lua_pushstring, but
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
800 prefixed with the the location of the innermost Lua call-point
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
801 (as formated by luaL_where). */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
802 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
803 SWIG_Lua_pusherrstring (lua_State *L, const char *str)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
804 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
805 luaL_where (L, 1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
806 lua_pushstring (L, str);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
807 lua_concat (L, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
808 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
809
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
810 /* Push a formatted string generated from FMT and following args on
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
811 the Lua stack, like lua_pushfstring, but prefixed with the the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
812 location of the innermost Lua call-point (as formated by luaL_where). */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
813 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
814 SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
815 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
816 va_list argp;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
817 va_start(argp, fmt);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
818 luaL_where(L, 1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
819 lua_pushvfstring(L, fmt, argp);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
820 va_end(argp);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
821 lua_concat(L, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
822 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
823
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
824
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
825 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
826 * global swig types
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
827 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
828 /* Constant table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
829 #define SWIG_LUA_INT 1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
830 #define SWIG_LUA_FLOAT 2
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
831 #define SWIG_LUA_STRING 3
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
832 #define SWIG_LUA_POINTER 4
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
833 #define SWIG_LUA_BINARY 5
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
834 #define SWIG_LUA_CHAR 6
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
835
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
836 /* Structure for variable linking table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
837 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
838 const char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
839 lua_CFunction get;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
840 lua_CFunction set;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
841 } swig_lua_var_info;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
842
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
843 /* Constant information structure */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
844 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
845 int type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
846 char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
847 long lvalue;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
848 double dvalue;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
849 void *pvalue;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
850 swig_type_info **ptype;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
851 } swig_lua_const_info;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
852
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
853 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
854 const char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
855 lua_CFunction method;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
856 } swig_lua_method;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
857
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
858 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
859 const char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
860 lua_CFunction getmethod;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
861 lua_CFunction setmethod;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
862 } swig_lua_attribute;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
863
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
864 // Can be used to create namespaces. Currently used to
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
865 // wrap class static methods/variables/constants
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
866 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
867 const char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
868 swig_lua_method *ns_methods;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
869 swig_lua_attribute *ns_attributes;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
870 swig_lua_const_info *ns_constants;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
871 } swig_lua_namespace;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
872
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
873 typedef struct swig_lua_class {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
874 const char *name;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
875 swig_type_info **type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
876 lua_CFunction constructor;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
877 void (*destructor)(void *);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
878 swig_lua_method *methods;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
879 swig_lua_attribute *attributes;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
880 swig_lua_namespace cls_static;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
881 struct swig_lua_class **bases;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
882 const char **base_names;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
883 } swig_lua_class;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
884
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
885 /* this is the struct for wrapping all pointers in SwigLua
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
886 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
887 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
888 swig_type_info *type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
889 int own; /* 1 if owned & must be destroyed */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
890 void *ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
891 } swig_lua_userdata;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
892
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
893 /* this is the struct for wrapping arbitrary packed binary data
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
894 (currently it is only used for member function pointers)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
895 the data ordering is similar to swig_lua_userdata, but it is currently not possible
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
896 to tell the two structures apart within SWIG, other than by looking at the type
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
897 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
898 typedef struct {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
899 swig_type_info *type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
900 int own; /* 1 if owned & must be destroyed */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
901 char data[1]; /* arbitary amount of data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
902 } swig_lua_rawdata;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
903
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
904 /* Common SWIG API */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
905 #define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
906 #define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
907 #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
908 /* for C++ member pointers, ie, member methods */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
909 #define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
910 #define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
911
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
912 /* Runtime API */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
913 #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
914 #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
915 #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
916
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
917 /* Contract support */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
918 #define SWIG_contract_assert(expr, msg) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
919 if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
920
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
921
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
922 /* helper #defines */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
923 #define SWIG_fail {goto fail;}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
924 #define SWIG_fail_arg(func_name,argnum,type) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
925 {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
926 func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
927 goto fail;}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
928 #define SWIG_fail_ptr(func_name,argnum,type) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
929 SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
930 #define SWIG_check_num_args(func_name,a,b) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
931 if (lua_gettop(L)<a || lua_gettop(L)>b) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
932 {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
933 goto fail;}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
934
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
935
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
936 #define SWIG_Lua_get_table(L,n) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
937 (lua_pushstring(L, n), lua_rawget(L,-2))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
938
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
939 #define SWIG_Lua_add_function(L,n,f) \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
940 (lua_pushstring(L, n), \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
941 lua_pushcfunction(L, f), \
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
942 lua_rawset(L,-3))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
943
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
944 /* special helper for allowing 'nil' for usertypes */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
945 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
946
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
947 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
948 /* Special helper for member function pointers
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
949 it gets the address, casts it, then dereferences it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
950 //#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a)))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
951 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
952
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
953 /* storing/access of swig_module_info */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
954 SWIGRUNTIME swig_module_info *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
955 SWIG_Lua_GetModule(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
956 swig_module_info *ret = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
957 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
958 lua_rawget(L,LUA_REGISTRYINDEX);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
959 if (lua_islightuserdata(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
960 ret=(swig_module_info*)lua_touserdata(L,-1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
961 lua_pop(L,1); /* tidy */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
962 return ret;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
963 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
964
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
965 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
966 SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
967 /* add this all into the Lua registry: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
968 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
969 lua_pushlightuserdata(L,(void*)module);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
970 lua_rawset(L,LUA_REGISTRYINDEX);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
971 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
972
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
973 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
974 * global variable support code: modules
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
975 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
976
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
977 /* this function is called when trying to set an immutable.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
978 default action is to print an error.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
979 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
980 SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
981 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
982 /* there should be 1 param passed in: the new value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
983 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
984 lua_pop(L,1); /* remove it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
985 luaL_error(L,"This variable is immutable");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
986 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
987 return 0; /* should not return anything */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
988 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
989
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
990 /* the module.get method used for getting linked data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
991 SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
992 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
993 /* there should be 2 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
994 (1) table (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
995 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
996 printf("SWIG_Lua_module_get %p(%s) '%s'\n",
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
997 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
998 lua_tostring(L,2));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
999 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1000 /* get the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1001 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1002 assert(lua_isrotable(L,1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1003 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1004 assert(lua_istable(L,1)); /* default Lua action */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1005 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1006 lua_getmetatable(L,1); /* get the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1007 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1008 assert(lua_isrotable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1009 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1010 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1011 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1012 SWIG_Lua_get_table(L,".get"); /* get the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1013 lua_remove(L,3); /* remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1014 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1015 if (lua_isrotable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1016 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1017 if (lua_istable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1018 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1019 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1020 /* look for the key in the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1021 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1022 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1023 lua_remove(L,3); /* remove .get */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1024 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1025 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1026 lua_call(L,0,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1027 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1028 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1029 lua_pop(L,1); /* remove the top */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1030 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1031 lua_pop(L,1); /* remove the .get */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1032 lua_pushnil(L); /* return a nil */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1033 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1034 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1035
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1036 /* the module.set method used for setting linked data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1037 SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1038 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1039 /* there should be 3 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1040 (1) table (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1041 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1042 (3) any for the new value
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1043 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1044 /* get the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1045 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1046 assert(lua_isrotable(L,1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1047 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1048 assert(lua_istable(L,1)); /* default Lua action */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1049 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1050 lua_getmetatable(L,1); /* get the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1051 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1052 assert(lua_isrotable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1053 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1054 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1055 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1056 SWIG_Lua_get_table(L,".set"); /* get the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1057 lua_remove(L,4); /* remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1058 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1059 if (lua_isrotable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1060 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1061 if (lua_istable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1062 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1063 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1064 /* look for the key in the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1065 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1066 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1067 lua_remove(L,4); /* remove .set */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1068 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1069 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1070 lua_pushvalue(L,3); /* value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1071 lua_call(L,1,0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1072 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1073 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1074 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1075 else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1076 return 0; // Exits stoically if an invalid key is initialized.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1077 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1078 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1079 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1080 lua_settop(L,3); /* reset back to start */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1081 /* we now have the table, key & new value, so just set directly */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1082 lua_rawset(L,1); /* add direct */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1083 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1084 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1085
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1086 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1087 /* registering a module in lua. Pushes the module table on the stack. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1088 SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1089 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1090 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1091 lua_pushstring(L,name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1092 lua_newtable(L); /* the table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1093 /* add meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1094 lua_newtable(L); /* the meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1095 SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1096 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1097 lua_pushstring(L,".get");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1098 lua_newtable(L); /* the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1099 lua_rawset(L,-3); /* add .get into metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1100 lua_pushstring(L,".set");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1101 lua_newtable(L); /* the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1102 lua_rawset(L,-3); /* add .set into metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1103 lua_setmetatable(L,-2); /* sets meta table in module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1104 #ifdef SWIG_LUA_MODULE_GLOBAL
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1105 /* If requested, install the module directly into the global namespace. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1106 lua_rawset(L,-3); /* add module into parent */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1107 SWIG_Lua_get_table(L,name); /* get the table back out */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1108 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1109 /* Do not install the module table as global name. The stack top has
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1110 the module table with the name below. We pop the top and replace
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1111 the name with it. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1112 lua_replace(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1113 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1114 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1115
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1116 /* ending the register */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1117 SWIGINTERN void SWIG_Lua_module_end(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1118 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1119 lua_pop(L,1); /* tidy stack (remove module) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1120 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1121
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1122 /* adding a linked variable to the module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1123 SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1124 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1125 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1126 lua_getmetatable(L,-1); /* get the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1127 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1128 SWIG_Lua_get_table(L,".get"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1129 assert(lua_istable(L,-1)); /* should be a table: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1130 SWIG_Lua_add_function(L,name,getFn);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1131 lua_pop(L,1); /* tidy stack (remove table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1132 if (setFn) /* if there is a set fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1133 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1134 SWIG_Lua_get_table(L,".set"); /* find the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1135 assert(lua_istable(L,-1)); /* should be a table: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1136 SWIG_Lua_add_function(L,name,setFn);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1137 lua_pop(L,1); /* tidy stack (remove table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1138 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1139 lua_pop(L,1); /* tidy stack (remove meta) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1140 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1141 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1142
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1143 /* adding a function module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1144 SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1145 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1146 SWIG_Lua_add_function(L,name,fn);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1147 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1148
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1149 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1150 * global variable support code: namespaces
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1151 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1152
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1153 SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1154 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1155 /* there should be 2 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1156 (1) table (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1157 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1158 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1159 assert(lua_istable(L,-2)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1160 lua_getmetatable(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1161 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1162 SWIG_Lua_get_table(L,".get"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1163 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1164 /* look for the key in the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1165 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1166 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1167 lua_remove(L,-2); /* stack tidy, remove .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1168 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1169 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1170 lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1171 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1172 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1173 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1174 lua_pop(L,1); /* remove whatever was there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1175 /* ok, so try the .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1176 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1177 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1178 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1179 lua_rawget(L,-2); /* look for the fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1180 lua_remove(L,-2); /* stack tidy, remove .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1181 if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1182 { /* found it so return the fn & let lua call it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1183 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1184 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1185 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1186 lua_pop(L,1); /* remove whatever was there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1187 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1188 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1189
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1190 SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1191 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1192 /* there should be 3 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1193 (1) table (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1194 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1195 (3) any for the new value
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1196 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1197
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1198 assert(lua_istable(L,1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1199 lua_getmetatable(L,1); /* get the meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1200 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1201
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1202 SWIG_Lua_get_table(L,".set"); /* find the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1203 if (lua_istable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1204 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1205 /* look for the key in the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1206 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1207 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1208 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1209 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1210 lua_pushvalue(L,3); /* value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1211 lua_call(L,1,0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1212 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1213 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1214 lua_pop(L,1); /* remove the value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1215 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1216 lua_pop(L,1); /* remove the value .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1217 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1218 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1219
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1220 SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1221 SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1222
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1223 /* helper function - register namespace methods and attributes into namespace */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1224 SWIGINTERN void SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1225 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1226 int i = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1227 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1228 /* There must be table at the top of the stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1229 SWIG_Lua_InstallConstants(L, ns->ns_constants);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1230
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1231 lua_getmetatable(L,-1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1232
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1233 /* add fns */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1234 for(i=0;ns->ns_attributes[i].name;i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1235 SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1236 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1237
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1238 /* add methods to the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1239 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1240 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1241 for(i=0;ns->ns_methods[i].name;i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1242 SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1243 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1244 lua_pop(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1245
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1246 /* clear stack - remove metatble */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1247 lua_pop(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1248
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1249 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1250
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1251 /* helper function. creates namespace table and add it to module table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1252 SWIGINTERN void SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1253 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1254 assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1255 lua_checkstack(L,5);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1256 lua_pushstring(L, ns->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1257 lua_newtable(L); /* namespace itself */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1258 lua_newtable(L); /* metatable for namespace */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1259
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1260 /* add a table called ".get" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1261 lua_pushstring(L,".get");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1262 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1263 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1264 /* add a table called ".set" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1265 lua_pushstring(L,".set");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1266 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1267 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1268 /* add a table called ".fn" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1269 lua_pushstring(L,".fn");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1270 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1271 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1272
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1273 /* add accessor fns for using the .get,.set&.fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1274 SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1275 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1276
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1277 lua_setmetatable(L,-2); /* set metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1278 lua_rawset(L,-3); /* add namespace to module table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1279 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1280 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1281 * global variable support code: classes
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1282 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1283
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1284 /* the class.get method, performs the lookup of class attributes */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1285 SWIGINTERN int SWIG_Lua_class_get(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1286 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1287 /* there should be 2 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1288 (1) userdata (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1289 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1290 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1291 assert(lua_isuserdata(L,-2)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1292 lua_getmetatable(L,-2); /* get the meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1293 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1294 SWIG_Lua_get_table(L,".get"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1295 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1296 /* look for the key in the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1297 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1298 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1299 lua_remove(L,-2); /* stack tidy, remove .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1300 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1301 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1302 lua_pushvalue(L,1); /* the userdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1303 lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1304 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1305 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1306 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1307 lua_pop(L,1); /* remove whatever was there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1308 /* ok, so try the .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1309 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1310 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1311 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1312 lua_rawget(L,-2); /* look for the fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1313 lua_remove(L,-2); /* stack tidy, remove .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1314 if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1315 { /* found it so return the fn & let lua call it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1316 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1317 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1318 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1319 lua_pop(L,1); /* remove whatever was there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1320 /* NEW: looks for the __getitem() fn
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1321 this is a user provided get fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1322 SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1323 if (lua_iscfunction(L,-1)) /* if its there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1324 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1325 lua_pushvalue(L,1); /* the userdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1326 lua_pushvalue(L,2); /* the parameter */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1327 lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1328 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1329 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1330 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1331 return 0; /* sorry not known */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1332 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1333
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1334 /* the class.set method, performs the lookup of class attributes */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1335 SWIGINTERN int SWIG_Lua_class_set(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1336 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1337 /* there should be 3 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1338 (1) table (not the meta table)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1339 (2) string name of the attribute
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1340 (3) any for the new value
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1341 printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n",
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1342 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1343 lua_tostring(L,2),
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1344 lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1345
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1346 assert(lua_isuserdata(L,1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1347 lua_getmetatable(L,1); /* get the meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1348 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1349
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1350 SWIG_Lua_get_table(L,".set"); /* find the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1351 if (lua_istable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1352 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1353 /* look for the key in the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1354 lua_pushvalue(L,2); /* key */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1355 lua_rawget(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1356 if (lua_iscfunction(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1357 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1358 lua_pushvalue(L,1); /* userdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1359 lua_pushvalue(L,3); /* value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1360 lua_call(L,2,0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1361 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1362 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1363 lua_pop(L,1); /* remove the value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1364 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1365 lua_pop(L,1); /* remove the value .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1366 /* NEW: looks for the __setitem() fn
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1367 this is a user provided set fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1368 SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1369 if (lua_iscfunction(L,-1)) /* if its there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1370 { /* found it so call the fn & return its value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1371 lua_pushvalue(L,1); /* the userdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1372 lua_pushvalue(L,2); /* the parameter */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1373 lua_pushvalue(L,3); /* the value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1374 lua_call(L,3,0); /* 3 values in ,0 out */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1375 lua_remove(L,-2); /* stack tidy, remove metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1376 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1377 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1378 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1379 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1380
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1381 /* the class.destruct method called by the interpreter */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1382 SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1383 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1384 /* there should be 1 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1385 (1) userdata (not the meta table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1386 swig_lua_userdata* usr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1387 swig_lua_class* clss;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1388 assert(lua_isuserdata(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1389 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1390 /* if must be destroyed & has a destructor */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1391 if (usr->own) /* if must be destroyed */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1392 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1393 clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1394 if (clss && clss->destructor) /* there is a destroy fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1395 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1396 clss->destructor(usr->ptr); /* bye bye */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1397 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1398 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1399 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1400 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1401
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1402 /* the class.__tostring method called by the interpreter and print */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1403 SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1404 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1405 /* there should be 1 param passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1406 (1) userdata (not the metatable) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1407 assert(lua_isuserdata(L,1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1408 unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1409 lua_getmetatable(L,1); /* get the meta table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1410 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1411
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1412 lua_getfield(L, -1, ".type");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1413 const char* className = lua_tostring(L, -1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1414
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1415 char output[256];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1416 sprintf(output, "<%s userdata: %lX>", className, userData);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1417
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1418 lua_pushstring(L, (const char*)output);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1419 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1420 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1421
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1422 /* to manually disown some userdata */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1423 SWIGINTERN int SWIG_Lua_class_disown(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1424 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1425 /* there should be 1 params passed in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1426 (1) userdata (not the meta table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1427 swig_lua_userdata* usr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1428 assert(lua_isuserdata(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1429 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1430
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1431 usr->own = 0; /* clear our ownership */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1432 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1433 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1434
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1435 /* Constructor proxy. Used when class name entry in module is not class constructor,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1436 but special table instead. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1437 SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1438 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1439 /* unlimited number of parameters
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1440 First one is our proxy table and we should remove it
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1441 Other we should pass to real constructor
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1442 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1443 assert(lua_istable(L,1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1444 lua_pushstring(L,".constructor");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1445 lua_rawget(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1446 assert(!lua_isnil(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1447 lua_replace(L,1); /* replace our table with real constructor */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1448 lua_call(L,lua_gettop(L)-1,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1449 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1450 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1451
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1452 /* gets the swig class registry (or creates it) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1453 SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1454 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1455 /* add this all into the swig registry: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1456 lua_pushstring(L,"SWIG");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1457 lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1458 if (!lua_istable(L,-1)) /* not there */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1459 { /* must be first time, so add it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1460 lua_pop(L,1); /* remove the result */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1461 lua_pushstring(L,"SWIG");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1462 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1463 lua_rawset(L,LUA_REGISTRYINDEX);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1464 /* then get it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1465 lua_pushstring(L,"SWIG");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1466 lua_rawget(L,LUA_REGISTRYINDEX);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1467 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1468 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1469
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1470 /* helper fn to get the classes metatable from the register */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1471 SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1472 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1473 SWIG_Lua_get_class_registry(L); /* get the registry */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1474 lua_pushstring(L,cname); /* get the name */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1475 lua_rawget(L,-2); /* get it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1476 lua_remove(L,-2); /* tidy up (remove registry) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1477 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1478
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1479 /* helper add a variable to a registered class */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1480 SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1481 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1482 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1483 SWIG_Lua_get_table(L,".get"); /* find the .get table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1484 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1485 SWIG_Lua_add_function(L,name,getFn);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1486 lua_pop(L,1); /* tidy stack (remove table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1487 if (setFn)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1488 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1489 SWIG_Lua_get_table(L,".set"); /* find the .set table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1490 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1491 SWIG_Lua_add_function(L,name,setFn);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1492 lua_pop(L,1); /* tidy stack (remove table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1493 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1494 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1495
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1496 /* helper to recursively add class static details (static attributes, operations and constants) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1497 SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1498 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1499 int i = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1500 /* The class namespace table must be on the top of the stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1501 assert(lua_istable(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1502 /* call all the base classes first: we can then override these later: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1503 for(i=0;clss->bases[i];i++)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1504 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1505 SWIG_Lua_add_class_static_details(L,clss->bases[i]);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1506 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1507
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1508 SWIG_Lua_add_namespace_details(L, &clss->cls_static);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1509 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1510
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1511 /* helper to recursively add class details (attributes & operations) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1512 SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1513 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1514 int i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1515 /* call all the base classes first: we can then override these later: */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1516 for(i=0;clss->bases[i];i++)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1517 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1518 SWIG_Lua_add_class_details(L,clss->bases[i]);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1519 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1520 /* add fns */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1521 for(i=0;clss->attributes[i].name;i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1522 SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1523 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1524 /* add methods to the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1525 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1526 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1527 for(i=0;clss->methods[i].name;i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1528 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1529 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1530 lua_pop(L,1); /* tidy stack (remove table) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1531 /* add operator overloads
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1532 these look ANY method which start with "__" and assume they
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1533 are operator overloads & add them to the metatable
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1534 (this might mess up is someone defines a method __gc (the destructor)*/
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1535 for(i=0;clss->methods[i].name;i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1536 if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1537 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1538 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1539 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1540 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1541
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1542 /* set up the base classes pointers.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1543 Each class structure has a list of pointers to the base class structures.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1544 This function fills them.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1545 It cannot be done at compile time, as this will not work with hireachies
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1546 spread over more than one swig file.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1547 Therefore it must be done at runtime, querying the SWIG type system.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1548 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1549 SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1550 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1551 int i=0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1552 swig_module_info* module=SWIG_GetModule(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1553 for(i=0;clss->base_names[i];i++)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1554 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1555 if (clss->bases[i]==0) /* not found yet */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1556 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1557 /* lookup and cache the base class */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1558 swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1559 if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1560 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1561 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1562 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1563
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1564 /* Register class static methods,attributes etc as well as constructor proxy */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1565 SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1566 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1567 lua_checkstack(L,5); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1568 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1569 assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1570
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1571 SWIG_Lua_namespace_register(L,&clss->cls_static);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1572
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1573 SWIG_Lua_get_table(L,clss->name); // Get namespace table back
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1574 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1575
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1576 /* add its constructor to module with the name of the class
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1577 so you can do MyClass(...) as well as new_MyClass(...)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1578 BUT only if a constructor is defined
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1579 (this overcomes the problem of pure virtual classes without constructors)*/
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1580 if (clss->constructor)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1581 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1582 SWIG_Lua_add_function(L,".constructor", clss->constructor);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1583 lua_getmetatable(L,-1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1584 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1585 SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1586 lua_pop(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1587 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1588
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1589 assert(lua_istable(L,-1)); /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1590 SWIG_Lua_add_class_static_details(L, clss);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1591
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1592 /* clear stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1593 lua_pop(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1594 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1595
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1596 /* performs the entire class registration process */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1597 SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1598 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1599 SWIG_Lua_class_register_static(L,clss);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1600
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1601 SWIG_Lua_get_class_registry(L); /* get the registry */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1602 lua_pushstring(L,clss->name); /* get the name */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1603 lua_newtable(L); /* create the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1604 /* add string of class name called ".type" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1605 lua_pushstring(L,".type");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1606 lua_pushstring(L,clss->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1607 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1608 /* add a table called ".get" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1609 lua_pushstring(L,".get");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1610 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1611 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1612 /* add a table called ".set" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1613 lua_pushstring(L,".set");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1614 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1615 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1616 /* add a table called ".fn" */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1617 lua_pushstring(L,".fn");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1618 lua_newtable(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1619 /* add manual disown method */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1620 SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1621 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1622 /* add accessor fns for using the .get,.set&.fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1623 SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1624 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1625 SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1626 /* add tostring method for better output */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1627 SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1628 /* add it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1629 lua_rawset(L,-3); /* metatable into registry */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1630 lua_pop(L,1); /* tidy stack (remove registry) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1631
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1632 SWIG_Lua_get_class_metatable(L,clss->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1633 SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1634 lua_pop(L,1); /* tidy stack (remove class metatable) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1635 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1636
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1637 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1638 * Class/structure conversion fns
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1639 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1640
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1641 /* helper to add metatable to new lua object */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1642 SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1643 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1644 if (type->clientdata) /* there is clientdata: so add the metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1645 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1646 SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1647 if (lua_istable(L,-1))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1648 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1649 lua_setmetatable(L,-2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1650 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1651 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1652 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1653 lua_pop(L,1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1654 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1655 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1656 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1657
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1658 /* pushes a new object into the lua stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1659 SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1660 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1661 swig_lua_userdata* usr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1662 if (!ptr){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1663 lua_pushnil(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1664 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1665 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1666 usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1667 usr->ptr=ptr; /* set the ptr */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1668 usr->type=type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1669 usr->own=own;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1670 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1671 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1672 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1673 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1674
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1675 /* takes a object from the lua stack & converts it into an object of the correct type
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1676 (if possible) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1677 SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1678 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1679 swig_lua_userdata* usr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1680 swig_cast_info *cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1681 if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1682 usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1683 if (usr)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1684 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1685 if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1686 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1687 usr->own=0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1688 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1689 if (!type) /* special cast void*, no casting fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1690 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1691 *ptr=usr->ptr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1692 return SWIG_OK; /* ok */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1693 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1694 cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1695 if (cast)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1696 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1697 int newmemory = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1698 *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1699 assert(!newmemory); /* newmemory handling not yet implemented */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1700 return SWIG_OK; /* ok */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1701 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1702 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1703 return SWIG_ERROR; /* error */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1704 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1705
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1706 SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1707 int argnum,const char* func_name){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1708 void* result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1709 if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1710 luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1711 func_name,(type && type->str)?type->str:"void*",argnum);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1712 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1713 return result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1714 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1715
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1716 /* pushes a packed userdata. user for member fn pointers only */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1717 SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1718 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1719 swig_lua_rawdata* raw;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1720 assert(ptr); /* not acceptable to pass in a NULL value */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1721 raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1722 raw->type=type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1723 raw->own=0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1724 memcpy(raw->data,ptr,size); /* copy the data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1725 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1726 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1727
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1728 /* converts a packed userdata. user for member fn pointers only */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1729 SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1730 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1731 swig_lua_rawdata* raw;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1732 raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1733 if (!raw) return SWIG_ERROR; /* error */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1734 if (type==0 || type==raw->type) /* void* or identical type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1735 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1736 memcpy(ptr,raw->data,size); /* copy it */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1737 return SWIG_OK; /* ok */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1738 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1739 return SWIG_ERROR; /* error */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1740 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1741
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1742 /* a function to get the typestring of a piece of data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1743 SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1744 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1745 swig_lua_userdata* usr;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1746 if (lua_isuserdata(L,tp))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1747 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1748 usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1749 if (usr && usr->type && usr->type->str)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1750 return usr->type->str;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1751 return "userdata (unknown type)";
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1752 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1753 return lua_typename(L,lua_type(L,tp));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1754 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1755
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1756 /* lua callable function to get the userdata's type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1757 SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1758 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1759 lua_pushstring(L,SWIG_Lua_typename(L,1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1760 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1761 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1762
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1763 /* lua callable function to compare userdata's value
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1764 the issue is that two userdata may point to the same thing
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1765 but to lua, they are different objects */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1766 SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1767 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1768 int result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1769 swig_lua_userdata *usr1,*usr2;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1770 if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1771 return 0; /* nil reply */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1772 usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1773 usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1774 /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1775 result=(usr1->ptr==usr2->ptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1776 lua_pushboolean(L,result);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1777 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1778 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1779
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1780 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1781 * global variable support code: class/struct typemap functions
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1782 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1783
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1784 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1785 /* Install Constants */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1786 SWIGINTERN void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1787 SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1788 int i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1789 for (i = 0; constants[i].type; i++) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1790 switch(constants[i].type) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1791 case SWIG_LUA_INT:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1792 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1793 lua_pushnumber(L,(lua_Number)constants[i].lvalue);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1794 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1795 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1796 case SWIG_LUA_FLOAT:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1797 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1798 lua_pushnumber(L,(lua_Number)constants[i].dvalue);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1799 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1800 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1801 case SWIG_LUA_CHAR:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1802 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1803 lua_pushfstring(L,"%c",(char)constants[i].lvalue);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1804 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1805 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1806 case SWIG_LUA_STRING:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1807 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1808 lua_pushstring(L,(char *) constants[i].pvalue);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1809 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1810 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1811 case SWIG_LUA_POINTER:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1812 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1813 SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1814 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1815 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1816 case SWIG_LUA_BINARY:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1817 lua_pushstring(L,constants[i].name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1818 SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1819 lua_rawset(L,-3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1820 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1821 default:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1822 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1823 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1824 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1825 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1826 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1827
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1828 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1829 * executing lua code from within the wrapper
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1830 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1831
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1832 #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1833 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1834 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1835 /* Executes a C string in Lua which is a really simple way of calling lua from C
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1836 Unfortunately lua keeps changing its APIs, so we need a conditional compile
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1837 In lua 5.0.X its lua_dostring()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1838 In lua 5.1.X its luaL_dostring()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1839 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1840 SWIGINTERN int
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1841 SWIG_Lua_dostring(lua_State *L, const char* str) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1842 int ok,top;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1843 if (str==0 || str[0]==0) return 0; /* nothing to do */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1844 top=lua_gettop(L); /* save stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1845 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1846 ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1847 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1848 ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1849 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1850 if (ok!=0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1851 SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1852 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1853 lua_settop(L,top); /* restore the stack */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1854 return ok;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1855 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1856
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1857 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1858 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1859 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1860
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1861 /* ------------------------------ end luarun.swg ------------------------------ */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1862
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1863
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1864 /* -------- TYPES TABLE (BEGIN) -------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1865
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1866 #define SWIGTYPE_p_UIControl swig_types[0]
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1867 static swig_type_info *swig_types[2];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1868 static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1869 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1870 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1871
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1872 /* -------- TYPES TABLE (END) -------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1873
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1874 #define SWIG_name "UIControl"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1875 #define SWIG_init luaopen_UIControl
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1876 #define SWIG_init_user luaopen_UIControl_user
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1877
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1878 #define SWIG_LUACODE luaopen_UIControl_luacode
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1879
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1880 namespace swig {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1881 typedef struct{} LANGUAGE_OBJ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1882 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1883
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1884
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1885 #include "UIControl.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1886
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1887 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1888 extern "C" {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1889 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1890 static int _wrap_UIControl_Show(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1891 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1892 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1893
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1894 SWIG_check_num_args("UIControl::Show",1,1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1895 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Show",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1896
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1897 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1898 SWIG_fail_ptr("UIControl_Show",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1899 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1900
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1901 (arg1)->Show();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1902
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1903 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1904
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1905 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1906
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1907 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1908 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1909 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1910 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1911
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1912
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1913 static int _wrap_UIControl_Focused(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1914 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1915 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1916 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1917
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1918 SWIG_check_num_args("UIControl::Focused",1,1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1919 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Focused",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1920
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1921 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1922 SWIG_fail_ptr("UIControl_Focused",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1923 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1924
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1925 result = (bool)(arg1)->Focused();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1926 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1927 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1928
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1929 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1930
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1931 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1932 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1933 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1934 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1935
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1936
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1937 static int _wrap_UIControl_OnKey(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1938 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1939 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1940 int arg2 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1941 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1942
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1943 SWIG_check_num_args("UIControl::OnKey",2,2)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1944 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnKey",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1945 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnKey",2,"int");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1946
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1947 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1948 SWIG_fail_ptr("UIControl_OnKey",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1949 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1950
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1951 arg2 = (int)lua_tonumber(L, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1952 result = (bool)(arg1)->OnKey(arg2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1953 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1954 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1955
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1956 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1957
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1958 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1959 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1960 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1961 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1962
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1963
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1964 static int _wrap_UIControl_OnMouseLeftClick(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1965 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1966 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1967 int arg2 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1968 int arg3 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1969 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1970
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1971 SWIG_check_num_args("UIControl::OnMouseLeftClick",3,3)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1972 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeftClick",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1973 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseLeftClick",2,"int");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1974 if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseLeftClick",3,"int");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1975
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1976 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1977 SWIG_fail_ptr("UIControl_OnMouseLeftClick",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1978 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1979
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1980 arg2 = (int)lua_tonumber(L, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1981 arg3 = (int)lua_tonumber(L, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1982 result = (bool)(arg1)->OnMouseLeftClick(arg2,arg3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1983 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1984 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1985
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1986 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1987
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1988 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1989 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1990 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1991 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1992
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1993
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1994 static int _wrap_UIControl_OnMouseRightClick(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1995 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1996 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1997 int arg2 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1998 int arg3 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1999 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2000
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2001 SWIG_check_num_args("UIControl::OnMouseRightClick",3,3)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2002 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseRightClick",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2003 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseRightClick",2,"int");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2004 if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseRightClick",3,"int");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2005
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2006 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2007 SWIG_fail_ptr("UIControl_OnMouseRightClick",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2008 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2009
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2010 arg2 = (int)lua_tonumber(L, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2011 arg3 = (int)lua_tonumber(L, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2012 result = (bool)(arg1)->OnMouseRightClick(arg2,arg3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2013 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2014 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2015
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2016 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2017
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2018 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2019 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2020 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2021 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2022
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2023
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2024 static int _wrap_UIControl_OnMouseEnter(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2025 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2026 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2027 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2028
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2029 SWIG_check_num_args("UIControl::OnMouseEnter",1,1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2030 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseEnter",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2031
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2032 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2033 SWIG_fail_ptr("UIControl_OnMouseEnter",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2034 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2035
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2036 result = (bool)(arg1)->OnMouseEnter();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2037 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2038 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2039
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2040 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2041
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2042 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2043 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2044 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2045 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2046
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2047
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2048 static int _wrap_UIControl_OnMouseLeave(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2049 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2050 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2051 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2052
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2053 SWIG_check_num_args("UIControl::OnMouseLeave",1,1)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2054 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeave",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2055
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2056 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2057 SWIG_fail_ptr("UIControl_OnMouseLeave",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2058 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2059
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2060 result = (bool)(arg1)->OnMouseLeave();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2061 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2062 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2063
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2064 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2065
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2066 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2067 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2068 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2069 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2070
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2071
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2072 static int _wrap_UIControl_AddControl(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2073 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2074 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2075 UIControl *arg2 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2076 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2077
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2078 SWIG_check_num_args("UIControl::AddControl",2,2)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2079 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::AddControl",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2080 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::AddControl",2,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2081
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2082 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2083 SWIG_fail_ptr("UIControl_AddControl",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2084 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2085
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2086
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2087 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2088 SWIG_fail_ptr("UIControl_AddControl",2,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2089 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2090
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2091 result = (bool)(arg1)->AddControl(arg2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2092 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2093 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2094
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2095 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2096
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2097 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2098 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2099 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2100 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2101
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2102
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2103 static int _wrap_UIControl_RemoveControl(lua_State* L) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2104 int SWIG_arg = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2105 UIControl *arg1 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2106 UIControl *arg2 = (UIControl *) 0 ;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2107 bool result;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2108
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2109 SWIG_check_num_args("UIControl::RemoveControl",2,2)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2110 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::RemoveControl",1,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2111 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::RemoveControl",2,"UIControl *");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2112
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2113 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2114 SWIG_fail_ptr("UIControl_RemoveControl",1,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2115 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2116
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2117
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2118 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2119 SWIG_fail_ptr("UIControl_RemoveControl",2,SWIGTYPE_p_UIControl);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2120 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2121
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2122 result = (bool)(arg1)->RemoveControl(arg2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2123 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2124 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2125
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2126 if(0) SWIG_fail;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2127
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2128 fail:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2129 lua_error(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2130 return SWIG_arg;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2131 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2132
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2133
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2134 static void swig_delete_UIControl(void *obj) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2135 UIControl *arg1 = (UIControl *) obj;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2136 delete arg1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2137 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2138 static swig_lua_method swig_UIControl_methods[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2139 {"Show", _wrap_UIControl_Show},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2140 {"Focused", _wrap_UIControl_Focused},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2141 {"OnKey", _wrap_UIControl_OnKey},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2142 {"OnMouseLeftClick", _wrap_UIControl_OnMouseLeftClick},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2143 {"OnMouseRightClick", _wrap_UIControl_OnMouseRightClick},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2144 {"OnMouseEnter", _wrap_UIControl_OnMouseEnter},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2145 {"OnMouseLeave", _wrap_UIControl_OnMouseLeave},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2146 {"AddControl", _wrap_UIControl_AddControl},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2147 {"RemoveControl", _wrap_UIControl_RemoveControl},
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2148 {0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2149 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2150 static swig_lua_attribute swig_UIControl_attributes[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2151 {0,0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2152 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2153 static swig_lua_attribute swig_UIControl_cls_attributes[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2154 {0,0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2155 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2156 static swig_lua_method swig_UIControl_cls_methods[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2157 {0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2158 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2159 static swig_lua_const_info swig_UIControl_cls_constants[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2160 {0,0,0,0,0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2161 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2162 static swig_lua_class *swig_UIControl_bases[] = {0};
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2163 static const char *swig_UIControl_base_names[] = {0};
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2164 static swig_lua_class _wrap_class_UIControl = { "UIControl", &SWIGTYPE_p_UIControl,0, swig_delete_UIControl, swig_UIControl_methods, swig_UIControl_attributes, { "UIControl", swig_UIControl_cls_methods, swig_UIControl_cls_attributes, swig_UIControl_cls_constants }, swig_UIControl_bases, swig_UIControl_base_names };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2165
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2166 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2167 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2168 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2169
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2170 static const struct luaL_Reg swig_commands[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2171 {0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2172 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2173
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2174 static swig_lua_var_info swig_variables[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2175 {0,0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2176 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2177
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2178 static swig_lua_const_info swig_constants[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2179 {0,0,0,0,0,0}
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2180 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2181
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2182 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2183
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2184 static swig_type_info _swigt__p_UIControl = {"_p_UIControl", "UIControl *", 0, 0, (void*)&_wrap_class_UIControl, 0};
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2185
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2186 static swig_type_info *swig_type_initial[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2187 &_swigt__p_UIControl,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2188 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2189
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2190 static swig_cast_info _swigc__p_UIControl[] = { {&_swigt__p_UIControl, 0, 0, 0},{0, 0, 0, 0}};
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2191
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2192 static swig_cast_info *swig_cast_initial[] = {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2193 _swigc__p_UIControl,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2194 };
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2195
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2196
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2197 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2198
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2199 /* -----------------------------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2200 * Type initialization:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2201 * This problem is tough by the requirement that no dynamic
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2202 * memory is used. Also, since swig_type_info structures store pointers to
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2203 * swig_cast_info structures and swig_cast_info structures store pointers back
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2204 * to swig_type_info structures, we need some lookup code at initialization.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2205 * The idea is that swig generates all the structures that are needed.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2206 * The runtime then collects these partially filled structures.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2207 * The SWIG_InitializeModule function takes these initial arrays out of
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2208 * swig_module, and does all the lookup, filling in the swig_module.types
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2209 * array with the correct data and linking the correct swig_cast_info
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2210 * structures together.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2211 *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2212 * The generated swig_type_info structures are assigned staticly to an initial
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2213 * array. We just loop through that array, and handle each type individually.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2214 * First we lookup if this type has been already loaded, and if so, use the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2215 * loaded structure instead of the generated one. Then we have to fill in the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2216 * cast linked list. The cast data is initially stored in something like a
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2217 * two-dimensional array. Each row corresponds to a type (there are the same
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2218 * number of rows as there are in the swig_type_initial array). Each entry in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2219 * a column is one of the swig_cast_info structures for that type.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2220 * The cast_initial array is actually an array of arrays, because each row has
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2221 * a variable number of columns. So to actually build the cast linked list,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2222 * we find the array of casts associated with the type, and loop through it
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2223 * adding the casts to the list. The one last trick we need to do is making
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2224 * sure the type pointer in the swig_cast_info struct is correct.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2225 *
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2226 * First off, we lookup the cast->type name to see if it is already loaded.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2227 * There are three cases to handle:
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2228 * 1) If the cast->type has already been loaded AND the type we are adding
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2229 * casting info to has not been loaded (it is in this module), THEN we
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2230 * replace the cast->type pointer with the type pointer that has already
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2231 * been loaded.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2232 * 2) If BOTH types (the one we are adding casting info to, and the
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2233 * cast->type) are loaded, THEN the cast info has already been loaded by
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2234 * the previous module so we just ignore it.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2235 * 3) Finally, if cast->type has not already been loaded, then we add that
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2236 * swig_cast_info to the linked list (because the cast->type) pointer will
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2237 * be correct.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2238 * ----------------------------------------------------------------------------- */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2239
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2240 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2241 extern "C" {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2242 #if 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2243 } /* c-mode */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2244 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2245 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2246
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2247 #if 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2248 #define SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2249 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2250
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2251
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2252 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2253 SWIG_InitializeModule(void *clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2254 size_t i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2255 swig_module_info *module_head, *iter;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2256 int found, init;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2257
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2258 /* check to see if the circular list has been setup, if not, set it up */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2259 if (swig_module.next==0) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2260 /* Initialize the swig_module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2261 swig_module.type_initial = swig_type_initial;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2262 swig_module.cast_initial = swig_cast_initial;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2263 swig_module.next = &swig_module;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2264 init = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2265 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2266 init = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2267 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2268
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2269 /* Try and load any already created modules */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2270 module_head = SWIG_GetModule(clientdata);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2271 if (!module_head) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2272 /* This is the first module loaded for this interpreter */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2273 /* so set the swig module into the interpreter */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2274 SWIG_SetModule(clientdata, &swig_module);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2275 module_head = &swig_module;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2276 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2277 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2278 found=0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2279 iter=module_head;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2280 do {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2281 if (iter==&swig_module) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2282 found=1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2283 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2284 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2285 iter=iter->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2286 } while (iter!= module_head);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2287
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2288 /* if the is found in the list, then all is done and we may leave */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2289 if (found) return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2290 /* otherwise we must add out module into the list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2291 swig_module.next = module_head->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2292 module_head->next = &swig_module;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2293 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2294
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2295 /* When multiple interpreters are used, a module could have already been initialized in
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2296 a different interpreter, but not yet have a pointer in this interpreter.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2297 In this case, we do not want to continue adding types... everything should be
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2298 set up already */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2299 if (init == 0) return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2300
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2301 /* Now work on filling in swig_module.types */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2302 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2303 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2304 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2305 for (i = 0; i < swig_module.size; ++i) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2306 swig_type_info *type = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2307 swig_type_info *ret;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2308 swig_cast_info *cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2309
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2310 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2311 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2312 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2313
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2314 /* if there is another module already loaded */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2315 if (swig_module.next != &swig_module) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2316 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2317 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2318 if (type) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2319 /* Overwrite clientdata field */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2320 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2321 printf("SWIG_InitializeModule: found type %s\n", type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2322 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2323 if (swig_module.type_initial[i]->clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2324 type->clientdata = swig_module.type_initial[i]->clientdata;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2325 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2326 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2327 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2328 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2329 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2330 type = swig_module.type_initial[i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2331 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2332
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2333 /* Insert casting types */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2334 cast = swig_module.cast_initial[i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2335 while (cast->type) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2336
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2337 /* Don't need to add information already in the list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2338 ret = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2339 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2340 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2341 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2342 if (swig_module.next != &swig_module) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2343 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2344 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2345 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2346 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2347 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2348 if (ret) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2349 if (type == swig_module.type_initial[i]) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2350 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2351 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2352 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2353 cast->type = ret;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2354 ret = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2355 } else {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2356 /* Check for casting already in the list */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2357 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2358 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2359 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2360 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2361 if (!ocast) ret = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2362 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2363 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2364
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2365 if (!ret) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2366 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2367 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2368 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2369 if (type->cast) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2370 type->cast->prev = cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2371 cast->next = type->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2372 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2373 type->cast = cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2374 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2375 cast++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2376 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2377 /* Set entry in modules->types array equal to the type */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2378 swig_module.types[i] = type;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2379 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2380 swig_module.types[i] = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2381
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2382 #ifdef SWIGRUNTIME_DEBUG
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2383 printf("**** SWIG_InitializeModule: Cast List ******\n");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2384 for (i = 0; i < swig_module.size; ++i) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2385 int j = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2386 swig_cast_info *cast = swig_module.cast_initial[i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2387 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2388 while (cast->type) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2389 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2390 cast++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2391 ++j;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2392 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2393 printf("---- Total casts: %d\n",j);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2394 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2395 printf("**** SWIG_InitializeModule: Cast List ******\n");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2396 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2397 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2398
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2399 /* This function will propagate the clientdata field of type to
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2400 * any new swig_type_info structures that have been added into the list
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2401 * of equivalent types. It is like calling
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2402 * SWIG_TypeClientData(type, clientdata) a second time.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2403 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2404 SWIGRUNTIME void
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2405 SWIG_PropagateClientData(void) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2406 size_t i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2407 swig_cast_info *equiv;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2408 static int init_run = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2409
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2410 if (init_run) return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2411 init_run = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2412
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2413 for (i = 0; i < swig_module.size; i++) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2414 if (swig_module.types[i]->clientdata) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2415 equiv = swig_module.types[i]->cast;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2416 while (equiv) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2417 if (!equiv->converter) {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2418 if (equiv->type && !equiv->type->clientdata)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2419 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2420 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2421 equiv = equiv->next;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2422 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2423 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2424 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2425 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2426
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2427 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2428 #if 0
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2429 { /* c-mode */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2430 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2431 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2432 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2433
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2434
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2435
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2436 /* Forward declaration of where the user's %init{} gets inserted */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2437 void SWIG_init_user(lua_State* L );
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2438
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2439 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2440 extern "C" {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2441 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2442 /* this is the initialization function
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2443 added at the very end of the code
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2444 the function is always called SWIG_init, but an earlier #define will rename it
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2445 */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2446 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2447 LUALIB_API int SWIG_init(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2448 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2449 SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2450 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2451 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2452 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2453 int i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2454 /* start with global table */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2455 lua_pushglobaltable (L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2456 /* SWIG's internal initalisation */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2457 SWIG_InitializeModule((void*)L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2458 SWIG_PropagateClientData();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2459 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2460
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2461 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2462 /* add a global fn */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2463 SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2464 SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2465 /* begin the module (its a table with the same name as the module) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2466 SWIG_Lua_module_begin(L,SWIG_name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2467 /* add commands/functions */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2468 for (i = 0; swig_commands[i].name; i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2469 SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2470 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2471 /* add variables */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2472 for (i = 0; swig_variables[i].name; i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2473 SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2474 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2475 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2476
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2477 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2478 /* set up base class pointers (the hierarchy) */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2479 for (i = 0; swig_types[i]; i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2480 if (swig_types[i]->clientdata){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2481 SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2482 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2483 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2484 /* additional registration structs & classes in lua */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2485 for (i = 0; swig_types[i]; i++){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2486 if (swig_types[i]->clientdata){
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2487 SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2488 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2489 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2490 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2491
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2492 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2493 /* constants */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2494 SWIG_Lua_InstallConstants(L,swig_constants);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2495 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2496
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2497 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2498 /* invoke user-specific initialization */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2499 SWIG_init_user(L);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2500 /* end module */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2501 /* Note: We do not clean up the stack here (Lua will do this for us). At this
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2502 point, we have the globals table and out module table on the stack. Returning
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2503 one value makes the module table the result of the require command. */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2504 return 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2505 #else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2506 return 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2507 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2508 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2509
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2510 #ifdef __cplusplus
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2511 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2512 #endif
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2513
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2514
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2515 const char* SWIG_LUACODE=
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2516 "";
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2517
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2518 void SWIG_init_user(lua_State* L)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2519 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2520 /* exec Lua code if applicable */
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2521 SWIG_Lua_dostring(L,SWIG_LUACODE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2522 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2523