Line data Source code
1 : /* ----------------------------------------------------------------------------
2 : * This file was automatically generated by SWIG (https://www.swig.org).
3 : * Version 4.4.0
4 : *
5 : * Do not make changes to this file unless you know what you are doing - modify
6 : * the SWIG interface file instead.
7 : * ----------------------------------------------------------------------------- */
8 :
9 : /* -----------------------------------------------------------------------------
10 : * swigcompat.swg
11 : *
12 : * Macros to provide support compatibility with older C and C++ standards.
13 : *
14 : * Note that SWIG expects __cplusplus to be defined to the appropriate C++ standard.
15 : * MSVC users are urged to check and examine the /Zc:__cplusplus compiler option.
16 : * See https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus.
17 : * ----------------------------------------------------------------------------- */
18 :
19 : /* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
20 : * if you're missing it.
21 : */
22 : #if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
23 : (defined __cplusplus && __cplusplus >= 201103L) || \
24 : defined SWIG_HAVE_SNPRINTF) && \
25 : !defined SWIG_NO_SNPRINTF
26 : # define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
27 : # define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
28 : #else
29 : /* Fallback versions ignore the buffer size, but most of our uses either have a
30 : * fixed maximum possible size or dynamically allocate a buffer that's large
31 : * enough.
32 : */
33 : # define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
34 : # define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
35 : #endif
36 : /* -----------------------------------------------------------------------------
37 : * This section contains generic SWIG labels for method/variable
38 : * declarations/attributes, and other compiler dependent labels.
39 : * ----------------------------------------------------------------------------- */
40 :
41 : /* template workaround for compilers that cannot correctly implement the C++ standard */
42 : #ifndef SWIGTEMPLATEDISAMBIGUATOR
43 : # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
44 : # define SWIGTEMPLATEDISAMBIGUATOR template
45 : # elif defined(__HP_aCC)
46 : /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
47 : /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
48 : # define SWIGTEMPLATEDISAMBIGUATOR template
49 : # else
50 : # define SWIGTEMPLATEDISAMBIGUATOR
51 : # endif
52 : #endif
53 :
54 : /* inline attribute */
55 : #ifndef SWIGINLINE
56 : # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
57 : # define SWIGINLINE inline
58 : # else
59 : # define SWIGINLINE
60 : # endif
61 : #endif
62 :
63 : /* attribute recognised by some compilers to avoid 'unused' warnings */
64 : #ifndef SWIGUNUSED
65 : # if defined(__GNUC__)
66 : # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
67 : # define SWIGUNUSED __attribute__ ((__unused__))
68 : # else
69 : # define SWIGUNUSED
70 : # endif
71 : # elif defined(__ICC)
72 : # define SWIGUNUSED __attribute__ ((__unused__))
73 : # else
74 : # define SWIGUNUSED
75 : # endif
76 : #endif
77 :
78 : #ifndef SWIG_MSC_UNSUPPRESS_4505
79 : # if defined(_MSC_VER)
80 : # pragma warning(disable : 4505) /* unreferenced local function has been removed */
81 : # endif
82 : #endif
83 :
84 : #ifndef SWIGUNUSEDPARM
85 : # ifdef __cplusplus
86 : # define SWIGUNUSEDPARM(p)
87 : # else
88 : # define SWIGUNUSEDPARM(p) p SWIGUNUSED
89 : # endif
90 : #endif
91 :
92 : /* internal SWIG method */
93 : #ifndef SWIGINTERN
94 : # define SWIGINTERN static SWIGUNUSED
95 : #endif
96 :
97 : /* internal inline SWIG method */
98 : #ifndef SWIGINTERNINLINE
99 : # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
100 : #endif
101 :
102 : /* exporting methods */
103 : #if defined(__GNUC__)
104 : # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105 : # ifndef GCC_HASCLASSVISIBILITY
106 : # define GCC_HASCLASSVISIBILITY
107 : # endif
108 : # endif
109 : #endif
110 :
111 : #ifndef SWIGEXPORT
112 : # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
113 : # if defined(STATIC_LINKED)
114 : # define SWIGEXPORT
115 : # else
116 : # define SWIGEXPORT __declspec(dllexport)
117 : # endif
118 : # else
119 : # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
120 : # define SWIGEXPORT __attribute__ ((visibility("default")))
121 : # else
122 : # define SWIGEXPORT
123 : # endif
124 : # endif
125 : #endif
126 :
127 : /* calling conventions for Windows */
128 : #ifndef SWIGSTDCALL
129 : # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
130 : # define SWIGSTDCALL __stdcall
131 : # else
132 : # define SWIGSTDCALL
133 : # endif
134 : #endif
135 :
136 : /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
137 : #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
138 : # define _CRT_SECURE_NO_DEPRECATE
139 : #endif
140 :
141 : /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
142 : #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
143 : # define _SCL_SECURE_NO_DEPRECATE
144 : #endif
145 :
146 : /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
147 : #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
148 : # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
149 : #endif
150 :
151 : /* Intel's compiler complains if a variable which was never initialised is
152 : * cast to void, which is a common idiom which we use to indicate that we
153 : * are aware a variable isn't used. So we just silence that warning.
154 : * See: https://github.com/swig/swig/issues/192 for more discussion.
155 : */
156 : #ifdef __INTEL_COMPILER
157 : # pragma warning disable 592
158 : #endif
159 :
160 : #if defined(__cplusplus) && __cplusplus >=201103L
161 : # define SWIG_NOEXCEPT noexcept
162 : #else
163 : # define SWIG_NOEXCEPT throw()
164 : #endif
165 : /* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */
166 : #define SWIG_UnknownError -1
167 : #define SWIG_IOError -2
168 : #define SWIG_RuntimeError -3
169 : #define SWIG_IndexError -4
170 : #define SWIG_TypeError -5
171 : #define SWIG_DivisionByZero -6
172 : #define SWIG_OverflowError -7
173 : #define SWIG_SyntaxError -8
174 : #define SWIG_ValueError -9
175 : #define SWIG_SystemError -10
176 : #define SWIG_AttributeError -11
177 : #define SWIG_MemoryError -12
178 : #define SWIG_NullReferenceError -13
179 :
180 : /* -----------------------------------------------------------------------------
181 : * swigrun.swg
182 : *
183 : * This file contains generic C API SWIG runtime support for pointer
184 : * type checking.
185 : * ----------------------------------------------------------------------------- */
186 :
187 : /* This should only be incremented when either the layout of swig_type_info changes,
188 : or for whatever reason, the runtime changes incompatibly */
189 : #define SWIG_RUNTIME_VERSION "5"
190 :
191 : /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
192 : #ifdef SWIG_TYPE_TABLE
193 : # define SWIG_QUOTE_STRING(x) #x
194 : # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
195 : # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
196 : #else
197 : # define SWIG_TYPE_TABLE_NAME
198 : #endif
199 :
200 : /*
201 : You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
202 : creating a static or dynamic library from the SWIG runtime code.
203 : In 99.9% of the cases, SWIG just needs to declare them as 'static'.
204 :
205 : But only do this if strictly necessary, ie, if you have problems
206 : with your compiler or suchlike.
207 : */
208 :
209 : #ifndef SWIGRUNTIME
210 : # define SWIGRUNTIME SWIGINTERN
211 : #endif
212 :
213 : #ifndef SWIGRUNTIMEINLINE
214 : # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
215 : #endif
216 :
217 : /* Generic buffer size */
218 : #ifndef SWIG_BUFFER_SIZE
219 : # define SWIG_BUFFER_SIZE 1024
220 : #endif
221 :
222 : /* Flags for pointer conversions */
223 : #define SWIG_POINTER_DISOWN 0x1
224 : #define SWIG_CAST_NEW_MEMORY 0x2
225 : #define SWIG_POINTER_NO_NULL 0x4
226 : #define SWIG_POINTER_CLEAR 0x8
227 : #define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN)
228 :
229 : /* Flags for new pointer objects */
230 : #define SWIG_POINTER_OWN 0x1
231 :
232 :
233 : /*
234 : Flags/methods for returning states.
235 :
236 : The SWIG conversion methods, as ConvertPtr, return an integer
237 : that tells if the conversion was successful or not. And if not,
238 : an error code can be returned (see swigerrors.swg for the codes).
239 :
240 : Use the following macros/flags to set or process the returning
241 : states.
242 :
243 : In old versions of SWIG, code such as the following was usually written:
244 :
245 : if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
246 : // success code
247 : } else {
248 : //fail code
249 : }
250 :
251 : Now you can be more explicit:
252 :
253 : int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
254 : if (SWIG_IsOK(res)) {
255 : // success code
256 : } else {
257 : // fail code
258 : }
259 :
260 : which is the same really, but now you can also do
261 :
262 : Type *ptr;
263 : int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
264 : if (SWIG_IsOK(res)) {
265 : // success code
266 : if (SWIG_IsNewObj(res) {
267 : ...
268 : delete *ptr;
269 : } else {
270 : ...
271 : }
272 : } else {
273 : // fail code
274 : }
275 :
276 : I.e., now SWIG_ConvertPtr can return new objects and you can
277 : identify the case and take care of the deallocation. Of course that
278 : also requires SWIG_ConvertPtr to return new result values, such as
279 :
280 : int SWIG_ConvertPtr(obj, ptr,...) {
281 : if (<obj is ok>) {
282 : if (<need new object>) {
283 : *ptr = <ptr to new allocated object>;
284 : return SWIG_NEWOBJ;
285 : } else {
286 : *ptr = <ptr to old object>;
287 : return SWIG_OLDOBJ;
288 : }
289 : } else {
290 : return SWIG_BADOBJ;
291 : }
292 : }
293 :
294 : Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
295 : more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
296 : SWIG errors code.
297 :
298 : Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
299 : allows returning the 'cast rank', for example, if you have this
300 :
301 : int food(double)
302 : int fooi(int);
303 :
304 : and you call
305 :
306 : food(1) // cast rank '1' (1 -> 1.0)
307 : fooi(1) // cast rank '0'
308 :
309 : just use the SWIG_AddCast()/SWIG_CheckState()
310 : */
311 :
312 : #define SWIG_OK (0)
313 : /* Runtime errors are < 0 */
314 : #define SWIG_ERROR (-1)
315 : /* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */
316 : /* Errors in range -100 to -199 are language specific errors defined in *errors.swg */
317 : /* Errors < -200 are generic runtime specific errors */
318 : #define SWIG_ERROR_RELEASE_NOT_OWNED (-200)
319 :
320 : #define SWIG_IsOK(r) (r >= 0)
321 : #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
322 :
323 : /* The CastRankLimit says how many bits are used for the cast rank */
324 : #define SWIG_CASTRANKLIMIT (1 << 8)
325 : /* The NewMask denotes the object was created (using new/malloc) */
326 : #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
327 : /* The TmpMask is for in/out typemaps that use temporary objects */
328 : #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
329 : /* Simple returning values */
330 : #define SWIG_BADOBJ (SWIG_ERROR)
331 : #define SWIG_OLDOBJ (SWIG_OK)
332 : #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
333 : #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
334 : /* Check, add and del object mask methods */
335 : #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
336 : #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
337 : #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
338 : #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
339 : #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
340 : #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
341 :
342 : /* Cast-Rank Mode */
343 : #if defined(SWIG_CASTRANK_MODE)
344 : # ifndef SWIG_TypeRank
345 : # define SWIG_TypeRank unsigned long
346 : # endif
347 : # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
348 : # define SWIG_MAXCASTRANK (2)
349 : # endif
350 : # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
351 : # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
352 : SWIGINTERNINLINE int SWIG_AddCast(int r) {
353 : return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
354 : }
355 : SWIGINTERNINLINE int SWIG_CheckState(int r) {
356 : return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
357 : }
358 : #else /* no cast-rank mode */
359 : # define SWIG_AddCast(r) (r)
360 : # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
361 : #endif
362 :
363 :
364 : #include <string.h>
365 :
366 : #ifdef __cplusplus
367 : extern "C" {
368 : #endif
369 :
370 : typedef void *(*swig_converter_func)(void *, int *);
371 : typedef struct swig_type_info *(*swig_dycast_func)(void **);
372 :
373 : /* Structure to store information on one type */
374 : typedef struct swig_type_info {
375 : const char *name; /* mangled name of this type */
376 : const char *str; /* human readable name of this type */
377 : swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
378 : struct swig_cast_info *cast; /* linked list of types that can cast into this type */
379 : void *clientdata; /* language specific type data */
380 : int owndata; /* flag if the structure owns the clientdata */
381 : } swig_type_info;
382 :
383 : /* Structure to store a type and conversion function used for casting */
384 : typedef struct swig_cast_info {
385 : swig_type_info *type; /* pointer to type that is equivalent to this type */
386 : swig_converter_func converter; /* function to cast the void pointers */
387 : struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */
388 : unsigned int value; /* index of the last valid element in the array | typename hash value */
389 : } swig_cast_info;
390 :
391 : /* Structure used to store module information
392 : * Each module generates one structure like this, and the runtime collects
393 : * all of these structures and stores them in a circularly linked list.*/
394 : typedef struct swig_module_info {
395 : swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
396 : size_t size; /* Number of types in this module */
397 : struct swig_module_info *next; /* Pointer to next element in circularly linked list */
398 : swig_type_info **type_initial; /* Array of initially generated type structures */
399 : swig_cast_info **cast_initial; /* Array of initially generated casting structures */
400 : void *clientdata; /* Language specific module data */
401 : } swig_module_info;
402 :
403 : /*
404 : Compare two type names skipping the space characters, therefore
405 : "char*" == "char *" and "Class<int>" == "Class<int >", etc.
406 :
407 : Return 0 when the two name types are equivalent, as in
408 : strncmp, but skipping ' '.
409 : */
410 : SWIGRUNTIME int
411 0 : SWIG_TypeNameComp(const char *f1, const char *l1,
412 : const char *f2, const char *l2) {
413 0 : for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
414 0 : while ((*f1 == ' ') && (f1 != l1)) ++f1;
415 0 : while ((*f2 == ' ') && (f2 != l2)) ++f2;
416 0 : if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
417 : }
418 0 : return (int)((l1 - f1) - (l2 - f2));
419 : }
420 :
421 : /*
422 : Check type equivalence in a name list like <name1>|<name2>|...
423 : Return 0 if equal, -1 if nb < tb, 1 if nb > tb
424 : */
425 : SWIGRUNTIME int
426 0 : SWIG_TypeCmp(const char *nb, const char *tb) {
427 0 : int equiv = 1;
428 0 : const char* te = tb + strlen(tb);
429 0 : const char* ne = nb;
430 0 : while (equiv != 0 && *ne) {
431 0 : for (nb = ne; *ne; ++ne) {
432 0 : if (*ne == '|') break;
433 : }
434 0 : equiv = SWIG_TypeNameComp(nb, ne, tb, te);
435 0 : if (*ne) ++ne;
436 : }
437 0 : return equiv;
438 : }
439 :
440 : /*
441 : Check type equivalence in a name list like <name1>|<name2>|...
442 : Return 0 if not equal, 1 if equal
443 : */
444 : SWIGRUNTIME int
445 0 : SWIG_TypeEquiv(const char *nb, const char *tb) {
446 0 : return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
447 : }
448 :
449 : /*
450 : * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html)
451 : */
452 0 : SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) {
453 0 : const unsigned char *data = (const unsigned char *)str;
454 0 : unsigned int hash = len, i = 0, k;
455 0 : int rem = (int)len;
456 :
457 0 : while (rem >= (int)sizeof(unsigned int)) {
458 0 : k = *(unsigned int *)data;
459 0 : k += i++;
460 0 : hash ^= k;
461 0 : hash *= 171717;
462 0 : data += sizeof(unsigned int);
463 0 : rem -= sizeof(unsigned int);
464 : }
465 :
466 0 : switch (rem) {
467 0 : case 3: k = (unsigned int)(data[2]) << 16;
468 0 : k |= (unsigned int)(data[1]) << 8;
469 0 : k |= (unsigned int)(data[0]);
470 0 : k += i++;
471 0 : hash ^= k;
472 0 : hash *= 171717;
473 0 : break;
474 0 : case 2: k = (unsigned int)(data[1]) << 8;
475 0 : k |= (unsigned int)(data[0]);
476 0 : k += i++;
477 0 : hash ^= k;
478 0 : hash *= 171717;
479 0 : break;
480 0 : case 1: k = (unsigned int)(data[0]);
481 0 : k += i++;
482 0 : hash ^= k;
483 0 : hash *= 171717;
484 0 : break;
485 : }
486 0 : return hash;
487 : }
488 :
489 : /*
490 : Check the typename
491 : */
492 : SWIGRUNTIME swig_cast_info *
493 0 : SWIG_TypeCheck(const char *c, swig_type_info *ty) {
494 : static const unsigned int scan_threshold = 4;
495 0 : if (ty) {
496 0 : swig_cast_info *head = ty->cast;
497 0 : unsigned int hash_value = 0;
498 0 : int hashed = 0;
499 :
500 0 : while (head) {
501 :
502 0 : if (strcmp(head->type->name, c) == 0) {
503 0 : return head;
504 : }
505 :
506 0 : if (head->value) {
507 : swig_cast_info *iter;
508 0 : swig_cast_info *last = head + head->value;
509 0 : swig_cast_info *first = head + 1;
510 0 : int search = 1;
511 :
512 0 : if (!hashed) {
513 0 : if (head->value < scan_threshold) {
514 0 : for (iter = first; iter <= last; iter++) {
515 0 : if (strcmp(iter->type->name, c) == 0) {
516 0 : return iter;
517 : }
518 : }
519 0 : search = 0;
520 : } else {
521 0 : hashed = 1;
522 0 : hash_value = SWIG_Hash(c, (unsigned int)strlen(c));
523 : }
524 : }
525 :
526 0 : if (search) {
527 : /* Binary search over sorted <'next'|'value'> pairs */
528 : do {
529 0 : iter = first + ((last - first) >> 1);
530 0 : if (iter->value < hash_value) {
531 0 : first = iter + 1;
532 0 : } else if (iter->value == hash_value) {
533 :
534 0 : if (strcmp(iter->next->type->name, c) == 0) {
535 0 : return iter->next;
536 : }
537 :
538 : /* Hash collision check */
539 0 : for (last = iter + 1; last->next && last->value == hash_value; last++) {
540 0 : if (strcmp(last->next->type->name, c) == 0) {
541 0 : return last->next;
542 : }
543 : }
544 0 : for (first = iter - 1; first != head && first->value == hash_value; first--) {
545 0 : if (strcmp(first->next->type->name, c) == 0) {
546 0 : return first->next;
547 : }
548 : }
549 0 : break;
550 : } else
551 0 : last = iter - 1;
552 0 : } while (first <= last);
553 : }
554 : }
555 0 : head = head->next;
556 : }
557 : }
558 0 : return 0;
559 : }
560 :
561 : /*
562 : Check the type by type address
563 : */
564 : SWIGRUNTIME swig_cast_info *
565 0 : SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) {
566 0 : if (ty) {
567 0 : swig_cast_info *head = ty->cast;
568 0 : while (head) {
569 0 : if (head->type == from) {
570 0 : return head;
571 : }
572 :
573 0 : if (head->value) {
574 : swig_cast_info *iter;
575 0 : swig_cast_info *last = head + head->value;
576 0 : swig_cast_info *first = head + 1;
577 :
578 : /* Binary search over sorted array of casts */
579 : do {
580 0 : iter = first + ((last - first) >> 1);
581 0 : if (iter->type < from) {
582 0 : first = iter + 1;
583 0 : } else if (iter->type == from) {
584 0 : return iter;
585 : } else
586 0 : last = iter - 1;
587 0 : } while (first <= last);
588 : }
589 0 : head = head->next;
590 : }
591 : }
592 0 : return 0;
593 : }
594 :
595 : /*
596 : Cast a pointer up an inheritance hierarchy
597 : */
598 : SWIGRUNTIMEINLINE void *
599 0 : SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
600 0 : return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
601 : }
602 :
603 : /*
604 : Dynamic pointer casting. Down an inheritance hierarchy
605 : */
606 : SWIGRUNTIME swig_type_info *
607 0 : SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
608 0 : swig_type_info *lastty = ty;
609 0 : if (!ty || !ty->dcast) return ty;
610 0 : while (ty && (ty->dcast)) {
611 0 : ty = (*ty->dcast)(ptr);
612 0 : if (ty) lastty = ty;
613 : }
614 0 : return lastty;
615 : }
616 :
617 : /*
618 : Return the name associated with this type
619 : */
620 : SWIGRUNTIMEINLINE const char *
621 : SWIG_TypeName(const swig_type_info *ty) {
622 : return ty->name;
623 : }
624 :
625 : /*
626 : Return the pretty name associated with this type,
627 : that is an unmangled type name in a form presentable to the user.
628 : */
629 : SWIGRUNTIME const char *
630 0 : SWIG_TypePrettyName(const swig_type_info *type) {
631 : /* The "str" field contains the equivalent pretty names of the
632 : type, separated by vertical-bar characters. Choose the last
633 : name. It should be the most specific; a fully resolved name
634 : but not necessarily with default template parameters expanded. */
635 0 : if (!type) return NULL;
636 0 : if (type->str != NULL) {
637 0 : const char *last_name = type->str;
638 : const char *s;
639 0 : for (s = type->str; *s; s++)
640 0 : if (*s == '|') last_name = s+1;
641 0 : return last_name;
642 : }
643 : else
644 0 : return type->name;
645 : }
646 :
647 : /*
648 : Set the clientdata field for a type
649 : */
650 : SWIGRUNTIME void
651 0 : SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
652 0 : swig_cast_info *head = ti->cast;
653 : /* if (ti->clientdata == clientdata) return; */
654 0 : ti->clientdata = clientdata;
655 :
656 0 : while (head) {
657 : swig_cast_info *cast;
658 0 : for (cast = head; (cast - head) <= head->value; cast++) {
659 0 : if (!cast->converter) {
660 0 : swig_type_info *tc = cast->type;
661 0 : if (!tc->clientdata) {
662 0 : SWIG_TypeClientData(tc, clientdata);
663 : }
664 : }
665 : }
666 0 : head = head->next;
667 : }
668 0 : }
669 :
670 : SWIGRUNTIME void
671 0 : SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
672 0 : SWIG_TypeClientData(ti, clientdata);
673 0 : ti->owndata = 1;
674 0 : }
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 0 : SWIG_MangledTypeQueryModule(swig_module_info *start,
686 : swig_module_info *end,
687 : const char *name) {
688 0 : swig_module_info *iter = start;
689 : do {
690 0 : if (iter->size) {
691 0 : size_t l = 0;
692 0 : size_t r = iter->size - 1;
693 : do {
694 : /* since l+r >= 0, we can (>> 1) instead (/ 2) */
695 0 : size_t i = (l + r) >> 1;
696 0 : const char *iname = iter->types[i]->name;
697 0 : if (iname) {
698 0 : int compare = strcmp(name, iname);
699 0 : if (compare == 0) {
700 0 : return iter->types[i];
701 0 : } else if (compare < 0) {
702 0 : if (i) {
703 0 : r = i - 1;
704 : } else {
705 0 : break;
706 : }
707 0 : } else if (compare > 0) {
708 0 : l = i + 1;
709 : }
710 : } else {
711 0 : break; /* should never happen */
712 : }
713 0 : } while (l <= r);
714 : }
715 0 : iter = iter->next;
716 0 : } while (iter != end);
717 0 : 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 0 : 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 0 : swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
735 0 : if (ret) {
736 0 : 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 0 : swig_module_info *iter = start;
741 : do {
742 0 : size_t i = 0;
743 0 : for (; i < iter->size; ++i) {
744 0 : if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
745 0 : return iter->types[i];
746 : }
747 0 : iter = iter->next;
748 0 : } while (iter != end);
749 : }
750 :
751 : /* neither found a match */
752 0 : return 0;
753 : }
754 :
755 : /*
756 : Pack binary data into a string
757 : */
758 : SWIGRUNTIME char *
759 0 : SWIG_PackData(char *c, void *ptr, size_t sz) {
760 : static const char hex[17] = "0123456789abcdef";
761 0 : const unsigned char *u = (unsigned char *) ptr;
762 0 : const unsigned char *eu = u + sz;
763 0 : for (; u != eu; ++u) {
764 0 : unsigned char uu = *u;
765 0 : *(c++) = hex[(uu & 0xf0) >> 4];
766 0 : *(c++) = hex[uu & 0xf];
767 : }
768 0 : return c;
769 : }
770 :
771 : /*
772 : Unpack binary data from a string
773 : */
774 : SWIGRUNTIME const char *
775 0 : SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
776 0 : unsigned char *u = (unsigned char *) ptr;
777 0 : const unsigned char *eu = u + sz;
778 0 : for (; u != eu; ++u) {
779 0 : char d = *(c++);
780 : unsigned char uu;
781 0 : if ((d >= '0') && (d <= '9'))
782 0 : uu = (unsigned char)((d - '0') << 4);
783 0 : else if ((d >= 'a') && (d <= 'f'))
784 0 : uu = (unsigned char)((d - ('a'-10)) << 4);
785 : else
786 0 : return (char *) 0;
787 0 : d = *(c++);
788 0 : if ((d >= '0') && (d <= '9'))
789 0 : uu |= (unsigned char)(d - '0');
790 0 : else if ((d >= 'a') && (d <= 'f'))
791 0 : uu |= (unsigned char)(d - ('a'-10));
792 : else
793 0 : return (char *) 0;
794 0 : *u = uu;
795 : }
796 0 : return c;
797 : }
798 :
799 : /*
800 : Pack 'void *' into a string buffer.
801 : */
802 : SWIGRUNTIME char *
803 0 : SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
804 0 : char *r = buff;
805 0 : if ((2*sizeof(void *) + 2) > bsz) return 0;
806 0 : *(r++) = '_';
807 0 : r = SWIG_PackData(r,&ptr,sizeof(void *));
808 0 : if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
809 0 : strcpy(r,name);
810 0 : return buff;
811 : }
812 :
813 : SWIGRUNTIME const char *
814 0 : SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
815 0 : if (*c != '_') {
816 0 : if (strcmp(c,"NULL") == 0) {
817 0 : *ptr = (void *) 0;
818 0 : return name;
819 : } else {
820 0 : return 0;
821 : }
822 : }
823 0 : return SWIG_UnpackData(++c,ptr,sizeof(void *));
824 : }
825 :
826 : SWIGRUNTIME char *
827 0 : SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
828 0 : char *r = buff;
829 0 : size_t lname = (name ? strlen(name) : 0);
830 0 : if ((2*sz + 2 + lname) > bsz) return 0;
831 0 : *(r++) = '_';
832 0 : r = SWIG_PackData(r,ptr,sz);
833 0 : if (lname) {
834 0 : strncpy(r,name,lname+1);
835 : } else {
836 0 : *r = 0;
837 : }
838 0 : return buff;
839 : }
840 :
841 : SWIGRUNTIME const char *
842 0 : SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
843 0 : if (*c != '_') {
844 0 : if (strcmp(c,"NULL") == 0) {
845 0 : memset(ptr,0,sz);
846 0 : return name;
847 : } else {
848 0 : return 0;
849 : }
850 : }
851 0 : return SWIG_UnpackData(++c,ptr,sz);
852 : }
853 :
854 : #ifdef __cplusplus
855 : }
856 : #endif
857 : /* -----------------------------------------------------------------------------
858 : * guile_scm_run.swg
859 : * ----------------------------------------------------------------------------- */
860 :
861 : #if __GNUC__ >= 10
862 : #if defined(__cplusplus)
863 : #pragma GCC diagnostic ignored "-Wvolatile" /* For 'volatile SCM *' in at least Guile 3.0 and earlier */
864 : #endif
865 : #endif
866 :
867 : #include <libguile.h>
868 : #include <stdio.h>
869 : #include <string.h>
870 : #include <stdlib.h>
871 : #include <assert.h>
872 :
873 : #ifdef __cplusplus
874 : extern "C" {
875 : #endif
876 :
877 :
878 : /* In the code below, use guile 2.0 compatible functions where possible.
879 : Functions that don't exist in older versions will be mapped to
880 : a deprecated equivalent for those versions only */
881 : #if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
882 :
883 : static SCM
884 : scm_module_variable (SCM module, SCM sym)
885 : {
886 : return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
887 : }
888 :
889 : #define scm_to_utf8_string scm_to_locale_string
890 : #define scm_from_utf8_string scm_from_locale_string
891 : #endif
892 :
893 : #if SCM_MAJOR_VERSION >= 2
894 : /* scm_c_define_gsubr takes a different parameter type depending on the guile version */
895 :
896 : typedef scm_t_subr swig_guile_proc;
897 : #else
898 : typedef SCM (*swig_guile_proc)();
899 : #endif
900 : typedef SCM (*guile_destructor)(SCM);
901 :
902 : typedef struct swig_guile_clientdata {
903 : guile_destructor destroy;
904 : SCM goops_class;
905 : } swig_guile_clientdata;
906 :
907 : #define SWIG_scm2str(s) \
908 : SWIG_Guile_scm2newstr(s, NULL)
909 : #define SWIG_str02scm(str) \
910 : str ? scm_from_utf8_string(str) : SCM_BOOL_F
911 : # define SWIG_malloc(size) \
912 : scm_malloc(size)
913 : # define SWIG_free(mem) \
914 : free(mem)
915 : #define SWIG_ConvertPtr(s, result, type, flags) \
916 : SWIG_Guile_ConvertPtr(s, result, type, flags)
917 : #define SWIG_MustGetPtr(s, type, argnum, flags) \
918 : SWIG_Guile_MustGetPtr(s, type, argnum, flags, FUNC_NAME)
919 : #define SWIG_NewPointerObj(ptr, type, owner) \
920 : SWIG_Guile_NewPointerObj((void*)ptr, type, owner)
921 : #define SWIG_PointerAddress(object) \
922 : SWIG_Guile_PointerAddress(object)
923 : #define SWIG_PointerType(object) \
924 : SWIG_Guile_PointerType(object)
925 : #define SWIG_IsPointerOfType(object, type) \
926 : SWIG_Guile_IsPointerOfType(object, type)
927 : #define SWIG_IsPointer(object) \
928 : SWIG_Guile_IsPointer(object)
929 : #define SWIG_contract_assert(expr, msg) \
930 : do { \
931 : if (!(expr)) \
932 : scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \
933 : FUNC_NAME, msg, SCM_EOL, SCM_BOOL_F); \
934 : } while (0)
935 :
936 : /* for C++ member pointers, ie, member methods */
937 : #define SWIG_ConvertMember(obj, ptr, sz, ty) \
938 : SWIG_Guile_ConvertMember(obj, ptr, sz, ty, FUNC_NAME)
939 : #define SWIG_NewMemberObj(ptr, sz, type) \
940 : SWIG_Guile_NewMemberObj(ptr, sz, type, FUNC_NAME)
941 :
942 : /* Runtime API */
943 : static swig_module_info *SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata));
944 : #define SWIG_GetModule(clientdata) SWIG_Guile_GetModule(clientdata)
945 : #define SWIG_SetModule(clientdata, pointer) SWIG_Guile_SetModule(pointer)
946 :
947 : SWIGINTERN char *
948 0 : SWIG_Guile_scm2newstr(SCM str, size_t *len) {
949 : #define FUNC_NAME "SWIG_Guile_scm2newstr"
950 0 : SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);
951 :
952 0 : return scm_to_utf8_stringn(str, len);
953 : #undef FUNC_NAME
954 : }
955 :
956 : static int swig_initialized = 0;
957 : static scm_t_bits swig_tag = 0;
958 : static scm_t_bits swig_collectable_tag = 0;
959 : static scm_t_bits swig_finalized_tag = 0;
960 : static scm_t_bits swig_destroyed_tag = 0;
961 : static scm_t_bits swig_member_function_tag = 0;
962 : static SCM swig_make_func = SCM_EOL;
963 : static SCM swig_keyword = SCM_EOL;
964 : static SCM swig_symbol = SCM_EOL;
965 :
966 : #define SWIG_Guile_GetSmob(x) \
967 : ( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \
968 : ? scm_slot_ref(x, swig_symbol) : (x) )
969 :
970 : SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s);
971 :
972 : SWIGINTERN SCM
973 0 : SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner)
974 : {
975 0 : if (ptr == NULL)
976 0 : return SCM_EOL;
977 : else {
978 : SCM smob;
979 0 : swig_guile_clientdata *cdata = (swig_guile_clientdata *) type->clientdata;
980 0 : if (owner)
981 0 : SCM_NEWSMOB2(smob, swig_collectable_tag, ptr, (void *) type);
982 : else
983 0 : SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type);
984 :
985 0 : if (!cdata || scm_is_null(cdata->goops_class) || swig_make_func == SCM_EOL ) {
986 0 : return smob;
987 : } else {
988 : /* the scm_make() C function only handles the creation of gf,
989 : methods and classes (no instances) the (make ...) function is
990 : later redefined in goops.scm. So we need to call that
991 : Scheme function. */
992 0 : return scm_apply(swig_make_func,
993 : scm_list_3(cdata->goops_class,
994 : swig_keyword,
995 : smob),
996 0 : SCM_EOL);
997 : }
998 : }
999 : }
1000 :
1001 : SWIGINTERN unsigned long
1002 0 : SWIG_Guile_PointerAddress(SCM object)
1003 : {
1004 0 : SCM smob = SWIG_Guile_GetSmob(object);
1005 0 : if (scm_is_null(smob)) return 0;
1006 0 : else if (SCM_SMOB_PREDICATE(swig_tag, smob)
1007 0 : || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
1008 0 : || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
1009 0 : return (unsigned long) (void *) SCM_CELL_WORD_1(smob);
1010 : }
1011 0 : else scm_wrong_type_arg("SWIG-Guile-PointerAddress", 1, object);
1012 : }
1013 :
1014 : SWIGINTERN swig_type_info *
1015 0 : SWIG_Guile_PointerType(SCM object)
1016 : {
1017 0 : SCM smob = SWIG_Guile_GetSmob(object);
1018 0 : if (scm_is_null(smob)) return NULL;
1019 0 : else if (SCM_SMOB_PREDICATE(swig_tag, smob)
1020 0 : || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
1021 0 : || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
1022 0 : return (swig_type_info *) SCM_CELL_WORD_2(smob);
1023 : }
1024 0 : else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
1025 : }
1026 :
1027 : SWIGINTERN int
1028 0 : SWIG_Guile_IsValidSmob(SCM smob)
1029 : {
1030 : /* We do not accept smobs representing destroyed pointers, but we have to
1031 : allow finalized smobs because Guile >= 2.0.12 sets all smob instances
1032 : to the 'finalized' type before calling their 'free' function. This change
1033 : was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
1034 0 : return SCM_SMOB_PREDICATE(swig_tag, smob)
1035 0 : || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
1036 0 : || SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
1037 : }
1038 :
1039 : SWIGINTERN int
1040 0 : SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
1041 : {
1042 : swig_cast_info *cast;
1043 : swig_type_info *from;
1044 0 : SCM smob = SWIG_Guile_GetSmob(s);
1045 0 : int ret = SWIG_ERROR;
1046 :
1047 0 : if (scm_is_null(smob)) {
1048 0 : *result = NULL;
1049 0 : return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
1050 : #if SCM_MAJOR_VERSION >= 2
1051 0 : } else if (SCM_POINTER_P(s)) {
1052 0 : *result = SCM_POINTER_VALUE(s);
1053 0 : return SWIG_OK;
1054 : #endif /* if SCM_MAJOR_VERSION >= 2 */
1055 0 : } else if (SWIG_Guile_IsValidSmob(smob)) {
1056 0 : from = (swig_type_info *) SCM_CELL_WORD_2(smob);
1057 0 : if (!from) return SWIG_ERROR;
1058 :
1059 0 : if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) {
1060 0 : if ((SCM_CELL_TYPE(smob) == swig_collectable_tag && SCM_CELL_WORD_1(smob) == 0) || SCM_CELL_TYPE(smob) == swig_tag) {
1061 0 : return SWIG_ERROR_RELEASE_NOT_OWNED;
1062 : }
1063 : }
1064 :
1065 0 : if (type) {
1066 0 : cast = SWIG_TypeCheckStruct(from, type);
1067 0 : if (cast) {
1068 0 : int newmemory = 0;
1069 0 : *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory);
1070 0 : assert(!newmemory); /* newmemory handling not yet implemented */
1071 0 : ret = SWIG_OK;
1072 : } else {
1073 0 : return SWIG_ERROR;
1074 : }
1075 : } else {
1076 0 : *result = (void *) SCM_CELL_WORD_1(smob);
1077 0 : ret = SWIG_OK;
1078 : }
1079 :
1080 0 : if (flags & SWIG_POINTER_DISOWN) {
1081 0 : SWIG_Guile_MarkPointerNoncollectable(smob);
1082 : }
1083 0 : if (flags & SWIG_POINTER_CLEAR) {
1084 0 : SCM_SET_CELL_WORD_1(smob, 0);
1085 : }
1086 : }
1087 0 : return ret;
1088 : }
1089 :
1090 : SWIGINTERNINLINE void *
1091 0 : SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
1092 : int argnum, int flags, const char *func_name)
1093 : {
1094 : void *result;
1095 0 : int res = SWIG_Guile_ConvertPtr(s, &result, type, flags);
1096 0 : if (!SWIG_IsOK(res)) {
1097 : /* type mismatch */
1098 0 : scm_wrong_type_arg(func_name, argnum, s);
1099 : }
1100 0 : return result;
1101 : }
1102 :
1103 : SWIGINTERNINLINE int
1104 : SWIG_Guile_IsPointerOfType (SCM s, swig_type_info *type)
1105 : {
1106 : void *result;
1107 : if (SWIG_Guile_ConvertPtr(s, &result, type, 0)) {
1108 : /* type mismatch */
1109 : return 0;
1110 : }
1111 : else return 1;
1112 : }
1113 :
1114 : SWIGINTERNINLINE int
1115 : SWIG_Guile_IsPointer (SCM s)
1116 : {
1117 : /* module might not be initialized yet, so initialize it */
1118 : SWIG_GetModule(0);
1119 : return SWIG_Guile_IsPointerOfType (s, NULL);
1120 : }
1121 :
1122 : /* Mark a pointer object non-collectable */
1123 : SWIGINTERN void
1124 0 : SWIG_Guile_MarkPointerNoncollectable(SCM s)
1125 : {
1126 0 : SCM smob = SWIG_Guile_GetSmob(s);
1127 0 : if (!scm_is_null(smob)) {
1128 0 : if (SWIG_Guile_IsValidSmob(smob)) {
1129 0 : SCM_SET_CELL_TYPE(smob, swig_tag);
1130 : }
1131 0 : else scm_wrong_type_arg(NULL, 0, s);
1132 : }
1133 0 : }
1134 :
1135 : /* Mark a pointer object destroyed */
1136 : SWIGINTERN void
1137 0 : SWIG_Guile_MarkPointerDestroyed(SCM s)
1138 : {
1139 0 : SCM smob = SWIG_Guile_GetSmob(s);
1140 0 : if (!scm_is_null(smob)) {
1141 0 : if (SWIG_Guile_IsValidSmob(smob)) {
1142 0 : SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
1143 : }
1144 0 : else scm_wrong_type_arg(NULL, 0, s);
1145 : }
1146 0 : }
1147 :
1148 : /* Member functions */
1149 :
1150 : SWIGINTERN SCM
1151 0 : SWIG_Guile_NewMemberObj(void *ptr, size_t sz, swig_type_info *type,
1152 : const char *func_name)
1153 : {
1154 : SCM smob;
1155 0 : void *copy = malloc(sz);
1156 0 : memcpy(copy, ptr, sz);
1157 0 : SCM_NEWSMOB2(smob, swig_member_function_tag, copy, (void *) type);
1158 0 : return smob;
1159 : }
1160 :
1161 : SWIGINTERN int
1162 0 : SWIG_Guile_ConvertMember(SCM smob, void *ptr, size_t sz, swig_type_info *type,
1163 : const char *func_name)
1164 : {
1165 : swig_cast_info *cast;
1166 : swig_type_info *from;
1167 :
1168 0 : if (SCM_SMOB_PREDICATE(swig_member_function_tag, smob)) {
1169 0 : from = (swig_type_info *) SCM_CELL_WORD_2(smob);
1170 0 : if (!from) return SWIG_ERROR;
1171 0 : if (type) {
1172 0 : cast = SWIG_TypeCheckStruct(from, type);
1173 0 : if (!cast) return SWIG_ERROR;
1174 : }
1175 0 : memcpy(ptr, (void *) SCM_CELL_WORD_1(smob), sz);
1176 0 : return SWIG_OK;
1177 : }
1178 0 : return SWIG_ERROR;
1179 : }
1180 :
1181 :
1182 : /* Init */
1183 :
1184 : SWIGINTERN int
1185 0 : print_swig_aux (SCM swig_smob, SCM port, scm_print_state *pstate,
1186 : const char *attribute)
1187 : {
1188 : swig_type_info *type;
1189 :
1190 0 : type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
1191 0 : if (type) {
1192 0 : scm_puts("#<", port);
1193 0 : scm_puts(attribute, port);
1194 0 : scm_puts("swig-pointer ", port);
1195 0 : scm_puts(SWIG_TypePrettyName(type), port);
1196 0 : scm_puts(" ", port);
1197 0 : scm_intprint((long) SCM_CELL_WORD_1(swig_smob), 16, port);
1198 0 : scm_puts(">", port);
1199 : /* non-zero means success */
1200 0 : return 1;
1201 : } else {
1202 0 : return 0;
1203 : }
1204 : }
1205 :
1206 :
1207 : SWIGINTERN int
1208 0 : print_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
1209 : {
1210 0 : return print_swig_aux(swig_smob, port, pstate, "");
1211 : }
1212 :
1213 : SWIGINTERN int
1214 0 : print_collectable_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
1215 : {
1216 0 : return print_swig_aux(swig_smob, port, pstate, "collectable-");
1217 : }
1218 :
1219 : SWIGINTERN int
1220 0 : print_destroyed_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
1221 : {
1222 0 : return print_swig_aux(swig_smob, port, pstate, "destroyed-");
1223 : }
1224 :
1225 : SWIGINTERN int
1226 0 : print_member_function_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
1227 : {
1228 : swig_type_info *type;
1229 0 : type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
1230 0 : if (type) {
1231 0 : scm_puts("#<", port);
1232 0 : scm_puts("swig-member-function-pointer ", port);
1233 0 : scm_puts(SWIG_TypePrettyName(type), port);
1234 0 : scm_puts(" >", port);
1235 : /* non-zero means success */
1236 0 : return 1;
1237 : } else {
1238 0 : return 0;
1239 : }
1240 : }
1241 :
1242 : SWIGINTERN SCM
1243 0 : equalp_swig (SCM A, SCM B)
1244 : {
1245 0 : if (SCM_CELL_WORD_0(A) == SCM_CELL_WORD_0(B) && SCM_CELL_WORD_1(A) == SCM_CELL_WORD_1(B)
1246 0 : && SCM_CELL_WORD_2(A) == SCM_CELL_WORD_2(B))
1247 0 : return SCM_BOOL_T;
1248 0 : else return SCM_BOOL_F;
1249 : }
1250 :
1251 : SWIGINTERN size_t
1252 0 : free_swig(SCM A)
1253 : {
1254 0 : swig_type_info *type = (swig_type_info *) SCM_CELL_WORD_2(A);
1255 0 : if (type) {
1256 0 : if (type->clientdata && ((swig_guile_clientdata *)type->clientdata)->destroy)
1257 0 : ((swig_guile_clientdata *)type->clientdata)->destroy(A);
1258 : }
1259 0 : return 0;
1260 : }
1261 :
1262 : SWIGINTERN size_t
1263 0 : free_swig_member_function(SCM A)
1264 : {
1265 0 : free((swig_type_info *) SCM_CELL_WORD_1(A));
1266 0 : return 0;
1267 : }
1268 :
1269 : SWIGINTERN int
1270 0 : ensure_smob_tag(SCM swig_module,
1271 : scm_t_bits *tag_variable,
1272 : const char *smob_name,
1273 : const char *scheme_variable_name)
1274 : {
1275 0 : SCM variable = scm_module_variable(swig_module,
1276 0 : scm_from_locale_symbol(scheme_variable_name));
1277 0 : if (scm_is_false(variable)) {
1278 0 : *tag_variable = scm_make_smob_type(scheme_variable_name, 0);
1279 0 : scm_c_module_define(swig_module, scheme_variable_name,
1280 : scm_from_ulong(*tag_variable));
1281 0 : return 1;
1282 : }
1283 : else {
1284 0 : *tag_variable = scm_to_ulong(SCM_VARIABLE_REF(variable));
1285 0 : return 0;
1286 : }
1287 : }
1288 :
1289 : SWIGINTERN SCM
1290 0 : SWIG_Guile_Init ()
1291 : {
1292 : static SCM swig_module;
1293 :
1294 0 : if (swig_initialized) return swig_module;
1295 0 : swig_initialized = 1;
1296 :
1297 0 : swig_module = scm_c_resolve_module("Swig swigrun");
1298 0 : if (ensure_smob_tag(swig_module, &swig_tag,
1299 : "swig-pointer", "swig-pointer-tag")) {
1300 0 : scm_set_smob_print(swig_tag, print_swig);
1301 0 : scm_set_smob_equalp(swig_tag, equalp_swig);
1302 : }
1303 0 : if (ensure_smob_tag(swig_module, &swig_collectable_tag,
1304 : "collectable-swig-pointer", "collectable-swig-pointer-tag")) {
1305 0 : scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
1306 0 : scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
1307 0 : scm_set_smob_free(swig_collectable_tag, free_swig);
1308 : /* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
1309 0 : swig_finalized_tag = swig_collectable_tag & ~0xff00;
1310 : }
1311 0 : if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
1312 : "destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
1313 0 : scm_set_smob_print(swig_destroyed_tag, print_destroyed_swig);
1314 0 : scm_set_smob_equalp(swig_destroyed_tag, equalp_swig);
1315 : }
1316 0 : if (ensure_smob_tag(swig_module, &swig_member_function_tag,
1317 : "swig-member-function-pointer", "swig-member-function-pointer-tag")) {
1318 0 : scm_set_smob_print(swig_member_function_tag, print_member_function_swig);
1319 0 : scm_set_smob_free(swig_member_function_tag, free_swig_member_function);
1320 : }
1321 0 : swig_make_func = scm_permanent_object(
1322 : scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make")));
1323 0 : swig_keyword = scm_permanent_object(scm_from_locale_keyword("init-smob"));
1324 0 : swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob"));
1325 : #ifdef SWIG_INIT_RUNTIME_MODULE
1326 : SWIG_INIT_RUNTIME_MODULE
1327 : #endif
1328 :
1329 0 : return swig_module;
1330 : }
1331 :
1332 : SWIGINTERN swig_module_info *
1333 0 : SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
1334 : {
1335 0 : SCM module = SWIG_Guile_Init();
1336 0 : SCM variable = scm_module_variable(module, scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME));
1337 0 : if (scm_is_false(variable)) {
1338 0 : return NULL;
1339 : } else {
1340 0 : return (swig_module_info *) scm_to_ulong(SCM_VARIABLE_REF(variable));
1341 : }
1342 : }
1343 :
1344 : SWIGINTERN void
1345 0 : SWIG_Guile_SetModule(swig_module_info *swig_module)
1346 : {
1347 0 : SCM module = SWIG_Guile_Init();
1348 0 : scm_module_define(module,
1349 : scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
1350 : scm_from_ulong((unsigned long) swig_module));
1351 0 : }
1352 :
1353 : SWIGINTERN int
1354 0 : SWIG_Guile_GetArgs (SCM *dest, SCM rest,
1355 : int reqargs, int optargs,
1356 : const char *procname)
1357 : {
1358 : int i;
1359 0 : int num_args_passed = 0;
1360 0 : for (i = 0; i<reqargs; i++) {
1361 0 : if (!scm_is_pair(rest))
1362 0 : scm_wrong_num_args(scm_from_utf8_string(procname ? procname : "unknown procedure"));
1363 0 : *dest++ = SCM_CAR(rest);
1364 0 : rest = SCM_CDR(rest);
1365 0 : num_args_passed++;
1366 : }
1367 0 : for (i = 0; i<optargs && scm_is_pair(rest); i++) {
1368 0 : *dest++ = SCM_CAR(rest);
1369 0 : rest = SCM_CDR(rest);
1370 0 : num_args_passed++;
1371 : }
1372 0 : for (; i<optargs; i++)
1373 0 : *dest++ = SCM_UNDEFINED;
1374 0 : if (!scm_is_null(rest))
1375 0 : scm_wrong_num_args(scm_from_utf8_string(procname ? procname : "unknown procedure"));
1376 0 : return num_args_passed;
1377 : }
1378 :
1379 : #ifdef __cplusplus
1380 : }
1381 : #endif
1382 : /* -----------------------------------------------------------------------------*
1383 : Standard SWIG API for use inside user code.
1384 :
1385 : Don't include this file directly, run the command
1386 : swig -python -external-runtime
1387 : Also, read the Modules chapter of the SWIG Manual.
1388 :
1389 : * -----------------------------------------------------------------------------*/
1390 :
1391 : #ifdef SWIG_MODULE_CLIENTDATA_TYPE
1392 :
1393 : SWIGRUNTIMEINLINE swig_type_info *
1394 : SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
1395 : swig_module_info *module = SWIG_GetModule(clientdata);
1396 : return SWIG_TypeQueryModule(module, module, name);
1397 : }
1398 :
1399 : SWIGRUNTIMEINLINE swig_type_info *
1400 : SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
1401 : swig_module_info *module = SWIG_GetModule(clientdata);
1402 : return SWIG_MangledTypeQueryModule(module, module, name);
1403 : }
1404 :
1405 : #else
1406 :
1407 : SWIGRUNTIMEINLINE swig_type_info *
1408 0 : SWIG_TypeQuery(const char *name) {
1409 0 : swig_module_info *module = SWIG_GetModule(NULL);
1410 0 : return SWIG_TypeQueryModule(module, module, name);
1411 : }
1412 :
1413 : SWIGRUNTIMEINLINE swig_type_info *
1414 : SWIG_MangledTypeQuery(const char *name) {
1415 : swig_module_info *module = SWIG_GetModule(NULL);
1416 : return SWIG_MangledTypeQueryModule(module, module, name);
1417 : }
1418 :
1419 : #endif
|