From 212a53892aa8de3e640165a640e01ad6a10cda90 Mon Sep 17 00:00:00 2001 From: John Lenz Date: Thu, 6 Oct 2005 01:20:05 +0000 Subject: Minor updates to the documentation Minor bug fixes to chicken git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7595 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Doc/Devel/runtime.txt | 10 ++++++++++ SWIG/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss | 1 + SWIG/Lib/chicken/chicken.swg | 12 ++++++------ SWIG/Lib/chicken/chickenrun.swg | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/SWIG/Doc/Devel/runtime.txt b/SWIG/Doc/Devel/runtime.txt index 46993cc70..f834d3b99 100644 --- a/SWIG/Doc/Devel/runtime.txt +++ b/SWIG/Doc/Devel/runtime.txt @@ -140,6 +140,16 @@ 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. +The flag argument to ConvertPtr is used in some languages for disowning a +pointer. If the wrapped C function is taking ownership of the pointer (that +means, the wrapped C function is responsible for deleting the object), then that +pointer should be removed from the garbage collector. We do that in the +ConvertPtr function. The pointer is still valid in the target language, but +when the target language type is garbage collected, it will not call the +associated destructor. Languages have a special typemap called DISOWN that can be +applied which passes this argument. All the languages have the flags argument +for consistancy, and the flags argument can be ignored or used for some other +purpose. void *SWIG_MustGetPtr(LangType obj, swig_type_info *type, int flags, diff --git a/SWIG/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss b/SWIG/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss index 52997c6fe..a474e6dfd 100644 --- a/SWIG/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss +++ b/SWIG/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss @@ -7,6 +7,7 @@ (error "Error in inoutr-int2")))) (call-with-values (lambda () (out-foo 4)) (lambda (a b) + ; (if (not (and (= (slot-ref a 'a) 4) (= b 8))) (error "Error in out-foo")))) diff --git a/SWIG/Lib/chicken/chicken.swg b/SWIG/Lib/chicken/chicken.swg index 79c429e33..6429e182c 100644 --- a/SWIG/Lib/chicken/chicken.swg +++ b/SWIG/Lib/chicken/chicken.swg @@ -129,21 +129,21 @@ %enddef -SIMPLE_TYPEMAP(int, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); +SIMPLE_TYPEMAP(int, C_num_to_int, C_fix, C_swig_is_number, (int), 0); //SIMPLE_TYPEMAP(enum SWIGTYPE, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); -SIMPLE_TYPEMAP(short, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); +SIMPLE_TYPEMAP(short, C_num_to_int, C_fix, C_swig_is_number, (int), 0); SIMPLE_TYPEMAP(long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM); SIMPLE_TYPEMAP(long long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM); -SIMPLE_TYPEMAP(unsigned int, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); -SIMPLE_TYPEMAP(unsigned short, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); +SIMPLE_TYPEMAP(unsigned int, C_num_to_unsigned_int, C_fix, C_swig_is_number, (int), 0); +SIMPLE_TYPEMAP(unsigned short, C_num_to_unsigned_int, C_fix, C_swig_is_number, (int), 0); SIMPLE_TYPEMAP(unsigned long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM); SIMPLE_TYPEMAP(unsigned long long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM); SIMPLE_TYPEMAP(unsigned char, C_character_code, C_make_character, C_swig_is_char, (unsigned int), 0); SIMPLE_TYPEMAP(signed char, C_character_code, C_make_character, C_swig_is_char, (int), 0); SIMPLE_TYPEMAP(char, C_character_code, C_make_character, C_swig_is_char, (char), 0); SIMPLE_TYPEMAP(bool, C_truep, C_mk_bool, C_swig_is_bool, (bool), 0); -SIMPLE_TYPEMAP(float, C_flonum_magnitude, C_flonum, C_swig_is_flonum, (double), C_SIZEOF_FLONUM); -SIMPLE_TYPEMAP(double, C_flonum_magnitude, C_flonum, C_swig_is_flonum, (double), C_SIZEOF_FLONUM); +SIMPLE_TYPEMAP(float, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM); +SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM); /* enum SWIGTYPE */ %apply int { enum SWIGTYPE }; diff --git a/SWIG/Lib/chicken/chickenrun.swg b/SWIG/Lib/chicken/chickenrun.swg index 4a63b5a11..8d89e0962 100644 --- a/SWIG/Lib/chicken/chickenrun.swg +++ b/SWIG/Lib/chicken/chickenrun.swg @@ -49,7 +49,8 @@ extern "C" { #define C_swig_is_ptr(x) (C_truep (C_blockp (x)) && C_truep (C_pointerp (x))) #define C_swig_is_swigpointer(x) (C_truep (C_blockp(x)) && C_truep (C_swigpointerp(x))) #define C_swig_is_closurep(x) (C_truep (C_blockp(x)) && C_truep(C_closurep(x))) -#define C_swig_is_long(x) (C_swig_is_fixnum(x) || C_swig_is_flonum(x)) +#define C_swig_is_number(x) (C_swig_is_fixnum(x) || C_swig_is_flonum(x)) +#define C_swig_is_long(x) C_swig_is_number(x) #define SWIG_APPEND_VALUE(object) \ if (resultobj == C_SCHEME_UNDEFINED) \ -- cgit v1.2.1