99
60
#define gh_scm2char GSWIG_scm2char
62
/* Interface function */
63
#define SWIG_scm2str(x) gh_scm2newstr(x, NULL)
101
65
/* More 1.3.4 compatibility */
102
66
#ifndef SCM_INPUT_PORT_P
103
67
# define SCM_INPUT_PORT_P SCM_INPORTP
104
68
# define SCM_OUTPUT_PORT_P SCM_OUTPORTP
109
typedef void *(*swig_converter_func)(void *);
110
typedef struct swig_type_info *(*swig_dycast_func)(void **);
112
typedef struct SwigPtrType SwigPtrType;
114
typedef struct swig_type_info {
116
swig_converter_func converter;
119
swig_dycast_func dcast;
125
SWIG_Guile_RegisterTypes (swig_type_info **table,
126
swig_type_info **init);
128
/* Register a new type-mapping with the type-checker. origtype is the
129
original datatype and newtype is an equivalent type. cast is optional
130
pointer to a function to cast pointer values between types (this is
131
typically used to cast pointers from derived classes to base classes in
135
SWIG_RegisterMapping (const char *origtype, const char *newtype,
136
swig_converter_func cast);
139
/* Dynamic pointer casting. Down an inheritance hierarchy */
140
SWIGSTATIC swig_type_info *
141
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr);
143
/* Register SWIG smobs with Guile. */
147
/* Initialization function for this SWIG module; actually renamed by a
149
/* extern void SWIG_init(); */
151
/* Get a pointer value from a smob. If there is a type-mismatch,
152
return nonzero; on success, return 0. */
154
SWIG_Guile_GetPtr (SCM s, void **result, swig_type_info *type);
156
/* Get a pointer value from a smob. If there is a type-mismatch,
157
signal a wrong-type-arg error for the given argument number. */
159
SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
160
int argnum, const char *func_name);
162
/* Make a smob from a pointer and typeinfo. */
164
SWIG_Guile_MakePtr (void *ptr, swig_type_info *type);
166
/* Get arguments from an argument list */
168
SWIG_Guile_GetArgs (SCM *dest, SCM rest,
169
int reqargs, int optargs,
170
const char *procname);
172
typedef SCM (*swig_guile_proc)();
178
/* guiledec.swg ends here */
180
#ifndef SWIG_NOINCLUDE
181
/* SWIG pointer structure */
188
unsigned short type; /* Index into SwigPtrTbl */
189
void *(*cast)(void *); /* Pointer casting function */
190
struct SwigCast *next; /* Linked list pointer */
194
const char *name; /* Datatype name */
195
const char *prettyname; /* Pretty datatype name */
196
unsigned short tag; /* Index in SwigPtrTable */
197
struct SwigCast *cast; /* List of compatible types */
202
static int SwigPtrMax = 64; /* Max entries that can be held */
203
/* (may be adjusted dynamically) */
204
static int SwigPtrN = 0; /* Current number of entries */
205
static int SwigPtrSort = 0; /* Status flag indicating sort */
208
static SwigPtrType *SwigPtrList = 0; /* Table containing types and
209
equivalences; items will only
211
static size_t *SwigPtrTbl = 0; /* Sorted indirect table; items will
214
/* Sort comparison function */
216
swigsort (const void *data1, const void *data2)
218
size_t index1 = * (size_t *) data1;
219
size_t index2 = * (size_t *) data2;
220
return strcmp(SwigPtrList[index1].name, SwigPtrList[index2].name);
223
/* Register a new datatype with the type-checker */
225
SWIG_RegisterType (const char *type, const char *prettyname)
229
/* Allocate the pointer table if necessary */
231
SwigPtrList = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
232
SwigPtrTbl = (size_t *) malloc(SwigPtrMax*sizeof(size_t));
235
/* Grow the table if necessary */
236
if (SwigPtrN >= SwigPtrMax) {
237
SwigPtrMax = 2*SwigPtrMax;
238
SwigPtrList = (SwigPtrType *) realloc((char *) SwigPtrList,
239
SwigPtrMax*sizeof(SwigPtrType));
240
SwigPtrTbl = (size_t *) realloc((char *) SwigPtrTbl,
241
SwigPtrMax*sizeof(size_t));
244
for (i = 0; i < SwigPtrN; i++)
245
if (strcmp(SwigPtrList[i].name,type) == 0) {
246
if (prettyname!=NULL)
247
SwigPtrList[i].prettyname = prettyname;
251
struct SwigPtrType *t;
254
fprintf(stderr, "New type: %s\n", type);
256
tag = SwigPtrTbl[SwigPtrN] = SwigPtrN;
257
t = &SwigPtrList[tag];
259
t->prettyname = prettyname;
268
/* Register two data types and their mapping with the type checker. */
270
SWIG_RegisterMapping (const char *origtype, const char *newtype,
271
swig_converter_func cast)
273
size_t t = SWIG_RegisterType(origtype, NULL);
276
size_t t1 = SWIG_RegisterType(newtype, NULL);
278
/* Check for existing cast */
279
for (c = SwigPtrList[t].cast; c && c->type!=t1; c=c->next) /* nothing */;
281
if (cast) c->cast = cast;
284
c = (struct SwigCast *) malloc(sizeof(struct SwigCast));
287
c->next = SwigPtrList[t].cast;
288
SwigPtrList[t].cast = c;
296
SWIG_SortTable (void)
298
qsort ((void *) SwigPtrTbl, SwigPtrN, sizeof(size_t), swigsort);
299
/* Indicate that everything is sorted */
303
/* Look up pointer-type entry in table */
306
swigcmp (const void *key, const void *data)
308
char *k = (char *) key;
309
size_t index = *(size_t *)data;
310
return strcmp(k, SwigPtrList[index].name);
314
SWIG_GetPtrType (const char *_t)
317
if (!SwigPtrSort) SWIG_SortTable();
318
result = (size_t *) bsearch(_t, SwigPtrTbl, SwigPtrN, sizeof(size_t), swigcmp);
319
if (result!=NULL) return SwigPtrList+*result;
323
/* Cast a pointer if possible; returns 1 if successful */
326
SWIG_Cast (void *source, size_t source_type,
327
void **ptr, size_t dest_type)
329
if (dest_type != source_type) {
330
/* We have a type mismatch. Will have to look through our type
331
mapping table to figure out whether or not we can accept this
334
for (c = SwigPtrList[dest_type].cast;
335
c && c->type!=source_type; c = c->next) /* nothing */;
337
/* Get pointer value. */
338
if (c->cast) *ptr = (*(c->cast))(source);
342
/* Didn't find any sort of match for this data.
343
Get the pointer value and return false. */
347
/* Found a match on the first try. Return pointer value. */
353
/* Dynamic pointer casting. Down an inheritance hierarchy */
354
SWIGSTATIC swig_type_info *
355
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr)
357
swig_type_info *lastty = ty;
358
if (!ty || !ty->dcast) return ty;
359
while (ty && (ty->dcast)) {
360
ty = (*ty->dcast)(ptr);
366
/* Function for getting a pointer value */
368
static unsigned long swig_tag = 0;
371
SWIG_Guile_MakePtr (void *ptr, swig_type_info *type)
71
static swig_type_info *SWIG_Guile_LookupType(swig_module_info *module, SCM s, int normal) {
72
swig_module_info *iter;
73
if (!module) return 0;
76
if ((normal && (unsigned long) SCM_TYP16(s) == *((int *)iter->clientdata))) {
78
return iter->types[(long) SCM_CAR(s) >> 16];
81
} while (iter != module);
86
#define SWIG_GUILE_MODULE_STATIC
87
#elif !defined(SWIG_NOINCLUDE)
88
#define SWIG_GUILE_MODULE_STATIC static
91
#ifdef SWIG_GUILE_MODULE_STATIC
92
static swig_module_info *swig_guile_module = 0;
93
SWIG_GUILE_MODULE_STATIC swig_module_info *SWIG_Guile_GetModule() {
94
return swig_guile_module;
96
SWIG_GUILE_MODULE_STATIC void SWIG_Guile_SetModule(swig_module_info *pointer) {
97
swig_guile_module = pointer;
100
SWIGEXPORT swig_module_info * SWIG_Guile_GetModule();
101
SWIGEXPORT void SWIG_Guile_SetModule(swig_module_info *pointer);
105
SWIG_Guile_NewPointerObj(swig_module_info *module, void *ptr, swig_type_info *type, int owner)
373
108
if (ptr==NULL) return SCM_EOL;
374
SCM_RETURN_NEWSMOB((((unsigned long)type->tag << 16) | swig_tag),
109
if (!module) return SCM_EOL;
110
for (tag = 0; tag < module->size; ++tag) {
111
if (module->types[tag] == type)
114
if (tag >= module->size)
118
SCM_RETURN_NEWSMOB( ((tag << 16) | *((int *)module->clientdata)), ptr);
378
121
/* Return 0 if successful. */
380
SWIG_Guile_GetPtr(SCM s, void **result, swig_type_info *type)
123
SWIG_Guile_ConvertPtr(swig_module_info *module, SCM s, void **result, swig_type_info *type, int flags)
125
swig_cast_info *cast;
126
swig_type_info *from;
382
127
if (SCM_NULLP(s)) {
387
&& (unsigned long) SCM_TYP16(s) == swig_tag) {
389
return !SWIG_Cast((void *) SCM_CDR(s),
390
(long) SCM_CAR(s) >> 16,
130
} else if (SCM_NIMP(s)) {
131
from = SWIG_Guile_LookupType(module, s, 1);
134
cast = SWIG_TypeCheckStruct(from, type);
136
*result = SWIG_TypeCast(cast, (void *) SCM_CDR(s));
393
142
*result = (void *) SCM_CDR(s);