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
This commit is contained in:
William S Fulton 2012-08-20 21:20:19 +00:00
commit be1c4d2e68
2 changed files with 17 additions and 35 deletions

View file

@ -12,8 +12,6 @@
%apply int {unsigned int} %apply int {unsigned int}
%apply int {short} %apply int {short}
%apply int {unsigned short} %apply int {unsigned short}
%apply int {signed char}
%apply int {unsigned char}
%typemap("rtype") long, long *, long & "integer"; %typemap("rtype") long, long *, long & "integer";
%apply long {long long} %apply long {long long}
@ -38,9 +36,10 @@
%typemap("rtype") SWIGTYPE & "$R_class"; %typemap("rtype") SWIGTYPE & "$R_class";
%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 %} %{ (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) %} %{ is.integer($arg) || is.numeric($arg) %}
@ -108,8 +107,9 @@
%typemap(scoercein) enum SWIGTYPE *const %typemap(scoercein) enum SWIGTYPE *const
%{ $input = enumToInteger($input, "$R_class"); %} %{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE & %typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
%{ if (.hasSlot($input, "ref")) $input = slot($input,"ref") %} %{ %}
/* /*
%typemap(scoercein) SWIGTYPE *, SWIGTYPE *const %typemap(scoercein) SWIGTYPE *, SWIGTYPE *const
@ -141,7 +141,7 @@
long *, long *,
long &, long &,
long[ANY] long[ANY]
"$input = as.integer($input);"; "$input = as.integer($input); ";
%typemap(scoercein) char *, string, std::string, %typemap(scoercein) char *, string, std::string,
string &, std::string & string &, std::string &
@ -159,30 +159,18 @@ string &, std::string &
%typemap(scoerceout) enum SWIGTYPE *const %typemap(scoerceout) enum SWIGTYPE *const
%{ $result = enumToInteger($result, "$R_class"); %} %{ $result = enumToInteger($result, "$R_class"); %}
#%typemap(scoerceout) SWIGTYPE
# %{ class($result) <- "$&R_class"; %}
#%typemap(scoerceout) SWIGTYPE & %typemap(scoerceout) SWIGTYPE
# %{ class($result) <- "$R_class"; %} %{ class($result) <- "$&R_class"; %}
#%typemap(scoerceout) SWIGTYPE * %typemap(scoerceout) SWIGTYPE &
# %{ class($result) <- "$R_class"; %} %{ class($result) <- "$R_class"; %}
#%typemap(scoerceout) SWIGTYPE *const %typemap(scoerceout) SWIGTYPE *
# %{ class($result) <- "$R_class"; %} %{ 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 *const
%{ class($result) <- "$R_class"; %}
/* Override the SWIGTYPE * above. */ /* Override the SWIGTYPE * above. */
%typemap(scoerceout) char, %typemap(scoerceout) char,
@ -220,10 +208,8 @@ string &, std::string &
signed long &, signed long &,
unsigned long, unsigned long,
unsigned long &, unsigned long &,
signed char, unsigned char *,
signed char &, unsigned char &
unsigned char,
unsigned char &
%{ %} %{ %}
#if 0 #if 0

View file

@ -1891,9 +1891,6 @@ int R::functionWrapper(Node *n) {
if(nargs == -1) if(nargs == -1)
nargs = getFunctionPointerNumArgs(p, tt); nargs = getFunctionPointerNumArgs(p, tt);
Printv(sfun->code, "if (.hasSlot(", name, ", \"ref\")) {\n",
name, " = slot(", name, ", \"ref\");\n",
"}\n", NIL);
String *snargs = NewStringf("%d", nargs); String *snargs = NewStringf("%d", nargs);
Printv(sfun->code, "if(is.function(", name, ")) {", "\n", Printv(sfun->code, "if(is.function(", name, ")) {", "\n",
"assert('...' %in% names(formals(", name, "assert('...' %in% names(formals(", name,
@ -2115,8 +2112,7 @@ int R::functionWrapper(Node *n) {
{ {
String *finalizer = NewString(iname); String *finalizer = NewString(iname);
Replace(finalizer, "new_", "", DOH_REPLACE_FIRST); Replace(finalizer, "new_", "", DOH_REPLACE_FIRST);
Printf(sfun->code, "if (.hasSlot(ans, \"ref\")) {\n" Printf(sfun->code, "reg.finalizer(ans, delete_%s)\n", finalizer);
"reg.finalizer(ans@ref, delete_%s); }\n", finalizer);
} }
Printf(sfun->code, "ans\n"); Printf(sfun->code, "ans\n");
} }