New way of sharing type information between modules for chicken, mzscheme,

ruby, tcl, and perl.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6332 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-10-05 22:43:41 +00:00
commit 9dead7a11d
13 changed files with 203 additions and 84 deletions

View file

@ -5,6 +5,24 @@
* ----------------------------------------------------------------------------- */
%runtime "precommon.swg"
%insert(runtime) %{
#ifndef SWIG_ALLOW_RUNTIME
/* -----------------------------------------------------------------------------
* Disable runtime library use, everything is used as static
* ----------------------------------------------------------------------------- */
#ifndef SWIG_DISABLE_RUNTIME
#define SWIG_DISABLE_RUNTIME
#endif
#ifdef SWIG_GLOBAL
#undef SWIG_GLOBAL
#endif
#ifdef SWIG_NOINCLUDE
#undef SWIG_NOINCLUDE
#endif
#endif /* SWIG_ALLOW_RUNTIME */
%}
%runtime "common.swg" // common type checking code
%runtime "perlrun.swg" // Perl runtime functions
%runtime "noembed.h" // undefine Perl5 macros
@ -584,6 +602,9 @@ XS(SWIG_init) {
int i;
static int _init = 0;
if (!_init) {
#ifdef SWIG_DISABLE_RUNTIME
SWIG_Perl_LookupTypePointer();
#endif
for (i = 0; swig_types_initial[i]; i++) {
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
}

View file

@ -170,6 +170,21 @@ extern "C" {
# define SWIG_MAYBE_PERL_OBJECT
#endif
/* load the swig_runtime_list_handle variable from the interpreter */
static void SWIG_Perl_LookupTypePointer() {
SV *pointer;
/* first check if pointer already created */
pointer = get_sv("swig_runtime_data::type_pointer", FALSE);
if (pointer && SvOK(pointer)) {
swig_type_list_handle = INT2PTR(swig_type_info **, SvIV(pointer));
} else {
/* create a new pointer */
pointer = get_sv("swig_runtime_data::type_pointer", TRUE);
sv_setiv(pointer, PTR2IV(swig_type_list_handle));
}
}
#ifdef SWIG_NOINCLUDE
SWIGIMPORT(int) SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *, void **, swig_type_info *, int flags);