[Rd] too many arguments in foreign function call

Gregory R. Warnes greg@warnes.net
Fri, 13 Jul 2001 07:01:56 -0400


Hi all,

I've just been working with a piece of fortran code (Leo Breiman's
random forest code) that needs a lot of arguments.  When I use .Fortran,
I get the message 'too many arguments in foreign function call'. 
Neither the help page for .Fortran (actually Foreign) nor "Writing R
Extensions" explains how many arguments are too many.  

Looking at the code in src/main/dotcode.c, I see that MAX_ARGS is set to
65.  

While it is possible to work around this limitation, it seems
arbitrary.  I propose increasing the arbitrary value to 255 and adding
appropriate documentation to the Foreign manual page.

Any objections/comments?

-Greg

-----Patch-Starts-Here------

diff -ur R-1.3.0-orig/src/library/base/man/Foreign.Rd
R-1.3.0-patched/src/library/base/man/Foreign.Rd
--- R-1.3.0-orig/src/library/base/man/Foreign.Rd        Sun May  6
12:14:16 2001+++ R-1.3.0-patched/src/library/base/man/Foreign.Rd     Fri
Jul 13 06:58:42 2001@@ -20,7 +20,7 @@
 \arguments{
   \item{name}{a character string giving the name of a C function or
     Fortran subroutine.}
-  \item{\dots}{arguments to be passed to the foreign function.}
+  \item{\dots}{arguments (maximum of 255) to be passed to the foreign
function}   \item{NAOK}{if \code{TRUE} then any \code{\link{NA}} or
     \code{\link{NaN}} or \code{\link{Inf}} values in the arguments are
     passed on to the foreign function.  If \code{FALSE}, the presence
of
Only in R-1.3.0-patched/src/library/base/man: Foreign.Rd~
diff -ur R-1.3.0-orig/src/main/dotcode.c
R-1.3.0-patched/src/main/dotcode.c
--- R-1.3.0-orig/src/main/dotcode.c     Sat Jun  9 19:35:19 2001
+++ R-1.3.0-patched/src/main/dotcode.c  Fri Jul 13 06:58:56 2001
@@ -372,7 +372,7 @@
     return args;
 }
 
-#define MAX_ARGS 65
+#define MAX_ARGS 255
 
 SEXP do_symbol(SEXP call, SEXP op, SEXP args, SEXP env)
 {
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._