[Rcpp-commits] r1345 - in pkg/Rcpp: . R inst inst/unitTests man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 28 12:39:51 CEST 2010
Author: romain
Date: 2010-05-28 12:39:50 +0200 (Fri, 28 May 2010)
New Revision: 1345
Removed:
pkg/Rcpp/R/cppfunction.R
pkg/Rcpp/man/cppfunction.Rd
Modified:
pkg/Rcpp/DESCRIPTION
pkg/Rcpp/NAMESPACE
pkg/Rcpp/NEWS
pkg/Rcpp/inst/ChangeLog
pkg/Rcpp/inst/unitTests/runTests.R
pkg/Rcpp/inst/unitTests/runit.CharacterVector.R
pkg/Rcpp/inst/unitTests/runit.RObject.R
Log:
removed cppfunction and use the more flaxible cxxfunction from the svn version of inline
Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/DESCRIPTION 2010-05-28 10:39:50 UTC (rev 1345)
@@ -46,7 +46,7 @@
.
Several examples are included, and over 530 unit tests in over 240 unit test
functions provide addtional usage examples.
-Depends: R (>= 2.10.0), methods, inline (>= 0.3.4)
+Depends: R (>= 2.10.0), methods
Suggests: RUnit
SystemRequirements: GNU make
URL: http://dirk.eddelbuettel.com/code/rcpp.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/Rcpp
Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/NAMESPACE 2010-05-28 10:39:50 UTC (rev 1345)
@@ -1,13 +1,10 @@
useDynLib(Rcpp)
export(Rcpp.package.skeleton)
-export(cppfunction)
importFrom( utils, capture.output )
importFrom( methods, new )
-importFrom( inline, cfunction )
-
exportClasses( Module, "C++Class", "C++Object" )
export( Module )
exportMethods( new )
Modified: pkg/Rcpp/NEWS
===================================================================
--- pkg/Rcpp/NEWS 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/NEWS 2010-05-28 10:39:50 UTC (rev 1345)
@@ -11,6 +11,14 @@
runit.Module.R shows an example.
The Rcpp-modules vignette documents the feature
+
+ o cppfunction has been withdrawn since the introduction of the more
+ flexible cxxfunction in the inline package. Rcpp no longer depend
+ on inline since many uses of Rcpp do not require inline at all. We still
+ use inline for unit tests but this is now handled locally in the
+ unit tests loader runTests.R. Users of cppfunction can redefine it as:
+
+ cppfunction <- function(...) cxxfunction( ..., plugin = "Rcpp" )
0.8.0 2010-05-17
Deleted: pkg/Rcpp/R/cppfunction.R
===================================================================
--- pkg/Rcpp/R/cppfunction.R 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/R/cppfunction.R 2010-05-28 10:39:50 UTC (rev 1345)
@@ -1,40 +0,0 @@
-# Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
-#
-# This file is part of Rcpp.
-#
-# Rcpp is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# Rcpp is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
-
-NAMESPACE <- environment()
-
-cppfunction <- function (sig = character(), body = character(), includes = character(),
- otherdefs = character(), verbose = FALSE,
- cppargs = character(), cxxargs = character(), libargs = character(),
- namespace = TRUE, forward.exceptions = TRUE ){
-
- if( isTRUE( namespace ) ){
- includes <- c( includes, "using namespace Rcpp;" )
- }
- if( isTRUE( forward.exceptions ) ){
- body <- sprintf(
-"BEGIN_RCPP
-%s
-END_RCPP
-", body )
- }
- fx <- cfunction( sig = sig, body = body, includes = includes,
- otherdefs = otherdefs, language = "C++", convention = ".Call",
- Rcpp = TRUE, cppargs = cppargs, cxxargs = cxxargs, libargs = libargs,
- verbose = verbose )
- fx
-}
Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/inst/ChangeLog 2010-05-28 10:39:50 UTC (rev 1345)
@@ -1,3 +1,12 @@
+2010-05-28 Romain Francois <romain at r-enthusiasts.com>
+
+ * R/cppfunction.R: withdrawn, we now use inline::cxxfunction which is
+ more flexible and we no longer need to depend on inline
+ * man/cppfunction.Rd: *
+
+ * inst/unitTests/runTests.R: The tests now require a recent version
+ of inline (>= 0.3.4.2)
+
2010-05-27 Romain Francois <romain at r-enthusiasts.com>
* inst/include/Rcpp/Module.h: adding support for registering a free function
Modified: pkg/Rcpp/inst/unitTests/runTests.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runTests.R 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/inst/unitTests/runTests.R 2010-05-28 10:39:50 UTC (rev 1345)
@@ -1,5 +1,17 @@
pkg <- "Rcpp"
+if( ! require( "inline", character.only = TRUE, quietly = TRUE ) ){
+ stop( "The inline package is required to run Rcpp unit tests" )
+}
+
+if( compareVersion( packageDescription( "inline" )[["Version"]], "0.3.4.2" ) < 0 ){
+ stop( "Rcpp unit tests need at least the version 0.3.4.2 of inline" )
+}
+
+cppfunction <- function(...){
+ cxxfunction( ..., plugin = "Rcpp" )
+}
+
if(require("RUnit", quietly = TRUE)) {
is_local <- function(){
Modified: pkg/Rcpp/inst/unitTests/runit.CharacterVector.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.CharacterVector.R 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/inst/unitTests/runit.CharacterVector.R 2010-05-28 10:39:50 UTC (rev 1345)
@@ -54,7 +54,7 @@
x[0] += "bar" ;
x[1] += x[0] ;
return x ;
- ', )
+ ' )
checkEquals( funx(), c("foobar", "barfoobar"),
msg = "StringProxy::operator+=" )
}
Modified: pkg/Rcpp/inst/unitTests/runit.RObject.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.RObject.R 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/inst/unitTests/runit.RObject.R 2010-05-28 10:39:50 UTC (rev 1345)
@@ -195,7 +195,7 @@
iv[i] = iv[i] + iv[i];
}
return(Rcpp::wrap( iv ));'
- funx <- cppfunction(signature(x="character"), foo, )
+ funx <- cppfunction(signature(x="character"), foo )
checkEquals( funx(c("foo", "bar")), c("foofoo", "barbar"), msg = "as< std::vector<std::string> >(character)" )
checkException( funx(1L), msg = "as< std::vector<std::string> >(integer) -> exception" )
checkException( funx(1.0), msg = "as< std::vector<std::string> >(numeric) -> exception" )
Deleted: pkg/Rcpp/man/cppfunction.Rd
===================================================================
--- pkg/Rcpp/man/cppfunction.Rd 2010-05-27 13:52:32 UTC (rev 1344)
+++ pkg/Rcpp/man/cppfunction.Rd 2010-05-28 10:39:50 UTC (rev 1345)
@@ -1,50 +0,0 @@
-\name{cppfunction}
-\alias{cppfunction}
-\title{
-Functionality to dynamically define R functions
-with inlined c++ code that uses Rcpp classes
-}
-\description{
-\code{cppfunction} is a slightly modified version of \link[inline]{cfunction}
-}
-\usage{
-cppfunction(sig = character(), body = character(), includes = character(),
- otherdefs = character(), verbose = FALSE, cppargs = character(),
- cxxargs = character(), libargs = character(), namespace = TRUE,
- forward.exceptions = TRUE)
-}
-\arguments{
-\item{sig}{Signature. See \link[inline]{cfunction}}
-\item{body}{C++ code to inline. See \link[inline]{cfunction}}
-\item{includes}{See \link[inline]{cfunction}}
-\item{otherdefs}{See \link[inline]{cfunction}}
-\item{verbose}{See \link[inline]{cfunction}}
-\item{cppargs}{See \link[inline]{cfunction}}
-\item{cxxargs}{See \link[inline]{cfunction}}
-\item{libargs}{See \link[inline]{cfunction}}
-\item{namespace}{If \code{TRUE} the line "using namespace Rcpp; " is added
-to the includes list}
-\item{forward.exceptions}{If \code{TRUE}, the body is explicitely wrapped so that
-c++ exceptions are forwarded as R conditions. }
-}
-\details{
- As opposed to \link[inline]{cfunction}, this function can only code
- that is designed to use the \link{.Call} interface, the language is
- restricted to C++ and the \code{Rcpp} argument of \link[inline]{cfunction}
- is set to \code{TRUE}
-}
-\value{
-An R function, similar to the returned value of \link[inline]{cfunction}
-}
-\references{
-Oleg Sklyar, Duncan Murdoch, Mike Smith and Dirk Eddelbuettel (2009).
- inline: Inline C, C++, Fortran function calls from R. R package
- version 0.3.4. \url{http://CRAN.R-project.org/package=inline}
-}
-\examples{
-\dontrun{
-fx <- cppfunction( body = "return IntegerVector::create( 1, 2, 3) ;" )
-stopifnot( identical( fx(), 1:3 ) )
-}
-}
-\keyword{interface}
More information about the Rcpp-commits
mailing list