summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2012-08-20 21:20:19 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2012-08-20 21:20:19 +0000
commitbe1c4d2e68ccdef00648e745db432114b4614d91 (patch)
tree3cfe7476d378966bd4c457b74d38775c61688136
parent9da9df9ee8b01bc5cefc6739b0186ecaec50b6d3 (diff)
downloadswig-be1c4d2e68ccdef00648e745db432114b4614d91.tar.gz
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
-rw-r--r--Lib/r/rtype.swg46
-rw-r--r--Source/Modules/r.cxx6
2 files changed, 17 insertions, 35 deletions
diff --git a/Lib/r/rtype.swg b/Lib/r/rtype.swg
index 007eaf140..6af45cf40 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 b589bfda7..f163c8b30 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");
}