@@ -26,13 +26,13 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
2626 maintainer = if (missing( author )) " Who to complain to" else author ,
2727 email = " yourfault@somewhere.net" ,
2828 license = " What Licence is it under ?" ) {
29+
30+ call <- match.call()
31+ call [[1 ]] <- as.name(" package.skeleton" )
32+ env <- parent.frame(1 )
2933
3034 if (! is.character(cpp_files ))
3135 stop(" 'cpp_files' must be a character vector" )
32- # set example_code if attributes is set
33- if ( isTRUE(attributes ) )
34- example_code <- TRUE
35- env <- parent.frame(1 )
3636
3737 if ( ! length(list ) ){
3838 fake <- TRUE
@@ -41,21 +41,24 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
4141 assign( " rcpp_hello_world" , function (){}, envir = env )
4242 remove_hello_world <- TRUE
4343 } else {
44- remove_hello_world <- FALSE
44+ remove_hello_world <- FALSE
4545 }
4646 } else {
47- if ( ! " rcpp_hello_world" %in% list ){
48- call [[" list" ]] <- c( " rcpp_hello_world" , call [[" list" ]] )
47+ if ( example_code && ! isTRUE(attributes )){
48+ if ( ! " rcpp_hello_world" %in% list ){
49+ assign( " rcpp_hello_world" , function (){}, envir = env )
50+ call [[" list" ]] <- as.call( c(
51+ as.name(" c" ), as.list(c( " rcpp_hello_world" , list ))
52+ ) )
53+ }
4954 remove_hello_world <- TRUE
50- } else {
55+ } else {
5156 remove_hello_world <- FALSE
5257 }
5358 fake <- FALSE
5459 }
5560
56- # first let the traditional version do its business
57- call <- match.call()
58- call [[1 ]] <- as.name(" package.skeleton" )
61+ # first let the traditional version do its business
5962 # remove Rcpp specific arguments
6063
6164 call <- call [ c( 1L , which( names(call ) %in% names(formals(package.skeleton )))) ]
0 commit comments