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