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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Oct 4 10:41:47 UTC 2006


Revision: 802
          http://svn.sourceforge.net/rkward/?rev=802&view=rev
Author:   tfry
Date:     2006-10-04 03:41:38 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Deal with non-package toplevel environments (Autoloads)

Modified Paths:
--------------
    trunk/rkward/rkward/core/renvironmentobject.cpp
    trunk/rkward/rkward/core/robject.h
    trunk/rkward/rkward/core/robjectlist.cpp
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R

Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-04 10:00:22 UTC (rev 801)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-04 10:41:38 UTC (rev 802)
@@ -52,8 +52,8 @@
 	if (type & ToplevelEnv) {
 /* Some items are placed outside of their native namespace. E.g. in package:boot item "motor". It can be retrieved using as.environment ("package:boot")$motor. This is extremly ugly. We need to give them (and only them) this special treatment. */
 // TODO: hopefully one day operator "::" will work even in those cases. So check back later, and remove after a sufficient amount of backwards compatibility time
-		if (misplaced) return (getFullName () + "$" + RObject::rQuote (short_child_name));
-		return (namespace_name + "::" + RObject::rQuote (short_child_name));
+		if ((type & PackageEnv) && (!misplaced)) return (namespace_name + "::" + RObject::rQuote (short_child_name));
+		return (getFullName () + "$" + RObject::rQuote (short_child_name));
 	}
 	return (name + "$" + short_child_name);
 }

Modified: trunk/rkward/rkward/core/robject.h
===================================================================
--- trunk/rkward/rkward/core/robject.h	2006-10-04 10:00:22 UTC (rev 801)
+++ trunk/rkward/rkward/core/robject.h	2006-10-04 10:41:38 UTC (rev 802)
@@ -55,8 +55,9 @@
 		Environment=256,
 		GlobalEnv=512,
 		ToplevelEnv=1024,
-		HasMetaObject=2048,
-		Misplaced=4096		/** < the object is not in the namespace where it would be expected */
+		PackageEnv=2048,
+		HasMetaObject=4096,
+		Misplaced=8192		/** < the object is not in the namespace where it would be expected */
 	};
 
 	#define ROBJECT_TYPE_INTERNAL_MASK (RObject::Container | RObject::Variable | RObject::Workspace | RObject::Environment | RObject::Function)

Modified: trunk/rkward/rkward/core/robjectlist.cpp
===================================================================
--- trunk/rkward/rkward/core/robjectlist.cpp	2006-10-04 10:00:22 UTC (rev 801)
+++ trunk/rkward/rkward/core/robjectlist.cpp	2006-10-04 10:41:38 UTC (rev 802)
@@ -157,12 +157,10 @@
 	REnvironmentObject *envobj = new REnvironmentObject (this, name);
 
 	if (name == ".GlobalEnv") {
-		envobj->type |= GlobalEnv;
+		envobj->type |= GlobalEnv | PackageEnv;
 	} else if (name.contains (':')) {
 		envobj->namespace_name = name.section (':', 1);
-	} else if (name == "Autoloads") {
-#warning HACK, wrong
-		envobj->type |= GlobalEnv;              // this is wrong! but it's a temporary HACK to get things to work
+		envobj->type |= PackageEnv;
 	}
 
 	childmap.insert (name, envobj);

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-04 10:00:22 UTC (rev 801)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-04 10:41:38 UTC (rev 802)
@@ -14,28 +14,6 @@
 ".rk.editor.closed" <- function (x) {
 	if (exists (".rk.editing")) .rk.editing <<- .rk.editing[.rk.editing != deparse (substitute (x))]
 }
-#TODO: remove:
-".rk.classify" <- function (x) {
-	type <- 0
-	if (is.data.frame (x)) type = type + 1
-	if (is.matrix (x)) type = type + 2
-	if (is.array (x)) type = type + 4
-	if (is.list (x)) type = type + 8
-	if (type != 0) type = type + 16 else type = 32
-	if (is.function (x)) type = 128
-	if (is.environment (x)) type = 256
-	if (!is.null (attr (x, ".rk.meta"))) type = type + 2048
-	d <- dim (x)
-	if (length (d) < 1) d <- length (x);	# handling for objects that according to R do not have a dimension (such as vectors, functions, etc.)
-	c (type, d)
-}
-#TODO: remove:
-".rk.get.type" <- function (x) {
-	if (is.data.frame (x) || is.matrix (x) || is.array (x) || is.list (x)) return (1)		# container
-	if (is.function (x)) return (2)		# function
-	if (is.vector (x)) return (3)		# a vector/variable
-	return (4)		# something else
-}
 
 ".rk.data.frame.insert.row" <- function (x, index=0) {
 	if ((index == 0) || (index > dim (x)[1])) {	# insert row at end
@@ -298,8 +276,8 @@
 		type = 256
 		cont <- TRUE
 	}
-	if (!is.null (attr (x, ".rk.meta"))) type = type + 2048
-	if (misplaced) type <- type + 4096
+	if (!is.null (attr (x, ".rk.meta"))) type = type + 4096
+	if (misplaced) type <- type + 8192
 	type <- as.integer (type)
 
 # 3: classes


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