[Rcpp-commits] r3882 - / pkg/Rcpp pkg/Rcpp/R pkg/Rcpp/inst pkg/Rcpp/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 1 12:52:04 CET 2012
Author: jjallaire
Date: 2012-11-01 12:52:04 +0100 (Thu, 01 Nov 2012)
New Revision: 3882
Modified:
/
pkg/Rcpp/ChangeLog
pkg/Rcpp/R/Attributes.R
pkg/Rcpp/inst/NEWS.Rd
pkg/Rcpp/man/cppFunction.Rd
pkg/Rcpp/man/sourceCpp.Rd
Log:
change 'envir' param to 'env' for consistency with loadModule; documentation and NEWS.Rd updates
Property changes on:
___________________________________________________________________
Added: svn:ignore
+ .Rproj.user
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-11-01 09:34:53 UTC (rev 3881)
+++ pkg/Rcpp/ChangeLog 2012-11-01 11:52:04 UTC (rev 3882)
@@ -1,3 +1,10 @@
+2012-10-31 JJ Allaire <jj at rstudio.org>
+
+ * R/Attributes.R: change 'envir' param to 'env' for consistency with
+ the interface of loadModule
+ * man/sourceCpp.Rd: documentation updates
+ * man/cppFunction.Rd: documentation updates
+
2012-11-01 Romain Francois <romain at r-enthusiasts.com>
* include/Rcpp/sugar/logical/or.h : implementing x | y where x and y are
Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R 2012-11-01 09:34:53 UTC (rev 3881)
+++ pkg/Rcpp/R/Attributes.R 2012-11-01 11:52:04 UTC (rev 3882)
@@ -19,7 +19,7 @@
# Source C++ code from a file
sourceCpp <- function(file = "",
code = NULL,
- envir = globalenv(),
+ env = globalenv(),
rebuild = FALSE,
showOutput = verbose,
verbose = getOption("verbose")) {
@@ -125,7 +125,7 @@
# source the R script
scriptPath <- file.path(context$buildDirectory, context$rSourceFilename)
- source(scriptPath, local = envir)
+ source(scriptPath, local = env)
# return (invisibly) a list of exported functions
invisible(context$exportedFunctions)
@@ -135,7 +135,7 @@
cppFunction <- function(code,
plugin = NULL,
includes = NULL,
- envir = parent.frame(),
+ env = parent.frame(),
rebuild = FALSE,
showOutput = verbose,
verbose = getOption("verbose")) {
@@ -168,13 +168,13 @@
cat(code)
}
- # source cpp into specified environment. if envir is set to NULL
+ # source cpp into specified environment. if env is set to NULL
# then create a new one (the caller can get a hold of the function
# via the return value)
- if (is.null(envir))
- envir <- new.env()
+ if (is.null(env))
+ env <- new.env()
exported <- sourceCpp(code = code,
- envir = envir,
+ env = env,
rebuild = rebuild,
showOutput = showOutput,
verbose = verbose)
@@ -186,7 +186,7 @@
stop("More than one function definition")
else {
functionName <- exported[[1]]
- invisible(get(functionName, envir))
+ invisible(get(functionName, env))
}
}
Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd 2012-11-01 09:34:53 UTC (rev 3881)
+++ pkg/Rcpp/inst/NEWS.Rd 2012-11-01 11:52:04 UTC (rev 3882)
@@ -8,9 +8,10 @@
[ TODO -- Lots more Rcpp modules work to be described ? ]
\item Provide a namespace 'R' for the standalone Rmath library so
that Rcpp users can access those functions too
- \item Added new functions sourceCpp() and compileAttributes()
- that use C++11 style attributes (embedded in comments) to
- perform automatic generation of boilerplate marshaling code
+ \item Added new functions cppFunction(), sourceCpp() and
+ compileAttributes() that use C++11 style attributes (embedded in
+ comments) to make declaring and using C++ functions in R much
+ more straightforward.
}
}
Modified: pkg/Rcpp/man/cppFunction.Rd
===================================================================
--- pkg/Rcpp/man/cppFunction.Rd 2012-11-01 09:34:53 UTC (rev 3881)
+++ pkg/Rcpp/man/cppFunction.Rd 2012-11-01 11:52:04 UTC (rev 3882)
@@ -8,7 +8,7 @@
}
\usage{
cppFunction(code, plugin = NULL, includes = NULL,
- envir = parent.frame(), rebuild = FALSE,
+ env = parent.frame(), rebuild = FALSE,
showOutput = verbose, verbose = getOption("verbose"))
}
@@ -22,7 +22,7 @@
\item{includes}{
User includes, inserted after the includes provided by the plugin.
}
- \item{envir}{
+ \item{env}{
The \link[base:environment]{environment} in which to define the R function. May be \code{NULL} in which case the defined function can be obtained from the return value of \code{cppFunction}.
}
\item{rebuild}{
Modified: pkg/Rcpp/man/sourceCpp.Rd
===================================================================
--- pkg/Rcpp/man/sourceCpp.Rd 2012-11-01 09:34:53 UTC (rev 3881)
+++ pkg/Rcpp/man/sourceCpp.Rd 2012-11-01 11:52:04 UTC (rev 3882)
@@ -7,7 +7,7 @@
\code{sourceCpp} parses the specified C++ file or source code and looks for functions marked with the \code{\link[=exportAttribute]{Rcpp::export}} attribute. A shared library is then built and its exported functions are made available as R functions in the specified environment.
}
\usage{
-sourceCpp(file = "", code = NULL, envir = globalenv(), rebuild = FALSE,
+sourceCpp(file = "", code = NULL, env = globalenv(), rebuild = FALSE,
showOutput = verbose, verbose = getOption("verbose"))
}
%- maybe also 'usage' for other objects documented here.
@@ -18,7 +18,7 @@
\item{code}{
A charcter string with source code. If supplied, the code is taken from this string instead of a file.
}
- \item{envir}{
+ \item{env}{
Environment where the R functions should be made available.
}
\item{rebuild}{
More information about the Rcpp-commits
mailing list