From bates@stat.wisc.edu  Thu Apr  1 23:44:01 1999
From: bates@stat.wisc.edu (Douglas Bates)
Date: 01 Apr 1999 16:44:01 -0600
Subject: .External interface
Message-ID: <6r90cc0xn2.fsf@verdi.stat.wisc.edu>

There was some mention at the Vienna conference of documenting the
.External interface so the brave could write C code that directly
dealt with SEXP's.  I recently submitted to CRAN/src/contrib/Devel an
add-on to do nonlinear least squares.  That is set up so most of the
work occurs in an nlsModel object which is a list of functions and
their enclosing environment.  Those who think in terms of
object-oriented languages like Java can imagine it to be an instance
of a class.

We would like to write the code that controls the iterations in C -
partially so that implementing things like an algorithm for partially
linear models would be easier.  I need to know how to pass an object
(a list) into a C routine and access the elements, how to force the
evaluation of a function with no arguments, and how to force the
evaluation of a function with a single argument that is a numeric
object.  I presume that I must protect the list that I am passing down
to C so the pointer to that object remains valid after a garbage
collection that may occur during this function evaluation.

I know everyone is busy but a few hints or vague references to look at
the code for ... would help.  Thomas? Robert?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


.External interface
Douglas Bates