Skip to content
Prev 30992 / 63421 Next

can't get names of R_env

Thanks for your reply.

2009/1/5 Prof Brian Ripley <ripley at stats.ox.ac.uk>:
Yes, I can see their implementation in src/main/envir.c.
But I'm still somewhat lost concerning the innerworkings of the .R <->
.c interface.
Especially the passing of the R_env parameter from R.

I'll try to explain what puzzles me as concisely as possible
-----------------------------------------------------
i.e
the optim() prototype is
optim <- function(par, fn, gr = NULL, ...,
                  method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN"),
                  lower = -Inf, upper = Inf,
                  control = list(), hessian = FALSE)

This makes an .Internal method call with
.Internal(optim(par, fn1, gr1, method, con, lower, upper))
This has seven args.

An by "src/names.c" this will use the do_optim() from src/main/optim.c
which has the following protype
SEXP attribute_hidden do_optim(SEXP call, SEXP op, SEXP args, SEXP rho);
This has 4 args.

According to the R-ints all .Internal that calls c-code will call
dispatchOrEval() in src/eval.c
http://cran.r-project.org/doc/manuals/R-ints.html#Argument-evaluation
But the arguments (there are 8), remains quite obscure for me.
And I'm having some problems tracking down the .Internal function
definition in the sourcetree.

Can someone clarify what happens in between .
.Internal(optim(...))  to do_optim(...)

Thanks again.