mathematical 0.5.0 → 0.6.0

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