# This is a cumulative patch consisting of:
#
# list_sort.patch
# common-types.patch
# doc.patch
# python.patch
# perl.patch
# tcl.patch
# guile-scm.patch
# mzscheme.patch
# chicken.patch
# ocaml.patch
# ruby.patch
# php4.patch
# pike.patch
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#
--- /dev/null
+++ SWIG/Doc/Devel/runtime.txt
@@ -0,0 +1,152 @@
+This file describes the necissary functions and interfaces a language module
+needs to implement to take advantage of the run time type system. I assume you
+have read the run-time section of the Typemaps chapter in the SWIG
+documentation.
+
+Last updated: January 23, 2005
+
+The file we are concerned with here should be named langrun.swg. A good example
+of a simple file is the Lib/mzscheme/mzrun.swg file. First, a few requirements
+and notes:
+
+1) Every function in this file should be declared static.
+
+2) It should be inserted into the runtime section of the _wrap file from your
+config file. The Lib/swigrun.swg file should be included before this file.
+That is, you need to have
+%runtime "swigrun.swg"
+%runtime "langrun.swg"
+
+3) You must also include the swiginit.swg file in the init section of the
+wrapper. That is, you should have
+%insert(init) "swiginit.swg"
+
+4) From module.cxx, you need to call the SwigType_emit_type_table function, as
+well as register types with SwigType_remember or SwigType_remember_clientdata
+
+5) By convention, all functions in this file are of the form
+SWIG_Language_Whatever, and #defines are used to rename SWIG API functions to
+these function names
+
+6) You need to call void SWIG_InitializeModule(void *clientdata) from your init
+function.
+
+-------------------------------------------------------------------------------
+Required Functions
+-------------------------------------------------------------------------------
+swig_module_info *SWIG_GetModule(void *clientdata);
+void SWIG_SetModule(void *clientdata, swig_module_info *mod);
+
+The SetModule function should store the mod argument into some globally
+accessable variable in the target language. The action of these two functions
+is to provide a way for multiple modules to share information. The SetModule
+function should create a new global var named something like
+"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME
+SWIG_RUNTIME_VERSION is currently defined as "2", and SWIG_TYPE_TABLE_NAME is
+defined by the -DSWIG_TYPE_TABLE=mytable option when compiling the wrapper.
+
+Alternativly, if the language supports modules, a module named
+"swig_runtime_data" SWIG_RUNTIME_VERSION can be created, and a global variable
+named "type_table" SWIG_TYPE_TABLE_NAME can be created inside it. The most
+common approach is to store the mod pointer in some global variable in the
+target language, but if the language provides an alternative place to store data
+(like the chicken module), then that is good too.
+
+The way the code is set up, SetModule should only be called when GetModule
+returns NULL, and if SetModule is called a second time, the behavior is
+undefined. Just make sure it doesn't crash in the random chance occurance that
+SetModule is called twice.
+
+There are two options here.
+
+1) The perferred approach is for GetModule and SetModule to not require a
+clientdata pointer. If you can at all avoid it, please do so. Here, you would
+write swig_module_info *SWIG_Language_GetModule();
+void SWIG_Language_SetModule(swig_module_info *mod);
+and then add
+#define SWIG_GetModule(clientdata) SWIG_Language_GetModule()
+#define SWIG_SetModule(cd, ptr) SWIG_Language_SetModule(ptr)
+You would then call
+SWIG_InitializeModule(0)
+
+2) If GetModule and SetModule need to take a custom pointer (most notably an
+environment pointer, see tcl or mzscheme), then you should write
+swig_module_info *SWIG_Language_GetModule(void *clientdata)
+void SWIG_Langauge_SetModule(void *clientdata, swig_module_info *mod);
+and also define
+#define SWIG_GetModule(cd) SWIG_Langauge_GetModule(cd)
+#define SWIG_SetModule(cd, ptr) SWIG_Language_SetModule(cd, ptr)
+#define SWIG_MODULE_CLIENTDATA_TYPE Whatever
+SWIG_MODULE_CLIENTDATA_TYPE should be defined to whatever the type of
+clientdata is.
+
+You would then call SWIG_InitializeModule(clientdata), and clientdata would get
+passed to GetModule and SetModule. clientdata will not be stored and will only
+be referenced during the InitializeModule call. After InitializeModule returns,
+clientdata does not need to be valid any more.
+
+This method is not preferred, because it makes external access to the type
+system more complicated. See the Modules chapter of the documentation, and read
+the "External access to the run-time" section. Then take a look at
+Lib/runtime.swg. Anybody that calls SWIG_TypeQuery needs to pass along the
+clientdata pointer, and that is the reason for defining
+SWIG_MODULE_CLIENTDATA_TYPE.
+
+-------------------------------------------------------------------------------
+Standard Functions
+-------------------------------------------------------------------------------
+These functions are not required and their API is not formalized, but almost all
+language modules implement them for consistancy across languages. Throughout
+this discussion, I will use LangType to represent the underlying language type
+(C_word in chicken, Scheme_Object * in mzscheme, PyObject * in python, etc)
+
+
+
+LangObj SWIG_NewPointerObj(void *ptr, swig_type_info *type, int flags);
+Create and return a new pointer object that has both ptr and type. For almost
+all language modules, flags is used for ownership. If flags==1, then the
+created pointer should be registered to be garbage collected.
+
+
+
+int SWIG_ConvertPtr(LangType obj, void **result, swig_type_info *type, int flags);
+Convert a language wrapped pointer into a void *. The pointer is returned in
+result, and the function should return 0 on success, non-zero on error.
+A sample ConvertPtr is given here:
+
+ swig_cast_info *cast;
+
+ if () {
+ cast = SWIG_TypeCheck(, type);
+ cast = SWIG_TypeCheckStruct(, type);
+ if (cast) {
+ *result = SWIG_TypeCast(cast, );
+ return 0;
+ }
+ }
+ return 1;
+
+Either TypeCheck or TypeCheckStruct can be called, depending on how the pointer
+is wrapped in langtype. If obj stores the void pointer and the type name, then
+the TypeCheck function should be used, while if obj stores the void pointer and
+a pointer to the swig_type_info structure, then the TypeCheckStruct function
+should be called. The TypeCheckStruct is slightly faster, since it does a
+pointer comparison instead of a strcmp.
+
+
+
+void *SWIG_MustGetPtr(LangType obj, swig_type_info *type, int flags,
+ int argnum, const char *func_name) {
+ void *result;
+ if (SWIG_ConvertPtr(s, &result, type, flags)) {
+ generate runtime type error ("Error in func_name, expected a" +
+ type->str ? type->str : "void *" +
+ "at argument number" + argnum);
+ }
+ return result;
+}
+This function is optional, and the number and type of parameters can be
+different, but is useful for typemap purposes:
+%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
+ $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 0, $argnum, FUNC_NAME);
+}
--- SWIG/Doc/Manual/Modules.html~doc
+++ SWIG/Doc/Manual/Modules.html
@@ -9,9 +9,10 @@
@@ -68,7 +69,52 @@
languages provide. One solution is to load all modules before spawning any threads.
-15.2 A word of caution about static libraries
+15.2 External access to the run-time system
+
+As described in The run-time type checker,
+the functions SWIG_TypeQuery, SWIG_NewPointerObj, and others sometimes need
+to be called. Calling these functions from a typemap is supported, since the typemap code
+is embedded into the _wrap.c file, which has those declerations available. If you need
+to call the SWIG run-time functions from another C file, there are three headers you need
+to include. They are located in the Lib directory in the SWIG source, or wherever the
+SWIG Library was installed. You can see the current library path by running
+swig -swiglib.
+
+
+#include <swigrun.swg>
+#include <python/pyrun.swg> /* Or other header, see below */
+#include <runtime.swg>
+
+
+After including these three headers, your code should be able to call SWIG_TypeQuery,
+SWIG_NewPointerObj, SWIG_ConvertPtr and others. The exact argument paramaters
+for these functions might differ between language modules; please check the language module chapters
+for more information.
+
+Inside these headers the functions are declared static and are included inline into the file,
+and thus the file does not need to be linked against any SWIG libraries or code (you might still
+need to link against the language libraries like libpython-2.3). Data is shared between this
+file and the _wrap.c files through a global variable in the wrapping language. It is also
+possible to copy these three header files into your own package for distribution along with
+the generated wrapper files, so that you can distribute a package that can be compiled
+without SWIG installed (this works because the header files are self contained, and do not
+need to link with anything).
+
+The headers that should be included in place of the #include <python/pyrun.swg>
+for the different language modules are:
+
+- Chicken - <chicken/chickenrun.swg>
+- Guile (scm) - <guile/guile_scm_run.swg>
+- Guile (gh) - This does not work with the -gh API, use the -scm API
+- MzScheme - <mzscheme/mzrun.swg>
+- Ocaml - <ocaml/ocaml.swg>
+- Python - <python/pyrun.swg>
+- Perl5 - <perl5/perlrun.swg>
+- Ruby - <ruby/rubydef.swg>
+- Tcl - <tcl/swigtcl8.swg>
+
+
+15.3 A word of caution about static libraries
When working with multiple SWIG modules, you should take care not to use static
@@ -77,13 +123,13 @@
into it. This is very often NOT what you want and it can lead to unexpected or bizarre program
behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libaries.
-15.3 References
+15.4 References
Due to the complexity of working with shared libraries and multiple modules, it might be a good idea to consult
an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
-15.4 Reducing the wrapper file size
+15.5 Reducing the wrapper file size
--- SWIG/Doc/Manual/Typemaps.html~doc
+++ SWIG/Doc/Manual/Typemaps.html
@@ -2540,6 +2540,24 @@
10.8 The run-time type checker
+Most scripting languages need type information at run-time. This type information
+can include how to construct types, how to garbage collect types, and the inheritance
+relationships between types. If the language interface does not provide its own type
+information storage, the generated SWIG code needs to provide it.
+
+Requirements for the type system:
+Store inheritance and type equivalence information and be able to correctly
+re-create the type pointer.
+Share type information between modules.
+Modules can be loaded in any order, irregardless of actual type
+dependency.
+Avoid the use of dynamically allocated memory, and library/system calls in general.
+Provide a reasonably fast implementation, minimizing the lookup time for all
+language modules.
+Custom, language specific information can be attached to types.
+Modules can be unloaded from the type system.
+
+8.8.1 Implementation
The run-time type checker is used by many, but not all, of SWIG's supported target languages.
@@ -2628,7 +2646,90 @@
function depends on the target language (see language specific chapters for details).
-When pointers are converted in a typemap, the typemap code often looks
+The actual type code is in swigrun.swg, and gets inserted near the top of the generated
+swig wrapper file. The phrase "a type X that can cast into a type Y" means
+that given a type X, it can be converted into a type Y. In other words, X is a derived
+class of Y or X is a typedef of Y. The structure to store type information looks like this:
+
+
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name for 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;
+
+
+
+Each swig_type_info stores a linked list of types that it is equivalent to. Each entry in this
+doubly linked list stores a pointer back to another swig_type_info structure,
+along with a pointer to a conversion function. This conversion function is used
+to solve the above problem of the FooBar class, correctly returning a pointer to
+the type we want.
+
+
+The basic problem we need to solve is verifying and building arguments passed to functions.
+So going back to the SWIG_ConvertPtr() function example from above, we are
+expecting a Foo * and need to
+check if obj0 is in fact a Foo *. From before, SWIGTYPE_p_Foo is just
+a pointer to the swig_type_info structure describing Foo *. So we loop though the
+linked list of swig_cast_info structures attached to SWIGTYPE_p_Foo. If we see that the type of obj0 is in the
+linked list, we pass the object through the associated conversion function and
+then return a positive. If we reach the end of the linked list without a match,
+then obj0 can not be converted to a Foo * and an error is generated.
+
+
+Another issue needing to be addressed is sharing type information between multiple modules.
+More explicitly, we need
+to have ONE swig_type_info for each type. If two modules both use the type, the
+second module loaded must lookup and use the swig_type_info structure from the module already loaded.
+Because no dynamic memory is used and the circular dependencies of the
+casting information, loading the type information is somewhat tricky, and not explained here.
+A complete description is in the common.swg file (and near the top of any generated file).
+
+Each module has one swig_module_info structure which looks like this:
+
+
+
+/* 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;
+
+
+
+Each module stores an array of pointers to swig_type_info structures and the number of
+types in this module. So when a second module is loaded, it finds the swig_module_info
+structure for the first module and searches the array of types. If any of its own
+types are in the first module and have already been loaded, it uses those swig_type_info
+structures rather than creating new ones. These swig_module_info
+structures are chained together in a circularly linked list.
+
+8.8.2 Usage
+This section covers how to use these functions from typemaps. To learn how to
+call these functions from external files (not the generated _wrap.c file), see
+the External access to the run-time system
+section.
+
+When pointers are converted in a typemap, the typemap code often looks
similar to this:
--- SWIG/Lib/chicken/chicken.swg~chicken
+++ SWIG/Lib/chicken/chicken.swg
@@ -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 @@
%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 @@
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));
--- SWIG/Lib/chicken/chickenrun.swg~chicken
+++ SWIG/Lib/chicken/chickenrun.swg
@@ -28,6 +28,10 @@
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 @@
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 @@
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 @@
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
--- SWIG/Lib/common.swg
+++ /dev/null
@@ -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
--- SWIG/Lib/guile/guile_scm.swg~guile-scm
+++ SWIG/Lib/guile/guile_scm.swg
@@ -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 @@
%}
-%init %{
- static int _swig_init = 0;
-
- SWIG_Guile_Init();
+%insert(init) "swiginit.swg"
- 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;
- }
+%init %{
+SWIG_GUILE_INIT_STATIC void
+SWIG_init(void)
+{
+ SWIG_InitializeModule(0);
+ SWIG_PropagateClientData();
%}
--- SWIG/Lib/guile/guile_scm_run.swg~guile-scm
+++ SWIG/Lib/guile/guile_scm_run.swg
@@ -47,6 +47,10 @@
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 @@
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 @@
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 @@
}
}
-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 @@
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 @@
#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
--- SWIG/Lib/mzscheme/mzrun.swg~mzscheme
+++ SWIG/Lib/mzscheme/mzrun.swg
@@ -23,6 +23,11 @@
#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,43 +44,9 @@
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;
if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type)
@@ -102,7 +73,7 @@
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 @@
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
--- SWIG/Lib/mzscheme/mzscheme.swg~mzscheme
+++ SWIG/Lib/mzscheme/mzscheme.swg
@@ -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"
+%insert(init) "swiginit.swg"
+
%init %{
- static int _swig_init = 0;
+Scheme_Object *scheme_reload(Scheme_Env *env) {
+ Scheme_Env *menv = SWIG_MZSCHEME_CREATE_MENV(env);
- 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;
- }
+ SWIG_InitializeModule((void *) env);
%}
--- SWIG/Lib/ocaml/ocaml.i~ocaml
+++ SWIG/Lib/ocaml/ocaml.i
@@ -5,12 +5,12 @@
/* 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) %{
--- SWIG/Lib/ocaml/ocaml.swg~ocaml
+++ SWIG/Lib/ocaml/ocaml.swg
@@ -58,8 +58,8 @@
*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 : "" );
@@ -371,11 +371,12 @@
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 @@
}
}
- 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
--- SWIG/Lib/ocaml/ocamldec.swg~ocaml
+++ SWIG/Lib/ocaml/ocamldec.swg
@@ -89,6 +89,8 @@
#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
--- SWIG/Lib/ocaml/swig.ml~ocaml
+++ SWIG/Lib/ocaml/swig.ml
@@ -143,16 +143,14 @@
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 =
--- SWIG/Lib/ocaml/typeregister.swg~ocaml
+++ SWIG/Lib/ocaml/typeregister.swg
@@ -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);
--- SWIG/Lib/perl5/perl5.swg~perl
+++ SWIG/Lib/perl5/perl5.swg
@@ -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
--- SWIG/Lib/perl5/perlinit.swg~perl
+++ SWIG/Lib/perl5/perlinit.swg
@@ -17,31 +17,9 @@
/* Module initialization function */
-%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;
- }
-}
+%insert(init) "swiginit.swg"
+%init %{
#ifdef __cplusplus
extern "C"
@@ -50,14 +28,8 @@
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++) {
--- SWIG/Lib/perl5/perlrun.swg~perl
+++ SWIG/Lib/perl5/perlrun.swg
@@ -142,6 +142,10 @@
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 @@
# 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 @@
/* 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 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));
+}
--- SWIG/Lib/php4/php4.swg~php4
+++ SWIG/Lib/php4/php4.swg
@@ -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 @@
%apply unsigned long { size_t };
+%init %{
+ SWIG_php_minit {
+ SWIG_InitializeModule(0);
+%}
+
/* php kewords */
/* please test and activate */
//%include "phpkw.swg"
--- SWIG/Lib/php4/php4run.swg~php4
+++ SWIG/Lib/php4/php4run.swg
@@ -31,6 +31,10 @@
}
#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 @@
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 @@
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 @@
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);
+}
--- SWIG/Lib/pike/pike.swg~pike
+++ SWIG/Lib/pike/pike.swg
@@ -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 @@
* The start of the Pike initialization function
* ------------------------------------------------------------ */
+%init "swiginit.swg"
+
%init %{
#ifdef __cplusplus
extern "C"
@@ -331,10 +332,7 @@
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 */
--- SWIG/Lib/pike/pikerun.swg~pike
+++ SWIG/Lib/pike/pikerun.swg
@@ -20,6 +20,7 @@
/* 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 @@
#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;
--- SWIG/Lib/python/pyinit.swg~python
+++ SWIG/Lib/python/pyinit.swg
@@ -2,6 +2,8 @@
* The start of the Python initialization function
* ------------------------------------------------------------ */
+%insert(init) "swiginit.swg"
+
%init %{
#ifdef __cplusplus
@@ -263,33 +265,6 @@
}
#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 @@
* 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);
%}
--- SWIG/Lib/python/pyrun.swg~python
+++ SWIG/Lib/python/pyrun.swg
@@ -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 @@
/* 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 @@
/* 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 @@
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 @@
}
}
#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
}
--- SWIG/Lib/python/pyruntime.swg~python
+++ SWIG/Lib/python/pyruntime.swg
@@ -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 */
--- SWIG/Lib/ruby/ruby.swg~ruby
+++ SWIG/Lib/ruby/ruby.swg
@@ -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")
--- SWIG/Lib/ruby/rubydef.swg~ruby
+++ SWIG/Lib/ruby/rubydef.swg
@@ -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 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 @@
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 @@
/* 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 @@
}
}
+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
--- SWIG/Lib/runtime.swg~common-types
+++ SWIG/Lib/runtime.swg
@@ -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
--- /dev/null
+++ SWIG/Lib/swiginit.swg
@@ -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
--- SWIG/Lib/swigrun.swg~common-types
+++ SWIG/Lib/swigrun.swg
@@ -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 @@
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" == "Class", etc.
@@ -81,6 +112,7 @@
/*
Check type equivalence in a name list like ||...
+ Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
@@ -98,89 +130,70 @@
}
/*
- Register a type mapping with the type-checking
+ Check type equivalence in a name list like ||...
+ 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);
- }
- }
- 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;
+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;
}
- tc = tc->prev;
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
+ if (*ne) ++ne;
}
- head = ti;
- next = 0;
+ return equiv;
+}
- /* 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;
-}
+/* 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 @@
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 @@
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.
*/
--- SWIG/Lib/tcl/swigtcl8.swg~tcl
+++ SWIG/Lib/tcl/swigtcl8.swg
@@ -64,6 +64,7 @@
swig_attribute *attributes;
struct swig_class **bases;
char **base_names;
+ swig_module_info *module;
} swig_class;
typedef struct swig_instance {
@@ -105,22 +106,10 @@
#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 @@
/* 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 @@
/* 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 @@
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 @@
#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
--- SWIG/Lib/tcl/tcl8.swg~tcl
+++ SWIG/Lib/tcl/tcl8.swg
@@ -5,7 +5,6 @@
* ----------------------------------------------------------------------------- */
%runtime "swigrun.swg" // Common C API type-checking code
-%runtime "common.swg"
%runtime "swigtcl8.swg"
/* -----------------------------------------------------------------------------
@@ -632,10 +631,11 @@
/* 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 @@
#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);
}
--- SWIG/Source/DOH/doh.h~list_sort
+++ SWIG/Source/DOH/doh.h
@@ -292,6 +292,7 @@
* ----------------------------------------------------------------------------- */
extern DOHList *DohNewList();
+extern void DohSortList(DOH *lo, int (*cmp)(DOH *, DOH *));
/* -----------------------------------------------------------------------------
* Hash
@@ -388,6 +389,7 @@
#define First DohFirst
#define Next DohNext
#define Iterator DohIterator
+#define SortList DohSortList
#endif
#ifdef NIL
--- SWIG/Source/DOH/list.c~list_sort
+++ SWIG/Source/DOH/list.c
@@ -361,3 +361,18 @@
return DohObjMalloc(&DohListType,l);
}
+static int (*List_sort_compare_func)(DOH *, DOH *);
+static int List_qsort_compare(const void *a, const void *b) {
+ return List_sort_compare_func(*((DOH **)a), *((DOH **)b));
+}
+
+/* Sort a list */
+void DohSortList(DOH *lo, int (*cmp)(DOH *, DOH *)) {
+ List *l = (List *) ObjData(lo);
+ if (cmp) {
+ List_sort_compare_func = cmp;
+ } else {
+ List_sort_compare_func = DohCmp;
+ }
+ qsort(l->items, l->nitems, sizeof(DOH *), List_qsort_compare);
+}
--- SWIG/Source/Modules/guile.cxx~guile-scm
+++ SWIG/Source/Modules/guile.cxx
@@ -377,12 +377,12 @@
/* Simple linkage; we have to export the SWIG_init function. The user can
rename the function by a #define. */
Printf (f_runtime, "extern void\nSWIG_init (void)\n;\n");
- Printf (f_init, "extern void\nSWIG_init (void)\n{\n");
+ Printf (f_init, "#define SWIG_GUILE_INIT_STATIC static\n");
break;
default:
/* Other linkage; we make the SWIG_init function static */
Printf (f_runtime, "static void\nSWIG_init (void)\n;\n");
- Printf (f_init, "static void\nSWIG_init (void)\n{\n");
+ Printf (f_init, "#define SWIG_GUILE_INIT_STATIC extern\n");
break;
}
if (CPlusPlus) {
--- SWIG/Source/Modules/mzscheme.cxx~mzscheme
+++ SWIG/Source/Modules/mzscheme.cxx
@@ -155,30 +155,28 @@
SwigType_emit_type_table (f_runtime, f_wrappers);
if (!noinit) {
- Printf(f_init, "Scheme_Object *scheme_reload(Scheme_Env *env) {\n");
- if (declaremodule) {
- Printf(f_init, "\tScheme_Env *menv = scheme_primitive_module(scheme_intern_symbol(\"%s\"), env);\n", module);
- }
- else {
- Printf(f_init, "\tScheme_Env *menv = env;\n");
- }
- Printf(f_init, "%s\n", Char(init_func_def));
- if (declaremodule) {
- Printf(f_init, "\tscheme_finish_primitive_module(menv);\n");
- }
- Printf (f_init, "\treturn scheme_void;\n}\n");
- Printf(f_init, "Scheme_Object *scheme_initialize(Scheme_Env *env) {\n");
- Printf(f_init, "\treturn scheme_reload(env);\n");
- Printf (f_init, "}\n");
+ if (declaremodule) {
+ Printf(f_init, "#define SWIG_MZSCHEME_CREATE_MENV(env) scheme_primitive_module(scheme_intern_symbol(\"%s\"), env)\n", module);
+ }
+ else {
+ Printf(f_init,"#define SWIG_MZSCHEME_CREATE_MENV(env) (env)\n");
+ }
+ Printf(f_init, "%s\n", Char(init_func_def));
+ if (declaremodule) {
+ Printf(f_init, "\tscheme_finish_primitive_module(menv);\n");
+ }
+ Printf (f_init, "\treturn scheme_void;\n}\n");
+ Printf(f_init, "Scheme_Object *scheme_initialize(Scheme_Env *env) {\n");
+ Printf(f_init, "\treturn scheme_reload(env);\n");
+ Printf (f_init, "}\n");
- Printf(f_init,"Scheme_Object *scheme_module_name(void) {\n");
- if (declaremodule) {
- Printf(f_init, " return scheme_intern_symbol((char*)\"%s\");\n", module);
- }
- else {
- Printf(f_init," return scheme_make_symbol((char*)\"%s\");\n", module);
- }
- Printf(f_init,"}\n");
+ Printf(f_init,"Scheme_Object *scheme_module_name(void) {\n");
+ if (declaremodule) {
+ Printf(f_init, " return scheme_intern_symbol((char*)\"%s\");\n", module);
+ } else {
+ Printf(f_init," return scheme_make_symbol((char*)\"%s\");\n", module);
+ }
+ Printf(f_init,"}\n");
}
/* Close all of the files */
--- SWIG/Source/Modules/ocaml.cxx~ocaml
+++ SWIG/Source/Modules/ocaml.cxx
@@ -337,7 +337,7 @@
Printf( f_mlibody,
"val int_to_enum : c_enum_type -> int -> c_obj\n" );
Printf( f_init,
- "SWIGEXT void f_%s_init() {\n"
+ "#define SWIG_init f_%s_init\n"
"%s"
"}\n",
module, init_func_def );
--- SWIG/Source/Modules/php4.cxx~php4
+++ SWIG/Source/Modules/php4.cxx
@@ -733,12 +733,8 @@
* things are being called in the wrong order
*/
- Printf(s_init,"PHP_MINIT_FUNCTION(%s)\n{\n", module);
- Printf(s_init,
- " int i;\n"
- " for (i = 0; swig_types_initial[i]; i++) {\n"
- " swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);\n"
- " }\n");
+ Printf(s_init,"#define SWIG_php_minit PHP_MINIT_FUNCTION(%s)\n", module);
+
/* Emit all of the code */
Language::top(n);
--- SWIG/Source/Modules/ruby.cxx~ruby
+++ SWIG/Source/Modules/ruby.cxx
@@ -147,6 +147,7 @@
File *f_header;
File *f_wrappers;
File *f_init;
+ File *f_initbeforefunc;
bool useGlobalModule;
bool multipleInheritance;
@@ -185,6 +186,7 @@
f_header = 0;
f_wrappers = 0;
f_init = 0;
+ f_initbeforefunc = 0;
useGlobalModule = false;
multipleInheritance = false;
director_prot_ctor_code = NewString("");
@@ -391,6 +393,7 @@
f_wrappers = NewString("");
f_directors_h = NewString("");
f_directors = NewString("");
+ f_initbeforefunc = NewString("");
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header",f_header);
@@ -399,6 +402,7 @@
Swig_register_filebyname("init",f_init);
Swig_register_filebyname("director",f_directors);
Swig_register_filebyname("director_h",f_directors_h);
+ Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
modvar = 0;
current = NO_CPP;
@@ -457,9 +461,9 @@
Printv(f_init,
"\n",
- "for (i = 0; swig_types_initial[i]; i++) {\n",
- "swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);\n",
- "SWIG_define_class(swig_types[i]);\n",
+ "SWIG_InitializeModule(0);\n",
+ "for (i = 0; i < swig_module.size; i++) {\n",
+ "SWIG_define_class(swig_module.types[i]);\n",
"}\n",
NIL);
Printf(f_init,"\n");
@@ -482,11 +486,13 @@
}
Dump(f_wrappers,f_runtime);
+ Dump(f_initbeforefunc, f_runtime);
Wrapper_pretty_print(f_init,f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
+ Delete(f_initbeforefunc);
Close(f_runtime);
Delete(f_runtime);
--- SWIG/Source/Modules/tcl8.cxx~tcl
+++ SWIG/Source/Modules/tcl8.cxx
@@ -896,7 +896,7 @@
Delete(base_class);
Delete(base_class_names);
- Printv(f_wrappers, "swig_class _wrap_class_", mangled_classname, " = { \"", class_name,
+ Printv(f_wrappers, "static swig_class _wrap_class_", mangled_classname, " = { \"", class_name,
"\", &SWIGTYPE", SwigType_manglestr(t), ",",NIL);
if (have_constructor) {
@@ -912,7 +912,7 @@
Printf(f_wrappers,",0");
}
Printv(f_wrappers, ", swig_", mangled_classname, "_methods, swig_", mangled_classname, "_attributes, swig_", mangled_classname,"_bases,",
- "swig_", mangled_classname, "_base_names };\n", NIL);
+ "swig_", mangled_classname, "_base_names, &swig_module };\n", NIL);
if( !itcl ) {
Printv(cmd_tab, tab4, "{ SWIG_prefix \"", class_name, "\", (swig_wrapper_func) SWIG_ObjectConstructor, &_wrap_class_", mangled_classname, "},\n", NIL);
--- SWIG/Source/Swig/typesys.c~common-types
+++ SWIG/Source/Swig/typesys.c
@@ -1745,6 +1745,24 @@
}
}
+/* Helper function to sort the mangled list */
+static int SwigType_compare_mangled(DOH *a, DOH *b) {
+ return strcmp(DohData(a), DohData(b));
+}
+
+/* -----------------------------------------------------------------------------
+ * SwigType_get_sorted_mangled_list()
+ *
+ * Returns the sorted list of mangled type names that should be exported into the
+ * wrapper file.
+ * ----------------------------------------------------------------------------- */
+List *SwigType_get_sorted_mangled_list() {
+ List *l = Keys(r_mangled);
+ SortList(l, SwigType_compare_mangled);
+ return l;
+}
+
+
/* -----------------------------------------------------------------------------
* SwigType_type_table()
*
@@ -1754,7 +1772,9 @@
void
SwigType_emit_type_table(File *f_forward, File *f_table) {
Iterator ki;
- String *types, *table;
+ String *types, *table, *cast, *cast_init, *cast_temp;
+ Hash *imported_types;
+ List *mangled_list;
int i = 0;
if (!r_mangled) {
@@ -1789,11 +1809,17 @@
#endif
table = NewString("");
types = NewString("");
- Printf(table,"static swig_type_info *swig_types_initial[] = {\n");
-
- ki = First(r_mangled);
+ cast = NewString("");
+ cast_init = NewString("");
+ imported_types = NewHash("");
+
+ Printf(table,"static swig_type_info *swig_type_initial[] = {\n");
+ Printf(cast_init, "static swig_cast_info *swig_cast_initial[] = {\n");
+
Printf(f_forward,"\n/* -------- TYPES TABLE (BEGIN) -------- */\n\n");
- while (ki.key) {
+
+ mangled_list = SwigType_get_sorted_mangled_list();
+ for (ki = First(mangled_list); ki.item; ki = Next(ki)) {
List *el;
Iterator ei;
SwigType *lt;
@@ -1803,12 +1829,19 @@
String *rn;
const String *cd;
- Printf(f_forward,"#define SWIGTYPE%s swig_types[%d] \n", ki.key, i);
- Printv(types,"static swig_type_info _swigt_", ki.key, "[] = {", NIL);
+ cast_temp = NewString("");
- cd = SwigType_clientdata_collect(ki.key);
+ Printf(f_forward,"#define SWIGTYPE%s swig_types[%d]\n", ki.item, i);
+ Printv(types,"static swig_type_info _swigt_", ki.item, " = {", NIL);
+ Printf(table, " &_swigt_%s,\n", ki.item);
+ Printf(cast_temp, "static swig_cast_info _swigc_%s[] = {", ki.item);
+ Printf(cast_init, " _swigc_%s,\n", ki.item);
+ i++;
+
+ cd = SwigType_clientdata_collect(ki.item);
if (!cd) cd = "0";
- lt = Getattr(r_ltype,ki.key);
+
+ lt = Getattr(r_ltype,ki.item);
rt = SwigType_typedef_resolve_all(lt);
/* we save the original type and the fully resolved version */
ln = SwigType_lstr(lt,0);
@@ -1818,35 +1851,58 @@
} else {
nt = NewStringf("%s|%s", rn, ln);
}
- Printv(types,"{\"", ki.key, "\", 0, \"",nt,"\", ", cd, ", 0, 0, 0},", NIL);
- el = SwigType_equivalent_mangle(ki.key,0,0);
+ Printf(types, "\"%s\", \"%s\", 0, 0, %s};\n", ki.item, nt, cd);
+
+ el = SwigType_equivalent_mangle(ki.item,0,0);
for (ei = First(el); ei.item; ei = Next(ei)) {
String *ckey;
String *conv;
- ckey = NewStringf("%s+%s", ei.item, ki.key);
+ ckey = NewStringf("%s+%s", ei.item, ki.item);
conv = Getattr(conversions,ckey);
if (conv) {
- Printf(types,"{\"%s\", %s, 0, 0, 0, 0, 0},", ei.item, conv);
+ Printf(cast_temp," {&_swigt_%s, %s, 0, 0},", ei.item, conv);
} else {
- Printf(types,"{\"%s\", 0, 0, 0, 0, 0, 0},", ei.item);
+ Printf(cast_temp," {&_swigt_%s, 0, 0, 0},", ei.item);
}
Delete(ckey);
+
+ if (!Getattr(r_mangled, ei.item) && !Getattr(imported_types, ei.item)) {
+ Printf(f_forward, "#define SWIGTYPE%s swig_types[%i]\n", ei.item, i);
+ Printf(types, "static swig_type_info _swigt_%s = {\"%s\", 0, 0, 0, 0};\n", ei.item, ei.item);
+ Printf(table, " &_swigt_%s,\n", ei.item);
+ Printf(cast, "static swig_cast_info _swigc_%s[] = {{&_swigt_%s, 0, 0, 0},{0, 0, 0, 0}};\n",
+ ei.item, ei.item);
+ Printf(cast_init, " _swigc_%s,\n", ei.item);
+ i++;
+
+ Setattr(imported_types, ei.item, "1");
+ }
}
Delete(el);
+ Printf(cast,"%s{0, 0, 0, 0}};\n", cast_temp);
+ Delete(cast_temp);
Delete(nt);
Delete(rt);
- Printf(types,"{0, 0, 0, 0, 0, 0, 0}};\n");
- Printv(table, "_swigt_", ki.key, ", \n", NIL);
- ki = Next(ki);
- i++;
}
+ Delete(mangled_list);
- Printf(table, "0\n};\n");
- Printf(f_forward,"static swig_type_info *swig_types[%d];\n", i+1);
- Printf(f_forward,"\n/* -------- TYPES TABLE (END) -------- */\n\n");
+ Printf(table, "};\n");
+ Printf(cast_init, "};\n");
Printf(f_table,"%s\n", types);
Printf(f_table,"%s\n", table);
+ Printf(f_table,"%s\n", cast);
+ Printf(f_table,"%s\n", cast_init);
Printf(f_table,"\n/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */\n\n");
+
+ Printf(f_forward,"static swig_type_info *swig_types[%d];\n", i);
+ Printf(f_forward,"static swig_module_info swig_module = {swig_types, %d, 0, 0, 0, 0};\n", i);
+ Printf(f_forward,"#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)\n");
+ Printf(f_forward,"#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)\n");
+ Printf(f_forward,"\n/* -------- TYPES TABLE (END) -------- */\n\n");
+
Delete(types);
Delete(table);
+ Delete(cast);
+ Delete(cast_init);
+ Delete(imported_types);
}