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/SWIG@6332 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-10-05 22:43:41 +00:00
commit 6ed2f7e90e
13 changed files with 203 additions and 84 deletions

View file

@ -6,13 +6,37 @@
%runtime "rubyhead.swg"
%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"
%insert(runtime) %{
#ifdef SWIG_NOINCLUDE
%}
%runtime "rubydec.swg"
%insert(runtime) %{
#else
%}
%runtime "rubydef.swg"
%insert(runtime) %{
#endif
%}
#define %alias %feature("alias")
#define %freefunc %feature("freefunc")

View file

@ -5,14 +5,31 @@ extern "C" {
static VALUE _mSWIG = Qnil;
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;
/* Initialize Ruby runtime support */
SWIGRUNTIME(void)
SWIG_Ruby_InitRuntime(void)
{
VALUE pointer;
if (_mSWIG == Qnil) {
_mSWIG = rb_define_module("SWIG");
}
#ifdef SWIG_DISABLE_RUNTIME
/* first check if pointer already created */
pointer = rb_gv_get("$swig_runtime_data_type_pointer");
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_data_type_pointer);
}
#endif
}
/* Define Ruby class for C type */