v8eval 0.2.2 → 0.2.3

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