From 67e2785cb7c928ed6d925342c15403d91fa71bed Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Mon, 29 Dec 2008 22:25:55 +0000 Subject: [PATCH] change as(...,"integer") to as.integer to force conversion into integers git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11015 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/r/rtype.swg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/r/rtype.swg b/Lib/r/rtype.swg index 9206b5e3e..043b7487d 100644 --- a/Lib/r/rtype.swg +++ b/Lib/r/rtype.swg @@ -35,15 +35,18 @@ INTSXP. */ +/* Force coercion of integer, since by default R sets all constants to + numeric, which means that you can't directly call a function with an + integer using an R numercal literal */ %typemap(scoercein) int, int *, int & - %{ $input = as($input, "integer"); %} + %{ $input = as.integer($input); %} %typemap(scoercein) ptrdiff_t, ptrdiff_t *, ptrdiff_t & - %{ $input = as($input, "integer"); %} + %{ $input = as.integer($input); %} %typemap(scoercein) unsigned long, unsigned long *, unsigned long & - %{ $input = as($input, "integer"); %} + %{ $input = as.integer($input); %} %typemap(scoercein) unsigned int, unsigned int *, unsigned int & - %{ $input = as($input, "integer"); %} + %{ $input = as.integer($input); %} %typemap(scoercein) double, double *, double & %{ %} %typemap(scoercein) float, float *, float &