- 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
|
|
@ -11,7 +11,6 @@
|
|||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; // Common C API type-checking code
|
||||
%insert(runtime) "common.swg"; // Common type-checking code
|
||||
%insert(runtime) "chickenrun.swg"; // CHICKEN run-time code
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -583,12 +582,12 @@ SWIGEXPORT(void) SWIG_init(int, C_word, C_word) C_noret;
|
|||
|
||||
%insert(closprefix) "swigclosprefix.scm"
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%insert(init) %{
|
||||
/* CHICKEN initialization function */
|
||||
static char *swig_type_ptr_name = "type_pointer" SWIG_TYPE_TABLE_NAME;
|
||||
SWIGEXPORT(void)
|
||||
SWIG_init(int argc, C_word closure, C_word continuation) {
|
||||
static int typeinit = 0;
|
||||
int i;
|
||||
C_word sym;
|
||||
C_word tmp;
|
||||
|
|
@ -596,32 +595,9 @@ SWIG_init(int argc, C_word closure, C_word continuation) {
|
|||
C_word ret;
|
||||
C_word *return_vec;
|
||||
|
||||
if (!typeinit) {
|
||||
/* lookup the type pointer... it is stored in it's own symbol table */
|
||||
C_SYMBOL_TABLE *stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
|
||||
if (stable != NULL) {
|
||||
sym = SWIG_Chicken_LookupSymbol(swig_type_ptr_name, stable);
|
||||
if (C_truep(sym) && C_swig_is_ptr(sym)) {
|
||||
swig_type_list_handle = (swig_type_info **) C_block_item(sym, 0);
|
||||
}
|
||||
} else {
|
||||
C_word *a = C_alloc(C_SIZEOF_POINTER + C_SIZEOF_INTERNED_SYMBOL(C_strlen(swig_type_ptr_name)));
|
||||
stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
|
||||
sym = C_intern_in(&a, C_strlen(swig_type_ptr_name), swig_type_ptr_name, stable);
|
||||
C_mutate(&C_block_item(sym, 0), C_mpointer(&a, (void *) swig_type_list_handle));
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
typeinit = 1;
|
||||
ret = C_SCHEME_TRUE;
|
||||
} else {
|
||||
ret = C_SCHEME_FALSE;
|
||||
}
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_PropagateClientData();
|
||||
ret = C_SCHEME_TRUE;
|
||||
|
||||
#if $veclength
|
||||
return_vec = C_alloc(C_SIZEOF_VECTOR($veclength));
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ extern "C" {
|
|||
SWIG_Chicken_NewPointerObj((void*)ptr, type, owner, &known_space)
|
||||
#define swig_barf SWIG_Chicken_Barf
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Chicken_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Chicken_SetModule(pointer)
|
||||
|
||||
#define C_swig_is_bool(x) C_truep (C_booleanp (x))
|
||||
#define C_swig_is_char(x) C_truep (C_charp (x))
|
||||
#define C_swig_is_fixnum(x) C_truep (C_fixnump (x))
|
||||
|
|
@ -186,7 +190,7 @@ SWIG_Chicken_NewPointerObj(void *ptr, swig_type_info *type, int owner, C_word **
|
|||
static int
|
||||
SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags)
|
||||
{
|
||||
swig_type_info *cast;
|
||||
swig_cast_info *cast;
|
||||
swig_type_info *from;
|
||||
|
||||
if (s == C_SCHEME_FALSE) {
|
||||
|
|
@ -196,7 +200,7 @@ SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags
|
|||
from = (swig_type_info *) C_block_item(s, 1);
|
||||
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 *) C_block_item(s, 0));
|
||||
return 0;
|
||||
|
|
@ -223,6 +227,48 @@ SWIG_Chicken_MustGetPtr (C_word s, swig_type_info *type, int argnum, int flags)
|
|||
return result;
|
||||
}
|
||||
|
||||
static char *chicken_runtimevar_name = "type_pointer" SWIG_TYPE_TABLE_NAME;
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_Chicken_GetModule() {
|
||||
swig_module_info *ret = 0;
|
||||
C_word sym;
|
||||
|
||||
/* lookup the type pointer... it is stored in it's own symbol table */
|
||||
C_SYMBOL_TABLE *stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
|
||||
if (stable != NULL) {
|
||||
sym = SWIG_Chicken_LookupSymbol(chicken_runtimevar_name, stable);
|
||||
if (C_truep(sym) && C_swig_is_ptr(sym)) {
|
||||
ret = (swig_module_info *) C_block_item(sym, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_Chicken_SetModule(swig_module_info *module) {
|
||||
C_word *a;
|
||||
C_SYMBOL_TABLE *stable;
|
||||
C_word sym;
|
||||
C_word pointer;
|
||||
static C_word *space = 0;
|
||||
|
||||
/* type pointer is stored in it's own symbol table */
|
||||
stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
|
||||
if (stable == NULL) {
|
||||
stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
|
||||
}
|
||||
|
||||
if (!space) {
|
||||
space = (C_word *) C_malloc((C_SIZEOF_POINTER + C_SIZEOF_INTERNED_SYMBOL(C_strlen(chicken_runtimevar_name))) * sizeof(C_word));
|
||||
}
|
||||
a = space;
|
||||
pointer = C_mpointer(&a, (void *) module);
|
||||
sym = C_intern_in(&a, C_strlen(chicken_runtimevar_name), chicken_runtimevar_name, stable);
|
||||
C_set_block_item(sym, 0, pointer);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
/***********************************************************************
|
||||
* common.swg
|
||||
*
|
||||
* This file contains generic SWIG runtime support for pointer
|
||||
* type checking as well as a few commonly used macros to control
|
||||
* external linkage.
|
||||
*
|
||||
* Author : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (c) 1999-2000, The University of Chicago
|
||||
*
|
||||
* This file may be freely redistributed without license or fee provided
|
||||
* this copyright message remains intact.
|
||||
************************************************************************/
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if !defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* The static type info list */
|
||||
|
||||
static swig_type_info *swig_type_list = 0;
|
||||
static swig_type_info **swig_type_list_handle = &swig_type_list;
|
||||
|
||||
|
||||
/* Register a type mapping with the type-checking */
|
||||
static swig_type_info *
|
||||
SWIG_TypeRegister(swig_type_info *ti) {
|
||||
return SWIG_TypeRegisterTL(swig_type_list_handle, ti);
|
||||
}
|
||||
|
||||
/* Search for a swig_type_info structure */
|
||||
static swig_type_info *
|
||||
SWIG_TypeQuery(const char *name) {
|
||||
return SWIG_TypeQueryTL(*swig_type_list_handle, name);
|
||||
}
|
||||
|
||||
/* Set the clientdata field for a type */
|
||||
static void
|
||||
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
||||
SWIG_TypeClientDataTL(*swig_type_list_handle, ti, clientdata);
|
||||
}
|
||||
|
||||
/* This function will propagate the clientdata field of type to
|
||||
* any new swig_type_info structures that have been added into the list
|
||||
* of equivalent types. It is like calling
|
||||
* SWIG_TypeClientData(type, clientdata) a second time.
|
||||
*/
|
||||
static void
|
||||
SWIG_PropagateClientData(swig_type_info *type) {
|
||||
SWIG_PropagateClientDataTL(*swig_type_list_handle, type);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ extern "C" {
|
|||
#define SWIG_MustGetPtr(s, type, argnum, flags) \
|
||||
SWIG_MzScheme_MustGetPtr(s, type, argnum, flags, FUNC_NAME, argc, argv)
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_MzScheme_GetModule((Scheme_Env *)(clientdata))
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_MzScheme_SetModule((Scheme_Env *) (clientdata), pointer)
|
||||
#define SWIG_MODULE_CLIENTDATA_TYPE Scheme_Env *
|
||||
|
||||
/* MzScheme-specific SWIG API */
|
||||
|
||||
#define SWIG_malloc(size) SWIG_MzScheme_Malloc(size, FUNC_NAME)
|
||||
|
|
@ -39,42 +44,8 @@ struct swig_mz_proxy {
|
|||
void *object;
|
||||
};
|
||||
|
||||
/* The interpreter will store a pointer to this structure in a global
|
||||
variable called swig-runtime-data-type-pointer. The instance of this
|
||||
struct is only used if no other module has yet been loaded */
|
||||
struct swig_mzscheme_runtime_data {
|
||||
swig_type_info **handle;
|
||||
Scheme_Type type;
|
||||
};
|
||||
static struct swig_mzscheme_runtime_data swig_mzscheme_runtime_data;
|
||||
|
||||
static Scheme_Type swig_type;
|
||||
|
||||
static void
|
||||
SWIG_MzScheme_LookupTypePointer(Scheme_Env *env) {
|
||||
Scheme_Object *pointer, *symbol;
|
||||
struct swig_mzscheme_runtime_data *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
symbol = scheme_intern_symbol("swig-runtime-data-type-pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
pointer = scheme_lookup_global(symbol, env);
|
||||
if (pointer && SCHEME_CPTRP(pointer)) {
|
||||
data = (struct swig_mzscheme_runtime_data *) SCHEME_CPTR_VAL(pointer);
|
||||
swig_type_list_handle = data->handle;
|
||||
swig_type = data->type;
|
||||
} else {
|
||||
/* create a new type for wrapped pointer values */
|
||||
swig_type = scheme_make_type((char *)"swig");
|
||||
swig_mzscheme_runtime_data.handle = swig_type_list_handle;
|
||||
swig_mzscheme_runtime_data.type = swig_type;
|
||||
|
||||
/* create a new pointer */
|
||||
pointer = scheme_make_cptr((void *) &swig_mzscheme_runtime_data, "swig_mzscheme_runtime_data");
|
||||
scheme_add_global_symbol(symbol, pointer, env);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mz_free_swig(void *p, void *data) {
|
||||
struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) p;
|
||||
|
|
@ -102,7 +73,7 @@ SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) {
|
|||
|
||||
static int
|
||||
SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) {
|
||||
swig_type_info *cast;
|
||||
swig_cast_info *cast;
|
||||
|
||||
if (SCHEME_NULLP(s)) {
|
||||
*result = NULL;
|
||||
|
|
@ -192,7 +163,58 @@ SWIG_MzScheme_new_scheme_struct (Scheme_Env* env, const char* basename,
|
|||
|
||||
return new_type;
|
||||
}
|
||||
|
||||
/* The interpreter will store a pointer to this structure in a global
|
||||
variable called swig-runtime-data-type-pointer. The instance of this
|
||||
struct is only used if no other module has yet been loaded */
|
||||
struct swig_mzscheme_runtime_data {
|
||||
swig_module_info *module_head;
|
||||
Scheme_Type type;
|
||||
};
|
||||
static struct swig_mzscheme_runtime_data swig_mzscheme_runtime_data;
|
||||
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_MzScheme_GetModule(Scheme_Env *env) {
|
||||
Scheme_Object *pointer, *symbol;
|
||||
struct swig_mzscheme_runtime_data *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
symbol = scheme_intern_symbol("swig-runtime-data-type-pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
pointer = scheme_lookup_global(symbol, env);
|
||||
if (pointer && SCHEME_CPTRP(pointer)) {
|
||||
data = (struct swig_mzscheme_runtime_data *) SCHEME_CPTR_VAL(pointer);
|
||||
swig_type = data->type;
|
||||
return data->module_head;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_MzScheme_SetModule(Scheme_Env *env, swig_module_info *module) {
|
||||
Scheme_Object *pointer, *symbol;
|
||||
struct swig_mzscheme_runtime_data *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
symbol = scheme_intern_symbol("swig-runtime-data-type-pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
pointer = scheme_lookup_global(symbol, env);
|
||||
if (pointer && SCHEME_CPTRP(pointer)) {
|
||||
data = (struct swig_mzscheme_runtime_data *) SCHEME_CPTR_VAL(pointer);
|
||||
swig_type = data->type;
|
||||
data->module_head = module;
|
||||
} else {
|
||||
/* create a new type for wrapped pointer values */
|
||||
swig_type = scheme_make_type((char *)"swig");
|
||||
swig_mzscheme_runtime_data.module_head = module;
|
||||
swig_mzscheme_runtime_data.type = swig_type;
|
||||
|
||||
/* create a new pointer */
|
||||
pointer = scheme_make_cptr((void *) &swig_mzscheme_runtime_data, "swig_mzscheme_runtime_data");
|
||||
scheme_add_global_symbol(symbol, pointer, env);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
/* Include headers */
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg"
|
||||
%runtime "mzrun.swg"
|
||||
|
||||
%define SWIG_APPEND_VALUE(value)
|
||||
|
|
@ -22,15 +21,11 @@
|
|||
/* Read in standard typemaps. */
|
||||
%include "typemaps.i"
|
||||
|
||||
%init %{
|
||||
static int _swig_init = 0;
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
if (!_swig_init) {
|
||||
int i;
|
||||
SWIG_MzScheme_LookupTypePointer(env);
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
_swig_init = 1;
|
||||
}
|
||||
%init %{
|
||||
Scheme_Object *scheme_reload(Scheme_Env *env) {
|
||||
Scheme_Env *menv = SWIG_MZSCHEME_CREATE_MENV(env);
|
||||
|
||||
SWIG_InitializeModule((void *) env);
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
%typemap(in) enum SWIGTYPE {
|
||||
if (!SCHEME_INTP($input))
|
||||
scheme_wrong_type(FUNC_NAME, "integer", $argnum - 1, argc, argv);
|
||||
$1 = SCHEME_INT_VAL($input);
|
||||
$1 = ($1_type) SCHEME_INT_VAL($input);
|
||||
}
|
||||
|
||||
%typemap(varin) enum SWIGTYPE {
|
||||
|
|
|
|||
|
|
@ -3,14 +3,18 @@
|
|||
This file is parsed by SWIG before reading any other interface
|
||||
file. */
|
||||
|
||||
%runtime %{
|
||||
#define SWIGSTATIC static
|
||||
%}
|
||||
|
||||
/* Insert common stuff */
|
||||
%insert(runtime) "swigrun.swg"
|
||||
%insert(runtime) "common.swg"
|
||||
|
||||
/* Include headers */
|
||||
%insert(runtime) "ocamldec.swg"
|
||||
|
||||
/* Type registration */
|
||||
%insert(init) "swiginit.swg"
|
||||
%insert(init) "typeregister.swg"
|
||||
|
||||
%insert(mlitail) %{
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ extern "C" {
|
|||
*ptr = source;
|
||||
return 0;
|
||||
} else {
|
||||
swig_type_info *tc =
|
||||
SWIG_TypeCheck( (char *)source_type->name, dest_type );
|
||||
swig_cast_info *tc =
|
||||
SWIG_TypeCheckStruct(source_type, dest_type );
|
||||
#ifdef TYPE_CAST_VERBOSE
|
||||
fprintf( stderr, "Typecheck -> %s\n",
|
||||
tc ? tc->str : "<none>" );
|
||||
|
|
@ -371,11 +371,12 @@ extern "C" {
|
|||
CAMLreturn(vv);
|
||||
}
|
||||
|
||||
SWIGSTATIC CAML_VALUE caml_val_obj( void *v, char *object_type ) {
|
||||
#define caml_val_obj(v, name) caml_val_obj_helper(v, SWIG_TypeQuery((name)), name)
|
||||
SWIGSTATIC CAML_VALUE caml_val_obj_helper( void *v, swig_type_info *type, char *name) {
|
||||
CAMLparam0();
|
||||
CAMLreturn(callback2(*caml_named_value("caml_create_object_fn"),
|
||||
caml_val_ptr(v,SWIG_TypeQuery(object_type)),
|
||||
copy_string(object_type)));
|
||||
caml_val_ptr(v,type),
|
||||
copy_string(name)));
|
||||
}
|
||||
|
||||
SWIGSTATIC long caml_long_val_full( CAML_VALUE v, char *name ) {
|
||||
|
|
@ -575,14 +576,21 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
static void SWIG_Ocaml_LookupTypePointer() {
|
||||
CAML_VALUE mod_pointer, pointer;
|
||||
static swig_module_info *SWIG_Ocaml_GetModule() {
|
||||
CAML_VALUE pointer;
|
||||
|
||||
mod_pointer = caml_val_ptr(swig_type_list_handle, NULL);
|
||||
pointer = callback(*caml_named_value("swig_find_type_info"), mod_pointer);
|
||||
if (SWIG_Tag_val(pointer) == C_ptr) {
|
||||
swig_type_list_handle = (swig_type_info **)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
|
||||
pointer = callback(*caml_named_value("swig_find_type_info"), caml_val_int(0));
|
||||
if (Is_block(pointer) && SWIG_Tag_val(pointer) == C_ptr) {
|
||||
return (swig_module_info *)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SWIG_Ocaml_SetModule(swig_module_info *pointer) {
|
||||
CAML_VALUE mod_pointer;
|
||||
|
||||
mod_pointer = caml_val_ptr(pointer, NULL);
|
||||
callback(*caml_named_value("swig_set_type_info"), mod_pointer);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -590,7 +598,7 @@ extern "C" {
|
|||
#endif
|
||||
#undef value
|
||||
|
||||
|
||||
/* ocaml keywords */
|
||||
/* please test and activate */
|
||||
/* There's no need to use this, because of my rewriting machinery. C++
|
||||
* words never collide with ocaml keywords */
|
||||
//%include "ocamlkw.swg"
|
||||
|
|
|
|||
|
|
@ -81,14 +81,9 @@ CAMLextern int64 Int64_val(caml_value_t v);
|
|||
#define SWIG_Int64_val(v) Int64_val(v)
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define SWIGSTATIC static inline
|
||||
#else
|
||||
# define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
|
||||
#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type)
|
||||
#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer)
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) if(!(expr)) {failwith(msg);} else
|
||||
|
||||
|
|
|
|||
|
|
@ -143,16 +143,14 @@ let new_derived_object cfun x_class args =
|
|||
end
|
||||
|
||||
let swig_current_type_info = ref C_void
|
||||
let find_type_info obj =
|
||||
match obj with
|
||||
C_ptr _ -> if !swig_current_type_info = C_void
|
||||
then begin
|
||||
swig_current_type_info := obj ;
|
||||
obj
|
||||
end else
|
||||
!swig_current_type_info
|
||||
| _ -> raise (Failure "Internal error: passed non pointer to find_type_info")
|
||||
let find_type_info obj = !swig_current_type_info
|
||||
let _ = Callback.register "swig_find_type_info" find_type_info
|
||||
let set_type_info obj =
|
||||
match obj with
|
||||
C_ptr _ -> swig_current_type_info := obj ;
|
||||
obj
|
||||
| _ -> raise (Failure "Internal error: passed non pointer to set_type_info")
|
||||
let _ = Callback.register "swig_set_type_info" set_type_info
|
||||
|
||||
let class_master_list = Hashtbl.create 20
|
||||
let register_class_byname nm co =
|
||||
|
|
|
|||
|
|
@ -1,12 +1,2 @@
|
|||
/* Code ripped from python implementation */
|
||||
{
|
||||
static int typeinit = 0;
|
||||
int i;
|
||||
if (!typeinit) {
|
||||
SWIG_Ocaml_LookupTypePointer();
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
typeinit = 1;
|
||||
}
|
||||
}
|
||||
SWIGEXT void SWIG_init() {
|
||||
SWIG_InitializeModule(0);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg" // common type checking code
|
||||
%runtime "perlrun.swg" // Perl runtime functions
|
||||
%runtime "noembed.h" // undefine Perl5 macros
|
||||
|
||||
|
|
|
|||
|
|
@ -17,32 +17,10 @@ SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
|
|||
|
||||
/* Module initialization function */
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
|
||||
static void SWIG_Perl_SetTypeListHandle(swig_type_info **handle) {
|
||||
SV *pointer;
|
||||
|
||||
/* create a new pointer */
|
||||
pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
|
||||
sv_setiv(pointer, PTR2IV(swig_type_list_handle));
|
||||
}
|
||||
|
||||
static swig_type_info **
|
||||
SWIG_Perl_LookupTypePointer(swig_type_info **type_list_handle) {
|
||||
swig_type_info **type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = SWIG_Perl_GetTypeListHandle();
|
||||
if (type_pointer) {
|
||||
return type_pointer;
|
||||
} else {
|
||||
/* create a new module and variable */
|
||||
SWIG_Perl_SetTypeListHandle(type_list_handle);
|
||||
return type_list_handle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
|
@ -50,14 +28,8 @@ extern "C"
|
|||
XS(SWIG_init) {
|
||||
dXSARGS;
|
||||
int i;
|
||||
static int _init = 0;
|
||||
if (!_init) {
|
||||
swig_type_list_handle = SWIG_Perl_LookupTypePointer(swig_type_list_handle);
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
_init = 1;
|
||||
}
|
||||
|
||||
SWIG_InitializeModule(0);
|
||||
|
||||
/* Install commands */
|
||||
for (i = 0; swig_commands[i].name; i++) {
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@ extern "C" {
|
|||
SWIG_Perl_ConvertPacked(obj, p, s, type, flags)
|
||||
#endif
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Perl_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer)
|
||||
|
||||
/* Perl-specific API */
|
||||
#ifdef PERL_OBJECT
|
||||
# define SWIG_MakePtr(sv, ptr, type, flags) \
|
||||
|
|
@ -166,63 +170,16 @@ extern "C" {
|
|||
# define SWIG_MAYBE_PERL_OBJECT
|
||||
#endif
|
||||
|
||||
static swig_type_info **
|
||||
SWIG_Perl_GetTypeListHandle() {
|
||||
static void *type_pointer = (void *)0;
|
||||
SV *pointer;
|
||||
|
||||
/* first check if pointer already created */
|
||||
if (!type_pointer) {
|
||||
pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
|
||||
if (pointer && SvOK(pointer)) {
|
||||
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
|
||||
}
|
||||
}
|
||||
|
||||
return (swig_type_info **) type_pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
Search for a swig_type_info structure
|
||||
*/
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_Perl_GetTypeList() {
|
||||
swig_type_info **tlh = SWIG_Perl_GetTypeListHandle();
|
||||
return tlh ? *tlh : (swig_type_info*)0;
|
||||
}
|
||||
|
||||
#define SWIG_Runtime_GetTypeList SWIG_Perl_GetTypeList
|
||||
|
||||
static swig_type_info *
|
||||
static swig_cast_info *
|
||||
SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) {
|
||||
swig_type_info *s;
|
||||
if (!ty) return 0; /* Void pointer */
|
||||
s = ty->next; /* First element always just a name */
|
||||
do {
|
||||
if (sv_derived_from(rv, (char *) s->name)) {
|
||||
if (s == ty->next) return s;
|
||||
/* Move s to the top of the linked list */
|
||||
s->prev->next = s->next;
|
||||
if (s->next) {
|
||||
s->next->prev = s->prev;
|
||||
}
|
||||
/* Insert s as second element in the list */
|
||||
s->next = ty->next;
|
||||
if (ty->next) ty->next->prev = s;
|
||||
ty->next = s;
|
||||
s->prev = ty;
|
||||
return s;
|
||||
}
|
||||
s = s->next;
|
||||
} while (s && (s != ty->next));
|
||||
return 0;
|
||||
SWIG_TypeCheck_Template(sv_derived_from(rv, (char *) iter->type->name), ty);
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
static int
|
||||
SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
void *voidptr = (void *)0;
|
||||
|
||||
/* If magical, apply more magic */
|
||||
|
|
@ -332,7 +289,7 @@ static void
|
|||
/* Convert a packed value value */
|
||||
static int
|
||||
SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
const char *c = 0;
|
||||
|
||||
if ((!obj) || (!SvOK(obj))) return -1;
|
||||
|
|
@ -437,6 +394,27 @@ static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (C
|
|||
}
|
||||
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_Perl_GetModule() {
|
||||
static void *type_pointer = (void *)0;
|
||||
SV *pointer;
|
||||
|
||||
/* first check if pointer already created */
|
||||
if (!type_pointer) {
|
||||
pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
|
||||
if (pointer && SvOK(pointer)) {
|
||||
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
|
||||
}
|
||||
}
|
||||
|
||||
return (swig_module_info *) type_pointer;
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_Perl_SetModule(swig_module_info *module) {
|
||||
SV *pointer;
|
||||
|
||||
/* create a new pointer */
|
||||
pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
|
||||
sv_setiv(pointer, PTR2IV(module));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@
|
|||
*/
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg" // common type checking code
|
||||
%runtime "php4run.swg" // Php4 runtime functions
|
||||
%include "utils.i" // building blocks
|
||||
|
||||
%init "swiginit.swg"
|
||||
|
||||
/* Typemaps for input parameters by value */
|
||||
|
||||
%typemap(in) int, unsigned int, unsigned short, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE %{
|
||||
|
|
@ -502,6 +503,11 @@ deliberate error cos this code looks bogus to me
|
|||
|
||||
%apply unsigned long { size_t };
|
||||
|
||||
%init %{
|
||||
SWIG_php_minit {
|
||||
SWIG_InitializeModule(0);
|
||||
%}
|
||||
|
||||
/* php kewords */
|
||||
/* please test and activate */
|
||||
//%include "phpkw.swg"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Standard SWIG API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Php4_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Php4_SetModule(pointer)
|
||||
|
||||
/* used to wrap returned objects in so we know whether they are newobject
|
||||
and need freeing, or not */
|
||||
typedef struct _swig_object_wrapper {
|
||||
|
|
@ -106,7 +110,7 @@ static int
|
|||
SWIG_ConvertPtr_(char *c, void **ptr, swig_type_info *ty) {
|
||||
register int d;
|
||||
unsigned long p;
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
|
||||
if(c == NULL) {
|
||||
*ptr = 0;
|
||||
|
|
@ -161,7 +165,7 @@ type_error:
|
|||
with the type name hard wired in. */
|
||||
static int
|
||||
SWIG_ZTS_ConvertResourceData(void * p, int type, const char *type_name, void **ptr, swig_type_info *ty TSRMLS_DC) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
|
||||
if (ty) {
|
||||
if (! type_name) {
|
||||
|
|
@ -238,3 +242,22 @@ type_error:
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char const_name[] = "swig_runtime_data_type_pointer";
|
||||
static swig_module_info *SWIG_Php4_GetModule() {
|
||||
zval *pointer;
|
||||
swig_module_info *ret = 0;
|
||||
|
||||
MAKE_STD_ZVAL(pointer);
|
||||
|
||||
if (zend_get_constant(const_name, sizeof(const_name), pointer)) {
|
||||
if (pointer->type == IS_LONG) {
|
||||
ret = (swig_module_info *) pointer->value.lval;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SWIG_Php4_SetModule(swig_module_info *pointer) {
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%insert(runtime) "swigrun.swg"; // Common C API type-checking code
|
||||
%insert(runtime) "common.swg"; // Common type-checking code
|
||||
%insert(runtime) "pikerun.swg"; // Pike run-time code
|
||||
|
||||
%insert(runtime) %{
|
||||
|
|
@ -319,6 +318,8 @@ extern "C" {
|
|||
* The start of the Pike initialization function
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%init "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
|
@ -331,10 +332,7 @@ extern "C"
|
|||
PIKE_MODULE_INIT
|
||||
{
|
||||
struct program *pr;
|
||||
int i;
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
SWIG_InitializeModule(0);
|
||||
%}
|
||||
|
||||
/* pike keywords */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ extern "C" {
|
|||
/* Stores information about a wrapped object */
|
||||
typedef struct swig_object_wrapper {
|
||||
void *self;
|
||||
swig_type_info *type;
|
||||
} swig_object_wrapper;
|
||||
|
||||
#ifdef THIS
|
||||
|
|
@ -29,18 +30,34 @@ typedef struct swig_object_wrapper {
|
|||
|
||||
#define SWIG_ConvertPtr SWIG_Pike_ConvertPtr
|
||||
#define SWIG_NewPointerObj SWIG_Pike_NewPointerObj
|
||||
#define SWIG_GetModule(clientdata) SWIG_Pike_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Pike_SetModule(pointer)
|
||||
|
||||
/* These need to be filled in before type sharing between modules will work */
|
||||
static swig_module_info *SWIG_Pike_GetModule() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SWIG_Pike_SetModule(swig_module_info *pointer) {
|
||||
|
||||
}
|
||||
|
||||
/* Convert a pointer value */
|
||||
static int
|
||||
SWIG_Pike_ConvertPtr(struct object *obj, void **ptr, swig_type_info *ty, int flags) {
|
||||
char *storage;
|
||||
struct program *pr;
|
||||
swig_cast_info *tc;
|
||||
swig_object_wrapper *obj_wrapper;
|
||||
|
||||
if (ty) {
|
||||
pr = (struct program *) ty->clientdata;
|
||||
storage = get_storage(obj, pr);
|
||||
if (storage) {
|
||||
*ptr = ((swig_object_wrapper *) storage)->self;
|
||||
return 0;
|
||||
obj_wrapper = (swig_object_wrapper *) get_storage(obj, pr);
|
||||
if (obj_wrapper && obj_wrapper->type) {
|
||||
tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty);
|
||||
if (tc) {
|
||||
*ptr = SWIG_TypeCast(tc, obj_wrapper->self);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* The start of the Python initialization function
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -263,33 +265,6 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
|||
}
|
||||
#endif
|
||||
|
||||
static swig_type_info **
|
||||
SWIG_Python_SetTypeListHandle(swig_type_info **type_list_handle) {
|
||||
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
|
||||
|
||||
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
|
||||
swig_empty_runtime_method_table);
|
||||
PyObject *pointer = PyCObject_FromVoidPtr((void *) type_list_handle, NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
|
||||
}
|
||||
return type_list_handle;
|
||||
}
|
||||
|
||||
static swig_type_info **
|
||||
SWIG_Python_LookupTypePointer(swig_type_info **type_list_handle) {
|
||||
swig_type_info **type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = SWIG_Python_GetTypeListHandle();
|
||||
if (type_pointer) {
|
||||
return type_pointer;
|
||||
} else {
|
||||
/* create a new module and variable */
|
||||
return SWIG_Python_SetTypeListHandle(type_list_handle);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -298,42 +273,22 @@ SWIG_Python_LookupTypePointer(swig_type_info **type_list_handle) {
|
|||
* Partial Init method
|
||||
* -----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void *) SWIG_ReturnGlobalTypeList(void *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) SWIG_init(void) {
|
||||
static PyObject *SWIG_globals = 0;
|
||||
static int typeinit = 0;
|
||||
PyObject *m, *d;
|
||||
int i;
|
||||
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
|
||||
|
||||
/* Fix SwigMethods to carry the callback ptrs when needed */
|
||||
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_types_initial);
|
||||
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
|
||||
|
||||
m = Py_InitModule((char *) SWIG_name, SwigMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
if (!typeinit) {
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
swig_type_list_handle = (swig_type_info **) SWIG_ReturnGlobalTypeList(swig_type_list_handle);
|
||||
#else
|
||||
# ifndef SWIG_STATIC_RUNTIME
|
||||
swig_type_list_handle = SWIG_Python_LookupTypePointer(swig_type_list_handle);
|
||||
# endif
|
||||
#endif
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
typeinit = 1;
|
||||
}
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_InstallConstants(d,swig_const_table);
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
|
||||
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer declarations
|
||||
|
|
@ -522,7 +525,7 @@ SWIG_Python_ArgFail(int argnum)
|
|||
/* Convert a pointer value */
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
const char *c = 0;
|
||||
static PyObject *SWIG_this = 0;
|
||||
int newref = 0;
|
||||
|
|
@ -629,7 +632,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
|
|||
/* Convert a packed value value */
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
const char *c = 0;
|
||||
|
||||
#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON)
|
||||
|
|
@ -720,8 +723,8 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
|||
void *SWIG_ReturnGlobalTypeList(void *);
|
||||
#endif
|
||||
|
||||
SWIGRUNTIME swig_type_info **
|
||||
SWIG_Python_GetTypeListHandle() {
|
||||
SWIGRUNTIME swig_module_info *
|
||||
SWIG_Python_GetModule() {
|
||||
static void *type_pointer = (void *)0;
|
||||
/* first check if module already created */
|
||||
if (!type_pointer) {
|
||||
|
|
@ -736,19 +739,21 @@ SWIG_Python_GetTypeListHandle() {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
return (swig_type_info **) type_pointer;
|
||||
return (swig_module_info *) type_pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
Search for a swig_type_info structure
|
||||
*/
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_Python_GetTypeList() {
|
||||
swig_type_info **tlh = SWIG_Python_GetTypeListHandle();
|
||||
return tlh ? *tlh : (swig_type_info*)0;
|
||||
}
|
||||
static void
|
||||
SWIG_Python_SetModule(swig_module_info *swig_module) {
|
||||
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
|
||||
|
||||
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
|
||||
swig_empty_runtime_method_table);
|
||||
PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
|
||||
}
|
||||
}
|
||||
|
||||
#define SWIG_Runtime_GetTypeList SWIG_Python_GetTypeList
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,5 @@
|
|||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; /* Common C API type-checking code */
|
||||
%insert(runtime) "common.swg"; /* Common type-checking code */
|
||||
%insert(runtime) "pyapi.swg"; /* SWIG/Pyton API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
%runtime "rubyhead.swg"
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg"
|
||||
%runtime "rubydef.swg"
|
||||
|
||||
%insert(initbeforefunc) "swiginit.swg"
|
||||
|
||||
#define %alias %feature("alias")
|
||||
#define %freefunc %feature("freefunc")
|
||||
#define %markfunc %feature("markfunc")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
SWIG_Ruby_NewPointerObj(p, type, flags)
|
||||
#define SWIG_MustGetPtr(p, type, argnum, flags) \
|
||||
SWIG_Ruby_MustGetPtr(p, type, argnum, flags)
|
||||
#define SWIG_GetModule(clientdata) \
|
||||
SWIG_Ruby_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) \
|
||||
SWIG_Ruby_SetModule(pointer)
|
||||
|
||||
/* Ruby-specific SWIG API */
|
||||
|
||||
|
|
@ -36,23 +40,9 @@ static VALUE swig_runtime_data_type_pointer = Qnil;
|
|||
static void
|
||||
SWIG_Ruby_InitRuntime(void)
|
||||
{
|
||||
VALUE pointer;
|
||||
|
||||
if (_mSWIG == Qnil) {
|
||||
_mSWIG = rb_define_module("SWIG");
|
||||
}
|
||||
|
||||
/* first check if pointer already created */
|
||||
pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
if (pointer != Qnil) {
|
||||
Data_Get_Struct(pointer, swig_type_info *, swig_type_list_handle);
|
||||
} else {
|
||||
/* register a new class */
|
||||
VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
|
||||
/* create and store the structure pointer to a global variable */
|
||||
swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, swig_type_list_handle);
|
||||
rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Define Ruby class for C type */
|
||||
|
|
@ -120,7 +110,7 @@ static int
|
|||
SWIG_Ruby_ConvertPtr(VALUE obj, void **ptr, swig_type_info *ty, int flags)
|
||||
{
|
||||
char *c;
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
|
||||
/* Grab the pointer */
|
||||
if (NIL_P(obj)) {
|
||||
|
|
@ -190,7 +180,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
|
|||
/* Convert a packed value value */
|
||||
static void
|
||||
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
const char *c;
|
||||
|
||||
if (TYPE(obj) != T_STRING) goto type_error;
|
||||
|
|
@ -216,6 +206,26 @@ type_error:
|
|||
}
|
||||
}
|
||||
|
||||
static swig_module_info *SWIG_Ruby_GetModule() {
|
||||
VALUE pointer;
|
||||
swig_module_info *ret = 0;
|
||||
|
||||
/* first check if pointer already created */
|
||||
pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
if (pointer != Qnil) {
|
||||
Data_Get_Struct(pointer, swig_module_info, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void SWIG_Ruby_SetModule(swig_module_info *pointer) {
|
||||
/* register a new class */
|
||||
VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
|
||||
/* create and store the structure pointer to a global variable */
|
||||
swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
|
||||
rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,32 +15,32 @@
|
|||
|
||||
* -----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef SWIG_MODULE_CLIENTDATA_TYPE
|
||||
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_Runtime_TypeQuery(const char *name) {
|
||||
swig_type_info *tl = SWIG_Runtime_GetTypeList();
|
||||
return SWIG_TypeQueryTL(tl, name);
|
||||
SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
|
||||
swig_module_info *module = SWIG_Runtime_GetModule(clientdata);
|
||||
return SWIG_TypeQueryModule(module, module, name);
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_Runtime_TypeRegister(swig_type_info *ti) {
|
||||
swig_type_info *tl = SWIG_Runtime_GetTypeList();
|
||||
return SWIG_TypeRegisterTL(&tl, ti);
|
||||
SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
|
||||
swig_module_info *module = SWIG_Runtime_GetModule(clientdata);
|
||||
return SWIG_MangledTypeQueryModule(module, module, name);
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE void
|
||||
SWIG_Runtime_TypeClientData(swig_type_info *ti, void *clientdata) {
|
||||
swig_type_info *tl = SWIG_Runtime_GetTypeList();
|
||||
SWIG_TypeClientDataTL(tl, ti, clientdata);
|
||||
#else
|
||||
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_TypeQuery(const char *name) {
|
||||
swig_module_info *module = SWIG_Runtime_GetModule();
|
||||
return SWIG_TypeQueryModule(module, module, name);
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE void
|
||||
SWIG_Runtime_PropagateClientData(swig_type_info *type) {
|
||||
swig_type_info *tl = SWIG_Runtime_GetTypeList();
|
||||
SWIG_PropagateClientDataTL(tl, type);
|
||||
SWIGRUNTIMEINLINE swig_type_info *
|
||||
SWIG_MangledTypeQuery(const char *name) {
|
||||
swig_module_info *module = SWIG_Runtime_GetModule();
|
||||
return SWIG_MangledTypeQueryModule(module, module, name);
|
||||
}
|
||||
|
||||
#define SWIG_GetTypeList() SWIG_Runtime_GetTypeList()
|
||||
#define SWIG_TypeQuery(name) SWIG_Runtime_TypeQuery(name)
|
||||
#define SWIG_TypeRegister(ti) SWIG_Runtime_TypeRegister(ti)
|
||||
#define SWIG_TypeClientData(ti, cd) SWIG_Runtime_TypeClientData(ti, cd)
|
||||
#define SWIG_PropagateClientData(ti) SWIG_Runtime_PropagateClientData(ti)
|
||||
#endif
|
||||
|
|
|
|||
147
SWIG/Lib/swiginit.swg
Normal file
147
SWIG/Lib/swiginit.swg
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*************************************************************************
|
||||
* Type initialization:
|
||||
* This problem is tough by the requirement that no dynamic
|
||||
* memory is used. Also, since swig_type_info structures store pointers to
|
||||
* swig_cast_info structures and swig_cast_info structures store pointers back
|
||||
* to swig_type_info structures, we need some lookup code at initialization.
|
||||
* The idea is that swig generates all the structures that are needed.
|
||||
* The runtime then collects these partially filled structures.
|
||||
* The SWIG_InitializeModule function takes these initial arrays out of
|
||||
* swig_module, and does all the lookup, filling in the swig_module.types
|
||||
* array with the correct data and linking the correct swig_cast_info
|
||||
* structures together.
|
||||
|
||||
* The generated swig_type_info structures are assigned staticly to an initial
|
||||
* array. We just loop though that array, and handle each type individually.
|
||||
* First we lookup if this type has been already loaded, and if so, use the
|
||||
* loaded structure instead of the generated one. Then we have to fill in the
|
||||
* cast linked list. The cast data is initially stored in something like a
|
||||
* two-dimensional array. Each row corresponds to a type (there are the same
|
||||
* number of rows as there are in the swig_type_initial array). Each entry in
|
||||
* a column is one of the swig_cast_info structures for that type.
|
||||
* The cast_initial array is actually an array of arrays, because each row has
|
||||
* a variable number of columns. So to actually build the cast linked list,
|
||||
* we find the array of casts associated with the type, and loop through it
|
||||
* adding the casts to the list. The one last trick we need to do is making
|
||||
* sure the type pointer in the swig_cast_info struct is correct.
|
||||
|
||||
* First off, we lookup the cast->type name to see if it is already loaded.
|
||||
* There are three cases to handle:
|
||||
* 1) If the cast->type has already been loaded AND the type we are adding
|
||||
* casting info to has not been loaded (it is in this module), THEN we
|
||||
* replace the cast->type pointer with the type pointer that has already
|
||||
* been loaded.
|
||||
* 2) If BOTH types (the one we are adding casting info to, and the
|
||||
* cast->type) are loaded, THEN the cast info has already been loaded by
|
||||
* the previous module so we just ignore it.
|
||||
* 3) Finally, if cast->type has not already been loaded, then we add that
|
||||
* swig_cast_info to the linked list (because the cast->type) pointer will
|
||||
* be correct.
|
||||
**/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_InitializeModule(void *clientdata) {
|
||||
swig_type_info *type, *ret;
|
||||
swig_cast_info *cast;
|
||||
int i;
|
||||
swig_module_info *module_head;
|
||||
static int init_run = 0;
|
||||
|
||||
if (init_run) return;
|
||||
init_run = 1;
|
||||
|
||||
/* Initialize the swig_module */
|
||||
swig_module.type_initial = swig_type_initial;
|
||||
swig_module.cast_initial = swig_cast_initial;
|
||||
|
||||
/* Try and load any already created modules */
|
||||
module_head = SWIG_GetModule(clientdata);
|
||||
if (module_head) {
|
||||
swig_module.next = module_head->next;
|
||||
module_head->next = &swig_module;
|
||||
} else {
|
||||
/* This is the first module loaded */
|
||||
swig_module.next = &swig_module;
|
||||
SWIG_SetModule(clientdata, &swig_module);
|
||||
}
|
||||
|
||||
/* Now work on filling in swig_module.types */
|
||||
for (i = 0; i < swig_module.size; ++i) {
|
||||
type = 0;
|
||||
|
||||
/* if there is another module already loaded */
|
||||
if (swig_module.next != &swig_module) {
|
||||
type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
|
||||
}
|
||||
if (type) {
|
||||
/* Overwrite clientdata field */
|
||||
if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata;
|
||||
} else {
|
||||
type = swig_module.type_initial[i];
|
||||
}
|
||||
|
||||
/* Insert casting types */
|
||||
cast = swig_module.cast_initial[i];
|
||||
while (cast->type) {
|
||||
|
||||
/* Don't need to add information already in the list */
|
||||
ret = 0;
|
||||
if (swig_module.next != &swig_module) {
|
||||
ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
|
||||
}
|
||||
if (ret && type == swig_module.type_initial[i]) {
|
||||
cast->type = ret;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
if (type->cast) {
|
||||
type->cast->prev = cast;
|
||||
cast->next = type->cast;
|
||||
}
|
||||
type->cast = cast;
|
||||
}
|
||||
|
||||
cast++;
|
||||
}
|
||||
|
||||
/* Set entry in modules->types array equal to the type */
|
||||
swig_module.types[i] = type;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function will propagate the clientdata field of type to
|
||||
* any new swig_type_info structures that have been added into the list
|
||||
* of equivalent types. It is like calling
|
||||
* SWIG_TypeClientData(type, clientdata) a second time.
|
||||
*/
|
||||
SWIGRUNTIME void
|
||||
SWIG_PropagateClientData() {
|
||||
int i;
|
||||
swig_cast_info *equiv;
|
||||
static int init_run = 0;
|
||||
|
||||
if (init_run) return;
|
||||
init_run = 1;
|
||||
|
||||
for (i = 0; i < swig_module.size; i++) {
|
||||
if (swig_module.types[i]->clientdata) {
|
||||
equiv = swig_module.types[i]->cast;
|
||||
while (equiv) {
|
||||
if (!equiv->converter) {
|
||||
if (equiv->type && !equiv->type->clientdata)
|
||||
SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
|
||||
}
|
||||
equiv = equiv->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* This should only be incremented when either the layout of swig_type_info changes,
|
||||
or for whatever reason, the runtime changes incompatibly */
|
||||
#define SWIG_RUNTIME_VERSION "1"
|
||||
#define SWIG_RUNTIME_VERSION "2"
|
||||
|
||||
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
|
||||
#ifdef SWIG_TYPE_TABLE
|
||||
|
|
@ -44,6 +44,17 @@
|
|||
#define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if !defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
@ -51,16 +62,36 @@ extern "C" {
|
|||
typedef void *(*swig_converter_func)(void *);
|
||||
typedef struct swig_type_info *(*swig_dycast_func)(void **);
|
||||
|
||||
/* Structure to store inforomation on one type */
|
||||
typedef struct swig_type_info {
|
||||
const char *name;
|
||||
swig_converter_func converter;
|
||||
const char *str;
|
||||
void *clientdata;
|
||||
swig_dycast_func dcast;
|
||||
struct swig_type_info *next;
|
||||
struct swig_type_info *prev;
|
||||
const char *name; /* mangled name of this type */
|
||||
const char *str; /* human readable name of this type */
|
||||
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
|
||||
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
|
||||
void *clientdata; /* language specific type data */
|
||||
} swig_type_info;
|
||||
|
||||
/* Structure to store a type and conversion function used for casting */
|
||||
typedef struct swig_cast_info {
|
||||
swig_type_info *type; /* pointer to type that is equivalent to this type */
|
||||
swig_converter_func converter; /* function to cast the void pointers */
|
||||
struct swig_cast_info *next; /* pointer to next cast in linked list */
|
||||
struct swig_cast_info *prev; /* pointer to the previous cast */
|
||||
} swig_cast_info;
|
||||
|
||||
/* Structure used to store module information
|
||||
* Each module generates one structure like this, and the runtime collects
|
||||
* all of these structures and stores them in a circularly linked list.*/
|
||||
typedef struct swig_module_info {
|
||||
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
|
||||
int size; /* Number of types in this module */
|
||||
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
|
||||
swig_type_info **type_initial; /* Array of initially generated type structures */
|
||||
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
|
||||
void *clientdata; /* Language specific module data */
|
||||
} swig_module_info;
|
||||
|
||||
|
||||
/*
|
||||
Compare two type names skipping the space characters, therefore
|
||||
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
|
||||
|
|
@ -81,6 +112,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
|
|||
|
||||
/*
|
||||
Check type equivalence in a name list like <name1>|<name2>|...
|
||||
Return 0 if not equal, 1 if equal
|
||||
*/
|
||||
SWIGRUNTIME int
|
||||
SWIG_TypeEquiv(const char *nb, const char *tb) {
|
||||
|
|
@ -98,89 +130,70 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|||
}
|
||||
|
||||
/*
|
||||
Register a type mapping with the type-checking
|
||||
Check type equivalence in a name list like <name1>|<name2>|...
|
||||
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_TypeRegisterTL(swig_type_info **tl, swig_type_info *ti) {
|
||||
swig_type_info *tc, *head, *ret, *next;
|
||||
/* Check to see if this type has already been registered */
|
||||
tc = *tl;
|
||||
while (tc) {
|
||||
/* check simple type equivalence */
|
||||
int typeequiv = (strcmp(tc->name, ti->name) == 0);
|
||||
/* check full type equivalence, resolving typedefs */
|
||||
if (!typeequiv) {
|
||||
/* only if tc is not a typedef (no '|' on it) */
|
||||
if (tc->str && ti->str && !strstr(tc->str,"|")) {
|
||||
typeequiv = SWIG_TypeEquiv(ti->str,tc->str);
|
||||
}
|
||||
SWIGRUNTIME int
|
||||
SWIG_TypeCompare(const char *nb, const char *tb) {
|
||||
int equiv = 0;
|
||||
const char* te = tb + strlen(tb);
|
||||
const char* ne = nb;
|
||||
while (!equiv && *ne) {
|
||||
for (nb = ne; *ne; ++ne) {
|
||||
if (*ne == '|') break;
|
||||
}
|
||||
if (typeequiv) {
|
||||
/* Already exists in the table. Just add additional types to the list */
|
||||
if (ti->clientdata) tc->clientdata = ti->clientdata;
|
||||
head = tc;
|
||||
next = tc->next;
|
||||
goto l1;
|
||||
}
|
||||
tc = tc->prev;
|
||||
equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
|
||||
if (*ne) ++ne;
|
||||
}
|
||||
head = ti;
|
||||
next = 0;
|
||||
|
||||
/* Place in list */
|
||||
ti->prev = *tl;
|
||||
*tl = ti;
|
||||
|
||||
/* Build linked lists */
|
||||
l1:
|
||||
ret = head;
|
||||
tc = ti + 1;
|
||||
/* Patch up the rest of the links */
|
||||
while (tc->name) {
|
||||
head->next = tc;
|
||||
tc->prev = head;
|
||||
head = tc;
|
||||
tc++;
|
||||
}
|
||||
if (next) next->prev = head;
|
||||
head->next = next;
|
||||
|
||||
return ret;
|
||||
return equiv;
|
||||
}
|
||||
|
||||
|
||||
/* think of this as a c++ template<> or a scheme macro */
|
||||
#define SWIG_TypeCheck_Template(comparison, ty) \
|
||||
do { \
|
||||
swig_cast_info *iter; \
|
||||
if (!ty) return 0; \
|
||||
iter = ty->cast; \
|
||||
while (iter) { \
|
||||
if (comparison) { \
|
||||
if (iter == ty->cast) return iter; \
|
||||
\
|
||||
/* Move iter to the top of the linked list */ \
|
||||
iter->prev->next = iter->next; \
|
||||
if (iter->next) \
|
||||
iter->next->prev = iter->prev; \
|
||||
iter->next = ty->cast; \
|
||||
iter->prev = 0; \
|
||||
if (ty->cast) ty->cast->prev = iter; \
|
||||
ty->cast = iter; \
|
||||
\
|
||||
return iter; \
|
||||
} \
|
||||
iter = iter->next; \
|
||||
} \
|
||||
return 0; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
Check the typename
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIGRUNTIME swig_cast_info *
|
||||
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
|
||||
swig_type_info *s;
|
||||
if (!ty) return 0; /* Void pointer */
|
||||
s = ty->next; /* First element always just a name */
|
||||
do {
|
||||
if (strcmp(s->name,c) == 0) {
|
||||
if (s == ty->next) return s;
|
||||
/* Move s to the top of the linked list */
|
||||
s->prev->next = s->next;
|
||||
if (s->next) {
|
||||
s->next->prev = s->prev;
|
||||
}
|
||||
/* Insert s as second element in the list */
|
||||
s->next = ty->next;
|
||||
if (ty->next) ty->next->prev = s;
|
||||
ty->next = s;
|
||||
s->prev = ty;
|
||||
return s;
|
||||
}
|
||||
s = s->next;
|
||||
} while (s && (s != ty->next));
|
||||
return 0;
|
||||
SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
|
||||
}
|
||||
|
||||
/* Same as previous function, except strcmp is replaced with a pointer comparison */
|
||||
SWIGRUNTIME swig_cast_info *
|
||||
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
|
||||
SWIG_TypeCheck_Template(iter->type == from, into);
|
||||
}
|
||||
|
||||
/*
|
||||
Cast a pointer up an inheritance hierarchy
|
||||
*/
|
||||
SWIGRUNTIMEINLINE void *
|
||||
SWIG_TypeCast(swig_type_info *ty, void *ptr) {
|
||||
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
|
||||
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
|
||||
}
|
||||
|
||||
|
|
@ -227,43 +240,100 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
|||
return type->name;
|
||||
}
|
||||
|
||||
/*
|
||||
Search for a swig_type_info structure
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_TypeQueryTL(swig_type_info *tl, const char *name) {
|
||||
swig_type_info *ty = tl;
|
||||
while (ty) {
|
||||
if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
|
||||
if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
|
||||
ty = ty->prev;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Set the clientdata field for a type
|
||||
*/
|
||||
SWIGRUNTIME void
|
||||
SWIG_TypeClientDataTL(swig_type_info *tl, swig_type_info *ti, void *clientdata) {
|
||||
swig_type_info *tc, *equiv;
|
||||
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
||||
swig_cast_info *cast;
|
||||
|
||||
if (ti->clientdata) return;
|
||||
/* if (ti->clientdata == clientdata) return; */
|
||||
ti->clientdata = clientdata;
|
||||
equiv = ti->next;
|
||||
while (equiv) {
|
||||
if (!equiv->converter) {
|
||||
tc = tl;
|
||||
while (tc) {
|
||||
if ((strcmp(tc->name, equiv->name) == 0))
|
||||
SWIG_TypeClientDataTL(tl,tc,clientdata);
|
||||
tc = tc->prev;
|
||||
}
|
||||
}
|
||||
equiv = equiv->next;
|
||||
|
||||
cast = ti->cast;
|
||||
while (cast) {
|
||||
if (!cast->converter)
|
||||
SWIG_TypeClientData(cast->type, clientdata);
|
||||
cast = cast->next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Search for a swig_type_info structure only by mangled name
|
||||
Search is a O(log #types)
|
||||
|
||||
We start searching at module start, and finish searching when start == end.
|
||||
Note: if start == end at the beginning of the function, we go all the way around
|
||||
the circular list.
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
||||
swig_module_info *end,
|
||||
const char *name) {
|
||||
swig_module_info *iter;
|
||||
int l, r, i, compare;
|
||||
|
||||
iter = start;
|
||||
do {
|
||||
l = 0;
|
||||
r = iter->size - 1;
|
||||
while (l <= r) {
|
||||
i = (l + r) / 2;
|
||||
|
||||
if (!(iter->types[i]->name)) break; /* should never happen */
|
||||
|
||||
compare = strcmp(name, iter->types[i]->name);
|
||||
if (compare == 0)
|
||||
return iter->types[i];
|
||||
else if (compare < 0)
|
||||
r = i - 1;
|
||||
else if (compare > 0)
|
||||
l = i + 1;
|
||||
}
|
||||
iter = iter->next;
|
||||
} while (iter != end);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Search for a swig_type_info structure for either a mangled name or a human readable name.
|
||||
It first searches the mangled names of the types, which is a O(log #types)
|
||||
If a type is not found it then searches the human readable names, which is O(#types).
|
||||
|
||||
We start searching at module start, and finish searching when start == end.
|
||||
Note: if start == end at the beginning of the function, we go all the way around
|
||||
the circular list.
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_TypeQueryModule(swig_module_info *start,
|
||||
swig_module_info *end,
|
||||
const char *name) {
|
||||
swig_module_info *iter;
|
||||
swig_type_info *ret;
|
||||
int i;
|
||||
|
||||
/* STEP 1: Search the name field using binary search */
|
||||
ret = SWIG_MangledTypeQueryModule(start, end, name);
|
||||
if (ret) return ret;
|
||||
|
||||
/* STEP 2: If the type hasn't been found, do a complete search
|
||||
of the str field (the human readable name) */
|
||||
iter = start;
|
||||
do {
|
||||
for (i = 0; i < iter->size; ++i) {
|
||||
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
|
||||
return iter->types[i];
|
||||
}
|
||||
iter = iter->next;
|
||||
} while (iter != end);
|
||||
|
||||
/* neither found a match */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Pack binary data into a string
|
||||
*/
|
||||
|
|
@ -309,30 +379,6 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
This function will propagate the clientdata field of type to any new
|
||||
swig_type_info structures that have been added into the list of
|
||||
equivalent types. It is like calling SWIG_TypeClientData(type,
|
||||
clientdata) a second time.
|
||||
*/
|
||||
SWIGRUNTIME void
|
||||
SWIG_PropagateClientDataTL(swig_type_info *tl, swig_type_info *type) {
|
||||
swig_type_info *equiv = type->next;
|
||||
swig_type_info *tc;
|
||||
if (!type->clientdata) return;
|
||||
while (equiv) {
|
||||
if (!equiv->converter) {
|
||||
tc = tl;
|
||||
while (tc) {
|
||||
if ((strcmp(tc->name, equiv->name) == 0) && !tc->clientdata)
|
||||
SWIG_TypeClientDataTL(tl,tc, type->clientdata);
|
||||
tc = tc->prev;
|
||||
}
|
||||
}
|
||||
equiv = equiv->next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Pack 'void *' into a string buffer.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ typedef struct swig_class {
|
|||
swig_attribute *attributes;
|
||||
struct swig_class **bases;
|
||||
char **base_names;
|
||||
swig_module_info *module;
|
||||
} swig_class;
|
||||
|
||||
typedef struct swig_instance {
|
||||
|
|
@ -105,22 +106,10 @@ typedef struct swig_instance {
|
|||
#define SWIG_MethodCommand SWIG_Tcl_MethodCommand
|
||||
#define SWIG_ObjectDelete SWIG_Tcl_ObjectDelete
|
||||
|
||||
static void
|
||||
SWIG_Tcl_LookupTypePointer(Tcl_Interp *interp) {
|
||||
char buf[512];
|
||||
char *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
data = (char *) Tcl_GetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TCL_GLOBAL_ONLY);
|
||||
if (data) {
|
||||
SWIG_UnpackData(data, &swig_type_list_handle, sizeof(swig_type_info **));
|
||||
} else {
|
||||
/* create a new pointer */
|
||||
data = SWIG_PackData(buf, &swig_type_list_handle, sizeof(swig_type_info **));
|
||||
*data = 0;
|
||||
Tcl_SetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
|
||||
}
|
||||
}
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Tcl_GetModule((Tcl_Interp *) (clientdata))
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Tcl_SetModule((Tcl_Interp *) (clientdata), pointer)
|
||||
#define SWIG_MODULE_CLIENTDATA_TYPE Tcl_Interp *
|
||||
|
||||
/* Object support */
|
||||
static Tcl_HashTable swigobjectTable;
|
||||
|
|
@ -163,7 +152,7 @@ SWIG_Tcl_Thisown(void *ptr) {
|
|||
/* Convert a pointer value */
|
||||
static int
|
||||
SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
/* Pointer values must start with leading underscore */
|
||||
while (*c != '_') {
|
||||
*ptr = (void *) 0;
|
||||
|
|
@ -225,7 +214,7 @@ SWIG_Tcl_PointerTypeFromString(char *c) {
|
|||
/* Convert a packed value value */
|
||||
static int
|
||||
SWIG_Tcl_ConvertPacked(Tcl_Interp *interp, Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
swig_cast_info *tc;
|
||||
const char *c;
|
||||
|
||||
if (!obj) goto type_error;
|
||||
|
|
@ -505,7 +494,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
|
|||
if (bi != -1) {
|
||||
if (!cls->bases[bi] && cls->base_names[bi]) {
|
||||
/* lookup and cache the base class */
|
||||
swig_type_info *info = SWIG_TypeQuery(cls->base_names[bi]);
|
||||
swig_type_info *info = SWIG_TypeQueryModule(cls->module, cls->module, cls->base_names[bi]);
|
||||
if (info) cls->bases[bi] = (swig_class *) info->clientdata;
|
||||
}
|
||||
cls = cls->bases[bi];
|
||||
|
|
@ -750,6 +739,31 @@ typedef struct {
|
|||
|
||||
#define SWIG_contract_assert(expr, msg) if (!(expr)) { Tcl_SetResult(interp, (char *) msg, TCL_STATIC ); goto fail; } else
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_Tcl_GetModule(Tcl_Interp *interp) {
|
||||
char *data;
|
||||
swig_module_info *ret = 0;
|
||||
|
||||
/* first check if pointer already created */
|
||||
data = (char *) Tcl_GetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TCL_GLOBAL_ONLY);
|
||||
if (data) {
|
||||
SWIG_UnpackData(data, &ret, sizeof(swig_type_info **));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_Tcl_SetModule(Tcl_Interp *interp, swig_module_info *module) {
|
||||
char buf[512];
|
||||
char *data;
|
||||
|
||||
/* create a new pointer */
|
||||
data = SWIG_PackData(buf, &module, sizeof(swig_type_info **));
|
||||
*data = 0;
|
||||
Tcl_SetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "common.swg"
|
||||
%runtime "swigtcl8.swg"
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -632,10 +631,11 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *);
|
|||
|
||||
/* Start the initialization function */
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) {
|
||||
int i;
|
||||
static int _init = 0;
|
||||
if (interp == 0) return TCL_ERROR;
|
||||
#ifdef USE_TCL_STUBS
|
||||
if (Tcl_InitStubs(interp, (char*)"8.1", 0) == NULL) {
|
||||
|
|
@ -648,16 +648,10 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) {
|
|||
#ifdef SWIG_namespace
|
||||
Tcl_Eval(interp, "namespace eval " SWIG_namespace " { }");
|
||||
#endif
|
||||
if (!_init) {
|
||||
SWIG_Tcl_LookupTypePointer(interp);
|
||||
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]);
|
||||
}
|
||||
_init = 1;
|
||||
}
|
||||
|
||||
SWIG_InitializeModule((void *) interp);
|
||||
SWIG_PropagateClientData();
|
||||
|
||||
for (i = 0; swig_commands[i].name; i++) {
|
||||
Tcl_CreateObjCommand(interp, (char *) swig_commands[i].name, (swig_wrapper_func) swig_commands[i].wrapper, swig_commands[i].clientdata, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue