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
This commit is contained in:
Marcelo Matus 2006-02-01 08:37:53 +00:00
commit 0f7b502a3b
22 changed files with 98 additions and 83 deletions

View file

@ -32,10 +32,6 @@
* ------------------------------------------------------------ */
%include <rubymacros.swg>
/* ------------------------------------------------------------
* Error manipulation
* ------------------------------------------------------------ */
%include <rubyerrors.swg>
/* ------------------------------------------------------------
* The runtime part

1
Lib/ruby/rubydef.swg Normal file
View file

@ -0,0 +1 @@
/* empty file added for backward comp. */

View file

@ -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));
}
}
%}

View file

@ -7,7 +7,7 @@
%fragment("SWIG_ruby_failed","header")
{
SWIGINTERN VALUE
SWIG_ruby_failed()
SWIG_ruby_failed(void)
{
return Qnil;
}

View file

@ -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;

View file

@ -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"

View file

@ -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. */