[Roxygen-commits] r100 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jul 27 04:28:02 CEST 2008


Author: pcd
Date: 2008-07-27 04:28:02 +0200 (Sun, 27 Jul 2008)
New Revision: 100

Modified:
   pkg/R/Rd.R
   pkg/R/collate.R
   pkg/R/functional.R
   pkg/R/namespace.R
   pkg/R/parse.R
   pkg/R/roxygen.R
   pkg/R/roxygenize.R
   pkg/README
Log:
note that de.tex doesn't work recursively; roxygenize NAMESPACE; add @exports


Modified: pkg/R/Rd.R
===================================================================
--- pkg/R/Rd.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/Rd.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -105,6 +105,7 @@
 #'
 #' roclet <- make.Rd.roclet('man')
 #' \dontrun{roclet$parse('example.R')}
+#' @export
 make.Rd.roclet <- function(subdir=NULL) {
   #' Translate a key and expressions into an Rd expression;
   #' multiple expressions take their own braces.

Modified: pkg/R/collate.R
===================================================================
--- pkg/R/collate.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/collate.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -24,6 +24,7 @@
 #'
 #' roclet <- make.collate.roclet()
 #' \dontrun{roclet$parse('example.R')}
+#' @export
 make.collate.roclet <- function() {
   vertices <- NULL
 

Modified: pkg/R/functional.R
===================================================================
--- pkg/R/functional.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/functional.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -5,6 +5,7 @@
 #' @param FUN the function to be curried
 #' @param \dots the determining parameters
 #' @return A new function partially determined
+#' @export
 Curry <- function(FUN,...) {
   .orig = list(...);
   function(...) do.call(FUN,c(.orig,list(...)))

Modified: pkg/R/namespace.R
===================================================================
--- pkg/R/namespace.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/namespace.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -48,6 +48,7 @@
 #'                                   Extensions}.}
 #' }
 #'
+#' @param outfile whither to send output; '' == standard out
 #' @return Namespace roclet
 #' @examples
 #' #' An example file, example.R, which imports
@@ -61,9 +62,12 @@
 #'
 #' roclet <- make.namespace.roclet()
 #' \dontrun{roclet$parse('example.R')}
-make.namespace.roclet <- function() {
+#' @export
+make.namespace.roclet <- function(outfile='') {
   parse.directive <- function(proc, parms)
-    cat(sprintf('%s(%s)\n', proc, strmap(Identity, ', ', parms)))
+    cat(sprintf('%s(%s)\n', proc, strmap(Identity, ', ', parms)),
+        file=outfile,
+        append=TRUE)
   
   exportee <- NULL
 
@@ -74,8 +78,12 @@
                       S4generic=partitum$S4method,
                       S4class=partitum$S4class)
 
+  pre.files <- function()
+    unlink(outfile)
+
   roclet <- make.roclet(parse.directive,
-                        pre.parse)
+                        pre.parse=pre.parse,
+                        pre.files=pre.files)
 
   parse.exportClass <- function(proc, parms)
     parse.directive('exportClasses', parms)

Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/parse.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -321,6 +321,7 @@
 #' @param ref the srcref, preref or pair of the same
 #' @param \dots ignored
 #' @return List containing the parsed srcref/preref
+#' @export
 parse.ref <- function(ref, ...)
   UseMethod('parse.ref')
 
@@ -329,6 +330,7 @@
 #' @param ref the preref/srcref pair
 #' @param \dots ignored
 #' @return List combining the parsed preref/srcref
+#' @export
 parse.ref.list <- function(ref, ...)
   append(parse.ref(car(ref)),
          parse.ref(cadr(ref)))
@@ -339,6 +341,7 @@
 #' @param ref the preref to be parsed
 #' @param \dots ignored
 #' @return List containing the parsed preref
+#' @export
 parse.ref.preref <- function(ref, ...) {
   lines <- Map(trim.left, getSrcLines(attributes(ref)$srcfile,
                                       car(ref),
@@ -474,6 +477,7 @@
 #' @param ref the srcref to be parsed
 #' @param \dots ignored
 #' @return List containing the parsed srcref
+#' @export
 parse.ref.srcref <- function(ref, ...) {
   srcfile <- attributes(ref)$srcfile
   srcref <- list(srcref=list(filename=srcfile$filename,
@@ -515,6 +519,7 @@
 #' Text-parsing hack using tempfiles for more facility.
 #' @param \dots lines of text to be parsed
 #' @return The parse tree
+#' @export
 parse.text <- function(...) {
   file <- tempfile()
   cat(..., sep='\n', file=file)

Modified: pkg/R/roxygen.R
===================================================================
--- pkg/R/roxygen.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/roxygen.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -1,11 +1,13 @@
 #' No-op for sourceless files
 #' @return \code{NULL}
+#' @export
 roxygen <- function() NULL
 
-#' See the \link{\code{make.Rd.roclet}},
-#' \link{\code{make.namespace.roclet}},
-#' and \link{\code{make.collate.roclet}} pages for
+#' See the \code{\link{make.Rd.roclet}},
+#' \code{\link{make.namespace.roclet}},
+#' and \code{\link{make.collate.roclet}} pages for
 #' an overview of roxygen tags.
-#' @alias roxygen-package roxygen
+#' @title Roxygen package
+#' @name roxygen-package
 #' @docType package
 roxygen()

Modified: pkg/R/roxygenize.R
===================================================================
--- pkg/R/roxygenize.R	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/R/roxygenize.R	2008-07-27 02:28:02 UTC (rev 100)
@@ -13,6 +13,12 @@
 #' Whence to copy source code
 R.DIR <- 'R'
 
+#' Whither to copy namespace
+NAMESPACE.FILE <- 'NAMESPACE'
+
+#' Whither to copy collate
+DESCRIPTION.FILE <- 'DESCRIPTION'
+
 #' Recursively copy a directory thither; optionally unlinking
 #' the target first; optionally overwriting; optionally
 #' verbalizing.
@@ -53,6 +59,8 @@
                        copy.package=TRUE) {
   roxygen.dir <- sprintf(ROXYGEN.DIR, package.dir)
   man.dir <- file.path(roxygen.dir, MAN.DIR)
+  namespace.file <- file.path(roxygen.dir, NAMESPACE.FILE)
+  description.file <- file.path(roxygen.dir, DESCRIPTION.FILE)
   skeleton <- c(roxygen.dir, man.dir)
 
   if (copy.package)
@@ -60,11 +68,13 @@
              roxygen.dir,
              unlink.target=TRUE,
              overwrite=TRUE,
-             verbose=TRUE)
+             verbose=FALSE)
 
   for (dir in skeleton) dir.create(dir, showWarnings=FALSE)
   r.dir <- file.path(package.dir, R.DIR)
-  source.files <- list.files(r.dir, recursive=TRUE, full.names=TRUE)
+  source.files <- as.list(list.files(r.dir, recursive=TRUE, full.names=TRUE))
   Rd <- make.Rd.roclet(man.dir)
-  do.call(Rd$parse, as.list(source.files))
+  do.call(Rd$parse, source.files)
+  namespace <- make.namespace.roclet(namespace.file)
+  do.call(namespace$parse, source.files)
 }

Modified: pkg/README
===================================================================
--- pkg/README	2008-07-27 02:27:47 UTC (rev 99)
+++ pkg/README	2008-07-27 02:28:02 UTC (rev 100)
@@ -49,5 +49,7 @@
 * first.sentence is fooled by infix periods, whereupon it resorts to
   `...'.
 
+* de.tex doesn't work recursively (i.e. de-TeXs only the top level).
+
 -----------
 * Hail, Hephaistos! Grant skill and weal.



More information about the Roxygen-commits mailing list