SuperTuxKart
Loading...
Searching...
No Matches
aswrappedcall.hpp
1#ifndef AS_GEN_WRAPPER_H
2#define AS_GEN_WRAPPER_H
3
4#ifndef ANGELSCRIPT_H
5// Avoid having to inform include path if header is already include before
6#include <angelscript.h>
7#endif
8#include <new>
9
10#ifdef GetObject
11#undef GetObject
12#endif
13
14namespace gw {
15
16template <typename T> class Proxy {
17 public:
18 T value;
19 Proxy(T value) : value(value) {}
20 static T cast(void * ptr) {
21 return reinterpret_cast<Proxy<T> *>(&ptr)->value;
22 }
23 private:
24 Proxy(const Proxy &);
25 Proxy & operator=(const Proxy &);
26};
27
28template <typename T> struct Wrapper {};
29template <typename T> struct ObjFirst {};
30template <typename T> struct ObjLast {};
31template <typename T> struct Constructor {};
32
33template <typename T>
34void destroy(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
35 static_cast<T *>(gen->GetObject())->~T();
36}
37template <>
38struct Wrapper<void (*)(void)> {
39 template <void (*fp)(void)>
40 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
41 ((fp)());
42 }
43};
44template <typename R>
45struct Wrapper<R (*)(void)> {
46 template <R (*fp)(void)>
47 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
48 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)());
49 }
50};
51template <typename T>
52struct Wrapper<void (T::*)(void)> {
53 template <void (T::*fp)(void)>
54 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
55 ((static_cast<T *>(gen->GetObject())->*fp)());
56 }
57};
58template <typename T, typename R>
59struct Wrapper<R (T::*)(void)> {
60 template <R (T::*fp)(void)>
61 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
62 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)());
63 }
64};
65template <typename T>
66struct Wrapper<void (T::*)(void) const> {
67 template <void (T::*fp)(void) const>
68 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
69 ((static_cast<T *>(gen->GetObject())->*fp)());
70 }
71};
72template <typename T, typename R>
73struct Wrapper<R (T::*)(void) const> {
74 template <R (T::*fp)(void) const>
75 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
76 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)());
77 }
78};
79template <typename T>
80struct ObjFirst<void (*)(T)> {
81 template <void (*fp)(T)>
82 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
83 ((fp)(
84 Proxy<T>::cast(gen->GetObject())));
85 }
86};
87template <typename T, typename R>
88struct ObjFirst<R (*)(T)> {
89 template <R (*fp)(T)>
90 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
91 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
92 Proxy<T>::cast(gen->GetObject())));
93 }
94};
95template <typename T>
96struct ObjLast<void (*)(T)> {
97 template <void (*fp)(T)>
98 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
99 ((fp)(
100 Proxy<T>::cast(gen->GetObject())));
101 }
102};
103template <typename T, typename R>
104struct ObjLast<R (*)(T)> {
105 template <R (*fp)(T)>
106 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
107 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
108 Proxy<T>::cast(gen->GetObject())));
109 }
110};
111template <typename T>
112struct Constructor <T ()> {
113 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
114 new (gen->GetObject()) T();
115 }
116};
117template <typename A0>
118struct Wrapper<void (*)(A0)> {
119 template <void (*fp)(A0)>
120 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
121 ((fp)(
122 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
123 }
124};
125template <typename R, typename A0>
126struct Wrapper<R (*)(A0)> {
127 template <R (*fp)(A0)>
128 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
129 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
130 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
131 }
132};
133template <typename T, typename A0>
134struct Wrapper<void (T::*)(A0)> {
135 template <void (T::*fp)(A0)>
136 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
137 ((static_cast<T *>(gen->GetObject())->*fp)(
138 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
139 }
140};
141template <typename T, typename R, typename A0>
142struct Wrapper<R (T::*)(A0)> {
143 template <R (T::*fp)(A0)>
144 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
145 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
146 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
147 }
148};
149template <typename T, typename A0>
150struct Wrapper<void (T::*)(A0) const> {
151 template <void (T::*fp)(A0) const>
152 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
153 ((static_cast<T *>(gen->GetObject())->*fp)(
154 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
155 }
156};
157template <typename T, typename R, typename A0>
158struct Wrapper<R (T::*)(A0) const> {
159 template <R (T::*fp)(A0) const>
160 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
161 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
162 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
163 }
164};
165template <typename T, typename A0>
166struct ObjFirst<void (*)(T, A0)> {
167 template <void (*fp)(T, A0)>
168 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
169 ((fp)(
170 Proxy<T>::cast(gen->GetObject()),
171 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
172 }
173};
174template <typename T, typename R, typename A0>
175struct ObjFirst<R (*)(T, A0)> {
176 template <R (*fp)(T, A0)>
177 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
178 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
179 Proxy<T>::cast(gen->GetObject()),
180 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value));
181 }
182};
183template <typename T, typename A0>
184struct ObjLast<void (*)(A0, T)> {
185 template <void (*fp)(A0, T)>
186 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
187 ((fp)(
188 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
189 Proxy<T>::cast(gen->GetObject())));
190 }
191};
192template <typename T, typename R, typename A0>
193struct ObjLast<R (*)(A0, T)> {
194 template <R (*fp)(A0, T)>
195 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
196 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
197 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
198 Proxy<T>::cast(gen->GetObject())));
199 }
200};
201template <typename T, typename A0>
202struct Constructor <T (A0)> {
203 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
204 new (gen->GetObject()) T(
205 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value);
206 }
207};
208template <typename A0, typename A1>
209struct Wrapper<void (*)(A0, A1)> {
210 template <void (*fp)(A0, A1)>
211 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
212 ((fp)(
213 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
214 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
215 }
216};
217template <typename R, typename A0, typename A1>
218struct Wrapper<R (*)(A0, A1)> {
219 template <R (*fp)(A0, A1)>
220 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
221 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
222 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
223 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
224 }
225};
226template <typename T, typename A0, typename A1>
227struct Wrapper<void (T::*)(A0, A1)> {
228 template <void (T::*fp)(A0, A1)>
229 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
230 ((static_cast<T *>(gen->GetObject())->*fp)(
231 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
232 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
233 }
234};
235template <typename T, typename R, typename A0, typename A1>
236struct Wrapper<R (T::*)(A0, A1)> {
237 template <R (T::*fp)(A0, A1)>
238 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
239 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
240 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
241 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
242 }
243};
244template <typename T, typename A0, typename A1>
245struct Wrapper<void (T::*)(A0, A1) const> {
246 template <void (T::*fp)(A0, A1) const>
247 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
248 ((static_cast<T *>(gen->GetObject())->*fp)(
249 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
250 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
251 }
252};
253template <typename T, typename R, typename A0, typename A1>
254struct Wrapper<R (T::*)(A0, A1) const> {
255 template <R (T::*fp)(A0, A1) const>
256 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
257 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
258 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
259 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
260 }
261};
262template <typename T, typename A0, typename A1>
263struct ObjFirst<void (*)(T, A0, A1)> {
264 template <void (*fp)(T, A0, A1)>
265 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
266 ((fp)(
267 Proxy<T>::cast(gen->GetObject()),
268 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
269 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
270 }
271};
272template <typename T, typename R, typename A0, typename A1>
273struct ObjFirst<R (*)(T, A0, A1)> {
274 template <R (*fp)(T, A0, A1)>
275 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
276 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
277 Proxy<T>::cast(gen->GetObject()),
278 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
279 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value));
280 }
281};
282template <typename T, typename A0, typename A1>
283struct ObjLast<void (*)(A0, A1, T)> {
284 template <void (*fp)(A0, A1, T)>
285 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
286 ((fp)(
287 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
288 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
289 Proxy<T>::cast(gen->GetObject())));
290 }
291};
292template <typename T, typename R, typename A0, typename A1>
293struct ObjLast<R (*)(A0, A1, T)> {
294 template <R (*fp)(A0, A1, T)>
295 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
296 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
297 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
298 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
299 Proxy<T>::cast(gen->GetObject())));
300 }
301};
302template <typename T, typename A0, typename A1>
303struct Constructor <T (A0, A1)> {
304 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
305 new (gen->GetObject()) T(
306 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
307 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value);
308 }
309};
310template <typename A0, typename A1, typename A2>
311struct Wrapper<void (*)(A0, A1, A2)> {
312 template <void (*fp)(A0, A1, A2)>
313 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
314 ((fp)(
315 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
316 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
317 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
318 }
319};
320template <typename R, typename A0, typename A1, typename A2>
321struct Wrapper<R (*)(A0, A1, A2)> {
322 template <R (*fp)(A0, A1, A2)>
323 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
324 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
325 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
326 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
327 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
328 }
329};
330template <typename T, typename A0, typename A1, typename A2>
331struct Wrapper<void (T::*)(A0, A1, A2)> {
332 template <void (T::*fp)(A0, A1, A2)>
333 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
334 ((static_cast<T *>(gen->GetObject())->*fp)(
335 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
336 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
337 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
338 }
339};
340template <typename T, typename R, typename A0, typename A1, typename A2>
341struct Wrapper<R (T::*)(A0, A1, A2)> {
342 template <R (T::*fp)(A0, A1, A2)>
343 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
344 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
345 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
346 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
347 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
348 }
349};
350template <typename T, typename A0, typename A1, typename A2>
351struct Wrapper<void (T::*)(A0, A1, A2) const> {
352 template <void (T::*fp)(A0, A1, A2) const>
353 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
354 ((static_cast<T *>(gen->GetObject())->*fp)(
355 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
356 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
357 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
358 }
359};
360template <typename T, typename R, typename A0, typename A1, typename A2>
361struct Wrapper<R (T::*)(A0, A1, A2) const> {
362 template <R (T::*fp)(A0, A1, A2) const>
363 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
364 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
365 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
366 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
367 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
368 }
369};
370template <typename T, typename A0, typename A1, typename A2>
371struct ObjFirst<void (*)(T, A0, A1, A2)> {
372 template <void (*fp)(T, A0, A1, A2)>
373 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
374 ((fp)(
375 Proxy<T>::cast(gen->GetObject()),
376 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
377 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
378 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
379 }
380};
381template <typename T, typename R, typename A0, typename A1, typename A2>
382struct ObjFirst<R (*)(T, A0, A1, A2)> {
383 template <R (*fp)(T, A0, A1, A2)>
384 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
385 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
386 Proxy<T>::cast(gen->GetObject()),
387 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
388 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
389 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value));
390 }
391};
392template <typename T, typename A0, typename A1, typename A2>
393struct ObjLast<void (*)(A0, A1, A2, T)> {
394 template <void (*fp)(A0, A1, A2, T)>
395 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
396 ((fp)(
397 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
398 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
399 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
400 Proxy<T>::cast(gen->GetObject())));
401 }
402};
403template <typename T, typename R, typename A0, typename A1, typename A2>
404struct ObjLast<R (*)(A0, A1, A2, T)> {
405 template <R (*fp)(A0, A1, A2, T)>
406 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
407 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
408 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
409 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
410 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
411 Proxy<T>::cast(gen->GetObject())));
412 }
413};
414template <typename T, typename A0, typename A1, typename A2>
415struct Constructor <T (A0, A1, A2)> {
416 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
417 new (gen->GetObject()) T(
418 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
419 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
420 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value);
421 }
422};
423template <typename A0, typename A1, typename A2, typename A3>
424struct Wrapper<void (*)(A0, A1, A2, A3)> {
425 template <void (*fp)(A0, A1, A2, A3)>
426 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
427 ((fp)(
428 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
429 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
430 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
431 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
432 }
433};
434template <typename R, typename A0, typename A1, typename A2, typename A3>
435struct Wrapper<R (*)(A0, A1, A2, A3)> {
436 template <R (*fp)(A0, A1, A2, A3)>
437 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
438 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
439 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
440 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
441 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
442 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
443 }
444};
445template <typename T, typename A0, typename A1, typename A2, typename A3>
446struct Wrapper<void (T::*)(A0, A1, A2, A3)> {
447 template <void (T::*fp)(A0, A1, A2, A3)>
448 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
449 ((static_cast<T *>(gen->GetObject())->*fp)(
450 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
451 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
452 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
453 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
454 }
455};
456template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
457struct Wrapper<R (T::*)(A0, A1, A2, A3)> {
458 template <R (T::*fp)(A0, A1, A2, A3)>
459 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
460 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
461 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
462 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
463 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
464 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
465 }
466};
467template <typename T, typename A0, typename A1, typename A2, typename A3>
468struct Wrapper<void (T::*)(A0, A1, A2, A3) const> {
469 template <void (T::*fp)(A0, A1, A2, A3) const>
470 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
471 ((static_cast<T *>(gen->GetObject())->*fp)(
472 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
473 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
474 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
475 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
476 }
477};
478template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
479struct Wrapper<R (T::*)(A0, A1, A2, A3) const> {
480 template <R (T::*fp)(A0, A1, A2, A3) const>
481 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
482 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
483 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
484 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
485 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
486 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
487 }
488};
489template <typename T, typename A0, typename A1, typename A2, typename A3>
490struct ObjFirst<void (*)(T, A0, A1, A2, A3)> {
491 template <void (*fp)(T, A0, A1, A2, A3)>
492 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
493 ((fp)(
494 Proxy<T>::cast(gen->GetObject()),
495 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
496 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
497 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
498 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
499 }
500};
501template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
502struct ObjFirst<R (*)(T, A0, A1, A2, A3)> {
503 template <R (*fp)(T, A0, A1, A2, A3)>
504 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
505 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
506 Proxy<T>::cast(gen->GetObject()),
507 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
508 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
509 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
510 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value));
511 }
512};
513template <typename T, typename A0, typename A1, typename A2, typename A3>
514struct ObjLast<void (*)(A0, A1, A2, A3, T)> {
515 template <void (*fp)(A0, A1, A2, A3, T)>
516 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
517 ((fp)(
518 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
519 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
520 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
521 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
522 Proxy<T>::cast(gen->GetObject())));
523 }
524};
525template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
526struct ObjLast<R (*)(A0, A1, A2, A3, T)> {
527 template <R (*fp)(A0, A1, A2, A3, T)>
528 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
529 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
530 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
531 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
532 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
533 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
534 Proxy<T>::cast(gen->GetObject())));
535 }
536};
537template <typename T, typename A0, typename A1, typename A2, typename A3>
538struct Constructor <T (A0, A1, A2, A3)> {
539 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
540 new (gen->GetObject()) T(
541 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
542 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
543 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
544 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value);
545 }
546};
547template <typename A0, typename A1, typename A2, typename A3, typename A4>
548struct Wrapper<void (*)(A0, A1, A2, A3, A4)> {
549 template <void (*fp)(A0, A1, A2, A3, A4)>
550 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
551 ((fp)(
552 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
553 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
554 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
555 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
556 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
557 }
558};
559template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
560struct Wrapper<R (*)(A0, A1, A2, A3, A4)> {
561 template <R (*fp)(A0, A1, A2, A3, A4)>
562 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
563 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
564 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
565 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
566 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
567 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
568 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
569 }
570};
571template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4>
572struct Wrapper<void (T::*)(A0, A1, A2, A3, A4)> {
573 template <void (T::*fp)(A0, A1, A2, A3, A4)>
574 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
575 ((static_cast<T *>(gen->GetObject())->*fp)(
576 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
577 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
578 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
579 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
580 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
581 }
582};
583template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
584struct Wrapper<R (T::*)(A0, A1, A2, A3, A4)> {
585 template <R (T::*fp)(A0, A1, A2, A3, A4)>
586 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
587 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
588 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
589 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
590 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
591 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
592 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
593 }
594};
595template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4>
596struct Wrapper<void (T::*)(A0, A1, A2, A3, A4) const> {
597 template <void (T::*fp)(A0, A1, A2, A3, A4) const>
598 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
599 ((static_cast<T *>(gen->GetObject())->*fp)(
600 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
601 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
602 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
603 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
604 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
605 }
606};
607template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
608struct Wrapper<R (T::*)(A0, A1, A2, A3, A4) const> {
609 template <R (T::*fp)(A0, A1, A2, A3, A4) const>
610 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
611 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
612 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
613 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
614 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
615 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
616 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
617 }
618};
619template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4>
620struct ObjFirst<void (*)(T, A0, A1, A2, A3, A4)> {
621 template <void (*fp)(T, A0, A1, A2, A3, A4)>
622 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
623 ((fp)(
624 Proxy<T>::cast(gen->GetObject()),
625 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
626 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
627 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
628 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
629 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
630 }
631};
632template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
633struct ObjFirst<R (*)(T, A0, A1, A2, A3, A4)> {
634 template <R (*fp)(T, A0, A1, A2, A3, A4)>
635 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
636 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
637 Proxy<T>::cast(gen->GetObject()),
638 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
639 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
640 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
641 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
642 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value));
643 }
644};
645template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4>
646struct ObjLast<void (*)(A0, A1, A2, A3, A4, T)> {
647 template <void (*fp)(A0, A1, A2, A3, A4, T)>
648 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
649 ((fp)(
650 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
651 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
652 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
653 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
654 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
655 Proxy<T>::cast(gen->GetObject())));
656 }
657};
658template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
659struct ObjLast<R (*)(A0, A1, A2, A3, A4, T)> {
660 template <R (*fp)(A0, A1, A2, A3, A4, T)>
661 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
662 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
663 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
664 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
665 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
666 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
667 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
668 Proxy<T>::cast(gen->GetObject())));
669 }
670};
671template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4>
672struct Constructor <T (A0, A1, A2, A3, A4)> {
673 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
674 new (gen->GetObject()) T(
675 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
676 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
677 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
678 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
679 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value);
680 }
681};
682template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
683struct Wrapper<void (*)(A0, A1, A2, A3, A4, A5)> {
684 template <void (*fp)(A0, A1, A2, A3, A4, A5)>
685 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
686 ((fp)(
687 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
688 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
689 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
690 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
691 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
692 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
693 }
694};
695template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
696struct Wrapper<R (*)(A0, A1, A2, A3, A4, A5)> {
697 template <R (*fp)(A0, A1, A2, A3, A4, A5)>
698 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
699 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
700 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
701 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
702 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
703 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
704 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
705 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
706 }
707};
708template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
709struct Wrapper<void (T::*)(A0, A1, A2, A3, A4, A5)> {
710 template <void (T::*fp)(A0, A1, A2, A3, A4, A5)>
711 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
712 ((static_cast<T *>(gen->GetObject())->*fp)(
713 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
714 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
715 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
716 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
717 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
718 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
719 }
720};
721template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
722struct Wrapper<R (T::*)(A0, A1, A2, A3, A4, A5)> {
723 template <R (T::*fp)(A0, A1, A2, A3, A4, A5)>
724 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
725 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
726 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
727 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
728 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
729 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
730 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
731 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
732 }
733};
734template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
735struct Wrapper<void (T::*)(A0, A1, A2, A3, A4, A5) const> {
736 template <void (T::*fp)(A0, A1, A2, A3, A4, A5) const>
737 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
738 ((static_cast<T *>(gen->GetObject())->*fp)(
739 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
740 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
741 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
742 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
743 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
744 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
745 }
746};
747template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
748struct Wrapper<R (T::*)(A0, A1, A2, A3, A4, A5) const> {
749 template <R (T::*fp)(A0, A1, A2, A3, A4, A5) const>
750 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
751 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
752 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
753 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
754 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
755 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
756 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
757 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
758 }
759};
760template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
761struct ObjFirst<void (*)(T, A0, A1, A2, A3, A4, A5)> {
762 template <void (*fp)(T, A0, A1, A2, A3, A4, A5)>
763 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
764 ((fp)(
765 Proxy<T>::cast(gen->GetObject()),
766 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
767 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
768 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
769 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
770 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
771 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
772 }
773};
774template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
775struct ObjFirst<R (*)(T, A0, A1, A2, A3, A4, A5)> {
776 template <R (*fp)(T, A0, A1, A2, A3, A4, A5)>
777 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
778 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
779 Proxy<T>::cast(gen->GetObject()),
780 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
781 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
782 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
783 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
784 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
785 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value));
786 }
787};
788template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
789struct ObjLast<void (*)(A0, A1, A2, A3, A4, A5, T)> {
790 template <void (*fp)(A0, A1, A2, A3, A4, A5, T)>
791 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
792 ((fp)(
793 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
794 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
795 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
796 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
797 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
798 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
799 Proxy<T>::cast(gen->GetObject())));
800 }
801};
802template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
803struct ObjLast<R (*)(A0, A1, A2, A3, A4, A5, T)> {
804 template <R (*fp)(A0, A1, A2, A3, A4, A5, T)>
805 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
806 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
807 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
808 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
809 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
810 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
811 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
812 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
813 Proxy<T>::cast(gen->GetObject())));
814 }
815};
816template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
817struct Constructor <T (A0, A1, A2, A3, A4, A5)> {
818 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
819 new (gen->GetObject()) T(
820 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
821 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
822 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
823 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
824 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
825 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value);
826 }
827};
828template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
829struct Wrapper<void (*)(A0, A1, A2, A3, A4, A5, A6)> {
830 template <void (*fp)(A0, A1, A2, A3, A4, A5, A6)>
831 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
832 ((fp)(
833 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
834 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
835 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
836 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
837 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
838 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
839 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
840 }
841};
842template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
843struct Wrapper<R (*)(A0, A1, A2, A3, A4, A5, A6)> {
844 template <R (*fp)(A0, A1, A2, A3, A4, A5, A6)>
845 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
846 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
847 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
848 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
849 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
850 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
851 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
852 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
853 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
854 }
855};
856template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
857struct Wrapper<void (T::*)(A0, A1, A2, A3, A4, A5, A6)> {
858 template <void (T::*fp)(A0, A1, A2, A3, A4, A5, A6)>
859 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
860 ((static_cast<T *>(gen->GetObject())->*fp)(
861 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
862 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
863 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
864 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
865 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
866 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
867 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
868 }
869};
870template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
871struct Wrapper<R (T::*)(A0, A1, A2, A3, A4, A5, A6)> {
872 template <R (T::*fp)(A0, A1, A2, A3, A4, A5, A6)>
873 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
874 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
875 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
876 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
877 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
878 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
879 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
880 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
881 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
882 }
883};
884template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
885struct Wrapper<void (T::*)(A0, A1, A2, A3, A4, A5, A6) const> {
886 template <void (T::*fp)(A0, A1, A2, A3, A4, A5, A6) const>
887 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
888 ((static_cast<T *>(gen->GetObject())->*fp)(
889 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
890 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
891 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
892 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
893 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
894 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
895 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
896 }
897};
898template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
899struct Wrapper<R (T::*)(A0, A1, A2, A3, A4, A5, A6) const> {
900 template <R (T::*fp)(A0, A1, A2, A3, A4, A5, A6) const>
901 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
902 new (gen->GetAddressOfReturnLocation()) Proxy<R>((static_cast<T *>(gen->GetObject())->*fp)(
903 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
904 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
905 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
906 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
907 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
908 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
909 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
910 }
911};
912template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
913struct ObjFirst<void (*)(T, A0, A1, A2, A3, A4, A5, A6)> {
914 template <void (*fp)(T, A0, A1, A2, A3, A4, A5, A6)>
915 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
916 ((fp)(
917 Proxy<T>::cast(gen->GetObject()),
918 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
919 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
920 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
921 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
922 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
923 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
924 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
925 }
926};
927template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
928struct ObjFirst<R (*)(T, A0, A1, A2, A3, A4, A5, A6)> {
929 template <R (*fp)(T, A0, A1, A2, A3, A4, A5, A6)>
930 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
931 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
932 Proxy<T>::cast(gen->GetObject()),
933 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
934 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
935 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
936 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
937 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
938 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
939 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value));
940 }
941};
942template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
943struct ObjLast<void (*)(A0, A1, A2, A3, A4, A5, A6, T)> {
944 template <void (*fp)(A0, A1, A2, A3, A4, A5, A6, T)>
945 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
946 ((fp)(
947 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
948 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
949 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
950 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
951 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
952 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
953 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value,
954 Proxy<T>::cast(gen->GetObject())));
955 }
956};
957template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
958struct ObjLast<R (*)(A0, A1, A2, A3, A4, A5, A6, T)> {
959 template <R (*fp)(A0, A1, A2, A3, A4, A5, A6, T)>
960 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
961 new (gen->GetAddressOfReturnLocation()) Proxy<R>((fp)(
962 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
963 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
964 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
965 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
966 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
967 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
968 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value,
969 Proxy<T>::cast(gen->GetObject())));
970 }
971};
972template <typename T, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
973struct Constructor <T (A0, A1, A2, A3, A4, A5, A6)> {
974 static void f(AS_NAMESPACE_QUALIFIER asIScriptGeneric * gen) {
975 new (gen->GetObject()) T(
976 static_cast<Proxy <A0> *>(gen->GetAddressOfArg(0))->value,
977 static_cast<Proxy <A1> *>(gen->GetAddressOfArg(1))->value,
978 static_cast<Proxy <A2> *>(gen->GetAddressOfArg(2))->value,
979 static_cast<Proxy <A3> *>(gen->GetAddressOfArg(3))->value,
980 static_cast<Proxy <A4> *>(gen->GetAddressOfArg(4))->value,
981 static_cast<Proxy <A5> *>(gen->GetAddressOfArg(5))->value,
982 static_cast<Proxy <A6> *>(gen->GetAddressOfArg(6))->value);
983 }
984};
985template <typename T>
986struct Id {
987 template <T fn_ptr> AS_NAMESPACE_QUALIFIER asSFuncPtr f(void) { return asFUNCTION(&Wrapper<T>::template f<fn_ptr>); }
988 template <T fn_ptr> AS_NAMESPACE_QUALIFIER asSFuncPtr of(void) { return asFUNCTION(&ObjFirst<T>::template f<fn_ptr>); }
989 template <T fn_ptr> AS_NAMESPACE_QUALIFIER asSFuncPtr ol(void) { return asFUNCTION(&ObjLast<T>::template f<fn_ptr>); }
990};
991
992template <typename T>
993Id<T> id(T fn_ptr) { return Id<T>(); }
994
995// On some versions of GNUC it is necessary to use the template keyword as disambiguator,
996// on others the template keyword gives an error, hence the need for the following define.
997// MSVC on the other hand seems to accept both with or without the template keyword.
998#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
999 // GNUC 4.4.3 doesn't need the template keyword, and
1000 // hopefully upcoming versions won't need it either
1001 #define TMPL template
1002#else
1003 #define TMPL
1004#endif
1005
1006#define WRAP_FN(name) (::gw::id(name).TMPL f< name >())
1007#define WRAP_MFN(ClassType, name) (::gw::id(&ClassType::name).TMPL f< &ClassType::name >())
1008#define WRAP_OBJ_FIRST(name) (::gw::id(name).TMPL of< name >())
1009#define WRAP_OBJ_LAST(name) (::gw::id(name).TMPL ol< name >())
1010
1011#define WRAP_FN_PR(name, Parameters, ReturnType) asFUNCTION((::gw::Wrapper<ReturnType (*)Parameters>::TMPL f< name >))
1012#define WRAP_MFN_PR(ClassType, name, Parameters, ReturnType) asFUNCTION((::gw::Wrapper<ReturnType (ClassType::*)Parameters>::TMPL f< &ClassType::name >))
1013#define WRAP_OBJ_FIRST_PR(name, Parameters, ReturnType) asFUNCTION((::gw::ObjFirst<ReturnType (*)Parameters>::TMPL f< name >))
1014#define WRAP_OBJ_LAST_PR(name, Parameters, ReturnType) asFUNCTION((::gw::ObjLast<ReturnType (*)Parameters>::TMPL f< name >))
1015
1016#define WRAP_CON(ClassType, Parameters) asFUNCTION((::gw::Constructor<ClassType Parameters>::f))
1017#define WRAP_DES(ClassType) asFUNCTION((::gw::destroy<ClassType>))
1018
1019} // end namespace gw
1020
1021#endif
Definition: aswrappedcall.hpp:16
Definition: aswrappedcall.hpp:31
Definition: aswrappedcall.hpp:986
Definition: aswrappedcall.hpp:29
Definition: aswrappedcall.hpp:30
Definition: aswrappedcall.hpp:28