diff options
author | Marcelo Matus <mmatus@acms.arizona.edu> | 2006-02-01 08:37:53 +0000 |
---|---|---|
committer | Marcelo Matus <mmatus@acms.arizona.edu> | 2006-02-01 08:37:53 +0000 |
commit | 0f7b502a3bfad12a4485a5bf9cd1c2f88622aa5c (patch) | |
tree | 4f6dfa287d8d21f6a738e0bcac8361ab5895b280 | |
parent | 4eb6a0a7273d91346ded433853c75eb1f8167a9a (diff) | |
download | swig-0f7b502a3bfad12a4485a5bf9cd1c2f88622aa5c.tar.gz |
fix -external-runtime and warning arounds in subversion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8666 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r-- | Lib/perl5/perl5.swg | 5 | ||||
-rw-r--r-- | Lib/perl5/perlerrors.swg | 5 | ||||
-rw-r--r-- | Lib/perl5/perlruntime.swg | 1 | ||||
-rw-r--r-- | Lib/python/pyerrors.swg | 13 | ||||
-rw-r--r-- | Lib/python/pyrun.swg | 15 | ||||
-rw-r--r-- | Lib/python/pyruntime.swg | 5 | ||||
-rw-r--r-- | Lib/python/python.swg | 4 | ||||
-rw-r--r-- | Lib/ruby/ruby.swg | 4 | ||||
-rw-r--r-- | Lib/ruby/rubydef.swg | 1 | ||||
-rw-r--r-- | Lib/ruby/rubyerrors.swg | 33 | ||||
-rw-r--r-- | Lib/ruby/rubyprimtypes.swg | 2 | ||||
-rw-r--r-- | Lib/ruby/rubyrun.swg | 27 | ||||
-rw-r--r-- | Lib/ruby/rubyruntime.swg | 4 | ||||
-rw-r--r-- | Lib/ruby/rubytracking.swg | 2 | ||||
-rw-r--r-- | Lib/tcl/tcl8.swg | 5 | ||||
-rw-r--r-- | Lib/tcl/tclerrors.swg | 7 | ||||
-rw-r--r-- | Lib/tcl/tclruntime.swg | 4 | ||||
-rw-r--r-- | Source/Modules/main.cxx | 7 | ||||
-rw-r--r-- | Source/Modules/perl5.cxx | 16 | ||||
-rw-r--r-- | Source/Modules/python.cxx | 7 | ||||
-rw-r--r-- | Source/Modules/ruby.cxx | 7 | ||||
-rw-r--r-- | Source/Modules/tcl8.cxx | 7 |
22 files changed, 98 insertions, 83 deletions
diff --git a/Lib/perl5/perl5.swg b/Lib/perl5/perl5.swg index 50f2c98af..693c2b945 100644 --- a/Lib/perl5/perl5.swg +++ b/Lib/perl5/perl5.swg @@ -10,11 +10,6 @@ %include <perlmacros.swg> /* ------------------------------------------------------------ - * Error manipulation - * ------------------------------------------------------------ */ -%include <perlerrors.swg> - -/* ------------------------------------------------------------ * The runtime part * ------------------------------------------------------------ */ %include <perlruntime.swg> diff --git a/Lib/perl5/perlerrors.swg b/Lib/perl5/perlerrors.swg index ee05bcf04..024f03798 100644 --- a/Lib/perl5/perlerrors.swg +++ b/Lib/perl5/perlerrors.swg @@ -2,10 +2,6 @@ * error manipulation * ----------------------------------------------------------------------------- */ -%insert("runtime") "swigerrors.swg" - -%insert("header") %{ - SWIGINTERN const char* SWIG_Perl_ErrorType(int code) { const char* type = 0; @@ -49,6 +45,5 @@ SWIG_Perl_ErrorType(int code) { return type; } -%} diff --git a/Lib/perl5/perlruntime.swg b/Lib/perl5/perlruntime.swg index 1db3cd8e2..34ff8f73d 100644 --- a/Lib/perl5/perlruntime.swg +++ b/Lib/perl5/perlruntime.swg @@ -1,5 +1,6 @@ %runtime "swigrun.swg" // Common C API type-checking code +%runtime "swigerrors.swg" // SWIG errors %runtime "perlrun.swg" // Perl runtime functions %runtime "noembed.h" // undefine Perl5 macros diff --git a/Lib/python/pyerrors.swg b/Lib/python/pyerrors.swg index bfab4ea47..20af4eee1 100644 --- a/Lib/python/pyerrors.swg +++ b/Lib/python/pyerrors.swg @@ -2,9 +2,7 @@ * error manipulation * ----------------------------------------------------------------------------- */ -%insert("header") %{ - -SWIGINTERN PyObject* +SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { @@ -47,14 +45,8 @@ SWIG_Python_ErrorType(int code) { return type; } -SWIGINTERNINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} -SWIGINTERN void +SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; @@ -74,5 +66,4 @@ SWIG_Python_AddErrorMsg(const char* mesg) } } -%} diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index cccb84e23..39512c094 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -215,6 +215,13 @@ SWIG_Python_CheckImplicit(swig_type_info *ty) return data ? data->implicitconv : 0; } +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + SWIGRUNTIME PySwigClientData * PySwigClientData_New(PyObject* obj) @@ -965,15 +972,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int impconv = 0; } if (impconv) { - PySwigObject *sobj = SWIG_Python_GetSwigThis(impconv); - if (sobj) { + PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)sobj, &vptr, ty, 0, 0); + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ - sobj->own = 0; + iobj->own = 0; res = SWIG_AddNewMask(SWIG_AddCast(res)); } else { res = SWIG_AddCast(res); diff --git a/Lib/python/pyruntime.swg b/Lib/python/pyruntime.swg index 558060ad7..d00dffa60 100644 --- a/Lib/python/pyruntime.swg +++ b/Lib/python/pyruntime.swg @@ -4,8 +4,9 @@ %} %insert(runtime) "swigrun.swg"; /* SWIG API */ -%insert(runtime) "swigerrors.swg" /* SWIG errors */ -%insert(runtime) "pyhead.swg" +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ +%insert(runtime) "pyhead.swg"; +%insert(runtime) "pyerrors.swg"; %insert(runtime) "pythreads.swg"; /* Python thread code */ %insert(runtime) "pyapi.swg"; /* Pyton API */ %insert(runtime) "pyrun.swg"; /* Python run-time code */ diff --git a/Lib/python/python.swg b/Lib/python/python.swg index 5b8c56d96..769d9e104 100644 --- a/Lib/python/python.swg +++ b/Lib/python/python.swg @@ -9,10 +9,6 @@ * ------------------------------------------------------------ */ %include <pymacros.swg> -/* ------------------------------------------------------------ - * Error manipulation - * ------------------------------------------------------------ */ -%include <pyerrors.swg> /* ------------------------------------------------------------ * The runtime part diff --git a/Lib/ruby/ruby.swg b/Lib/ruby/ruby.swg index 6e2acb1ee..78f1f6848 100644 --- a/Lib/ruby/ruby.swg +++ b/Lib/ruby/ruby.swg @@ -32,10 +32,6 @@ * ------------------------------------------------------------ */ %include <rubymacros.swg> -/* ------------------------------------------------------------ - * Error manipulation - * ------------------------------------------------------------ */ -%include <rubyerrors.swg> /* ------------------------------------------------------------ * The runtime part diff --git a/Lib/ruby/rubydef.swg b/Lib/ruby/rubydef.swg new file mode 100644 index 000000000..956aaee06 --- /dev/null +++ b/Lib/ruby/rubydef.swg @@ -0,0 +1 @@ +/* empty file added for backward comp. */ diff --git a/Lib/ruby/rubyerrors.swg b/Lib/ruby/rubyerrors.swg index 9beae1771..9f2737334 100644 --- a/Lib/ruby/rubyerrors.swg +++ b/Lib/ruby/rubyerrors.swg @@ -2,20 +2,17 @@ * error manipulation * ----------------------------------------------------------------------------- */ -%insert("runtime") "swigerrors.swg" /* Define some additional error types */ -%insert("runtime") %{ #define SWIG_ObjectPreviouslyDeletedError -100 -%} -%insert("header") %{ /* Define custom exceptions for errors that do not map to existing Ruby exceptions. Note this only works for C++ since a global cannot be initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/ -VALUE getNullReferenceError() { +SWIGINTERN VALUE +getNullReferenceError(void) { static int init = 0; static VALUE rb_eNullReferenceError ; if (!init) { @@ -25,7 +22,8 @@ VALUE getNullReferenceError() { return rb_eNullReferenceError; } -VALUE getObjectPreviouslyDeletedError() { +SWIGINTERN VALUE +getObjectPreviouslyDeletedError(void) { static int init = 0; static VALUE rb_eObjectPreviouslyDeleted ; if (!init) { @@ -35,15 +33,6 @@ VALUE getObjectPreviouslyDeletedError() { return rb_eObjectPreviouslyDeleted; } -VALUE getExceptionClass() { - static int init = 0; - static VALUE rubyExceptionClass ; - if (!init) { - init = 1; - rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); - } - return rubyExceptionClass; -} SWIGINTERN VALUE SWIG_Ruby_ErrorType(int SWIG_code) { @@ -98,18 +87,4 @@ SWIG_Ruby_ErrorType(int SWIG_code) { } -/* This code checks to see if the Ruby object being raised as part - of an exception inherits from the Ruby class Exception. If so, - the object is simply returned. If not, then a new Ruby exception - object is created and that will be returned to Ruby.*/ -SWIGINTERN VALUE -SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { - VALUE exceptionClass = getExceptionClass(); - if (rb_obj_is_kind_of(obj, exceptionClass)) { - return obj; - } else { - return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); - } -} -%}
\ No newline at end of file diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg index 5929664a6..77f8c0560 100644 --- a/Lib/ruby/rubyprimtypes.swg +++ b/Lib/ruby/rubyprimtypes.swg @@ -7,7 +7,7 @@ %fragment("SWIG_ruby_failed","header") { SWIGINTERN VALUE -SWIG_ruby_failed() +SWIG_ruby_failed(void) { return Qnil; } diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 4c329db37..97f61c53f 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -80,6 +80,31 @@ static VALUE _mSWIG = Qnil; static VALUE _cSWIG_Pointer = Qnil; static VALUE swig_runtime_data_type_pointer = Qnil; +SWIGRUNTIME VALUE +getExceptionClass(void) { + static int init = 0; + static VALUE rubyExceptionClass ; + if (!init) { + init = 1; + rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); + } + return rubyExceptionClass; +} + +/* This code checks to see if the Ruby object being raised as part + of an exception inherits from the Ruby class Exception. If so, + the object is simply returned. If not, then a new Ruby exception + object is created and that will be returned to Ruby.*/ +SWIGRUNTIME VALUE +SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { + VALUE exceptionClass = getExceptionClass(); + if (rb_obj_is_kind_of(obj, exceptionClass)) { + return obj; + } else { + return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); + } +} + /* Initialize Ruby runtime support */ SWIGRUNTIME void SWIG_Ruby_InitRuntime(void) @@ -294,7 +319,7 @@ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { } SWIGRUNTIME swig_module_info * -SWIG_Ruby_GetModule() +SWIG_Ruby_GetModule(void) { VALUE pointer; swig_module_info *ret = 0; diff --git a/Lib/ruby/rubyruntime.swg b/Lib/ruby/rubyruntime.swg index efffffdb0..31d741b8b 100644 --- a/Lib/ruby/rubyruntime.swg +++ b/Lib/ruby/rubyruntime.swg @@ -1,5 +1,9 @@ + +%runtime "swiglabels.swg" /* Common C API type-checking code */ %runtime "swigrun.swg" /* Common C API type-checking code */ +%runtime "swigerrors.swg" /* SWIG errors */ %runtime "rubyhead.swg" +%runtime "rubyerrors.swg" %runtime "rubytracking.swg" /* API for tracking C++ classes to Ruby objects */ %runtime "rubyapi.swg" %runtime "rubyrun.swg" diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg index 1d66b6c85..6ebff3484 100644 --- a/Lib/ruby/rubytracking.swg +++ b/Lib/ruby/rubytracking.swg @@ -22,7 +22,7 @@ static VALUE swig_ruby_trackings; static ID swig_ruby_hash_delete = 0; /* Setup a Ruby hash table to store Trackings */ -SWIGRUNTIME void SWIG_RubyInitializeTrackings() { +SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { /* Create a ruby hash table to store Trackings from C++ objects to Ruby objects. Also make sure to tell the garabage collector about the hash table. */ diff --git a/Lib/tcl/tcl8.swg b/Lib/tcl/tcl8.swg index bfb7afe81..1b682b680 100644 --- a/Lib/tcl/tcl8.swg +++ b/Lib/tcl/tcl8.swg @@ -10,11 +10,6 @@ %include <tclmacros.swg> /* ------------------------------------------------------------ - * Error manipulation - * ------------------------------------------------------------ */ -%include <tclerrors.swg> - -/* ------------------------------------------------------------ * The runtime part * ------------------------------------------------------------ */ %include <tclruntime.swg> diff --git a/Lib/tcl/tclerrors.swg b/Lib/tcl/tclerrors.swg index 66e689dac..1a3ba8ec7 100644 --- a/Lib/tcl/tclerrors.swg +++ b/Lib/tcl/tclerrors.swg @@ -2,11 +2,6 @@ * error manipulation * ----------------------------------------------------------------------------- */ -%insert("runtime") "swigerrors.swg" - -%insert("header") %{ - - SWIGINTERN const char* SWIG_Tcl_ErrorType(int code) { const char* type = 0; @@ -76,5 +71,3 @@ SWIG_Tcl_AddErrorMsg(Tcl_Interp *interp, const char* mesg) } - -%} diff --git a/Lib/tcl/tclruntime.swg b/Lib/tcl/tclruntime.swg index f29848ba0..bb4edd745 100644 --- a/Lib/tcl/tclruntime.swg +++ b/Lib/tcl/tclruntime.swg @@ -9,5 +9,7 @@ %} %insert(runtime) "swigrun.swg"; /* Common C API type-checking code */ -%insert(runtime) "tclapi.swg"; /* SWIG/Tcl API */ +%insert(runtime) "swigerrors.swg" /* SWIG errors */ +%insert(runtime) "tclerrors.swg"; /* Tcl Errors */ +%insert(runtime) "tclapi.swg"; /* Tcl API */ %insert(runtime) "tclrun.swg"; /* Tcl run-time code */ diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index e672fee4b..71ce29036 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -370,6 +370,13 @@ static void SWIG_dump_runtime() { Printf(runtime, "%s", s); Delete(s); + s = Swig_include_sys("swigerrors.swg"); + if (!s) { + Printf(stderr, "*** Unable to open 'swigerrors.swg'\n"); + Close(runtime); + SWIG_exit(EXIT_FAILURE); + } + Printf(runtime, "%s", s); s = Swig_include_sys("swigrun.swg"); if (!s) { Printf(stderr, "*** Unable to open 'swigrun.swg'\n"); diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index de0674769..554580f36 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -1668,10 +1668,20 @@ public: } String *runtimeCode() { - String *s = Swig_include_sys("perlrun.swg"); - if (!s) { + String *s = NewString(""); + String *serrors = Swig_include_sys("perlerrors.swg"); + if (!serrors) { + Printf(stderr, "*** Unable to open 'perlerrors.swg'\n"); + } else { + Append(s, serrors); + Delete(serrors); + } + String *srun = Swig_include_sys("perlrun.swg"); + if (!srun) { Printf(stderr, "*** Unable to open 'perlrun.swg'\n"); - s = NewString(""); + } else { + Append(s, srun); + Delete(srun); } return s; } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index d38e6425a..16fe92c67 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3172,6 +3172,13 @@ public: Append(s, shead); Delete(shead); } + String *serrors = Swig_include_sys("pyerrors.swg"); + if (!serrors) { + Printf(stderr, "*** Unable to open 'pyerrors.swg'\n"); + } else { + Append(s, serrors); + Delete(serrors); + } String *sthread = Swig_include_sys("pythreads.swg"); if (!sthread) { Printf(stderr, "*** Unable to open 'pythreads.swg'\n"); diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 33db6a192..c1fcd59cc 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -2644,6 +2644,13 @@ public: Append(s, shead); Delete(shead); } + String *serrors = Swig_include_sys("rubyerrors.swg"); + if (!serrors) { + Printf(stderr, "*** Unable to open 'rubyerrors.swg'\n"); + } else { + Append(s, serrors); + Delete(serrors); + } String *strack = Swig_include_sys("rubytracking.swg"); if (!strack) { Printf(stderr, "*** Unable to open 'rubytracking.swg'\n"); diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index fea4d7ec5..5bdf5248b 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -1274,6 +1274,13 @@ public: String *runtimeCode() { String *s = NewString(""); + String *serrors = Swig_include_sys("tclerrors.swg"); + if (!serrors) { + Printf(stderr, "*** Unable to open 'tclerrors.swg'\n"); + } else { + Append(s, serrors); + Delete(serrors); + } String *sapi = Swig_include_sys("tclapi.swg"); if (!sapi) { Printf(stderr, "*** Unable to open 'tclapi.swg'\n"); |