[Rd] Calling primitive functions from C code

Whit Armstrong
Wed, 31 Dec 2003 17:25:29 -0000

Does anyone have an example of calling primitive or internal functions from
C code that they would share with me?

I am having trouble trying to figure out how to construct the proper
arguments to pass to "do_subset_dflt"

Here is the prototype:
SEXP do_subset_dflt(SEXP call, SEXP op, SEXP args, SEXP rho);

The R_FunTab from "names.c" gives some additional information on the
arguments that the function expects.

{".subset",	do_subset_dflt,	1,	1,	-1,	{PP_FUNCALL,
PREC_FN,	  0}},

However, this is a little intimidating for someone like me who doesn't do
much C programming.

I understand that args is simply the argument list: x, rowsubset, colsubset,
drop, but the other variables are a mystery to me.

I've read the Appendix A R (internal) programming miscellanea from
R_exts.pdf, but there are no examples of calling these functions from C
code.
http://cran.r-project.org/doc/manuals/R-exts.pdf
<http://cran.r-project.org/doc/manuals/R-exts.pdf>

How does one create call, op and rho to be passed into do_subset_dflt?

Any advice on constructing a successful call to do_subset_dflt from C would
be greatly appreciated.

Thanks,
Whit Armstrong


	[[alternative HTML version deleted]]