- Improve the runtime type sytesm
- Update all languages to new type system - Add DohSortList function - Fix mzscheme Examples/Makefile git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
58cd593dae
commit
f6964f285f
48 changed files with 1383 additions and 1021 deletions
|
|
@ -5,16 +5,48 @@
|
|||
|
||||
#define SWIGGUILE_GH
|
||||
|
||||
%runtime "swigrun.swg"
|
||||
%runtime "guile_gh_run.swg"
|
||||
%include "guile.i"
|
||||
|
||||
%init %{
|
||||
static int _swig_init = 0;
|
||||
%runtime %{
|
||||
|
||||
if (!_swig_init) {
|
||||
SWIG_Guile_RegisterTypes(swig_types, swig_types_initial);
|
||||
_swig_init = 1;
|
||||
}
|
||||
/* scm_values was implemented on C level in 1.4.1, and the prototype
|
||||
is not included in libguile.h, so play safe and lookup `values'... */
|
||||
#define GUILE_MAYBE_VALUES \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_apply(gh_lookup("values"), gswig_result);
|
||||
|
||||
#define GUILE_MAYBE_VECTOR \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_list_to_vector(gswig_result);
|
||||
|
||||
#define SWIG_APPEND_VALUE(object) \
|
||||
if (gswig_result == SCM_UNSPECIFIED) { \
|
||||
gswig_result = object; \
|
||||
} else { \
|
||||
if (!gswig_list_p) { \
|
||||
gswig_list_p = 1; \
|
||||
gswig_result = gh_list(gswig_result, object, SCM_UNDEFINED); \
|
||||
} \
|
||||
else \
|
||||
gswig_result = gh_append2(gswig_result, \
|
||||
gh_list(object, SCM_UNDEFINED)); \
|
||||
}
|
||||
|
||||
SWIG_Guile_Init();
|
||||
%}
|
||||
|
||||
%init "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
static int _swig_module_smob_tag;
|
||||
|
||||
SWIG_GUILE_INIT_STATIC void
|
||||
SWIG_init(void)
|
||||
{
|
||||
|
||||
SWIG_InitializeModule(0);
|
||||
swig_module.clientdata = (void *) &_swig_module_smob_tag;
|
||||
|
||||
SWIG_Guile_Init(&swig_module);
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
* Lib/guile/guile_gh_run.swg
|
||||
*
|
||||
* Guile GH runtime file
|
||||
* Copyright (C) 2000 Matthias Koeppe
|
||||
* Copyright (C) 2004 John Lenz <lenz@cs.wisc.edu>
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
#define SWIGGUILE
|
||||
#include "guile/gh.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -15,16 +16,20 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef SCM (*swig_guile_proc)();
|
||||
|
||||
#define SWIG_malloc(size) \
|
||||
SCM_MUST_MALLOC(size)
|
||||
#define SWIG_free(mem) \
|
||||
scm_must_free(mem)
|
||||
#define SWIG_ConvertPtr(s, result, type, flags) \
|
||||
SWIG_Guile_GetPtr(s, result, type)
|
||||
SWIG_Guile_ConvertPtr(&swig_module, s, result, type, flags)
|
||||
#define SWIG_MustGetPtr(s, type, argnum, flags) \
|
||||
SWIG_Guile_MustGetPtr(s, type, argnum, FUNC_NAME)
|
||||
SWIG_Guile_MustGetPtr(&swig_module, s, type, argnum, flags, FUNC_NAME)
|
||||
#define SWIG_NewPointerObj(ptr, type, owner) \
|
||||
SWIG_Guile_MakePtr((void*)ptr, type)
|
||||
SWIG_Guile_NewPointerObj(&swig_module, (void*)ptr, type, owner)
|
||||
#define SWIG_GetModule(clientdata) SWIG_Guile_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Guile_SetModule(pointer)
|
||||
|
||||
/* Ignore object-ownership changes in gh mode */
|
||||
#define SWIG_Guile_MarkPointerNoncollectable(s) (s)
|
||||
|
|
@ -36,50 +41,24 @@ extern "C" {
|
|||
(char *) FUNC_NAME, (char *) msg, \
|
||||
SCM_EOL, SCM_BOOL_F); else
|
||||
|
||||
#if defined(SWIG_NOINCLUDE)
|
||||
# define SWIGSTATIC
|
||||
#elif defined(SWIG_GLOBAL)
|
||||
# define SWIGSTATIC
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(_MSC_VER) || defined(__GNUC__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT(a) a
|
||||
# else
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# endif
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGSTATIC static
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#define GH_NOT_PASSED SCM_UNDEFINED
|
||||
#define GH_UNSPECIFIED SCM_UNSPECIFIED
|
||||
|
||||
#define SWIG_APPEND_VALUE(object) \
|
||||
if (gswig_result == GH_UNSPECIFIED) \
|
||||
gswig_result = object; \
|
||||
else { \
|
||||
if (!gswig_list_p) { \
|
||||
gswig_list_p = 1; \
|
||||
gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
|
||||
} \
|
||||
else \
|
||||
gswig_result = gh_append2(gswig_result, \
|
||||
gh_list(object, GH_NOT_PASSED)); \
|
||||
}
|
||||
|
||||
#define GUILE_APPEND_RESULT SWIG_APPEND_VALUE
|
||||
|
||||
/* scm_values was implemented on C level in 1.4.1, and the prototype
|
||||
is not included in libguile.h, so play safe and lookup `values'... */
|
||||
#define GUILE_MAYBE_VALUES \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_apply(gh_lookup("values"), gswig_result);
|
||||
|
||||
#define GUILE_MAYBE_VECTOR \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_list_to_vector(gswig_result);
|
||||
|
||||
static char *
|
||||
SWIG_scm2str (SCM s)
|
||||
{
|
||||
return gh_scm2newstr (s, NULL);
|
||||
}
|
||||
|
||||
#define GSWIG_scm2str SWIG_scm2str
|
||||
|
||||
/* SCM_CHAR and SCM_CHARP were introduced in Guile 1.4; the following is for
|
||||
1.3.4 compatibility. */
|
||||
#ifndef SCM_CHAR
|
||||
|
|
@ -98,298 +77,86 @@ GSWIG_scm2char (SCM s)
|
|||
}
|
||||
#define gh_scm2char GSWIG_scm2char
|
||||
|
||||
/* Interface function */
|
||||
#define SWIG_scm2str(x) gh_scm2newstr(x, NULL)
|
||||
|
||||
/* More 1.3.4 compatibility */
|
||||
#ifndef SCM_INPUT_PORT_P
|
||||
# define SCM_INPUT_PORT_P SCM_INPORTP
|
||||
# define SCM_OUTPUT_PORT_P SCM_OUTPORTP
|
||||
#endif
|
||||
|
||||
/* Type system */
|
||||
|
||||
typedef void *(*swig_converter_func)(void *);
|
||||
typedef struct swig_type_info *(*swig_dycast_func)(void **);
|
||||
|
||||
typedef struct SwigPtrType SwigPtrType;
|
||||
|
||||
typedef struct swig_type_info {
|
||||
const char *name;
|
||||
swig_converter_func converter;
|
||||
const char *str;
|
||||
void *clientdata;
|
||||
swig_dycast_func dcast;
|
||||
size_t tag;
|
||||
int dummy;
|
||||
} swig_type_info;
|
||||
|
||||
SWIGSTATIC void
|
||||
SWIG_Guile_RegisterTypes (swig_type_info **table,
|
||||
swig_type_info **init);
|
||||
|
||||
/* Register a new type-mapping with the type-checker. origtype is the
|
||||
original datatype and newtype is an equivalent type. cast is optional
|
||||
pointer to a function to cast pointer values between types (this is
|
||||
typically used to cast pointers from derived classes to base classes in
|
||||
C++). */
|
||||
|
||||
SWIGSTATIC void
|
||||
SWIG_RegisterMapping (const char *origtype, const char *newtype,
|
||||
swig_converter_func cast);
|
||||
|
||||
|
||||
/* Dynamic pointer casting. Down an inheritance hierarchy */
|
||||
SWIGSTATIC swig_type_info *
|
||||
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr);
|
||||
|
||||
/* Register SWIG smobs with Guile. */
|
||||
SWIGSTATIC void
|
||||
SWIG_Guile_Init();
|
||||
|
||||
/* Initialization function for this SWIG module; actually renamed by a
|
||||
#define */
|
||||
/* extern void SWIG_init(); */
|
||||
|
||||
/* Get a pointer value from a smob. If there is a type-mismatch,
|
||||
return nonzero; on success, return 0. */
|
||||
SWIGSTATIC int
|
||||
SWIG_Guile_GetPtr (SCM s, void **result, swig_type_info *type);
|
||||
|
||||
/* Get a pointer value from a smob. If there is a type-mismatch,
|
||||
signal a wrong-type-arg error for the given argument number. */
|
||||
SWIGSTATIC void *
|
||||
SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
|
||||
int argnum, const char *func_name);
|
||||
|
||||
/* Make a smob from a pointer and typeinfo. */
|
||||
SWIGSTATIC SCM
|
||||
SWIG_Guile_MakePtr (void *ptr, swig_type_info *type);
|
||||
|
||||
/* Get arguments from an argument list */
|
||||
SWIGSTATIC int
|
||||
SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
||||
int reqargs, int optargs,
|
||||
const char *procname);
|
||||
|
||||
typedef SCM (*swig_guile_proc)();
|
||||
|
||||
#ifdef __cplusplus
|
||||
static swig_type_info *SWIG_Guile_LookupType(swig_module_info *module, SCM s, int normal) {
|
||||
swig_module_info *iter;
|
||||
if (!module) return 0;
|
||||
iter = module;
|
||||
do {
|
||||
if ((normal && (unsigned long) SCM_TYP16(s) == *((int *)iter->clientdata))) {
|
||||
|
||||
return iter->types[(long) SCM_CAR(s) >> 16];
|
||||
}
|
||||
iter = iter->next;
|
||||
} while (iter != module);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIG_GUILE_MODULE_STATIC
|
||||
#elif !defined(SWIG_NOINCLUDE)
|
||||
#define SWIG_GUILE_MODULE_STATIC static
|
||||
#endif
|
||||
|
||||
/* guiledec.swg ends here */
|
||||
|
||||
#ifndef SWIG_NOINCLUDE
|
||||
/* SWIG pointer structure */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#ifdef SWIG_GUILE_MODULE_STATIC
|
||||
static swig_module_info *swig_guile_module = 0;
|
||||
SWIG_GUILE_MODULE_STATIC swig_module_info *SWIG_Guile_GetModule() {
|
||||
return swig_guile_module;
|
||||
}
|
||||
SWIG_GUILE_MODULE_STATIC void SWIG_Guile_SetModule(swig_module_info *pointer) {
|
||||
swig_guile_module = pointer;
|
||||
}
|
||||
#else
|
||||
SWIGEXPORT(swig_module_info *) SWIG_Guile_GetModule();
|
||||
SWIGEXPORT(void) SWIG_Guile_SetModule(swig_module_info *pointer);
|
||||
#endif
|
||||
|
||||
struct SwigCast {
|
||||
unsigned short type; /* Index into SwigPtrTbl */
|
||||
void *(*cast)(void *); /* Pointer casting function */
|
||||
struct SwigCast *next; /* Linked list pointer */
|
||||
};
|
||||
|
||||
struct SwigPtrType {
|
||||
const char *name; /* Datatype name */
|
||||
const char *prettyname; /* Pretty datatype name */
|
||||
unsigned short tag; /* Index in SwigPtrTable */
|
||||
struct SwigCast *cast; /* List of compatible types */
|
||||
};
|
||||
|
||||
/* Some variables */
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be held */
|
||||
/* (may be adjusted dynamically) */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
|
||||
/* Pointer table */
|
||||
static SwigPtrType *SwigPtrList = 0; /* Table containing types and
|
||||
equivalences; items will only
|
||||
be appended */
|
||||
static size_t *SwigPtrTbl = 0; /* Sorted indirect table; items will
|
||||
be inserted */
|
||||
|
||||
/* Sort comparison function */
|
||||
static int
|
||||
swigsort (const void *data1, const void *data2)
|
||||
{
|
||||
size_t index1 = * (size_t *) data1;
|
||||
size_t index2 = * (size_t *) data2;
|
||||
return strcmp(SwigPtrList[index1].name, SwigPtrList[index2].name);
|
||||
}
|
||||
|
||||
/* Register a new datatype with the type-checker */
|
||||
SWIGSTATIC size_t
|
||||
SWIG_RegisterType (const char *type, const char *prettyname)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Allocate the pointer table if necessary */
|
||||
if (!SwigPtrList) {
|
||||
SwigPtrList = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrTbl = (size_t *) malloc(SwigPtrMax*sizeof(size_t));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
/* Grow the table if necessary */
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrList = (SwigPtrType *) realloc((char *) SwigPtrList,
|
||||
SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrTbl = (size_t *) realloc((char *) SwigPtrTbl,
|
||||
SwigPtrMax*sizeof(size_t));
|
||||
}
|
||||
/* Look up type */
|
||||
for (i = 0; i < SwigPtrN; i++)
|
||||
if (strcmp(SwigPtrList[i].name,type) == 0) {
|
||||
if (prettyname!=NULL)
|
||||
SwigPtrList[i].prettyname = prettyname;
|
||||
return i;
|
||||
}
|
||||
{
|
||||
struct SwigPtrType *t;
|
||||
size_t tag;
|
||||
#if 0
|
||||
fprintf(stderr, "New type: %s\n", type);
|
||||
#endif
|
||||
tag = SwigPtrTbl[SwigPtrN] = SwigPtrN;
|
||||
t = &SwigPtrList[tag];
|
||||
t->name = type;
|
||||
t->prettyname = prettyname;
|
||||
t->tag = SwigPtrN;
|
||||
t->cast = NULL;
|
||||
SwigPtrN++;
|
||||
SwigPtrSort = 0;
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
/* Register two data types and their mapping with the type checker. */
|
||||
SWIGSTATIC void
|
||||
SWIG_RegisterMapping (const char *origtype, const char *newtype,
|
||||
swig_converter_func cast)
|
||||
{
|
||||
size_t t = SWIG_RegisterType(origtype, NULL);
|
||||
|
||||
if (newtype!=NULL) {
|
||||
size_t t1 = SWIG_RegisterType(newtype, NULL);
|
||||
struct SwigCast *c;
|
||||
/* Check for existing cast */
|
||||
for (c = SwigPtrList[t].cast; c && c->type!=t1; c=c->next) /* nothing */;
|
||||
if (c) {
|
||||
if (cast) c->cast = cast;
|
||||
}
|
||||
else {
|
||||
c = (struct SwigCast *) malloc(sizeof(struct SwigCast));
|
||||
c->type = t1;
|
||||
c->cast = cast;
|
||||
c->next = SwigPtrList[t].cast;
|
||||
SwigPtrList[t].cast = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort table */
|
||||
|
||||
static void
|
||||
SWIG_SortTable (void)
|
||||
{
|
||||
qsort ((void *) SwigPtrTbl, SwigPtrN, sizeof(size_t), swigsort);
|
||||
/* Indicate that everything is sorted */
|
||||
SwigPtrSort = 1;
|
||||
}
|
||||
|
||||
/* Look up pointer-type entry in table */
|
||||
|
||||
static int
|
||||
swigcmp (const void *key, const void *data)
|
||||
{
|
||||
char *k = (char *) key;
|
||||
size_t index = *(size_t *)data;
|
||||
return strcmp(k, SwigPtrList[index].name);
|
||||
}
|
||||
|
||||
static SwigPtrType *
|
||||
SWIG_GetPtrType (const char *_t)
|
||||
{
|
||||
size_t *result;
|
||||
if (!SwigPtrSort) SWIG_SortTable();
|
||||
result = (size_t *) bsearch(_t, SwigPtrTbl, SwigPtrN, sizeof(size_t), swigcmp);
|
||||
if (result!=NULL) return SwigPtrList+*result;
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
/* Cast a pointer if possible; returns 1 if successful */
|
||||
|
||||
static int
|
||||
SWIG_Cast (void *source, size_t source_type,
|
||||
void **ptr, size_t dest_type)
|
||||
{
|
||||
if (dest_type != source_type) {
|
||||
/* We have a type mismatch. Will have to look through our type
|
||||
mapping table to figure out whether or not we can accept this
|
||||
datatype. */
|
||||
struct SwigCast *c;
|
||||
for (c = SwigPtrList[dest_type].cast;
|
||||
c && c->type!=source_type; c = c->next) /* nothing */;
|
||||
if (c) {
|
||||
/* Get pointer value. */
|
||||
if (c->cast) *ptr = (*(c->cast))(source);
|
||||
else *ptr = source;
|
||||
return 1;
|
||||
}
|
||||
/* Didn't find any sort of match for this data.
|
||||
Get the pointer value and return false. */
|
||||
*ptr = source;
|
||||
return 0;
|
||||
} else {
|
||||
/* Found a match on the first try. Return pointer value. */
|
||||
*ptr = source;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dynamic pointer casting. Down an inheritance hierarchy */
|
||||
SWIGSTATIC swig_type_info *
|
||||
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr)
|
||||
{
|
||||
swig_type_info *lastty = ty;
|
||||
if (!ty || !ty->dcast) return ty;
|
||||
while (ty && (ty->dcast)) {
|
||||
ty = (*ty->dcast)(ptr);
|
||||
if (ty) lastty = ty;
|
||||
}
|
||||
return lastty;
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
static unsigned long swig_tag = 0;
|
||||
|
||||
SWIGSTATIC SCM
|
||||
SWIG_Guile_MakePtr (void *ptr, swig_type_info *type)
|
||||
static SCM
|
||||
SWIG_Guile_NewPointerObj(swig_module_info *module, void *ptr, swig_type_info *type, int owner)
|
||||
{
|
||||
unsigned long tag;
|
||||
if (ptr==NULL) return SCM_EOL;
|
||||
SCM_RETURN_NEWSMOB((((unsigned long)type->tag << 16) | swig_tag),
|
||||
ptr);
|
||||
if (!module) return SCM_EOL;
|
||||
for (tag = 0; tag < module->size; ++tag) {
|
||||
if (module->types[tag] == type)
|
||||
break;
|
||||
}
|
||||
if (tag >= module->size)
|
||||
return SCM_EOL;
|
||||
|
||||
|
||||
SCM_RETURN_NEWSMOB( ((tag << 16) | *((int *)module->clientdata)), ptr);
|
||||
}
|
||||
|
||||
/* Return 0 if successful. */
|
||||
SWIGSTATIC int
|
||||
SWIG_Guile_GetPtr(SCM s, void **result, swig_type_info *type)
|
||||
static int
|
||||
SWIG_Guile_ConvertPtr(swig_module_info *module, SCM s, void **result, swig_type_info *type, int flags)
|
||||
{
|
||||
swig_cast_info *cast;
|
||||
swig_type_info *from;
|
||||
if (SCM_NULLP(s)) {
|
||||
*result = NULL;
|
||||
return 0;
|
||||
}
|
||||
else if (SCM_NIMP(s)
|
||||
&& (unsigned long) SCM_TYP16(s) == swig_tag) {
|
||||
if (type)
|
||||
return !SWIG_Cast((void *) SCM_CDR(s),
|
||||
(long) SCM_CAR(s) >> 16,
|
||||
result, type->tag);
|
||||
else {
|
||||
} else if (SCM_NIMP(s)) {
|
||||
from = SWIG_Guile_LookupType(module, s, 1);
|
||||
if (!from) return 1;
|
||||
if (type) {
|
||||
cast = SWIG_TypeCheckStruct(from, type);
|
||||
if (cast) {
|
||||
*result = SWIG_TypeCast(cast, (void *) SCM_CDR(s));
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
*result = (void *) SCM_CDR(s);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -397,12 +164,12 @@ SWIG_Guile_GetPtr(SCM s, void **result, swig_type_info *type)
|
|||
return 1;
|
||||
}
|
||||
|
||||
SWIGSTATIC void *
|
||||
SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
|
||||
int argnum, const char *func_name)
|
||||
static void *
|
||||
SWIG_Guile_MustGetPtr (swig_module_info *module, SCM s, swig_type_info *type,
|
||||
int argnum, int flags, const char *func_name)
|
||||
{
|
||||
void *result;
|
||||
if (SWIG_Guile_GetPtr(s, &result, type)) {
|
||||
if (SWIG_Guile_ConvertPtr(module, s, &result, type, flags)) {
|
||||
/* type mismatch */
|
||||
scm_wrong_type_arg((char *) func_name, argnum, s);
|
||||
}
|
||||
|
|
@ -414,15 +181,21 @@ SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
|
|||
static int
|
||||
print_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
|
||||
{
|
||||
scm_puts((char *) "#<swig ", port);
|
||||
if (SwigPtrList[(long) SCM_CAR(swig_smob) >> 16].prettyname != NULL)
|
||||
scm_puts((char*) SwigPtrList[(long) SCM_CAR(swig_smob) >> 16].prettyname, port);
|
||||
else scm_puts((char*) SwigPtrList[(long) SCM_CAR(swig_smob) >> 16].name, port);
|
||||
scm_puts((char *) " ", port);
|
||||
scm_intprint((long) SCM_CDR(swig_smob), 16, port);
|
||||
scm_puts((char *) ">", port);
|
||||
/* non-zero means success */
|
||||
return 1;
|
||||
swig_type_info *type = SWIG_Guile_LookupType(0, swig_smob, 1);
|
||||
if (type) {
|
||||
scm_puts((char *) "#<swig ", port);
|
||||
if (type->str != NULL)
|
||||
scm_puts((char *) type->str, port);
|
||||
else
|
||||
scm_puts((char *) type->name, port);
|
||||
scm_puts((char *) " ", port);
|
||||
scm_intprint((long) SCM_CDR(swig_smob), 16, port);
|
||||
scm_puts((char *) ">", port);
|
||||
/* non-zero means success */
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static SCM
|
||||
|
|
@ -434,33 +207,14 @@ equalp_swig (SCM A, SCM B)
|
|||
else return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
SWIGSTATIC void
|
||||
SWIG_Guile_Init (void)
|
||||
static void
|
||||
SWIG_Guile_Init (swig_module_info *module)
|
||||
{
|
||||
if (swig_tag == 0) {
|
||||
swig_tag = scm_make_smob_type_mfpe((char *) "swig", 0, NULL, NULL,
|
||||
print_swig, equalp_swig);
|
||||
}
|
||||
*((int *)module->clientdata) =
|
||||
scm_make_smob_type_mfpe((char *) "swig", 0, NULL, NULL, print_swig, equalp_swig);
|
||||
}
|
||||
|
||||
/* Convert datatype table */
|
||||
|
||||
SWIGSTATIC
|
||||
void SWIG_Guile_RegisterTypes(swig_type_info **table,
|
||||
swig_type_info **init)
|
||||
{
|
||||
for (; *init; table++, init++) {
|
||||
swig_type_info *type = *table = *init;
|
||||
const char *origname = type->name;
|
||||
/* Register datatype itself and store pointer back */
|
||||
type->tag = SWIG_RegisterType(origname, type->str);
|
||||
/* Register compatible types */
|
||||
for (type++; type->name; type++)
|
||||
SWIG_RegisterMapping(origname, type->name, type->converter);
|
||||
}
|
||||
}
|
||||
|
||||
SWIGSTATIC int
|
||||
static int
|
||||
SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
||||
int reqargs, int optargs,
|
||||
const char *procname)
|
||||
|
|
@ -480,7 +234,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
num_args_passed++;
|
||||
}
|
||||
for (; i<optargs; i++)
|
||||
*dest++ = GH_NOT_PASSED;
|
||||
*dest++ = SCM_UNDEFINED;
|
||||
if (!SCM_NULLP(rest))
|
||||
scm_wrong_num_args(gh_str02scm((char *) procname));
|
||||
return num_args_passed;
|
||||
|
|
@ -491,5 +245,3 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
#endif
|
||||
|
||||
/* guile.swg ends here */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#define SWIGGUILE_SCM
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg"
|
||||
|
||||
%runtime "guile_scm_run.swg"
|
||||
%include "ghinterface.i"
|
||||
|
|
@ -38,19 +37,12 @@
|
|||
|
||||
%}
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
static int _swig_init = 0;
|
||||
|
||||
SWIG_Guile_Init();
|
||||
|
||||
if (!_swig_init) {
|
||||
int i;
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
SWIG_PropagateClientData(swig_types[i]);
|
||||
}
|
||||
_swig_init = 1;
|
||||
}
|
||||
SWIG_GUILE_INIT_STATIC void
|
||||
SWIG_init(void)
|
||||
{
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_PropagateClientData();
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ typedef struct swig_guile_clientdata {
|
|||
scm_error(scm_str2symbol("swig-contract-assertion-failed"), \
|
||||
(char *) FUNC_NAME, (char *) msg, \
|
||||
SCM_EOL, SCM_BOOL_F); else
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Guile_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Guile_SetModule(pointer)
|
||||
|
||||
static char *
|
||||
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
|
||||
|
|
@ -138,7 +142,7 @@ SWIG_Guile_PointerType(SCM object)
|
|||
static int
|
||||
SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
|
||||
{
|
||||
swig_type_info *cast;
|
||||
swig_cast_info *cast;
|
||||
swig_type_info *from;
|
||||
SCM smob = SWIG_Guile_GetSmob(s);
|
||||
|
||||
|
|
@ -150,7 +154,7 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
|
|||
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
|
||||
if (!from) return 1;
|
||||
if (type) {
|
||||
cast = SWIG_TypeCheck((char*)from->name, type);
|
||||
cast = SWIG_TypeCheckStruct(from, type);
|
||||
if (cast) {
|
||||
*result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob));
|
||||
return 0;
|
||||
|
|
@ -304,12 +308,12 @@ ensure_smob_tag(SCM swig_module,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static SCM
|
||||
SWIG_Guile_Init ()
|
||||
{
|
||||
SCM swig_module;
|
||||
static SCM swig_module;
|
||||
|
||||
if (swig_initialized) return;
|
||||
if (swig_initialized) return swig_module;
|
||||
swig_initialized = 1;
|
||||
|
||||
swig_module = scm_c_resolve_module("Swig swigrun");
|
||||
|
|
@ -329,19 +333,6 @@ SWIG_Guile_Init ()
|
|||
scm_set_smob_print(swig_destroyed_tag, print_destroyed_swig);
|
||||
scm_set_smob_equalp(swig_destroyed_tag, equalp_swig);
|
||||
}
|
||||
{
|
||||
SCM variable = scm_sym2var(scm_str2symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_module_lookup_closure(swig_module),
|
||||
SCM_BOOL_T);
|
||||
if (SCM_UNBNDP(SCM_VARIABLE_REF(variable))) {
|
||||
SCM_VARIABLE_SET(variable, scm_ulong2num((unsigned long) swig_type_list_handle));
|
||||
}
|
||||
else {
|
||||
swig_type_list_handle
|
||||
= (swig_type_info **) scm_num2ulong(SCM_VARIABLE_REF(variable), 0,
|
||||
"SWIG_Guile_Init");
|
||||
}
|
||||
}
|
||||
swig_make_func = scm_permanent_object(
|
||||
scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make")));
|
||||
swig_keyword = scm_permanent_object(scm_c_make_keyword((char*) "init-smob"));
|
||||
|
|
@ -349,6 +340,41 @@ SWIG_Guile_Init ()
|
|||
#ifdef SWIG_INIT_RUNTIME_MODULE
|
||||
SWIG_INIT_RUNTIME_MODULE
|
||||
#endif
|
||||
|
||||
return swig_module;
|
||||
}
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_Guile_GetModule()
|
||||
{
|
||||
SCM module;
|
||||
SCM variable;
|
||||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
variable = scm_sym2var(scm_str2symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_module_lookup_closure(module),
|
||||
SCM_BOOL_T);
|
||||
if (SCM_UNBNDP(SCM_VARIABLE_REF(variable))) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (swig_module_info *) scm_num2ulong(SCM_VARIABLE_REF(variable), 0, "SWIG_Guile_Init");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_Guile_SetModule(swig_module_info *swig_module)
|
||||
{
|
||||
SCM module;
|
||||
SCM variable;
|
||||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
variable = scm_sym2var(scm_str2symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_module_lookup_closure(module),
|
||||
SCM_BOOL_T);
|
||||
|
||||
SCM_VARIABLE_SET(variable, scm_ulong2num((unsigned long) swig_module));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue