[rkward-cvs] SF.net SVN: rkward: [801] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Oct 4 10:00:28 UTC 2006
Revision: 801
http://svn.sourceforge.net/rkward/?rev=801&view=rev
Author: tfry
Date: 2006-10-04 03:00:22 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
backwards compatibility with R < 2.4.0
Modified Paths:
--------------
trunk/rkward/rkward/core/renvironmentobject.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 08:31:55 UTC (rev 800)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp 2006-10-04 10:00:22 UTC (rev 801)
@@ -51,6 +51,7 @@
if (type & GlobalEnv) return (short_child_name);
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));
}
@@ -67,7 +68,7 @@
void REnvironmentObject::updateFromR () {
RK_TRACE (OBJECTS);
QString options;
- if (type & GlobalEnv) options = ", envleve=-1"; // in the .GlobalEnv recurse one more level
+ if (type & GlobalEnv) options = ", envlevel=-1"; // in the .GlobalEnv recurse one more level
if (type & ToplevelEnv) options.append (", namespacename=" + rQuote (namespace_name));
RCommand *command = new RCommand (".rk.get.structure (" + getFullName () + ", " + rQuote (getShortName ()) + options + ")", RCommand::App | RCommand::Sync | RCommand::GetStructuredData, QString::null, this, ROBJECT_UDPATE_STRUCTURE_COMMAND);
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2006-10-04 08:31:55 UTC (rev 800)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2006-10-04 10:00:22 UTC (rev 801)
@@ -350,11 +350,23 @@
ret[[childname]] <- .rk.get.structure (get (childname, envir=x), childname, envlevel)
}
} else {
- ns <- tryCatch (asNamespace (namespacename), error = function(e) NULL)
- for (childname in lst) {
- misplaced <- FALSE
- if ((!is.null (ns)) && (!exists (childname, envir=ns, inherits=FALSE))) misplaced <- TRUE
- ret[[childname]] <- .rk.get.structure (get (childname, envir=x), childname, envlevel, misplaced=misplaced)
+ # before R 2.4.0, operator "::" would only work on true namespaces, not on package names (operator "::" work, if there is a namespace, and that namespace has the symbol in it)
+ # TODO remove once we depend on R >= 2.4.0
+ if (compareVersion (paste (R.version$major, R.version$minor, sep="."), "2.4.0") < 0) {
+ ns <- tryCatch (asNamespace (namespacename), error = function(e) NULL)
+ for (childname in lst) {
+ misplaced <- FALSE
+ if (is.null (ns) || (!exists (childname, envir=ns, inherits=FALSE))) misplaced <- TRUE
+ ret[[childname]] <- .rk.get.structure (get (childname, envir=x), childname, envlevel, misplaced=misplaced)
+ }
+ } else {
+ # for R 2.4.0 or greater: operator "::" works if package has no namespace at all, or has a namespace with the symbol in it
+ ns <- tryCatch (asNamespace (namespacename), error = function(e) NULL)
+ for (childname in lst) {
+ misplaced <- FALSE
+ if ((!is.null (ns)) && (!exists (childname, envir=ns, inherits=FALSE))) misplaced <- TRUE
+ ret[[childname]] <- .rk.get.structure (get (childname, envir=x), childname, envlevel, misplaced=misplaced)
+ }
}
}
}
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