[Rcpp-commits] r4505 - in pkg/Rcpp: . R inst/skeleton man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 18 10:03:45 CEST 2013


Author: romain
Date: 2013-09-18 10:03:41 +0200 (Wed, 18 Sep 2013)
New Revision: 4505

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Rcpp.package.skeleton.R
   pkg/Rcpp/inst/skeleton/rcpp_hello_world.h
   pkg/Rcpp/man/Rcpp.package.skeleton.Rd
Log:
set attributes to TRUE by default in Rcpp.package.skeleton, we should encourage people to use them

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-09-18 07:40:39 UTC (rev 4504)
+++ pkg/Rcpp/ChangeLog	2013-09-18 08:03:41 UTC (rev 4505)
@@ -1,7 +1,7 @@
 2013-09-17  JJ Allaire  <jj at rstudio.org>
 
 	* R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without
-	qualification rather than with '...'
+	qualification rather than with ':::'
 
 2013-09-17  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R
===================================================================
--- pkg/Rcpp/R/Rcpp.package.skeleton.R	2013-09-18 07:40:39 UTC (rev 4504)
+++ pkg/Rcpp/R/Rcpp.package.skeleton.R	2013-09-18 08:03:41 UTC (rev 4505)
@@ -22,7 +22,7 @@
 	path = ".", force = FALSE, namespace = TRUE,
 	code_files = character(), cpp_files = character(),
 	example_code = TRUE,
-	attributes = FALSE,
+	attributes = TRUE,
 	module = FALSE,
 	author = "Who wrote it",
 	maintainer = if(missing( author)) "Who to complain to" else author,
@@ -32,7 +32,9 @@
 	
 	if (!is.character(cpp_files)) 
 		stop("'cpp_files' must be a character vector")
-
+	# set example_code if attributes is set
+	if( isTRUE(attributes) )
+	    example_code <- TRUE
 	env <- parent.frame(1)
 
 	if( !length(list) ){
@@ -115,6 +117,20 @@
 		}
 		close( ns )
 	}
+	
+	# update the package description help page
+	package_help_page <- file.path( root, "man", sprintf( "%s-package.Rd" ) )
+	if( file.exists(package_help_page) ){
+	    lines <- readLines(package_help_page)
+	    lines <- gsub( "What license is it under?", license, fixed = TRUE )
+	    lines <- gsub( "Who to complain to <yourfault at somewhere.net>", 
+	        sprintf( "%s <%s>", maintainer, email), 
+	        fixed = TRUE
+	        )
+	    )
+	    lines <- gsub( "Who wrote it", author, fixed = TRUE )
+	    writeLines( lines, package_help_page )
+	}
 
 	# lay things out in the src directory
 	src <- file.path( root, "src")

Modified: pkg/Rcpp/inst/skeleton/rcpp_hello_world.h
===================================================================
--- pkg/Rcpp/inst/skeleton/rcpp_hello_world.h	2013-09-18 07:40:39 UTC (rev 4504)
+++ pkg/Rcpp/inst/skeleton/rcpp_hello_world.h	2013-09-18 08:03:41 UTC (rev 4505)
@@ -8,7 +8,7 @@
  *
  * It gives C calling convention to the rcpp_hello_world function so that 
  * it can be called from .Call in R. Otherwise, the C++ compiler mangles the 
- * name of the function and .Call can't find it.
+ * name of the function and .Call cannot find it.
  *
  * It is only useful to use RcppExport when the function is intended to be called
  * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672

Modified: pkg/Rcpp/man/Rcpp.package.skeleton.Rd
===================================================================
--- pkg/Rcpp/man/Rcpp.package.skeleton.Rd	2013-09-18 07:40:39 UTC (rev 4504)
+++ pkg/Rcpp/man/Rcpp.package.skeleton.Rd	2013-09-18 08:03:41 UTC (rev 4505)
@@ -14,7 +14,7 @@
 Rcpp.package.skeleton(name = "anRpackage", list = character(), 
 	environment = .GlobalEnv, path = ".", force = FALSE, 
 	namespace = TRUE, code_files = character(), cpp_files = character(),
-	example_code = TRUE, attributes = FALSE, module = FALSE, 
+	example_code = TRUE, attributes = TRUE, module = FALSE, 
 	author = "Who wrote it", 
 	maintainer = if(missing( author)) "Who to complain to" else author, 
 	email = "yourfault at somewhere.net", 
@@ -64,7 +64,9 @@
 	
 	If the \code{attributes} argument is \code{TRUE}, then rather than generate
 	the example files as described above, a single \samp{rcpp_hello_world.cpp}
-	file is created in the \samp{src} directory and it's attributes are compiled.
+	file is created in the \samp{src} directory and it's attributes are 
+	compiled using the \code{\link{compileAttributes}} function, so files
+	\samp{RcppExports.R} and \samp{RcppExports.cpp} are generated as well. 
 	
 	If the \code{module} argument is \code{TRUE}, a sample Rcpp module will 
 	be generated as well. 



More information about the Rcpp-commits mailing list