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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Jan 26 15:54:54 UTC 2007


Revision: 1228
          http://svn.sourceforge.net/rkward/?rev=1228&view=rev
Author:   tfry
Date:     2007-01-26 07:54:54 -0800 (Fri, 26 Jan 2007)

Log Message:
-----------
Don't litter the .GlobalEnv with our internal objects.
SVN users: You will need to do make install, or you will get a number of bugs

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

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2007-01-25 23:43:41 UTC (rev 1227)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2007-01-26 15:54:54 UTC (rev 1228)
@@ -271,7 +271,7 @@
 	RKGlobals::controlWindow()->addChain (request->in_chain);
 
 	// clear reply object
-	issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+	issueCommand (".rk.set.reply (NULL)", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 	if (!request->call_length) {
 		RK_ASSERT (false);
 		closeChain (request->in_chain);
@@ -289,14 +289,14 @@
 			while (dir.exists (file_prefix + QString::number (i) + file_extension)) {
 				i++;
 			}
-			issueCommand (".rk.rkreply <- \"" + dir.filePath (file_prefix + QString::number (i) + file_extension) + "\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+			issueCommand (".rk.set.reply (\"" + dir.filePath (file_prefix + QString::number (i) + file_extension) + "\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 		} else {
-			issueCommand (".rk.rkreply <- \"Too few arguments in call to get.tempfile.name.\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+			issueCommand (".rk.set.reply (\"Too few arguments in call to get.tempfile.name.\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 		}
 	} else if (call == "get.output.html.file") {
 		QDir dir (RKSettingsModuleGeneral::filesPath ());
 		// TODO: make more generic, get filename sanely
-		issueCommand (".rk.rkreply <- \"" + dir.filePath ("rk_out.html") + "\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+		issueCommand (".rk.set.reply (\"" + dir.filePath ("rk_out.html") + "\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 	} else if (call == "sync") {
 		RK_ASSERT (request->call_length >= 2);
 
@@ -334,17 +334,16 @@
 	} else if (call == "require") {
 		if (request->call_length >= 2) {
 			QString lib_name = request->call[1];
-			issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 			KMessageBox::information (0, i18n ("The R-backend has indicated that in order to carry out the current task it needs the package '%1', which is not currently installed. We will open the package-management tool, and there you can try to locate and install the needed package.").arg (lib_name), i18n ("Require package '%1'").arg (lib_name));
 			RKLoadLibsDialog::showInstallPackagesModal (0, request->in_chain, lib_name);
-			issueCommand (".rk.rkreply <- \"\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+			issueCommand (".rk.set.reply (\"\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 		} else {
-			issueCommand (".rk.rkreply <- \"Too few arguments in call to require.\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+			issueCommand (".rk.set.reply (\"Too few arguments in call to require.\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 		}
 	} else if (call == "quit") {
 		RKWardMainWindow::getMain ()->close ();
 		// if we're still alive, quitting was cancelled
-		issueCommand (".rk.rkreply <- \"Quitting was cancelled\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+		issueCommand (".rk.set.reply (\"Quitting was cancelled\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 #ifndef DISABLE_RKWINDOWCATCHER
  	} else if (call == "startOpenX11") {
 		// TODO: error checking/handling (wrong parameter count/type)
@@ -362,7 +361,7 @@
 		}
 #endif // DISABLE_RKWINDOWCATCHER
 	} else {
-		issueCommand (".rk.rkreply <- \"Unrecognized call '" + call + "'. Ignoring\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
+		issueCommand (".rk.set.reply (\"Unrecognized call '" + call + "'. Ignoring\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 	}
 	
 	closeChain (request->in_chain);

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2007-01-25 23:43:41 UTC (rev 1227)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2007-01-26 15:54:54 UTC (rev 1228)
@@ -84,10 +84,11 @@
 	return(c(as.vector(H$topic),as.vector(H$title),as.vector(H$Package)))
 }
 
+".rk.available.packages.cache" <- NULL
 # This function works like available.packages (with no arguments), but does simple caching of the result, and of course uses a cache if available. Cache is only used, if it is less than 1 hour old, and options("repos") is unchanged.
 ".rk.cached.available.packages" <- function () {
 	x <- NULL
-	if (exists (".rk.available.packages.cache")) {
+	if (exists (".rk.available.packages.cache") && (!is.null (.rk.available.packages.cache))) {
 		if (.rk.available.packages.cache$timestamp > (Sys.time () - 3600)) {
 			if (all (.rk.available.packages.cache$repos$repos == options ("repos")$repos)) {
 				x <- .rk.available.packages.cache$cache
@@ -338,6 +339,10 @@
 	ret
 }
 
+".rk.rkreply" <- NULL
+
+".rk.set.reply" <- function (x) .rk.rkreply <<- x
+
 ".rk.preview.devices" <- list ();
 
 ".rk.startPreviewDevice" <- function (x) {


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