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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Oct 11 21:55:24 UTC 2006


Revision: 852
          http://svn.sourceforge.net/rkward/?rev=852&view=rev
Author:   tfry
Date:     2006-10-11 14:55:17 -0700 (Wed, 11 Oct 2006)

Log Message:
-----------
Cleanups

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

Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO	2006-10-11 21:42:29 UTC (rev 851)
+++ trunk/rkward/TODO	2006-10-11 21:55:17 UTC (rev 852)
@@ -66,18 +66,18 @@
 Internal stuff:
 	RKVariable:
 		- Need to add a conversion script. See .rk.get.meta (). Both should be changed at the same time.
-			-Or was it already broken, before?
+			- Or was it already broken, before?
 		- True Support for Logicals
 		- In the current design, RKVariable would not handle storage mode changes from outside well at all
 		- use QIntDict instead of string-map for value-labels / factor levels? Qt4: QHash
 	- maybe we can do stuff like auto-printing, (toplevel handlers: no, not those, they are not called in R_ReplDLLdo1 ()), syntax error information by using R_ReplDLLdo1 () for user/console commands. The command-text would be fed in via R_ReadConsole (would need to keep a buffer).
-			- How to differentiate readline calls to get new command data from readline calls to get user info?! The prompt may not be realiable enough. Is there other info?
-				- the hist parameter may be a hint, but is also set in do_browser
-				- Does R_ResetConsole play any role in this?
-				- maybe (but this would really be taking chances) do so by determining, if the buffer belongs to the main Repl_Console (currently that buffer always remains the same during one loop, but can we be certain, this never changes?). Same buffer is used while inside do_browser ().
-				- RBusy is set to 0 just before the command data is read! (but also while inside do_browser ())
-			- Where would we jump after a SIGINT? I suppose we'd have to make sure to clear the buffer before signalling (another mutex)
-			- Is it UTF-8 safe?
+		- How to differentiate readline calls to get new command data from readline calls to get user info?! The prompt may not be realiable enough. Is there other info?
+			- the hist parameter may be a hint, but is also set in do_browser
+			- Does R_ResetConsole play any role in this?
+			- maybe (but this would really be taking chances) do so by determining, if the buffer belongs to the main Repl_Console (currently that buffer always remains the same during one loop, but can we be certain, this never changes?). Same buffer is used while inside do_browser ().
+			- RBusy is set to 0 just before the command data is read! (but also while inside do_browser ())
+		- Where would we jump after a SIGINT? I suppose we'd have to make sure to clear the buffer before signalling (another mutex)
+		- Is it UTF-8 safe?
 	RCommandReceiver:
 		- add virtual rCommandStarted () function, so receivers can find out, when their command becomes active
 	REmbedInternal:
@@ -113,10 +113,6 @@
 	- .rk.get.available.packages ()
 		- use external (file) storage for cache to save mem
 	- can the mutex be made non-recursive? I think so, but don't recall
-	- .rk.get.meta ()
-		- this is surprisingly inefficient, and may account for 5% of startup time (due to being called on all objects while initializing the object list)
-			- use a vector with named rows instead of a dataframe
-				- this is an incompatible change, and will require some porting script
 
 General code:
 	- use constBegin (), constEnd ()

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-11 21:42:29 UTC (rev 851)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-11 21:55:17 UTC (rev 852)
@@ -126,12 +126,12 @@
 }
 
 # overriding q, to ask via GUI instead. Arguments are not interpreted.
-"q" <- function (save = "default", status = 0, runLast = TRUE) {
+"q" <- function (save = "default", status = 0, runLast = TRUE, ...) {
 	.rk.do.call ("quit")
 }
 
-"quit" <- function (save = "default", status = 0, runLast = TRUE) {
-	q (save, status, runLast)
+"quit" <- function (save = "default", status = 0, runLast = TRUE, ...) {
+	q (save, status, runLast, ...)
 }
 
 #".rk.init.handlers" <- function () {
@@ -154,54 +154,6 @@
 #	.rk.do.call ("endOpenX11", as.character (dev.cur ()));
 #}
 
-
-# changed to allow assignment of values not in levels without losing information.
-"[<-.factor" <- function (x, i, value) {
-	ok <- TRUE
-	lx <- levels(x)
-	cx <- oldClass(x)
-	if (is.factor(value))
-		value <- levels(value)[value]
-	m <- match(value, lx)
-	if (any(is.na(m) & !is.na(value))) {
-		m <- value
-		ok <- FALSE
-		mode (x) <- "character"
-		warning("invalid factor level. Dropping factor-class. Restore using rk.restore.factor ().")
-	}
-## here, let m revert to original value to allow temporary storage in different type (probably character)
-## change storage back to 'normal' factor using "match (unclass (x), levels (x))"
-	class(x) <- NULL
-	if (missing(i))
-		x[] <- m
-	else x[i] <- m
-	attr(x, "levels") <- lx
-	if (ok) {
-		class (x) <- cx
-	} else {
-		tx <- cx[cx != "factor"]
-		if (length (tx) < 1) {
-			class (x) <- mode (x)
-		} else {
-			class (x) <- tx
-		}
-	}
-	x
-}
-
-"rk.restore.factor" <- function (x) {
-	t <- match (x, levels (x))
-	if (length (class (x)) > 1) {
-		classes <- c ("factor", class (x))
-	} else {
-		classes <- "factor"
-	}
-	attribs <- attributes (x)
-	eval (substitute (x <<- t))
-	eval (substitute (attributes (x) <<- attribs))
-	eval (substitute (class (x) <<- classes))
-}
-
 # these functions can be used to track assignments to R objects. The main interfaces are .rk.watch.symbol (k) and .rk.unwatch.symbol (k). This works by copying the symbol to a backup environment, removing it, and replacing it by an active binding to the backup location
 ".rk.watched.symbols" <- new.env ()
 


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