From be1c4d2e68ccdef00648e745db432114b4614d91 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 20 Aug 2012 21:20:19 +0000 Subject: [PATCH] Revert r13601 as it breaks older versions of R git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13713 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/r/rtype.swg | 46 +++++++++++++++----------------------------- Source/Modules/r.cxx | 6 +----- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/Lib/r/rtype.swg b/Lib/r/rtype.swg index 007eaf14034..6af45cf409d 100644 --- a/Lib/r/rtype.swg +++ b/Lib/r/rtype.swg @@ -12,8 +12,6 @@ %apply int {unsigned int} %apply int {short} %apply int {unsigned short} -%apply int {signed char} -%apply int {unsigned char} %typemap("rtype") long, long *, long & "integer"; %apply long {long long} @@ -38,9 +36,10 @@ %typemap("rtype") SWIGTYPE & "$R_class"; %typemap("rtype") SWIGTYPE "$&R_class"; -%typemap("rtypecheck") int, int &, long, long & +%typemap("rtypecheck") int, int &, long, long &, + unsigned char, unsigned char & %{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %} -%typemap("rtypecheck") int *, long * +%typemap("rtypecheck") int *, long *, unsigned char * %{ is.integer($arg) || is.numeric($arg) %} @@ -108,8 +107,9 @@ %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} + %typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE & - %{ if (.hasSlot($input, "ref")) $input = slot($input,"ref") %} + %{ %} /* %typemap(scoercein) SWIGTYPE *, SWIGTYPE *const @@ -141,7 +141,7 @@ long *, long &, long[ANY] - "$input = as.integer($input);"; + "$input = as.integer($input); "; %typemap(scoercein) char *, string, std::string, string &, std::string & @@ -159,30 +159,18 @@ string &, std::string & %typemap(scoerceout) enum SWIGTYPE *const %{ $result = enumToInteger($result, "$R_class"); %} -#%typemap(scoerceout) SWIGTYPE -# %{ class($result) <- "$&R_class"; %} - -#%typemap(scoerceout) SWIGTYPE & -# %{ class($result) <- "$R_class"; %} -#%typemap(scoerceout) SWIGTYPE * -# %{ class($result) <- "$R_class"; %} +%typemap(scoerceout) SWIGTYPE + %{ class($result) <- "$&R_class"; %} -#%typemap(scoerceout) SWIGTYPE *const -# %{ class($result) <- "$R_class"; %} +%typemap(scoerceout) SWIGTYPE & + %{ class($result) <- "$R_class"; %} - %typemap(scoerceout) SWIGTYPE - %{ $result <- new("$&R_class", ref=$result); %} - - %typemap(scoerceout) SWIGTYPE & - %{ $result <- new("$R_class", ref=$result) ; %} - - %typemap(scoerceout) SWIGTYPE * - %{ $result <- new("$R_class", ref=$result) ; %} - - %typemap(scoerceout) SWIGTYPE *const - %{ $result <- new("$R_class", ref=$result) ; %} +%typemap(scoerceout) SWIGTYPE * + %{ class($result) <- "$R_class"; %} +%typemap(scoerceout) SWIGTYPE *const + %{ class($result) <- "$R_class"; %} /* Override the SWIGTYPE * above. */ %typemap(scoerceout) char, @@ -220,10 +208,8 @@ string &, std::string & signed long &, unsigned long, unsigned long &, - signed char, - signed char &, - unsigned char, - unsigned char & + unsigned char *, + unsigned char & %{ %} #if 0 diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index b589bfda791..f163c8b30ba 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -1891,9 +1891,6 @@ int R::functionWrapper(Node *n) { if(nargs == -1) nargs = getFunctionPointerNumArgs(p, tt); - Printv(sfun->code, "if (.hasSlot(", name, ", \"ref\")) {\n", - name, " = slot(", name, ", \"ref\");\n", - "}\n", NIL); String *snargs = NewStringf("%d", nargs); Printv(sfun->code, "if(is.function(", name, ")) {", "\n", "assert('...' %in% names(formals(", name, @@ -2115,8 +2112,7 @@ int R::functionWrapper(Node *n) { { String *finalizer = NewString(iname); Replace(finalizer, "new_", "", DOH_REPLACE_FIRST); - Printf(sfun->code, "if (.hasSlot(ans, \"ref\")) {\n" - "reg.finalizer(ans@ref, delete_%s); }\n", finalizer); + Printf(sfun->code, "reg.finalizer(ans, delete_%s)\n", finalizer); } Printf(sfun->code, "ans\n"); }