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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 4 19:31:16 UTC 2007


Revision: 1534
          http://svn.sourceforge.net/rkward/?rev=1534&view=rev
Author:   tfry
Date:     2007-03-04 11:31:15 -0800 (Sun, 04 Mar 2007)

Log Message:
-----------
EXPERIMENTAL: place all plugin generated code into local()

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkpreviewbox.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
    trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R

Modified: trunk/rkward/rkward/plugin/rkpreviewbox.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpreviewbox.cpp	2007-03-02 18:46:05 UTC (rev 1533)
+++ trunk/rkward/rkward/plugin/rkpreviewbox.cpp	2007-03-04 19:31:15 UTC (rev 1534)
@@ -131,7 +131,7 @@
 	preview_active = true;
 	QString dummy;
 	RKGlobals::rInterface ()->issueCommand (dummy.sprintf (".rk.startPreviewDevice (\"%p\")", this), RCommand::Plugin | RCommand::Sync);
-	RKGlobals::rInterface ()->issueCommand (code_property->preview (), RCommand::Plugin | RCommand::Sync, QString::null, this);
+	RKGlobals::rInterface ()->issueCommand ("local({\n" + code_property->preview () + "})\n", RCommand::Plugin | RCommand::Sync, QString::null, this);
 
 	last_plot_done = false;
 	new_plot_pending = false;

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-03-02 18:46:05 UTC (rev 1533)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-03-04 19:31:15 UTC (rev 1534)
@@ -135,13 +135,13 @@
 	RK_TRACE (PLUGIN);
 
 	RK_ASSERT (code_property->isValid ());
-	
-	RCommandChain *chain = RKGlobals::rInterface ()->startChain ();
-	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->preprocess (), RCommand::Plugin | RCommand::DirectToOutput, QString::null, error_dialog), chain);
-	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->calculate (), RCommand::Plugin | RCommand::DirectToOutput, QString::null, error_dialog), chain);
-	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->printout (), RCommand::Plugin | RCommand::DirectToOutput, QString::null, error_dialog), chain);
-	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->cleanup (), RCommand::Plugin | RCommand::DirectToOutput | RCommand::ObjectListUpdate, QString::null, error_dialog), chain);
-	RKGlobals::rInterface ()->closeChain (chain);
+
+	QString command = "local({\n";
+	command.append (code_property->preprocess ());
+	command.append (code_property->calculate ());
+	command.append (code_property->printout ());
+	command.append ("})\n");
+	RKGlobals::rInterface ()->issueCommand (new RCommand (command, RCommand::Plugin | RCommand::DirectToOutput, QString::null, error_dialog));
 }
 
 void RKStandardComponentGUI::cancel () {
@@ -220,9 +220,9 @@
 
 	if (!code_property->isValid ()) {
 		code_display->setText (i18n ("Processing. Please wait"));
-		RK_DO (qDebug ("code not ready to be displayed: pre %d, cal %d, pri %d, cle %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull (), !code_property->cleanup ().isNull ()), PLUGIN, DL_DEBUG);
+		RK_DO (qDebug ("code not ready to be displayed: pre %d, cal %d, pri %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull ()), PLUGIN, DL_DEBUG);
 	} else {
-		code_display->setText (code_property->preprocess () + code_property->calculate () + code_property->printout () + code_property->cleanup ());
+		code_display->setText ("local({\n" + code_property->preprocess () + code_property->calculate () + code_property->printout () + "})\n");
 	}
 }
 

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.php	2007-03-02 18:46:05 UTC (rev 1533)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.php	2007-03-04 19:31:15 UTC (rev 1534)
@@ -15,7 +15,7 @@
 	$quote = getRK_val ("quote");
 	if ($quote == "other") $quote = quoteString (getRK_val ("custom_quote"));
 
-getRK("name"); ?> <- read.table (file="<? getRK("file"); ?>", header=<? getRK("header"); ?>, sep=<? echo ($sep); ?>, quote=<? echo ($quote); ?>, dec=<? echo ($dec); ?>, <? # doing row names (what a pity...) 
+getRK("name"); ?> <<- read.table (file="<? getRK("file"); ?>", header=<? getRK("header"); ?>, sep=<? echo ($sep); ?>, quote=<? echo ($quote); ?>, dec=<? echo ($dec); ?>, <? # doing row names (what a pity...) 
 	if (getRK_val("rowname")!="NULL") {
 		echo( "row.names = ");
 		if (getRK_val("rowname")=="rowcol") echo (getRK("nomrow") . ",");

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.php	2007-03-02 18:46:05 UTC (rev 1533)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.php	2007-03-04 19:31:15 UTC (rev 1534)
@@ -57,6 +57,7 @@
 <?	}
 	if (getRK_val ("doedit") && $data_frame) { ?>
 
+<? echo ($object); ?> <<- <? echo ($object); ?>		# assign to globalenv()
 rk.edit (<? echo ($object); ?>)
 <?	}
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2007-03-02 18:46:05 UTC (rev 1533)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2007-03-04 19:31:15 UTC (rev 1534)
@@ -9,14 +9,14 @@
 }
 
 # set rkward label
-"rk.set.label" <- function (x, label) {
+"rk.set.label" <- function (x, label, envir=parent.frame()) {
 	if (is.call (x) || is.name (x)) {
-		meta <- attr (eval (x), ".rk.meta")
+		meta <- attr (eval (x, envir=envir), ".rk.meta")
 	} else {
 		meta <- attr (x, ".rk.meta")
 	}
 	meta[["label"]] <- as.character (label)
-	eval (substitute (attr (x, ".rk.meta") <<- meta))
+	eval(substitute(attr(x, ".rk.meta") <- meta), envir = envir)
 }
 
 # get a short name for the given object
@@ -109,12 +109,12 @@
 
 # renames a named object in a data.frame/list without changing it's position
 # TODO: create a generic function instead, that can handle all kinds of renames
-"rk.rename.in.container" <- function (x, old_name, new_name) {
+"rk.rename.in.container" <- function (x, old_name, new_name, envir=parent.frame()) {
 	temp <- (names (x) == old_name)
 	i = 1;
 	for (val in temp) {
 		if (val) {
-			eval (substitute (names (x)[i] <<- new_name))
+			eval (substitute (names (x)[i] <- new_name), envir=envir)
 			return ()
 		}
 		i = i+1;


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