[Roxygen-commits] r65 - in pkg: R sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 20 20:02:42 CEST 2008
Author: pcd
Date: 2008-07-20 20:02:41 +0200 (Sun, 20 Jul 2008)
New Revision: 65
Modified:
pkg/R/collate.R
pkg/sandbox/collate.R
Log:
actually include genetics; topologically correct
Modified: pkg/R/collate.R
===================================================================
--- pkg/R/collate.R 2008-07-20 05:14:24 UTC (rev 64)
+++ pkg/R/collate.R 2008-07-20 18:02:41 UTC (rev 65)
@@ -17,21 +17,37 @@
structure(vertex, class='vertex')
}
- maybe.append.vertex <- function(file) {
- file <- trim(file)
+ maybe.append.vertex <- function(file)
if (is.null(vertices[[file]]))
assign.parent('vertices',
append(vertices,
as.list(structure(c(make.vertex(file)),
names=file))),
environment())
- }
- parse.include <- function(key, file)
+ maybe.append.ancestor <- function(predecessor, ancestor)
+ if (!c(ancestor) %in% predecessor$ancestors)
+ predecessor$ancestors <-
+ append(ancestor, predecessor$ancestors)
+
+ current.predecessor <- NULL
+
+ parse.include <- function(key, file) {
+ file <- trim(file)
maybe.append.vertex(file)
+ ancestor <- vertices[[file]]
+ maybe.append.ancestor(current.predecessor,
+ ancestor)
+ }
- pre.parse <- function(partitum)
- maybe.append.vertex(partitum$srcref$filename)
+ pre.parse <- function(partitum) {
+ file <- partitum$srcref$filename
+ maybe.append.vertex(file)
+ vertex <- vertices[[file]]
+ assign.parent('current.predecessor',
+ vertex,
+ environment())
+ }
topological.sort <- function(vertices) {
time <- 0
@@ -46,7 +62,7 @@
}
predecessor$finished <- time
assign.parent('sorted',
- append(predecessor, sorted),
+ append(sorted, predecessor),
environment())
}
for (vertex in vertices)
@@ -55,10 +71,12 @@
}
post.files <-
- function() cat(Reduce.paste(function(vertex) vertex$file,
+ function() cat('collate',
+ Reduce.paste(function(vertex) vertex$file,
topological.sort(vertices),
' '),
- '\n')
+ '\n',
+ sep='')
roclet <- make.roclet(parse.include,
pre.parse=pre.parse,
Modified: pkg/sandbox/collate.R
===================================================================
--- pkg/sandbox/collate.R 2008-07-20 05:14:24 UTC (rev 64)
+++ pkg/sandbox/collate.R 2008-07-20 18:02:41 UTC (rev 65)
@@ -17,16 +17,7 @@
argv <- commandArgs(trailingOnly=T)
argc <- length(argv)
-files <- ifelse(argc > 0, as.list(argv), FILES)
+files <- if (argc > 0) as.list(argv) else FILES
roclet <- make.collate.roclet()
-## do.call(roclet$parse, files)
-roclet$parse('collate/belt.R',
- 'collate/jacket.R',
- 'collate/pants.R',
- 'collate/shirt.R',
- 'collate/shoes.R',
- 'collate/socks.R',
- 'collate/tie.R',
- 'collate/undershorts.R',
- 'collate/watch.R')
+do.call(roclet$parse, files)
More information about the Roxygen-commits
mailing list