diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg index 87e030ce4..bbfdcdb78 100644 --- a/Lib/allegrocl/allegrocl.swg +++ b/Lib/allegrocl/allegrocl.swg @@ -16,8 +16,7 @@ float, double, long double, char *, void *, enum SWIGTYPE "(cl::setq ACL_ffresult $body)"; %typemap(lout) void "$body"; -%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, - SWIGTYPE & +%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE && %{ (cl:let* ((address $body) (new-inst (cl:make-instance '$lclass :foreign-address address))) (cl:when (cl:and $owner (cl:not (cl:zerop address))) @@ -60,6 +59,7 @@ %typemap(ffitype) void ":void"; %typemap(ffitype) enum SWIGTYPE ":int"; %typemap(ffitype) SWIGTYPE & "(* :void)"; +%typemap(ffitype) SWIGTYPE && "(* :void)"; /* const typemaps idea: marshall all primitive c types to their respective lisp types @@ -95,7 +95,7 @@ and error if a setf operation is performed on the address of this object. long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[], - SWIGTYPE[ANY], SWIGTYPE &, const SWIGTYPE "$1_ltype"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE &&, const SWIGTYPE "$1_ltype"; %typemap(ctype) SWIGTYPE "$&1_type"; %typemap(in) bool "$1 = (bool)$input;"; @@ -105,7 +105,7 @@ and error if a setf operation is performed on the address of this object. long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[], - SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; %typemap(in) SWIGTYPE "$1 = *$input;"; /* We don't need to do any actual C-side typechecking, but need to @@ -160,7 +160,7 @@ SWIG_TYPECHECK_STRING_ARRAY 1140 int, signed int, unsigned int, long, signed long, unsigned long, enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[], SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; @@ -185,7 +185,7 @@ SWIG_TYPECHECK_STRING_ARRAY 1140 long, signed long, unsigned long, float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; #ifdef __cplusplus %typemap(out) SWIGTYPE "$result = new $1_ltype($1);"; #else @@ -221,6 +221,7 @@ $body)" /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/Lib/cffi/cffi.swg b/Lib/cffi/cffi.swg index 6ac82f45e..e6a74b835 100644 --- a/Lib/cffi/cffi.swg +++ b/Lib/cffi/cffi.swg @@ -67,7 +67,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$1_ltype"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype"; %typemap(ctype) SWIGTYPE "$&1_type"; %typemap(in) bool "$1 = (bool)$input;"; @@ -77,7 +77,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; %typemap(in) SWIGTYPE "$1 = *$input;"; %typemap(out) void ""; @@ -88,7 +88,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; #ifdef __cplusplus %typemap(out) SWIGTYPE "$result = new $1_type($1);"; #else @@ -109,7 +109,7 @@ int, signed int, unsigned int, long, signed long, unsigned long, enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; /* This maps C/C++ types to Lisp classes for overload dispatch */ @@ -132,6 +132,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg index 112780499..f5779c1b6 100644 --- a/Lib/chicken/chicken.swg +++ b/Lib/chicken/chicken.swg @@ -149,6 +149,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO /* enum SWIGTYPE */ %apply int { enum SWIGTYPE }; %apply const int& { const enum SWIGTYPE& }; +%apply const int& { const enum SWIGTYPE&& }; %typemap(varin) enum SWIGTYPE { @@ -178,7 +179,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO %typemap(freearg) char * "if ($1 != NULL) { free ($1); }" /* Pointers, references, and arrays */ -%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE & { +%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, SWIGTYPE && { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, $disown); } @@ -199,6 +200,10 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [] { SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "Type error"); } @@ -216,7 +221,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO $1 = SWIG_MustGetPtr($input, NULL, 1, 0); } -%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); $result = SWIG_NewPointerObj($1, $descriptor, $owner); } @@ -237,6 +242,11 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); + $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0); +} + /* special typemaps for class pointers */ %typemap(in) SWIGTYPE (CLASS::*) { char err_msg[256]; @@ -531,7 +541,7 @@ $result = C_SCHEME_UNDEFINED; %typemap(constcode) char * "static const char *$result = $value;" -%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] +%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "static const void *$result = (void*) $value;" /* ------------------------------------------------------------ @@ -607,7 +617,7 @@ $result = C_SCHEME_UNDEFINED; $1 = C_swig_is_string ($input); } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; $1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0); } @@ -628,6 +638,17 @@ $result = C_SCHEME_UNDEFINED; } } +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && +{ + void *ptr = 0; + if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) { + /* error */ + $1 = 0; + } else { + $1 = (ptr != 0); + } +} + %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { void *ptr = 0; @@ -673,6 +694,12 @@ $result = C_SCHEME_UNDEFINED; SWIG_Chicken_ThrowException(ptr); } +%typemap(throws) SWIGTYPE && { + C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); + C_word ptr = SWIG_NewPointerObj((void *)&($1),$descriptor,0); + SWIG_Chicken_ThrowException(ptr); +} + /* ------------------------------------------------------------ * ANSI C typemaps * ------------------------------------------------------------ */ @@ -685,6 +712,7 @@ $result = C_SCHEME_UNDEFINED; /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index c194d4bc9..8e09d0dc0 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -6,10 +6,10 @@ /* Pointers */ -%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } -%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] ""; +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""; %typemap(in) void * { $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0); @@ -24,6 +24,10 @@ $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin) SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [] { scm_wrong_type_arg((char *) FUNC_NAME, 1, $input); } @@ -41,7 +45,7 @@ $1 = SWIG_MustGetPtr($input, NULL, 1, 0); } -%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { $result = SWIG_NewPointerObj ($1, $descriptor, $owner); } @@ -58,6 +62,10 @@ $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); +} + %typemap(throws) SWIGTYPE { $<ype temp = new $ltype($1); scm_throw(gh_symbol2scm((char *) "swig-exception"), @@ -71,6 +79,12 @@ SCM_UNDEFINED)); } +%typemap(throws) SWIGTYPE && { + scm_throw(gh_symbol2scm((char *) "swig-exception"), + gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1), + SCM_UNDEFINED)); +} + %typemap(throws) SWIGTYPE * { scm_throw(gh_symbol2scm((char *) "swig-exception"), gh_list(SWIG_NewPointerObj($1, $descriptor, 1), @@ -430,7 +444,7 @@ typedef unsigned long SCM; $1 = SCM_STRINGP($input) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0); $1 = SWIG_CheckState(res); @@ -450,6 +464,7 @@ typedef unsigned long SCM; /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/Lib/mzscheme/typemaps.i b/Lib/mzscheme/typemaps.i index f12513df8..026ec9567 100644 --- a/Lib/mzscheme/typemaps.i +++ b/Lib/mzscheme/typemaps.i @@ -23,6 +23,10 @@ $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin) SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [ANY] { void *temp; int ii; @@ -54,16 +58,20 @@ $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); +} + /* C++ References */ #ifdef __cplusplus -%typemap(in) SWIGTYPE &, const SWIGTYPE & { +%typemap(in) SWIGTYPE &, SWIGTYPE && { $1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0); if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)"); } -%typemap(out) SWIGTYPE &, const SWIGTYPE & { +%typemap(out) SWIGTYPE &, SWIGTYPE && { $result = SWIG_NewPointerObj ($1, $descriptor, $owner); } @@ -321,7 +329,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, $1 = (SCHEME_STRINGP($input)) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0)) { $1 = 0; @@ -351,6 +359,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/Lib/pike/pike.swg b/Lib/pike/pike.swg index 0cfec52b0..9b8179e69 100644 --- a/Lib/pike/pike.swg +++ b/Lib/pike/pike.swg @@ -53,6 +53,7 @@ extern "C" { %typemap(in) SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [] "SWIG_ConvertPtr($input.u.object, (void **) &$1, $1_descriptor, 1);" @@ -79,7 +80,8 @@ extern "C" { const bool & (bool temp), const long long & ($*1_ltype temp), const unsigned long long & ($*1_ltype temp), - const enum SWIGTYPE & ($*1_ltype temp) + const enum SWIGTYPE & ($*1_ltype temp), + const enum SWIGTYPE && ($*1_ltype temp) { if ($input.type != T_INT) Pike_error("Bad argument: Expected an integer.\n"); @@ -113,7 +115,7 @@ extern "C" { %typemap(out, pikedesc="tStr") char * "push_text($1);"; /* Pointers, references, and arrays */ -%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));"; +%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));"; /* Void return value; don't push anything */ %typemap(out, pikedesc="tVoid") void ""; @@ -153,7 +155,8 @@ extern "C" { const char &, const signed char &, const unsigned char &, const bool &, const long long &, const unsigned long long &, - const enum SWIGTYPE & ($*1_ltype temp) + const enum SWIGTYPE & ($*1_ltype temp), + const enum SWIGTYPE && ($*1_ltype temp) "push_int(*($1));"; %typemap(out, pikedesc="tFloat") const float &, const double & "push_float(*($1));"; @@ -216,7 +219,7 @@ extern "C" { const int &, const short &, const long &, const unsigned int &, const unsigned short &, const unsigned long &, const long long &, const unsigned long long &, - enum SWIGTYPE, enum SWIGTYPE &, + enum SWIGTYPE, enum SWIGTYPE &, SWIGTYPE &&, bool, const bool & { $1 = ($input.type == T_INT) ? 1 : 0; @@ -237,7 +240,7 @@ extern "C" { $1 = ($input.type == T_STRING) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, $1_descriptor, 0) == -1) { $1 = 0; @@ -266,6 +269,7 @@ extern "C" { /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }