R-alpha: unif_rand() again

Luke Tierney luke@stat.umn.edu
Tue, 3 Jun 1997 11:39:49 -0500 (CDT)


Peter Dalgaard BSA wrote:
> 
> Aha. I see, call_R seems to want an SEXP parameter, not a character
> pointer. So some way of converting "runif" into the relevant SEXPREC seems
> to be needed. Something like mkChar() <um, no, that doesn't seem to be
> the way to make a "SEXPsymbol"..> followed by findFun(). Or just pass
> it as a parameter to .C
> 
> This looks like a bug in the S compatibility, doesn't it? Nothing in
> the Splus examples indicate that the first argument should be a
> string, but I seem to recall seeing something to that effect in the
> blue book (?) 
> 

In the blue book the call looks like

	.C("zero_find", list(f), ...)

and is used as

	zero_find(void **ff, ...) {
	  func = ff[0];
	  ...
	  call_S(func, ...
	  ...
	}

In the R example the call looks like

	.C("zero_find", f, ...)

and is used as

	zero_find(void *f, ...) {
	  func = f;
	  ...
	  call_S(func, ...
	  ...
	}

In the blue book there is the extra wrapping in alist which gets
undone with a dereference in C -- I don't know if this is really
needed to or not.

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
206 Church Street                            email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-