[rkward-cvs] SF.net SVN: rkward: [1979] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Sep 20 18:42:51 UTC 2007


Revision: 1979
          http://rkward.svn.sourceforge.net/rkward/?rev=1979&view=rev
Author:   tfry
Date:     2007-09-20 11:42:51 -0700 (Thu, 20 Sep 2007)

Log Message:
-----------
FOR 0.4.8: Make sure not to force promises while copying them to .rk.watched.symbols

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rbackend/rembedinternal.cpp
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-09-20 09:58:54 UTC (rev 1978)
+++ trunk/rkward/ChangeLog	2007-09-20 18:42:51 UTC (rev 1979)
@@ -1,3 +1,4 @@
+- fixed: promise objects (created by delayedAssign()) directly in globalenv() would be forced early
 - make wrapper script work, when konsole is not installed
 - correct syntax highlighting for ::: and NA_integer_ and others
 - silence some GCC 4.2 warnings

Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp	2007-09-20 09:58:54 UTC (rev 1978)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp	2007-09-20 18:42:51 UTC (rev 1979)
@@ -670,6 +670,17 @@
 	return R_MakeExternalPtr (ret, RKWard_RData_Tag, R_NilValue);
 }
 
+/** copy a symbol without touching it (esp. not forcing any promises) */
+SEXP doCopyNoEval (SEXP name, SEXP fromenv, SEXP toenv) {
+	RK_TRACE (RBACKEND);
+
+	if(!isString (name) || length (name) != 1) error ("name is not a single string");
+	if(!isEnvironment (fromenv)) error ("fromenv is not an environment");
+	if(!isEnvironment (toenv)) error ("toenv is not an environment");
+	defineVar (Rf_install (CHAR (STRING_ELT (name, 0))), findVar (Rf_install (CHAR (STRING_ELT (name, 0))), fromenv), toenv);
+	return (R_NilValue);
+}
+
 bool REmbedInternal::registerFunctions (const char *library_path) {
 	RK_TRACE (RBACKEND);
 
@@ -682,6 +693,7 @@
 		{ "rk.do.command", (DL_FUNC) &doSubstackCall, 1 },
 		{ "rk.update.locale", (DL_FUNC) &doUpdateLocale, 0 },
 		{ "rk.get.structure", (DL_FUNC) &doGetStructure, 4 },
+		{ "rk.copy.no.eval", (DL_FUNC) &doCopyNoEval, 3 },
 		{ 0, 0, 0 }
 	};
 	R_registerRoutines (info, NULL, callMethods, NULL, NULL);

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2007-09-20 09:58:54 UTC (rev 1978)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2007-09-20 18:42:51 UTC (rev 1979)
@@ -191,7 +191,8 @@
 
 ".rk.watch.symbol" <- function (k) {
 	f <- .rk.make.watch.f (k)
-	assign (k, get (k, envir=globalenv ()), envir=.rk.watched.symbols)
+	.Call ("rk.copy.no.eval", k, globalenv(), .rk.watched.symbols);
+	#assign (k, get (k, envir=globalenv ()), envir=.rk.watched.symbols)
 	rm (list=k, envir=globalenv ())
 
 	base::makeActiveBinding (k, f, globalenv ())


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list