Revision: 536 http://rpy.svn.sourceforge.net/rpy/?rev=536&view=rev Author: lgautier Date: 2008-05-27 21:46:53 -0700 (Tue, 27 May 2008)
Log Message: ----------- - added local modified version of R's main/envir.c findFun (since R's findVar1 is declared static) - attempt at RPy-1-like defined-based name for the module's initialization function (left commented out) Modified Paths: -------------- branches/rpy_nextgen/rpy/rinterface/rinterface.c Modified: branches/rpy_nextgen/rpy/rinterface/rinterface.c =================================================================== --- branches/rpy_nextgen/rpy/rinterface/rinterface.c 2008-05-28 04:38:57 UTC (rev 535) +++ branches/rpy_nextgen/rpy/rinterface/rinterface.c 2008-05-28 04:46:53 UTC (rev 536) @@ -1169,9 +1169,35 @@ return 0; } +static SEXP rpy_findFun(SEXP symbol, SEXP rho) +{ + SEXP vl; + while (rho != R_EmptyEnv) { + /* This is not really right. Any variable can mask a function */ + vl = findVarInFrame3(rho, symbol, TRUE); + if (vl != R_UnboundValue) { + if (TYPEOF(vl) == PROMSXP) { + PROTECT(vl); + vl = eval(vl, rho); + UNPROTECT(1); + } + if (TYPEOF(vl) == CLOSXP || TYPEOF(vl) == BUILTINSXP || + TYPEOF(vl) == SPECIALSXP) + return (vl); + + if (vl == R_MissingArg) + printf("R_MissingArg in rpy_FindFun.\n"); + return R_UnboundValue; + } + rho = ENCLOS(rho); + } + return R_UnboundValue; +} + + + /* --- */ - static PySexpObject* EnvironmentSexp_findVar(PyObject *self, PyObject *args, PyObject *kwds) { @@ -1201,7 +1227,7 @@ } if (wantFun == Py_True) { - res_R = findFun(install(name), rho_R); + res_R = rpy_findFun(install(name), rho_R); } else { res_R = findVar(install(name), rho_R); } @@ -1429,15 +1455,10 @@ } - - - - - - //FIXME: write more doc PyDoc_STRVAR(S4Sexp_Type_doc, "R object that is an 'S4 object'.\ +Attributes can be accessed using the method 'do_slot'.\ "); @@ -1844,9 +1865,17 @@ #define PYASSERT_ZERO(code) \ if ((code) != 0) {return ; } + +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#define PyMODINIT_FUNC void +#endif + PyMODINIT_FUNC -RPY_RINTERFACE_INIT(void) +initrinterface(void) { +//PyMODINIT_FUNC +//RPY_RINTERFACE_INIT(void) +//{ /* Finalize the type object including setting type of the new type * object; doing it here is required for portability to Windows @@ -2011,5 +2040,5 @@ /* //FIXME: DECREF ? */ //Py_DECREF(na_string); - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list