v8eval 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2539 +0,0 @@
1
- /* ----------------------------------------------------------------------------
2
- * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.7
4
- *
5
- * This file is not intended to be easily readable and contains a number of
6
- * coding conventions designed to improve portability and efficiency. Do not make
7
- * changes to this file unless you know what you are doing--modify the SWIG
8
- * interface file instead.
9
- * ----------------------------------------------------------------------------- */
10
-
11
- #define SWIGRUBY
12
-
13
-
14
- #ifdef __cplusplus
15
- /* SwigValueWrapper is described in swig.swg */
16
- template<typename T> class SwigValueWrapper {
17
- struct SwigMovePointer {
18
- T *ptr;
19
- SwigMovePointer(T *p) : ptr(p) { }
20
- ~SwigMovePointer() { delete ptr; }
21
- SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
22
- } pointer;
23
- SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
24
- SwigValueWrapper(const SwigValueWrapper<T>& rhs);
25
- public:
26
- SwigValueWrapper() : pointer(0) { }
27
- SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
28
- operator T&() const { return *pointer.ptr; }
29
- T *operator&() { return pointer.ptr; }
30
- };
31
-
32
- template <typename T> T SwigValueInit() {
33
- return T();
34
- }
35
- #endif
36
-
37
- /* -----------------------------------------------------------------------------
38
- * This section contains generic SWIG labels for method/variable
39
- * declarations/attributes, and other compiler dependent labels.
40
- * ----------------------------------------------------------------------------- */
41
-
42
- /* template workaround for compilers that cannot correctly implement the C++ standard */
43
- #ifndef SWIGTEMPLATEDISAMBIGUATOR
44
- # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
45
- # define SWIGTEMPLATEDISAMBIGUATOR template
46
- # elif defined(__HP_aCC)
47
- /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
48
- /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
49
- # define SWIGTEMPLATEDISAMBIGUATOR template
50
- # else
51
- # define SWIGTEMPLATEDISAMBIGUATOR
52
- # endif
53
- #endif
54
-
55
- /* inline attribute */
56
- #ifndef SWIGINLINE
57
- # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
58
- # define SWIGINLINE inline
59
- # else
60
- # define SWIGINLINE
61
- # endif
62
- #endif
63
-
64
- /* attribute recognised by some compilers to avoid 'unused' warnings */
65
- #ifndef SWIGUNUSED
66
- # if defined(__GNUC__)
67
- # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
68
- # define SWIGUNUSED __attribute__ ((__unused__))
69
- # else
70
- # define SWIGUNUSED
71
- # endif
72
- # elif defined(__ICC)
73
- # define SWIGUNUSED __attribute__ ((__unused__))
74
- # else
75
- # define SWIGUNUSED
76
- # endif
77
- #endif
78
-
79
- #ifndef SWIG_MSC_UNSUPPRESS_4505
80
- # if defined(_MSC_VER)
81
- # pragma warning(disable : 4505) /* unreferenced local function has been removed */
82
- # endif
83
- #endif
84
-
85
- #ifndef SWIGUNUSEDPARM
86
- # ifdef __cplusplus
87
- # define SWIGUNUSEDPARM(p)
88
- # else
89
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
90
- # endif
91
- #endif
92
-
93
- /* internal SWIG method */
94
- #ifndef SWIGINTERN
95
- # define SWIGINTERN static SWIGUNUSED
96
- #endif
97
-
98
- /* internal inline SWIG method */
99
- #ifndef SWIGINTERNINLINE
100
- # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
101
- #endif
102
-
103
- /* exporting methods */
104
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105
- # ifndef GCC_HASCLASSVISIBILITY
106
- # define GCC_HASCLASSVISIBILITY
107
- # endif
108
- #endif
109
-
110
- #ifndef SWIGEXPORT
111
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112
- # if defined(STATIC_LINKED)
113
- # define SWIGEXPORT
114
- # else
115
- # define SWIGEXPORT __declspec(dllexport)
116
- # endif
117
- # else
118
- # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
119
- # define SWIGEXPORT __attribute__ ((visibility("default")))
120
- # else
121
- # define SWIGEXPORT
122
- # endif
123
- # endif
124
- #endif
125
-
126
- /* calling conventions for Windows */
127
- #ifndef SWIGSTDCALL
128
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
129
- # define SWIGSTDCALL __stdcall
130
- # else
131
- # define SWIGSTDCALL
132
- # endif
133
- #endif
134
-
135
- /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
136
- #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
137
- # define _CRT_SECURE_NO_DEPRECATE
138
- #endif
139
-
140
- /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
141
- #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
142
- # define _SCL_SECURE_NO_DEPRECATE
143
- #endif
144
-
145
- /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
146
- #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
147
- # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
148
- #endif
149
-
150
- /* Intel's compiler complains if a variable which was never initialised is
151
- * cast to void, which is a common idiom which we use to indicate that we
152
- * are aware a variable isn't used. So we just silence that warning.
153
- * See: https://github.com/swig/swig/issues/192 for more discussion.
154
- */
155
- #ifdef __INTEL_COMPILER
156
- # pragma warning disable 592
157
- #endif
158
-
159
- /* -----------------------------------------------------------------------------
160
- * This section contains generic SWIG labels for method/variable
161
- * declarations/attributes, and other compiler dependent labels.
162
- * ----------------------------------------------------------------------------- */
163
-
164
- /* template workaround for compilers that cannot correctly implement the C++ standard */
165
- #ifndef SWIGTEMPLATEDISAMBIGUATOR
166
- # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
167
- # define SWIGTEMPLATEDISAMBIGUATOR template
168
- # elif defined(__HP_aCC)
169
- /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
170
- /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
171
- # define SWIGTEMPLATEDISAMBIGUATOR template
172
- # else
173
- # define SWIGTEMPLATEDISAMBIGUATOR
174
- # endif
175
- #endif
176
-
177
- /* inline attribute */
178
- #ifndef SWIGINLINE
179
- # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
180
- # define SWIGINLINE inline
181
- # else
182
- # define SWIGINLINE
183
- # endif
184
- #endif
185
-
186
- /* attribute recognised by some compilers to avoid 'unused' warnings */
187
- #ifndef SWIGUNUSED
188
- # if defined(__GNUC__)
189
- # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
190
- # define SWIGUNUSED __attribute__ ((__unused__))
191
- # else
192
- # define SWIGUNUSED
193
- # endif
194
- # elif defined(__ICC)
195
- # define SWIGUNUSED __attribute__ ((__unused__))
196
- # else
197
- # define SWIGUNUSED
198
- # endif
199
- #endif
200
-
201
- #ifndef SWIG_MSC_UNSUPPRESS_4505
202
- # if defined(_MSC_VER)
203
- # pragma warning(disable : 4505) /* unreferenced local function has been removed */
204
- # endif
205
- #endif
206
-
207
- #ifndef SWIGUNUSEDPARM
208
- # ifdef __cplusplus
209
- # define SWIGUNUSEDPARM(p)
210
- # else
211
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
212
- # endif
213
- #endif
214
-
215
- /* internal SWIG method */
216
- #ifndef SWIGINTERN
217
- # define SWIGINTERN static SWIGUNUSED
218
- #endif
219
-
220
- /* internal inline SWIG method */
221
- #ifndef SWIGINTERNINLINE
222
- # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
223
- #endif
224
-
225
- /* exporting methods */
226
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
227
- # ifndef GCC_HASCLASSVISIBILITY
228
- # define GCC_HASCLASSVISIBILITY
229
- # endif
230
- #endif
231
-
232
- #ifndef SWIGEXPORT
233
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
234
- # if defined(STATIC_LINKED)
235
- # define SWIGEXPORT
236
- # else
237
- # define SWIGEXPORT __declspec(dllexport)
238
- # endif
239
- # else
240
- # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
241
- # define SWIGEXPORT __attribute__ ((visibility("default")))
242
- # else
243
- # define SWIGEXPORT
244
- # endif
245
- # endif
246
- #endif
247
-
248
- /* calling conventions for Windows */
249
- #ifndef SWIGSTDCALL
250
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
251
- # define SWIGSTDCALL __stdcall
252
- # else
253
- # define SWIGSTDCALL
254
- # endif
255
- #endif
256
-
257
- /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
258
- #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
259
- # define _CRT_SECURE_NO_DEPRECATE
260
- #endif
261
-
262
- /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
263
- #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
264
- # define _SCL_SECURE_NO_DEPRECATE
265
- #endif
266
-
267
- /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
268
- #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
269
- # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
270
- #endif
271
-
272
- /* Intel's compiler complains if a variable which was never initialised is
273
- * cast to void, which is a common idiom which we use to indicate that we
274
- * are aware a variable isn't used. So we just silence that warning.
275
- * See: https://github.com/swig/swig/issues/192 for more discussion.
276
- */
277
- #ifdef __INTEL_COMPILER
278
- # pragma warning disable 592
279
- #endif
280
-
281
- /* -----------------------------------------------------------------------------
282
- * swigrun.swg
283
- *
284
- * This file contains generic C API SWIG runtime support for pointer
285
- * type checking.
286
- * ----------------------------------------------------------------------------- */
287
-
288
- /* This should only be incremented when either the layout of swig_type_info changes,
289
- or for whatever reason, the runtime changes incompatibly */
290
- #define SWIG_RUNTIME_VERSION "4"
291
-
292
- /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
293
- #ifdef SWIG_TYPE_TABLE
294
- # define SWIG_QUOTE_STRING(x) #x
295
- # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
296
- # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
297
- #else
298
- # define SWIG_TYPE_TABLE_NAME
299
- #endif
300
-
301
- /*
302
- You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
303
- creating a static or dynamic library from the SWIG runtime code.
304
- In 99.9% of the cases, SWIG just needs to declare them as 'static'.
305
-
306
- But only do this if strictly necessary, ie, if you have problems
307
- with your compiler or suchlike.
308
- */
309
-
310
- #ifndef SWIGRUNTIME
311
- # define SWIGRUNTIME SWIGINTERN
312
- #endif
313
-
314
- #ifndef SWIGRUNTIMEINLINE
315
- # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
316
- #endif
317
-
318
- /* Generic buffer size */
319
- #ifndef SWIG_BUFFER_SIZE
320
- # define SWIG_BUFFER_SIZE 1024
321
- #endif
322
-
323
- /* Flags for pointer conversions */
324
- #define SWIG_POINTER_DISOWN 0x1
325
- #define SWIG_CAST_NEW_MEMORY 0x2
326
-
327
- /* Flags for new pointer objects */
328
- #define SWIG_POINTER_OWN 0x1
329
-
330
-
331
- /*
332
- Flags/methods for returning states.
333
-
334
- The SWIG conversion methods, as ConvertPtr, return an integer
335
- that tells if the conversion was successful or not. And if not,
336
- an error code can be returned (see swigerrors.swg for the codes).
337
-
338
- Use the following macros/flags to set or process the returning
339
- states.
340
-
341
- In old versions of SWIG, code such as the following was usually written:
342
-
343
- if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
344
- // success code
345
- } else {
346
- //fail code
347
- }
348
-
349
- Now you can be more explicit:
350
-
351
- int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
352
- if (SWIG_IsOK(res)) {
353
- // success code
354
- } else {
355
- // fail code
356
- }
357
-
358
- which is the same really, but now you can also do
359
-
360
- Type *ptr;
361
- int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
362
- if (SWIG_IsOK(res)) {
363
- // success code
364
- if (SWIG_IsNewObj(res) {
365
- ...
366
- delete *ptr;
367
- } else {
368
- ...
369
- }
370
- } else {
371
- // fail code
372
- }
373
-
374
- I.e., now SWIG_ConvertPtr can return new objects and you can
375
- identify the case and take care of the deallocation. Of course that
376
- also requires SWIG_ConvertPtr to return new result values, such as
377
-
378
- int SWIG_ConvertPtr(obj, ptr,...) {
379
- if (<obj is ok>) {
380
- if (<need new object>) {
381
- *ptr = <ptr to new allocated object>;
382
- return SWIG_NEWOBJ;
383
- } else {
384
- *ptr = <ptr to old object>;
385
- return SWIG_OLDOBJ;
386
- }
387
- } else {
388
- return SWIG_BADOBJ;
389
- }
390
- }
391
-
392
- Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
393
- more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
394
- SWIG errors code.
395
-
396
- Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
397
- allows to return the 'cast rank', for example, if you have this
398
-
399
- int food(double)
400
- int fooi(int);
401
-
402
- and you call
403
-
404
- food(1) // cast rank '1' (1 -> 1.0)
405
- fooi(1) // cast rank '0'
406
-
407
- just use the SWIG_AddCast()/SWIG_CheckState()
408
- */
409
-
410
- #define SWIG_OK (0)
411
- #define SWIG_ERROR (-1)
412
- #define SWIG_IsOK(r) (r >= 0)
413
- #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
414
-
415
- /* The CastRankLimit says how many bits are used for the cast rank */
416
- #define SWIG_CASTRANKLIMIT (1 << 8)
417
- /* The NewMask denotes the object was created (using new/malloc) */
418
- #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
419
- /* The TmpMask is for in/out typemaps that use temporal objects */
420
- #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
421
- /* Simple returning values */
422
- #define SWIG_BADOBJ (SWIG_ERROR)
423
- #define SWIG_OLDOBJ (SWIG_OK)
424
- #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
425
- #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
426
- /* Check, add and del mask methods */
427
- #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
428
- #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
429
- #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
430
- #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
431
- #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
432
- #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
433
-
434
- /* Cast-Rank Mode */
435
- #if defined(SWIG_CASTRANK_MODE)
436
- # ifndef SWIG_TypeRank
437
- # define SWIG_TypeRank unsigned long
438
- # endif
439
- # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
440
- # define SWIG_MAXCASTRANK (2)
441
- # endif
442
- # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
443
- # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
444
- SWIGINTERNINLINE int SWIG_AddCast(int r) {
445
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
446
- }
447
- SWIGINTERNINLINE int SWIG_CheckState(int r) {
448
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
449
- }
450
- #else /* no cast-rank mode */
451
- # define SWIG_AddCast(r) (r)
452
- # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
453
- #endif
454
-
455
-
456
- #include <string.h>
457
-
458
- #ifdef __cplusplus
459
- extern "C" {
460
- #endif
461
-
462
- typedef void *(*swig_converter_func)(void *, int *);
463
- typedef struct swig_type_info *(*swig_dycast_func)(void **);
464
-
465
- /* Structure to store information on one type */
466
- typedef struct swig_type_info {
467
- const char *name; /* mangled name of this type */
468
- const char *str; /* human readable name of this type */
469
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
470
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
471
- void *clientdata; /* language specific type data */
472
- int owndata; /* flag if the structure owns the clientdata */
473
- } swig_type_info;
474
-
475
- /* Structure to store a type and conversion function used for casting */
476
- typedef struct swig_cast_info {
477
- swig_type_info *type; /* pointer to type that is equivalent to this type */
478
- swig_converter_func converter; /* function to cast the void pointers */
479
- struct swig_cast_info *next; /* pointer to next cast in linked list */
480
- struct swig_cast_info *prev; /* pointer to the previous cast */
481
- } swig_cast_info;
482
-
483
- /* Structure used to store module information
484
- * Each module generates one structure like this, and the runtime collects
485
- * all of these structures and stores them in a circularly linked list.*/
486
- typedef struct swig_module_info {
487
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
488
- size_t size; /* Number of types in this module */
489
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
490
- swig_type_info **type_initial; /* Array of initially generated type structures */
491
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
492
- void *clientdata; /* Language specific module data */
493
- } swig_module_info;
494
-
495
- /*
496
- Compare two type names skipping the space characters, therefore
497
- "char*" == "char *" and "Class<int>" == "Class<int >", etc.
498
-
499
- Return 0 when the two name types are equivalent, as in
500
- strncmp, but skipping ' '.
501
- */
502
- SWIGRUNTIME int
503
- SWIG_TypeNameComp(const char *f1, const char *l1,
504
- const char *f2, const char *l2) {
505
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
506
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
507
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
508
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
509
- }
510
- return (int)((l1 - f1) - (l2 - f2));
511
- }
512
-
513
- /*
514
- Check type equivalence in a name list like <name1>|<name2>|...
515
- Return 0 if equal, -1 if nb < tb, 1 if nb > tb
516
- */
517
- SWIGRUNTIME int
518
- SWIG_TypeCmp(const char *nb, const char *tb) {
519
- int equiv = 1;
520
- const char* te = tb + strlen(tb);
521
- const char* ne = nb;
522
- while (equiv != 0 && *ne) {
523
- for (nb = ne; *ne; ++ne) {
524
- if (*ne == '|') break;
525
- }
526
- equiv = SWIG_TypeNameComp(nb, ne, tb, te);
527
- if (*ne) ++ne;
528
- }
529
- return equiv;
530
- }
531
-
532
- /*
533
- Check type equivalence in a name list like <name1>|<name2>|...
534
- Return 0 if not equal, 1 if equal
535
- */
536
- SWIGRUNTIME int
537
- SWIG_TypeEquiv(const char *nb, const char *tb) {
538
- return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
539
- }
540
-
541
- /*
542
- Check the typename
543
- */
544
- SWIGRUNTIME swig_cast_info *
545
- SWIG_TypeCheck(const char *c, swig_type_info *ty) {
546
- if (ty) {
547
- swig_cast_info *iter = ty->cast;
548
- while (iter) {
549
- if (strcmp(iter->type->name, c) == 0) {
550
- if (iter == ty->cast)
551
- return iter;
552
- /* Move iter to the top of the linked list */
553
- iter->prev->next = iter->next;
554
- if (iter->next)
555
- iter->next->prev = iter->prev;
556
- iter->next = ty->cast;
557
- iter->prev = 0;
558
- if (ty->cast) ty->cast->prev = iter;
559
- ty->cast = iter;
560
- return iter;
561
- }
562
- iter = iter->next;
563
- }
564
- }
565
- return 0;
566
- }
567
-
568
- /*
569
- Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
570
- */
571
- SWIGRUNTIME swig_cast_info *
572
- SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
573
- if (ty) {
574
- swig_cast_info *iter = ty->cast;
575
- while (iter) {
576
- if (iter->type == from) {
577
- if (iter == ty->cast)
578
- return iter;
579
- /* Move iter to the top of the linked list */
580
- iter->prev->next = iter->next;
581
- if (iter->next)
582
- iter->next->prev = iter->prev;
583
- iter->next = ty->cast;
584
- iter->prev = 0;
585
- if (ty->cast) ty->cast->prev = iter;
586
- ty->cast = iter;
587
- return iter;
588
- }
589
- iter = iter->next;
590
- }
591
- }
592
- return 0;
593
- }
594
-
595
- /*
596
- Cast a pointer up an inheritance hierarchy
597
- */
598
- SWIGRUNTIMEINLINE void *
599
- SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
600
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
601
- }
602
-
603
- /*
604
- Dynamic pointer casting. Down an inheritance hierarchy
605
- */
606
- SWIGRUNTIME swig_type_info *
607
- SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
608
- swig_type_info *lastty = ty;
609
- if (!ty || !ty->dcast) return ty;
610
- while (ty && (ty->dcast)) {
611
- ty = (*ty->dcast)(ptr);
612
- if (ty) lastty = ty;
613
- }
614
- return lastty;
615
- }
616
-
617
- /*
618
- Return the name associated with this type
619
- */
620
- SWIGRUNTIMEINLINE const char *
621
- SWIG_TypeName(const swig_type_info *ty) {
622
- return ty->name;
623
- }
624
-
625
- /*
626
- Return the pretty name associated with this type,
627
- that is an unmangled type name in a form presentable to the user.
628
- */
629
- SWIGRUNTIME const char *
630
- SWIG_TypePrettyName(const swig_type_info *type) {
631
- /* The "str" field contains the equivalent pretty names of the
632
- type, separated by vertical-bar characters. We choose
633
- to print the last name, as it is often (?) the most
634
- specific. */
635
- if (!type) return NULL;
636
- if (type->str != NULL) {
637
- const char *last_name = type->str;
638
- const char *s;
639
- for (s = type->str; *s; s++)
640
- if (*s == '|') last_name = s+1;
641
- return last_name;
642
- }
643
- else
644
- return type->name;
645
- }
646
-
647
- /*
648
- Set the clientdata field for a type
649
- */
650
- SWIGRUNTIME void
651
- SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
652
- swig_cast_info *cast = ti->cast;
653
- /* if (ti->clientdata == clientdata) return; */
654
- ti->clientdata = clientdata;
655
-
656
- while (cast) {
657
- if (!cast->converter) {
658
- swig_type_info *tc = cast->type;
659
- if (!tc->clientdata) {
660
- SWIG_TypeClientData(tc, clientdata);
661
- }
662
- }
663
- cast = cast->next;
664
- }
665
- }
666
- SWIGRUNTIME void
667
- SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
668
- SWIG_TypeClientData(ti, clientdata);
669
- ti->owndata = 1;
670
- }
671
-
672
- /*
673
- Search for a swig_type_info structure only by mangled name
674
- Search is a O(log #types)
675
-
676
- We start searching at module start, and finish searching when start == end.
677
- Note: if start == end at the beginning of the function, we go all the way around
678
- the circular list.
679
- */
680
- SWIGRUNTIME swig_type_info *
681
- SWIG_MangledTypeQueryModule(swig_module_info *start,
682
- swig_module_info *end,
683
- const char *name) {
684
- swig_module_info *iter = start;
685
- do {
686
- if (iter->size) {
687
- size_t l = 0;
688
- size_t r = iter->size - 1;
689
- do {
690
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
691
- size_t i = (l + r) >> 1;
692
- const char *iname = iter->types[i]->name;
693
- if (iname) {
694
- int compare = strcmp(name, iname);
695
- if (compare == 0) {
696
- return iter->types[i];
697
- } else if (compare < 0) {
698
- if (i) {
699
- r = i - 1;
700
- } else {
701
- break;
702
- }
703
- } else if (compare > 0) {
704
- l = i + 1;
705
- }
706
- } else {
707
- break; /* should never happen */
708
- }
709
- } while (l <= r);
710
- }
711
- iter = iter->next;
712
- } while (iter != end);
713
- return 0;
714
- }
715
-
716
- /*
717
- Search for a swig_type_info structure for either a mangled name or a human readable name.
718
- It first searches the mangled names of the types, which is a O(log #types)
719
- If a type is not found it then searches the human readable names, which is O(#types).
720
-
721
- We start searching at module start, and finish searching when start == end.
722
- Note: if start == end at the beginning of the function, we go all the way around
723
- the circular list.
724
- */
725
- SWIGRUNTIME swig_type_info *
726
- SWIG_TypeQueryModule(swig_module_info *start,
727
- swig_module_info *end,
728
- const char *name) {
729
- /* STEP 1: Search the name field using binary search */
730
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
731
- if (ret) {
732
- return ret;
733
- } else {
734
- /* STEP 2: If the type hasn't been found, do a complete search
735
- of the str field (the human readable name) */
736
- swig_module_info *iter = start;
737
- do {
738
- size_t i = 0;
739
- for (; i < iter->size; ++i) {
740
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
741
- return iter->types[i];
742
- }
743
- iter = iter->next;
744
- } while (iter != end);
745
- }
746
-
747
- /* neither found a match */
748
- return 0;
749
- }
750
-
751
- /*
752
- Pack binary data into a string
753
- */
754
- SWIGRUNTIME char *
755
- SWIG_PackData(char *c, void *ptr, size_t sz) {
756
- static const char hex[17] = "0123456789abcdef";
757
- const unsigned char *u = (unsigned char *) ptr;
758
- const unsigned char *eu = u + sz;
759
- for (; u != eu; ++u) {
760
- unsigned char uu = *u;
761
- *(c++) = hex[(uu & 0xf0) >> 4];
762
- *(c++) = hex[uu & 0xf];
763
- }
764
- return c;
765
- }
766
-
767
- /*
768
- Unpack binary data from a string
769
- */
770
- SWIGRUNTIME const char *
771
- SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
772
- unsigned char *u = (unsigned char *) ptr;
773
- const unsigned char *eu = u + sz;
774
- for (; u != eu; ++u) {
775
- char d = *(c++);
776
- unsigned char uu;
777
- if ((d >= '0') && (d <= '9'))
778
- uu = ((d - '0') << 4);
779
- else if ((d >= 'a') && (d <= 'f'))
780
- uu = ((d - ('a'-10)) << 4);
781
- else
782
- return (char *) 0;
783
- d = *(c++);
784
- if ((d >= '0') && (d <= '9'))
785
- uu |= (d - '0');
786
- else if ((d >= 'a') && (d <= 'f'))
787
- uu |= (d - ('a'-10));
788
- else
789
- return (char *) 0;
790
- *u = uu;
791
- }
792
- return c;
793
- }
794
-
795
- /*
796
- Pack 'void *' into a string buffer.
797
- */
798
- SWIGRUNTIME char *
799
- SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
800
- char *r = buff;
801
- if ((2*sizeof(void *) + 2) > bsz) return 0;
802
- *(r++) = '_';
803
- r = SWIG_PackData(r,&ptr,sizeof(void *));
804
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
805
- strcpy(r,name);
806
- return buff;
807
- }
808
-
809
- SWIGRUNTIME const char *
810
- SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
811
- if (*c != '_') {
812
- if (strcmp(c,"NULL") == 0) {
813
- *ptr = (void *) 0;
814
- return name;
815
- } else {
816
- return 0;
817
- }
818
- }
819
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
820
- }
821
-
822
- SWIGRUNTIME char *
823
- SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
824
- char *r = buff;
825
- size_t lname = (name ? strlen(name) : 0);
826
- if ((2*sz + 2 + lname) > bsz) return 0;
827
- *(r++) = '_';
828
- r = SWIG_PackData(r,ptr,sz);
829
- if (lname) {
830
- strncpy(r,name,lname+1);
831
- } else {
832
- *r = 0;
833
- }
834
- return buff;
835
- }
836
-
837
- SWIGRUNTIME const char *
838
- SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
839
- if (*c != '_') {
840
- if (strcmp(c,"NULL") == 0) {
841
- memset(ptr,0,sz);
842
- return name;
843
- } else {
844
- return 0;
845
- }
846
- }
847
- return SWIG_UnpackData(++c,ptr,sz);
848
- }
849
-
850
- #ifdef __cplusplus
851
- }
852
- #endif
853
-
854
- /* Errors in SWIG */
855
- #define SWIG_UnknownError -1
856
- #define SWIG_IOError -2
857
- #define SWIG_RuntimeError -3
858
- #define SWIG_IndexError -4
859
- #define SWIG_TypeError -5
860
- #define SWIG_DivisionByZero -6
861
- #define SWIG_OverflowError -7
862
- #define SWIG_SyntaxError -8
863
- #define SWIG_ValueError -9
864
- #define SWIG_SystemError -10
865
- #define SWIG_AttributeError -11
866
- #define SWIG_MemoryError -12
867
- #define SWIG_NullReferenceError -13
868
-
869
-
870
-
871
- #include <ruby.h>
872
-
873
- /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
874
- * breaks using rb_intern as an lvalue, as SWIG does. We work around this
875
- * issue for now by disabling this.
876
- * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
877
- */
878
- #ifdef rb_intern
879
- # undef rb_intern
880
- #endif
881
-
882
- /* Remove global macros defined in Ruby's win32.h */
883
- #ifdef write
884
- # undef write
885
- #endif
886
- #ifdef read
887
- # undef read
888
- #endif
889
- #ifdef bind
890
- # undef bind
891
- #endif
892
- #ifdef close
893
- # undef close
894
- #endif
895
- #ifdef connect
896
- # undef connect
897
- #endif
898
-
899
-
900
- /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
901
- #ifndef NUM2LL
902
- #define NUM2LL(x) NUM2LONG((x))
903
- #endif
904
- #ifndef LL2NUM
905
- #define LL2NUM(x) INT2NUM((long) (x))
906
- #endif
907
- #ifndef ULL2NUM
908
- #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
909
- #endif
910
-
911
- /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
912
- #ifndef NUM2ULL
913
- #ifdef HAVE_LONG_LONG
914
- #define NUM2ULL(x) rb_num2ull((x))
915
- #else
916
- #define NUM2ULL(x) NUM2ULONG(x)
917
- #endif
918
- #endif
919
-
920
- /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
921
- /* Define these for older versions so we can just write code the new way */
922
- #ifndef RSTRING_LEN
923
- # define RSTRING_LEN(x) RSTRING(x)->len
924
- #endif
925
- #ifndef RSTRING_PTR
926
- # define RSTRING_PTR(x) RSTRING(x)->ptr
927
- #endif
928
- #ifndef RSTRING_END
929
- # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
930
- #endif
931
- #ifndef RARRAY_LEN
932
- # define RARRAY_LEN(x) RARRAY(x)->len
933
- #endif
934
- #ifndef RARRAY_PTR
935
- # define RARRAY_PTR(x) RARRAY(x)->ptr
936
- #endif
937
- #ifndef RFLOAT_VALUE
938
- # define RFLOAT_VALUE(x) RFLOAT(x)->value
939
- #endif
940
- #ifndef DOUBLE2NUM
941
- # define DOUBLE2NUM(x) rb_float_new(x)
942
- #endif
943
- #ifndef RHASH_TBL
944
- # define RHASH_TBL(x) (RHASH(x)->tbl)
945
- #endif
946
- #ifndef RHASH_ITER_LEV
947
- # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
948
- #endif
949
- #ifndef RHASH_IFNONE
950
- # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
951
- #endif
952
- #ifndef RHASH_SIZE
953
- # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
954
- #endif
955
- #ifndef RHASH_EMPTY_P
956
- # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
957
- #endif
958
- #ifndef RSTRUCT_LEN
959
- # define RSTRUCT_LEN(x) RSTRUCT(x)->len
960
- #endif
961
- #ifndef RSTRUCT_PTR
962
- # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
963
- #endif
964
-
965
-
966
-
967
- /*
968
- * Need to be very careful about how these macros are defined, especially
969
- * when compiling C++ code or C code with an ANSI C compiler.
970
- *
971
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
972
- * a Ruby method so that it can be passed as an argument to API functions
973
- * like rb_define_method() and rb_define_singleton_method().
974
- *
975
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
976
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
977
- * can be passed as an argument to API functions like Data_Wrap_Struct()
978
- * and Data_Make_Struct().
979
- */
980
-
981
- #ifdef __cplusplus
982
- # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
983
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
984
- # define VALUEFUNC(f) ((VALUE (*)()) f)
985
- # define VOIDFUNC(f) ((void (*)()) f)
986
- # else
987
- # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
988
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
989
- # define VALUEFUNC(f) ((VALUE (*)()) f)
990
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
991
- # else /* These definitions should work for Ruby 1.7+ */
992
- # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
993
- # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
994
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
995
- # endif
996
- # endif
997
- #else
998
- # define VALUEFUNC(f) (f)
999
- # define VOIDFUNC(f) (f)
1000
- #endif
1001
-
1002
- /* Don't use for expressions have side effect */
1003
- #ifndef RB_STRING_VALUE
1004
- #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
1005
- #endif
1006
- #ifndef StringValue
1007
- #define StringValue(s) RB_STRING_VALUE(s)
1008
- #endif
1009
- #ifndef StringValuePtr
1010
- #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
1011
- #endif
1012
- #ifndef StringValueLen
1013
- #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
1014
- #endif
1015
- #ifndef SafeStringValue
1016
- #define SafeStringValue(v) do {\
1017
- StringValue(v);\
1018
- rb_check_safe_str(v);\
1019
- } while (0)
1020
- #endif
1021
-
1022
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1023
- #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1024
- #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1025
- #endif
1026
-
1027
- static VALUE _mSWIG = Qnil;
1028
-
1029
- /* -----------------------------------------------------------------------------
1030
- * error manipulation
1031
- * ----------------------------------------------------------------------------- */
1032
-
1033
-
1034
- /* Define some additional error types */
1035
- #define SWIG_ObjectPreviouslyDeletedError -100
1036
-
1037
-
1038
- /* Define custom exceptions for errors that do not map to existing Ruby
1039
- exceptions. Note this only works for C++ since a global cannot be
1040
- initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1041
-
1042
- SWIGINTERN VALUE
1043
- getNullReferenceError(void) {
1044
- static int init = 0;
1045
- static VALUE rb_eNullReferenceError ;
1046
- if (!init) {
1047
- init = 1;
1048
- rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1049
- }
1050
- return rb_eNullReferenceError;
1051
- }
1052
-
1053
- SWIGINTERN VALUE
1054
- getObjectPreviouslyDeletedError(void) {
1055
- static int init = 0;
1056
- static VALUE rb_eObjectPreviouslyDeleted ;
1057
- if (!init) {
1058
- init = 1;
1059
- rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1060
- }
1061
- return rb_eObjectPreviouslyDeleted;
1062
- }
1063
-
1064
-
1065
- SWIGINTERN VALUE
1066
- SWIG_Ruby_ErrorType(int SWIG_code) {
1067
- VALUE type;
1068
- switch (SWIG_code) {
1069
- case SWIG_MemoryError:
1070
- type = rb_eNoMemError;
1071
- break;
1072
- case SWIG_IOError:
1073
- type = rb_eIOError;
1074
- break;
1075
- case SWIG_RuntimeError:
1076
- type = rb_eRuntimeError;
1077
- break;
1078
- case SWIG_IndexError:
1079
- type = rb_eIndexError;
1080
- break;
1081
- case SWIG_TypeError:
1082
- type = rb_eTypeError;
1083
- break;
1084
- case SWIG_DivisionByZero:
1085
- type = rb_eZeroDivError;
1086
- break;
1087
- case SWIG_OverflowError:
1088
- type = rb_eRangeError;
1089
- break;
1090
- case SWIG_SyntaxError:
1091
- type = rb_eSyntaxError;
1092
- break;
1093
- case SWIG_ValueError:
1094
- type = rb_eArgError;
1095
- break;
1096
- case SWIG_SystemError:
1097
- type = rb_eFatal;
1098
- break;
1099
- case SWIG_AttributeError:
1100
- type = rb_eRuntimeError;
1101
- break;
1102
- case SWIG_NullReferenceError:
1103
- type = getNullReferenceError();
1104
- break;
1105
- case SWIG_ObjectPreviouslyDeletedError:
1106
- type = getObjectPreviouslyDeletedError();
1107
- break;
1108
- case SWIG_UnknownError:
1109
- type = rb_eRuntimeError;
1110
- break;
1111
- default:
1112
- type = rb_eRuntimeError;
1113
- }
1114
- return type;
1115
- }
1116
-
1117
-
1118
- /* This function is called when a user inputs a wrong argument to
1119
- a method.
1120
- */
1121
- SWIGINTERN
1122
- const char* Ruby_Format_TypeError( const char* msg,
1123
- const char* type,
1124
- const char* name,
1125
- const int argn,
1126
- VALUE input )
1127
- {
1128
- char buf[128];
1129
- VALUE str;
1130
- VALUE asStr;
1131
- if ( msg && *msg )
1132
- {
1133
- str = rb_str_new2(msg);
1134
- }
1135
- else
1136
- {
1137
- str = rb_str_new(NULL, 0);
1138
- }
1139
-
1140
- str = rb_str_cat2( str, "Expected argument " );
1141
- sprintf( buf, "%d of type ", argn-1 );
1142
- str = rb_str_cat2( str, buf );
1143
- str = rb_str_cat2( str, type );
1144
- str = rb_str_cat2( str, ", but got " );
1145
- str = rb_str_cat2( str, rb_obj_classname(input) );
1146
- str = rb_str_cat2( str, " " );
1147
- asStr = rb_inspect(input);
1148
- if ( RSTRING_LEN(asStr) > 30 )
1149
- {
1150
- str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1151
- str = rb_str_cat2( str, "..." );
1152
- }
1153
- else
1154
- {
1155
- str = rb_str_append( str, asStr );
1156
- }
1157
-
1158
- if ( name )
1159
- {
1160
- str = rb_str_cat2( str, "\n\tin SWIG method '" );
1161
- str = rb_str_cat2( str, name );
1162
- str = rb_str_cat2( str, "'" );
1163
- }
1164
-
1165
- return StringValuePtr( str );
1166
- }
1167
-
1168
- /* This function is called when an overloaded method fails */
1169
- SWIGINTERN
1170
- void Ruby_Format_OverloadedError(
1171
- const int argc,
1172
- const int maxargs,
1173
- const char* method,
1174
- const char* prototypes
1175
- )
1176
- {
1177
- const char* msg = "Wrong # of arguments";
1178
- if ( argc <= maxargs ) msg = "Wrong arguments";
1179
- rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1180
- "Possible C/C++ prototypes are:\n%s",
1181
- msg, method, prototypes);
1182
- }
1183
-
1184
- /* -----------------------------------------------------------------------------
1185
- * rubytracking.swg
1186
- *
1187
- * This file contains support for tracking mappings from
1188
- * Ruby objects to C++ objects. This functionality is needed
1189
- * to implement mark functions for Ruby's mark and sweep
1190
- * garbage collector.
1191
- * ----------------------------------------------------------------------------- */
1192
-
1193
- #ifdef __cplusplus
1194
- extern "C" {
1195
- #endif
1196
-
1197
- /* Ruby 1.8 actually assumes the first case. */
1198
- #if SIZEOF_VOIDP == SIZEOF_LONG
1199
- # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1200
- # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1201
- #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1202
- # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1203
- # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1204
- #else
1205
- # error sizeof(void*) is not the same as long or long long
1206
- #endif
1207
-
1208
-
1209
- /* Global Ruby hash table to store Trackings from C/C++
1210
- structs to Ruby Objects.
1211
- */
1212
- static VALUE swig_ruby_trackings = Qnil;
1213
-
1214
- /* Global variable that stores a reference to the ruby
1215
- hash table delete function. */
1216
- static ID swig_ruby_hash_delete;
1217
-
1218
- /* Setup a Ruby hash table to store Trackings */
1219
- SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1220
- /* Create a ruby hash table to store Trackings from C++
1221
- objects to Ruby objects. */
1222
-
1223
- /* Try to see if some other .so has already created a
1224
- tracking hash table, which we keep hidden in an instance var
1225
- in the SWIG module.
1226
- This is done to allow multiple DSOs to share the same
1227
- tracking table.
1228
- */
1229
- ID trackings_id = rb_intern( "@__trackings__" );
1230
- VALUE verbose = rb_gv_get("VERBOSE");
1231
- rb_gv_set("VERBOSE", Qfalse);
1232
- swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1233
- rb_gv_set("VERBOSE", verbose);
1234
-
1235
- /* No, it hasn't. Create one ourselves */
1236
- if ( swig_ruby_trackings == Qnil )
1237
- {
1238
- swig_ruby_trackings = rb_hash_new();
1239
- rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1240
- }
1241
-
1242
- /* Now store a reference to the hash table delete function
1243
- so that we only have to look it up once.*/
1244
- swig_ruby_hash_delete = rb_intern("delete");
1245
- }
1246
-
1247
- /* Get a Ruby number to reference a pointer */
1248
- SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1249
- /* We cast the pointer to an unsigned long
1250
- and then store a reference to it using
1251
- a Ruby number object. */
1252
-
1253
- /* Convert the pointer to a Ruby number */
1254
- return SWIG2NUM(ptr);
1255
- }
1256
-
1257
- /* Get a Ruby number to reference an object */
1258
- SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1259
- /* We cast the object to an unsigned long
1260
- and then store a reference to it using
1261
- a Ruby number object. */
1262
-
1263
- /* Convert the Object to a Ruby number */
1264
- return SWIG2NUM(object);
1265
- }
1266
-
1267
- /* Get a Ruby object from a previously stored reference */
1268
- SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1269
- /* The provided Ruby number object is a reference
1270
- to the Ruby object we want.*/
1271
-
1272
- /* Convert the Ruby number to a Ruby object */
1273
- return NUM2SWIG(reference);
1274
- }
1275
-
1276
- /* Add a Tracking from a C/C++ struct to a Ruby object */
1277
- SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1278
- /* In a Ruby hash table we store the pointer and
1279
- the associated Ruby object. The trick here is
1280
- that we cannot store the Ruby object directly - if
1281
- we do then it cannot be garbage collected. So
1282
- instead we typecast it as a unsigned long and
1283
- convert it to a Ruby number object.*/
1284
-
1285
- /* Get a reference to the pointer as a Ruby number */
1286
- VALUE key = SWIG_RubyPtrToReference(ptr);
1287
-
1288
- /* Get a reference to the Ruby object as a Ruby number */
1289
- VALUE value = SWIG_RubyObjectToReference(object);
1290
-
1291
- /* Store the mapping to the global hash table. */
1292
- rb_hash_aset(swig_ruby_trackings, key, value);
1293
- }
1294
-
1295
- /* Get the Ruby object that owns the specified C/C++ struct */
1296
- SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1297
- /* Get a reference to the pointer as a Ruby number */
1298
- VALUE key = SWIG_RubyPtrToReference(ptr);
1299
-
1300
- /* Now lookup the value stored in the global hash table */
1301
- VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1302
-
1303
- if (value == Qnil) {
1304
- /* No object exists - return nil. */
1305
- return Qnil;
1306
- }
1307
- else {
1308
- /* Convert this value to Ruby object */
1309
- return SWIG_RubyReferenceToObject(value);
1310
- }
1311
- }
1312
-
1313
- /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1314
- is very important to remove objects once they are destroyed
1315
- since the same memory address may be reused later to create
1316
- a new object. */
1317
- SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1318
- /* Get a reference to the pointer as a Ruby number */
1319
- VALUE key = SWIG_RubyPtrToReference(ptr);
1320
-
1321
- /* Delete the object from the hash table by calling Ruby's
1322
- do this we need to call the Hash.delete method.*/
1323
- rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1324
- }
1325
-
1326
- /* This is a helper method that unlinks a Ruby object from its
1327
- underlying C++ object. This is needed if the lifetime of the
1328
- Ruby object is longer than the C++ object */
1329
- SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1330
- VALUE object = SWIG_RubyInstanceFor(ptr);
1331
-
1332
- if (object != Qnil) {
1333
- DATA_PTR(object) = 0;
1334
- }
1335
- }
1336
-
1337
-
1338
- #ifdef __cplusplus
1339
- }
1340
- #endif
1341
-
1342
- /* -----------------------------------------------------------------------------
1343
- * Ruby API portion that goes into the runtime
1344
- * ----------------------------------------------------------------------------- */
1345
-
1346
- #ifdef __cplusplus
1347
- extern "C" {
1348
- #endif
1349
-
1350
- SWIGINTERN VALUE
1351
- SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1352
- if (NIL_P(target)) {
1353
- target = o;
1354
- } else {
1355
- if (TYPE(target) != T_ARRAY) {
1356
- VALUE o2 = target;
1357
- target = rb_ary_new();
1358
- rb_ary_push(target, o2);
1359
- }
1360
- rb_ary_push(target, o);
1361
- }
1362
- return target;
1363
- }
1364
-
1365
- /* For ruby1.8.4 and earlier. */
1366
- #ifndef RUBY_INIT_STACK
1367
- RUBY_EXTERN void Init_stack(VALUE* addr);
1368
- # define RUBY_INIT_STACK \
1369
- VALUE variable_in_this_stack_frame; \
1370
- Init_stack(&variable_in_this_stack_frame);
1371
- #endif
1372
-
1373
-
1374
- #ifdef __cplusplus
1375
- }
1376
- #endif
1377
-
1378
-
1379
- /* -----------------------------------------------------------------------------
1380
- * rubyrun.swg
1381
- *
1382
- * This file contains the runtime support for Ruby modules
1383
- * and includes code for managing global variables and pointer
1384
- * type checking.
1385
- * ----------------------------------------------------------------------------- */
1386
-
1387
- /* For backward compatibility only */
1388
- #define SWIG_POINTER_EXCEPTION 0
1389
-
1390
- /* for raw pointers */
1391
- #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1392
- #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1393
- #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1394
- #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1395
- #define swig_owntype ruby_owntype
1396
-
1397
- /* for raw packed data */
1398
- #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1399
- #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1400
-
1401
- /* for class or struct pointers */
1402
- #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1403
- #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1404
-
1405
- /* for C or C++ function pointers */
1406
- #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1407
- #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1408
-
1409
- /* for C++ member pointers, ie, member methods */
1410
- #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1411
- #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1412
-
1413
-
1414
- /* Runtime API */
1415
-
1416
- #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata)
1417
- #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1418
-
1419
-
1420
- /* Error manipulation */
1421
-
1422
- #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1423
- #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1424
- #define SWIG_fail goto fail
1425
-
1426
-
1427
- /* Ruby-specific SWIG API */
1428
-
1429
- #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1430
- #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1431
- #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1432
- #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1433
- #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1434
-
1435
- #include "assert.h"
1436
-
1437
- /* -----------------------------------------------------------------------------
1438
- * pointers/data manipulation
1439
- * ----------------------------------------------------------------------------- */
1440
-
1441
- #ifdef __cplusplus
1442
- extern "C" {
1443
- #endif
1444
-
1445
- typedef struct {
1446
- VALUE klass;
1447
- VALUE mImpl;
1448
- void (*mark)(void *);
1449
- void (*destroy)(void *);
1450
- int trackObjects;
1451
- } swig_class;
1452
-
1453
-
1454
- /* Global pointer used to keep some internal SWIG stuff */
1455
- static VALUE _cSWIG_Pointer = Qnil;
1456
- static VALUE swig_runtime_data_type_pointer = Qnil;
1457
-
1458
- /* Global IDs used to keep some internal SWIG stuff */
1459
- static ID swig_arity_id = 0;
1460
- static ID swig_call_id = 0;
1461
-
1462
- /*
1463
- If your swig extension is to be run within an embedded ruby and has
1464
- director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1465
- This will reset ruby's stack frame on each entry point from the main
1466
- program the first time a virtual director function is invoked (in a
1467
- non-recursive way).
1468
- If this is not done, you run the risk of Ruby trashing the stack.
1469
- */
1470
-
1471
- #ifdef RUBY_EMBEDDED
1472
-
1473
- # define SWIG_INIT_STACK \
1474
- if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1475
- ++swig_virtual_calls;
1476
- # define SWIG_RELEASE_STACK --swig_virtual_calls;
1477
- # define Ruby_DirectorTypeMismatchException(x) \
1478
- rb_raise( rb_eTypeError, "%s", x ); return c_result;
1479
-
1480
- static unsigned int swig_virtual_calls = 0;
1481
-
1482
- #else /* normal non-embedded extension */
1483
-
1484
- # define SWIG_INIT_STACK
1485
- # define SWIG_RELEASE_STACK
1486
- # define Ruby_DirectorTypeMismatchException(x) \
1487
- throw Swig::DirectorTypeMismatchException( x );
1488
-
1489
- #endif /* RUBY_EMBEDDED */
1490
-
1491
-
1492
- SWIGRUNTIME VALUE
1493
- getExceptionClass(void) {
1494
- static int init = 0;
1495
- static VALUE rubyExceptionClass ;
1496
- if (!init) {
1497
- init = 1;
1498
- rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1499
- }
1500
- return rubyExceptionClass;
1501
- }
1502
-
1503
- /* This code checks to see if the Ruby object being raised as part
1504
- of an exception inherits from the Ruby class Exception. If so,
1505
- the object is simply returned. If not, then a new Ruby exception
1506
- object is created and that will be returned to Ruby.*/
1507
- SWIGRUNTIME VALUE
1508
- SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1509
- VALUE exceptionClass = getExceptionClass();
1510
- if (rb_obj_is_kind_of(obj, exceptionClass)) {
1511
- return obj;
1512
- } else {
1513
- return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1514
- }
1515
- }
1516
-
1517
- /* Initialize Ruby runtime support */
1518
- SWIGRUNTIME void
1519
- SWIG_Ruby_InitRuntime(void)
1520
- {
1521
- if (_mSWIG == Qnil) {
1522
- _mSWIG = rb_define_module("SWIG");
1523
- swig_call_id = rb_intern("call");
1524
- swig_arity_id = rb_intern("arity");
1525
- }
1526
- }
1527
-
1528
- /* Define Ruby class for C type */
1529
- SWIGRUNTIME void
1530
- SWIG_Ruby_define_class(swig_type_info *type)
1531
- {
1532
- char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1533
- sprintf(klass_name, "TYPE%s", type->name);
1534
- if (NIL_P(_cSWIG_Pointer)) {
1535
- _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1536
- rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1537
- }
1538
- rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1539
- free((void *) klass_name);
1540
- }
1541
-
1542
- /* Create a new pointer object */
1543
- SWIGRUNTIME VALUE
1544
- SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1545
- {
1546
- int own = flags & SWIG_POINTER_OWN;
1547
- int track;
1548
- char *klass_name;
1549
- swig_class *sklass;
1550
- VALUE klass;
1551
- VALUE obj;
1552
-
1553
- if (!ptr)
1554
- return Qnil;
1555
-
1556
- if (type->clientdata) {
1557
- sklass = (swig_class *) type->clientdata;
1558
-
1559
- /* Are we tracking this class and have we already returned this Ruby object? */
1560
- track = sklass->trackObjects;
1561
- if (track) {
1562
- obj = SWIG_RubyInstanceFor(ptr);
1563
-
1564
- /* Check the object's type and make sure it has the correct type.
1565
- It might not in cases where methods do things like
1566
- downcast methods. */
1567
- if (obj != Qnil) {
1568
- VALUE value = rb_iv_get(obj, "@__swigtype__");
1569
- const char* type_name = RSTRING_PTR(value);
1570
-
1571
- if (strcmp(type->name, type_name) == 0) {
1572
- return obj;
1573
- }
1574
- }
1575
- }
1576
-
1577
- /* Create a new Ruby object */
1578
- obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1579
- ( own ? VOIDFUNC(sklass->destroy) :
1580
- (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1581
- ), ptr);
1582
-
1583
- /* If tracking is on for this class then track this object. */
1584
- if (track) {
1585
- SWIG_RubyAddTracking(ptr, obj);
1586
- }
1587
- } else {
1588
- klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1589
- sprintf(klass_name, "TYPE%s", type->name);
1590
- klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1591
- free((void *) klass_name);
1592
- obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1593
- }
1594
- rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1595
-
1596
- return obj;
1597
- }
1598
-
1599
- /* Create a new class instance (always owned) */
1600
- SWIGRUNTIME VALUE
1601
- SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1602
- {
1603
- VALUE obj;
1604
- swig_class *sklass = (swig_class *) type->clientdata;
1605
- obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1606
- rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1607
- return obj;
1608
- }
1609
-
1610
- /* Get type mangle from class name */
1611
- SWIGRUNTIMEINLINE char *
1612
- SWIG_Ruby_MangleStr(VALUE obj)
1613
- {
1614
- VALUE stype = rb_iv_get(obj, "@__swigtype__");
1615
- return StringValuePtr(stype);
1616
- }
1617
-
1618
- /* Acquire a pointer value */
1619
- typedef void (*ruby_owntype)(void*);
1620
-
1621
- SWIGRUNTIME ruby_owntype
1622
- SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1623
- if (obj) {
1624
- ruby_owntype oldown = RDATA(obj)->dfree;
1625
- RDATA(obj)->dfree = own;
1626
- return oldown;
1627
- } else {
1628
- return 0;
1629
- }
1630
- }
1631
-
1632
- /* Convert a pointer value */
1633
- SWIGRUNTIME int
1634
- SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1635
- {
1636
- char *c;
1637
- swig_cast_info *tc;
1638
- void *vptr = 0;
1639
-
1640
- /* Grab the pointer */
1641
- if (NIL_P(obj)) {
1642
- *ptr = 0;
1643
- return SWIG_OK;
1644
- } else {
1645
- if (TYPE(obj) != T_DATA) {
1646
- return SWIG_ERROR;
1647
- }
1648
- Data_Get_Struct(obj, void, vptr);
1649
- }
1650
-
1651
- if (own) *own = RDATA(obj)->dfree;
1652
-
1653
- /* Check to see if the input object is giving up ownership
1654
- of the underlying C struct or C++ object. If so then we
1655
- need to reset the destructor since the Ruby object no
1656
- longer owns the underlying C++ object.*/
1657
- if (flags & SWIG_POINTER_DISOWN) {
1658
- /* Is tracking on for this class? */
1659
- int track = 0;
1660
- if (ty && ty->clientdata) {
1661
- swig_class *sklass = (swig_class *) ty->clientdata;
1662
- track = sklass->trackObjects;
1663
- }
1664
-
1665
- if (track) {
1666
- /* We are tracking objects for this class. Thus we change the destructor
1667
- * to SWIG_RubyRemoveTracking. This allows us to
1668
- * remove the mapping from the C++ to Ruby object
1669
- * when the Ruby object is garbage collected. If we don't
1670
- * do this, then it is possible we will return a reference
1671
- * to a Ruby object that no longer exists thereby crashing Ruby. */
1672
- RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1673
- } else {
1674
- RDATA(obj)->dfree = 0;
1675
- }
1676
- }
1677
-
1678
- /* Do type-checking if type info was provided */
1679
- if (ty) {
1680
- if (ty->clientdata) {
1681
- if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1682
- if (vptr == 0) {
1683
- /* The object has already been deleted */
1684
- return SWIG_ObjectPreviouslyDeletedError;
1685
- }
1686
- *ptr = vptr;
1687
- return SWIG_OK;
1688
- }
1689
- }
1690
- if ((c = SWIG_MangleStr(obj)) == NULL) {
1691
- return SWIG_ERROR;
1692
- }
1693
- tc = SWIG_TypeCheck(c, ty);
1694
- if (!tc) {
1695
- return SWIG_ERROR;
1696
- } else {
1697
- int newmemory = 0;
1698
- *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1699
- assert(!newmemory); /* newmemory handling not yet implemented */
1700
- }
1701
- } else {
1702
- *ptr = vptr;
1703
- }
1704
-
1705
- return SWIG_OK;
1706
- }
1707
-
1708
- /* Check convert */
1709
- SWIGRUNTIMEINLINE int
1710
- SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1711
- {
1712
- char *c = SWIG_MangleStr(obj);
1713
- if (!c) return 0;
1714
- return SWIG_TypeCheck(c,ty) != 0;
1715
- }
1716
-
1717
- SWIGRUNTIME VALUE
1718
- SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1719
- char result[1024];
1720
- char *r = result;
1721
- if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1722
- *(r++) = '_';
1723
- r = SWIG_PackData(r, ptr, sz);
1724
- strcpy(r, type->name);
1725
- return rb_str_new2(result);
1726
- }
1727
-
1728
- /* Convert a packed value value */
1729
- SWIGRUNTIME int
1730
- SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1731
- swig_cast_info *tc;
1732
- const char *c;
1733
-
1734
- if (TYPE(obj) != T_STRING) goto type_error;
1735
- c = StringValuePtr(obj);
1736
- /* Pointer values must start with leading underscore */
1737
- if (*c != '_') goto type_error;
1738
- c++;
1739
- c = SWIG_UnpackData(c, ptr, sz);
1740
- if (ty) {
1741
- tc = SWIG_TypeCheck(c, ty);
1742
- if (!tc) goto type_error;
1743
- }
1744
- return SWIG_OK;
1745
-
1746
- type_error:
1747
- return SWIG_ERROR;
1748
- }
1749
-
1750
- SWIGRUNTIME swig_module_info *
1751
- SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
1752
- {
1753
- VALUE pointer;
1754
- swig_module_info *ret = 0;
1755
- VALUE verbose = rb_gv_get("VERBOSE");
1756
-
1757
- /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1758
- rb_gv_set("VERBOSE", Qfalse);
1759
-
1760
- /* first check if pointer already created */
1761
- pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1762
- if (pointer != Qnil) {
1763
- Data_Get_Struct(pointer, swig_module_info, ret);
1764
- }
1765
-
1766
- /* reinstate warnings */
1767
- rb_gv_set("VERBOSE", verbose);
1768
- return ret;
1769
- }
1770
-
1771
- SWIGRUNTIME void
1772
- SWIG_Ruby_SetModule(swig_module_info *pointer)
1773
- {
1774
- /* register a new class */
1775
- VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1776
- /* create and store the structure pointer to a global variable */
1777
- swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1778
- rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1779
- }
1780
-
1781
- /* This function can be used to check whether a proc or method or similarly
1782
- callable function has been passed. Usually used in a %typecheck, like:
1783
-
1784
- %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1785
- $result = SWIG_Ruby_isCallable( $input );
1786
- }
1787
- */
1788
- SWIGINTERN
1789
- int SWIG_Ruby_isCallable( VALUE proc )
1790
- {
1791
- if ( rb_respond_to( proc, swig_call_id ) )
1792
- return 1;
1793
- return 0;
1794
- }
1795
-
1796
- /* This function can be used to check the arity (number of arguments)
1797
- a proc or method can take. Usually used in a %typecheck.
1798
- Valid arities will be that equal to minimal or those < 0
1799
- which indicate a variable number of parameters at the end.
1800
- */
1801
- SWIGINTERN
1802
- int SWIG_Ruby_arity( VALUE proc, int minimal )
1803
- {
1804
- if ( rb_respond_to( proc, swig_arity_id ) )
1805
- {
1806
- VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1807
- int arity = NUM2INT(num);
1808
- if ( arity < 0 && (arity+1) < -minimal ) return 1;
1809
- if ( arity == minimal ) return 1;
1810
- return 1;
1811
- }
1812
- return 0;
1813
- }
1814
-
1815
-
1816
- #ifdef __cplusplus
1817
- }
1818
- #endif
1819
-
1820
-
1821
-
1822
- #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1823
-
1824
- #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1825
-
1826
-
1827
-
1828
- /* -------- TYPES TABLE (BEGIN) -------- */
1829
-
1830
- #define SWIGTYPE_p_char swig_types[0]
1831
- #define SWIGTYPE_p_v8eval___V8 swig_types[1]
1832
- static swig_type_info *swig_types[3];
1833
- static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
1834
- #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1835
- #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1836
-
1837
- /* -------- TYPES TABLE (END) -------- */
1838
-
1839
- #define SWIG_init Init_v8eval
1840
- #define SWIG_name "V8eval"
1841
-
1842
- static VALUE mV8eval;
1843
-
1844
- #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1845
- #define SWIG_RUBY_THREAD_END_BLOCK
1846
-
1847
-
1848
- #define SWIGVERSION 0x030007
1849
- #define SWIG_VERSION SWIGVERSION
1850
-
1851
-
1852
- #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1853
- #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1854
-
1855
-
1856
- #include <stdexcept>
1857
-
1858
-
1859
- #include <string>
1860
-
1861
-
1862
- #define SWIG_FILE_WITH_INIT
1863
- #include "v8eval.h"
1864
-
1865
-
1866
- SWIGINTERNINLINE VALUE
1867
- SWIG_From_bool (bool value)
1868
- {
1869
- return value ? Qtrue : Qfalse;
1870
- }
1871
-
1872
-
1873
- SWIGINTERN swig_type_info*
1874
- SWIG_pchar_descriptor(void)
1875
- {
1876
- static int init = 0;
1877
- static swig_type_info* info = 0;
1878
- if (!init) {
1879
- info = SWIG_TypeQuery("_p_char");
1880
- init = 1;
1881
- }
1882
- return info;
1883
- }
1884
-
1885
-
1886
- SWIGINTERN int
1887
- SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1888
- {
1889
- if (TYPE(obj) == T_STRING) {
1890
- char *cstr = StringValuePtr(obj);
1891
- size_t size = RSTRING_LEN(obj) + 1;
1892
- if (cptr) {
1893
- if (alloc) {
1894
- if (*alloc == SWIG_NEWOBJ) {
1895
- *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
1896
- } else {
1897
- *cptr = cstr;
1898
- *alloc = SWIG_OLDOBJ;
1899
- }
1900
- }
1901
- }
1902
- if (psize) *psize = size;
1903
- return SWIG_OK;
1904
- } else {
1905
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1906
- if (pchar_descriptor) {
1907
- void* vptr = 0;
1908
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1909
- if (cptr) *cptr = (char *)vptr;
1910
- if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1911
- if (alloc) *alloc = SWIG_OLDOBJ;
1912
- return SWIG_OK;
1913
- }
1914
- }
1915
- }
1916
- return SWIG_TypeError;
1917
- }
1918
-
1919
-
1920
- SWIGINTERN int
1921
- SWIG_AsPtr_std_string (VALUE obj, std::string **val)
1922
- {
1923
- char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
1924
- if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
1925
- if (buf) {
1926
- if (val) *val = new std::string(buf, size - 1);
1927
- if (alloc == SWIG_NEWOBJ) delete[] buf;
1928
- return SWIG_NEWOBJ;
1929
- } else {
1930
- if (val) *val = 0;
1931
- return SWIG_OLDOBJ;
1932
- }
1933
- } else {
1934
- static int init = 0;
1935
- static swig_type_info* descriptor = 0;
1936
- if (!init) {
1937
- descriptor = SWIG_TypeQuery("std::string" " *");
1938
- init = 1;
1939
- }
1940
- if (descriptor) {
1941
- std::string *vptr;
1942
- int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
1943
- if (SWIG_IsOK(res) && val) *val = vptr;
1944
- return res;
1945
- }
1946
- }
1947
- return SWIG_ERROR;
1948
- }
1949
-
1950
-
1951
- SWIGINTERNINLINE VALUE
1952
- SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1953
- {
1954
- if (carray) {
1955
- if (size > LONG_MAX) {
1956
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1957
- return pchar_descriptor ?
1958
- SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
1959
- } else {
1960
- return rb_str_new(carray, static_cast< long >(size));
1961
- }
1962
- } else {
1963
- return Qnil;
1964
- }
1965
- }
1966
-
1967
-
1968
- SWIGINTERNINLINE VALUE
1969
- SWIG_From_std_string (const std::string& s)
1970
- {
1971
- return SWIG_FromCharPtrAndSize(s.data(), s.size());
1972
- }
1973
-
1974
-
1975
- #include <limits.h>
1976
- #if !defined(SWIG_NO_LLONG_MAX)
1977
- # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1978
- # define LLONG_MAX __LONG_LONG_MAX__
1979
- # define LLONG_MIN (-LLONG_MAX - 1LL)
1980
- # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1981
- # endif
1982
- #endif
1983
-
1984
-
1985
- SWIGINTERN VALUE
1986
- SWIG_ruby_failed(void)
1987
- {
1988
- return Qnil;
1989
- }
1990
-
1991
-
1992
- /*@SWIG:/usr/local/Cellar/swig/3.0.7/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1993
- SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1994
- {
1995
- VALUE obj = args[0];
1996
- VALUE type = TYPE(obj);
1997
- long *res = (long *)(args[1]);
1998
- *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1999
- return obj;
2000
- }
2001
- /*@SWIG@*/
2002
-
2003
- SWIGINTERN int
2004
- SWIG_AsVal_long (VALUE obj, long* val)
2005
- {
2006
- VALUE type = TYPE(obj);
2007
- if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2008
- long v;
2009
- VALUE a[2];
2010
- a[0] = obj;
2011
- a[1] = (VALUE)(&v);
2012
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2013
- if (val) *val = v;
2014
- return SWIG_OK;
2015
- }
2016
- }
2017
- return SWIG_TypeError;
2018
- }
2019
-
2020
-
2021
- SWIGINTERN int
2022
- SWIG_AsVal_int (VALUE obj, int *val)
2023
- {
2024
- long v;
2025
- int res = SWIG_AsVal_long (obj, &v);
2026
- if (SWIG_IsOK(res)) {
2027
- if ((v < INT_MIN || v > INT_MAX)) {
2028
- return SWIG_OverflowError;
2029
- } else {
2030
- if (val) *val = static_cast< int >(v);
2031
- }
2032
- }
2033
- return res;
2034
- }
2035
-
2036
- SWIGINTERN VALUE
2037
- _wrap_initialize(int argc, VALUE *argv, VALUE self) {
2038
- bool result;
2039
- VALUE vresult = Qnil;
2040
-
2041
- if ((argc < 0) || (argc > 0)) {
2042
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2043
- }
2044
- result = (bool)v8eval::initialize();
2045
- vresult = SWIG_From_bool(static_cast< bool >(result));
2046
- return vresult;
2047
- fail:
2048
- return Qnil;
2049
- }
2050
-
2051
-
2052
- SWIGINTERN VALUE
2053
- _wrap_dispose(int argc, VALUE *argv, VALUE self) {
2054
- bool result;
2055
- VALUE vresult = Qnil;
2056
-
2057
- if ((argc < 0) || (argc > 0)) {
2058
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2059
- }
2060
- result = (bool)v8eval::dispose();
2061
- vresult = SWIG_From_bool(static_cast< bool >(result));
2062
- return vresult;
2063
- fail:
2064
- return Qnil;
2065
- }
2066
-
2067
-
2068
- static swig_class SwigClassV8;
2069
-
2070
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2071
- SWIGINTERN VALUE
2072
- _wrap_V8_allocate(VALUE self) {
2073
- #else
2074
- SWIGINTERN VALUE
2075
- _wrap_V8_allocate(int argc, VALUE *argv, VALUE self) {
2076
- #endif
2077
-
2078
-
2079
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_v8eval___V8);
2080
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2081
- rb_obj_call_init(vresult, argc, argv);
2082
- #endif
2083
- return vresult;
2084
- }
2085
-
2086
-
2087
- SWIGINTERN VALUE
2088
- _wrap_new_V8(int argc, VALUE *argv, VALUE self) {
2089
- v8eval::_V8 *result = 0 ;
2090
-
2091
- if ((argc < 0) || (argc > 0)) {
2092
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2093
- }
2094
- result = (v8eval::_V8 *)new v8eval::_V8();
2095
- DATA_PTR(self) = result;
2096
- return self;
2097
- fail:
2098
- return Qnil;
2099
- }
2100
-
2101
-
2102
- SWIGINTERN void
2103
- free_v8eval__V8(v8eval::_V8 *arg1) {
2104
- delete arg1;
2105
- }
2106
-
2107
- SWIGINTERN VALUE
2108
- _wrap_V8_eval(int argc, VALUE *argv, VALUE self) {
2109
- v8eval::_V8 *arg1 = (v8eval::_V8 *) 0 ;
2110
- std::string *arg2 = 0 ;
2111
- void *argp1 = 0 ;
2112
- int res1 = 0 ;
2113
- int res2 = SWIG_OLDOBJ ;
2114
- std::string result;
2115
- VALUE vresult = Qnil;
2116
-
2117
- if ((argc < 1) || (argc > 1)) {
2118
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2119
- }
2120
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_v8eval___V8, 0 | 0 );
2121
- if (!SWIG_IsOK(res1)) {
2122
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "v8eval::_V8 *","eval", 1, self ));
2123
- }
2124
- arg1 = reinterpret_cast< v8eval::_V8 * >(argp1);
2125
- {
2126
- std::string *ptr = (std::string *)0;
2127
- res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
2128
- if (!SWIG_IsOK(res2)) {
2129
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","eval", 2, argv[0] ));
2130
- }
2131
- if (!ptr) {
2132
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","eval", 2, argv[0]));
2133
- }
2134
- arg2 = ptr;
2135
- }
2136
- result = (arg1)->eval((std::string const &)*arg2);
2137
- vresult = SWIG_From_std_string(static_cast< std::string >(result));
2138
- if (SWIG_IsNewObj(res2)) delete arg2;
2139
- return vresult;
2140
- fail:
2141
- if (SWIG_IsNewObj(res2)) delete arg2;
2142
- return Qnil;
2143
- }
2144
-
2145
-
2146
- SWIGINTERN VALUE
2147
- _wrap_V8_call(int argc, VALUE *argv, VALUE self) {
2148
- v8eval::_V8 *arg1 = (v8eval::_V8 *) 0 ;
2149
- std::string *arg2 = 0 ;
2150
- std::string *arg3 = 0 ;
2151
- void *argp1 = 0 ;
2152
- int res1 = 0 ;
2153
- int res2 = SWIG_OLDOBJ ;
2154
- int res3 = SWIG_OLDOBJ ;
2155
- std::string result;
2156
- VALUE vresult = Qnil;
2157
-
2158
- if ((argc < 2) || (argc > 2)) {
2159
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2160
- }
2161
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_v8eval___V8, 0 | 0 );
2162
- if (!SWIG_IsOK(res1)) {
2163
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "v8eval::_V8 *","call", 1, self ));
2164
- }
2165
- arg1 = reinterpret_cast< v8eval::_V8 * >(argp1);
2166
- {
2167
- std::string *ptr = (std::string *)0;
2168
- res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
2169
- if (!SWIG_IsOK(res2)) {
2170
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","call", 2, argv[0] ));
2171
- }
2172
- if (!ptr) {
2173
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","call", 2, argv[0]));
2174
- }
2175
- arg2 = ptr;
2176
- }
2177
- {
2178
- std::string *ptr = (std::string *)0;
2179
- res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
2180
- if (!SWIG_IsOK(res3)) {
2181
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","call", 3, argv[1] ));
2182
- }
2183
- if (!ptr) {
2184
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","call", 3, argv[1]));
2185
- }
2186
- arg3 = ptr;
2187
- }
2188
- result = (arg1)->call((std::string const &)*arg2,(std::string const &)*arg3);
2189
- vresult = SWIG_From_std_string(static_cast< std::string >(result));
2190
- if (SWIG_IsNewObj(res2)) delete arg2;
2191
- if (SWIG_IsNewObj(res3)) delete arg3;
2192
- return vresult;
2193
- fail:
2194
- if (SWIG_IsNewObj(res2)) delete arg2;
2195
- if (SWIG_IsNewObj(res3)) delete arg3;
2196
- return Qnil;
2197
- }
2198
-
2199
-
2200
- SWIGINTERN VALUE
2201
- _wrap_V8_enable_debugger(int argc, VALUE *argv, VALUE self) {
2202
- v8eval::_V8 *arg1 = (v8eval::_V8 *) 0 ;
2203
- int arg2 ;
2204
- void *argp1 = 0 ;
2205
- int res1 = 0 ;
2206
- int val2 ;
2207
- int ecode2 = 0 ;
2208
- bool result;
2209
- VALUE vresult = Qnil;
2210
-
2211
- if ((argc < 1) || (argc > 1)) {
2212
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2213
- }
2214
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_v8eval___V8, 0 | 0 );
2215
- if (!SWIG_IsOK(res1)) {
2216
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "v8eval::_V8 *","enable_debugger", 1, self ));
2217
- }
2218
- arg1 = reinterpret_cast< v8eval::_V8 * >(argp1);
2219
- ecode2 = SWIG_AsVal_int(argv[0], &val2);
2220
- if (!SWIG_IsOK(ecode2)) {
2221
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","enable_debugger", 2, argv[0] ));
2222
- }
2223
- arg2 = static_cast< int >(val2);
2224
- result = (bool)(arg1)->enable_debugger(arg2);
2225
- vresult = SWIG_From_bool(static_cast< bool >(result));
2226
- return vresult;
2227
- fail:
2228
- return Qnil;
2229
- }
2230
-
2231
-
2232
- SWIGINTERN VALUE
2233
- _wrap_V8_disable_debugger(int argc, VALUE *argv, VALUE self) {
2234
- v8eval::_V8 *arg1 = (v8eval::_V8 *) 0 ;
2235
- void *argp1 = 0 ;
2236
- int res1 = 0 ;
2237
-
2238
- if ((argc < 0) || (argc > 0)) {
2239
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2240
- }
2241
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_v8eval___V8, 0 | 0 );
2242
- if (!SWIG_IsOK(res1)) {
2243
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "v8eval::_V8 *","disable_debugger", 1, self ));
2244
- }
2245
- arg1 = reinterpret_cast< v8eval::_V8 * >(argp1);
2246
- (arg1)->disable_debugger();
2247
- return Qnil;
2248
- fail:
2249
- return Qnil;
2250
- }
2251
-
2252
-
2253
-
2254
- /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2255
-
2256
- static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2257
- static swig_type_info _swigt__p_v8eval___V8 = {"_p_v8eval___V8", "v8eval::_V8 *", 0, 0, (void*)0, 0};
2258
-
2259
- static swig_type_info *swig_type_initial[] = {
2260
- &_swigt__p_char,
2261
- &_swigt__p_v8eval___V8,
2262
- };
2263
-
2264
- static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2265
- static swig_cast_info _swigc__p_v8eval___V8[] = { {&_swigt__p_v8eval___V8, 0, 0, 0},{0, 0, 0, 0}};
2266
-
2267
- static swig_cast_info *swig_cast_initial[] = {
2268
- _swigc__p_char,
2269
- _swigc__p_v8eval___V8,
2270
- };
2271
-
2272
-
2273
- /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2274
-
2275
- /* -----------------------------------------------------------------------------
2276
- * Type initialization:
2277
- * This problem is tough by the requirement that no dynamic
2278
- * memory is used. Also, since swig_type_info structures store pointers to
2279
- * swig_cast_info structures and swig_cast_info structures store pointers back
2280
- * to swig_type_info structures, we need some lookup code at initialization.
2281
- * The idea is that swig generates all the structures that are needed.
2282
- * The runtime then collects these partially filled structures.
2283
- * The SWIG_InitializeModule function takes these initial arrays out of
2284
- * swig_module, and does all the lookup, filling in the swig_module.types
2285
- * array with the correct data and linking the correct swig_cast_info
2286
- * structures together.
2287
- *
2288
- * The generated swig_type_info structures are assigned statically to an initial
2289
- * array. We just loop through that array, and handle each type individually.
2290
- * First we lookup if this type has been already loaded, and if so, use the
2291
- * loaded structure instead of the generated one. Then we have to fill in the
2292
- * cast linked list. The cast data is initially stored in something like a
2293
- * two-dimensional array. Each row corresponds to a type (there are the same
2294
- * number of rows as there are in the swig_type_initial array). Each entry in
2295
- * a column is one of the swig_cast_info structures for that type.
2296
- * The cast_initial array is actually an array of arrays, because each row has
2297
- * a variable number of columns. So to actually build the cast linked list,
2298
- * we find the array of casts associated with the type, and loop through it
2299
- * adding the casts to the list. The one last trick we need to do is making
2300
- * sure the type pointer in the swig_cast_info struct is correct.
2301
- *
2302
- * First off, we lookup the cast->type name to see if it is already loaded.
2303
- * There are three cases to handle:
2304
- * 1) If the cast->type has already been loaded AND the type we are adding
2305
- * casting info to has not been loaded (it is in this module), THEN we
2306
- * replace the cast->type pointer with the type pointer that has already
2307
- * been loaded.
2308
- * 2) If BOTH types (the one we are adding casting info to, and the
2309
- * cast->type) are loaded, THEN the cast info has already been loaded by
2310
- * the previous module so we just ignore it.
2311
- * 3) Finally, if cast->type has not already been loaded, then we add that
2312
- * swig_cast_info to the linked list (because the cast->type) pointer will
2313
- * be correct.
2314
- * ----------------------------------------------------------------------------- */
2315
-
2316
- #ifdef __cplusplus
2317
- extern "C" {
2318
- #if 0
2319
- } /* c-mode */
2320
- #endif
2321
- #endif
2322
-
2323
- #if 0
2324
- #define SWIGRUNTIME_DEBUG
2325
- #endif
2326
-
2327
-
2328
- SWIGRUNTIME void
2329
- SWIG_InitializeModule(void *clientdata) {
2330
- size_t i;
2331
- swig_module_info *module_head, *iter;
2332
- int init;
2333
-
2334
- /* check to see if the circular list has been setup, if not, set it up */
2335
- if (swig_module.next==0) {
2336
- /* Initialize the swig_module */
2337
- swig_module.type_initial = swig_type_initial;
2338
- swig_module.cast_initial = swig_cast_initial;
2339
- swig_module.next = &swig_module;
2340
- init = 1;
2341
- } else {
2342
- init = 0;
2343
- }
2344
-
2345
- /* Try and load any already created modules */
2346
- module_head = SWIG_GetModule(clientdata);
2347
- if (!module_head) {
2348
- /* This is the first module loaded for this interpreter */
2349
- /* so set the swig module into the interpreter */
2350
- SWIG_SetModule(clientdata, &swig_module);
2351
- } else {
2352
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2353
- iter=module_head;
2354
- do {
2355
- if (iter==&swig_module) {
2356
- /* Our module is already in the list, so there's nothing more to do. */
2357
- return;
2358
- }
2359
- iter=iter->next;
2360
- } while (iter!= module_head);
2361
-
2362
- /* otherwise we must add our module into the list */
2363
- swig_module.next = module_head->next;
2364
- module_head->next = &swig_module;
2365
- }
2366
-
2367
- /* When multiple interpreters are used, a module could have already been initialized in
2368
- a different interpreter, but not yet have a pointer in this interpreter.
2369
- In this case, we do not want to continue adding types... everything should be
2370
- set up already */
2371
- if (init == 0) return;
2372
-
2373
- /* Now work on filling in swig_module.types */
2374
- #ifdef SWIGRUNTIME_DEBUG
2375
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2376
- #endif
2377
- for (i = 0; i < swig_module.size; ++i) {
2378
- swig_type_info *type = 0;
2379
- swig_type_info *ret;
2380
- swig_cast_info *cast;
2381
-
2382
- #ifdef SWIGRUNTIME_DEBUG
2383
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2384
- #endif
2385
-
2386
- /* if there is another module already loaded */
2387
- if (swig_module.next != &swig_module) {
2388
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2389
- }
2390
- if (type) {
2391
- /* Overwrite clientdata field */
2392
- #ifdef SWIGRUNTIME_DEBUG
2393
- printf("SWIG_InitializeModule: found type %s\n", type->name);
2394
- #endif
2395
- if (swig_module.type_initial[i]->clientdata) {
2396
- type->clientdata = swig_module.type_initial[i]->clientdata;
2397
- #ifdef SWIGRUNTIME_DEBUG
2398
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2399
- #endif
2400
- }
2401
- } else {
2402
- type = swig_module.type_initial[i];
2403
- }
2404
-
2405
- /* Insert casting types */
2406
- cast = swig_module.cast_initial[i];
2407
- while (cast->type) {
2408
-
2409
- /* Don't need to add information already in the list */
2410
- ret = 0;
2411
- #ifdef SWIGRUNTIME_DEBUG
2412
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2413
- #endif
2414
- if (swig_module.next != &swig_module) {
2415
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2416
- #ifdef SWIGRUNTIME_DEBUG
2417
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2418
- #endif
2419
- }
2420
- if (ret) {
2421
- if (type == swig_module.type_initial[i]) {
2422
- #ifdef SWIGRUNTIME_DEBUG
2423
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2424
- #endif
2425
- cast->type = ret;
2426
- ret = 0;
2427
- } else {
2428
- /* Check for casting already in the list */
2429
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2430
- #ifdef SWIGRUNTIME_DEBUG
2431
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2432
- #endif
2433
- if (!ocast) ret = 0;
2434
- }
2435
- }
2436
-
2437
- if (!ret) {
2438
- #ifdef SWIGRUNTIME_DEBUG
2439
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2440
- #endif
2441
- if (type->cast) {
2442
- type->cast->prev = cast;
2443
- cast->next = type->cast;
2444
- }
2445
- type->cast = cast;
2446
- }
2447
- cast++;
2448
- }
2449
- /* Set entry in modules->types array equal to the type */
2450
- swig_module.types[i] = type;
2451
- }
2452
- swig_module.types[i] = 0;
2453
-
2454
- #ifdef SWIGRUNTIME_DEBUG
2455
- printf("**** SWIG_InitializeModule: Cast List ******\n");
2456
- for (i = 0; i < swig_module.size; ++i) {
2457
- int j = 0;
2458
- swig_cast_info *cast = swig_module.cast_initial[i];
2459
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2460
- while (cast->type) {
2461
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2462
- cast++;
2463
- ++j;
2464
- }
2465
- printf("---- Total casts: %d\n",j);
2466
- }
2467
- printf("**** SWIG_InitializeModule: Cast List ******\n");
2468
- #endif
2469
- }
2470
-
2471
- /* This function will propagate the clientdata field of type to
2472
- * any new swig_type_info structures that have been added into the list
2473
- * of equivalent types. It is like calling
2474
- * SWIG_TypeClientData(type, clientdata) a second time.
2475
- */
2476
- SWIGRUNTIME void
2477
- SWIG_PropagateClientData(void) {
2478
- size_t i;
2479
- swig_cast_info *equiv;
2480
- static int init_run = 0;
2481
-
2482
- if (init_run) return;
2483
- init_run = 1;
2484
-
2485
- for (i = 0; i < swig_module.size; i++) {
2486
- if (swig_module.types[i]->clientdata) {
2487
- equiv = swig_module.types[i]->cast;
2488
- while (equiv) {
2489
- if (!equiv->converter) {
2490
- if (equiv->type && !equiv->type->clientdata)
2491
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2492
- }
2493
- equiv = equiv->next;
2494
- }
2495
- }
2496
- }
2497
- }
2498
-
2499
- #ifdef __cplusplus
2500
- #if 0
2501
- { /* c-mode */
2502
- #endif
2503
- }
2504
- #endif
2505
-
2506
- /*
2507
-
2508
- */
2509
- #ifdef __cplusplus
2510
- extern "C"
2511
- #endif
2512
- SWIGEXPORT void Init_v8eval(void) {
2513
- size_t i;
2514
-
2515
- SWIG_InitRuntime();
2516
- mV8eval = rb_define_module("V8eval");
2517
-
2518
- SWIG_InitializeModule(0);
2519
- for (i = 0; i < swig_module.size; i++) {
2520
- SWIG_define_class(swig_module.types[i]);
2521
- }
2522
-
2523
- SWIG_RubyInitializeTrackings();
2524
- rb_define_module_function(mV8eval, "initialize", VALUEFUNC(_wrap_initialize), -1);
2525
- rb_define_module_function(mV8eval, "dispose", VALUEFUNC(_wrap_dispose), -1);
2526
-
2527
- SwigClassV8.klass = rb_define_class_under(mV8eval, "V8", rb_cObject);
2528
- SWIG_TypeClientData(SWIGTYPE_p_v8eval___V8, (void *) &SwigClassV8);
2529
- rb_define_alloc_func(SwigClassV8.klass, _wrap_V8_allocate);
2530
- rb_define_method(SwigClassV8.klass, "initialize", VALUEFUNC(_wrap_new_V8), -1);
2531
- rb_define_method(SwigClassV8.klass, "eval", VALUEFUNC(_wrap_V8_eval), -1);
2532
- rb_define_method(SwigClassV8.klass, "call", VALUEFUNC(_wrap_V8_call), -1);
2533
- rb_define_method(SwigClassV8.klass, "enable_debugger", VALUEFUNC(_wrap_V8_enable_debugger), -1);
2534
- rb_define_method(SwigClassV8.klass, "disable_debugger", VALUEFUNC(_wrap_V8_disable_debugger), -1);
2535
- SwigClassV8.mark = 0;
2536
- SwigClassV8.destroy = (void (*)(void *)) free_v8eval__V8;
2537
- SwigClassV8.trackObjects = 0;
2538
- }
2539
-