[Rcpp-commits] r1420 - pkg/Rcpp/inst/examples/RcppInline

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 4 16:31:44 CEST 2010


Author: romain
Date: 2010-06-04 16:31:44 +0200 (Fri, 04 Jun 2010)
New Revision: 1420

Modified:
   pkg/Rcpp/inst/examples/RcppInline/RcppInlineExample.r
   pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r
   pkg/Rcpp/inst/examples/RcppInline/external_pointer.r
Log:
switch from cppfunction to cxxfunction

Modified: pkg/Rcpp/inst/examples/RcppInline/RcppInlineExample.r
===================================================================
--- pkg/Rcpp/inst/examples/RcppInline/RcppInlineExample.r	2010-06-04 11:50:10 UTC (rev 1419)
+++ pkg/Rcpp/inst/examples/RcppInline/RcppInlineExample.r	2010-06-04 14:31:44 UTC (rev 1420)
@@ -31,7 +31,7 @@
   return rl;
 '
 
-funx <- cfunction(signature(v="numeric"), foo, Rcpp=TRUE)
+funx <- cxxfunction(signature(v="numeric"), foo, plugin = "Rcpp" )
 
 dd.inline.rcpp <- function() {
     x <- integer(10000)

Modified: pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r
===================================================================
--- pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r	2010-06-04 11:50:10 UTC (rev 1419)
+++ pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r	2010-06-04 14:31:44 UTC (rev 1420)
@@ -19,7 +19,10 @@
 
 require(Rcpp)
 require(inline)
-funx <- cppfunction(signature(), 'throw std::range_error("boom"); return R_NilValue ; ')
+funx <- cxxfunction(	
+	signature(), 
+	'throw std::range_error("boom"); return R_NilValue ; ', 
+	plugin = "Rcpp" )
 tryCatch(  funx(), "C++Error" = function(e){
 	cat( sprintf( "C++ exception of class '%s' : %s\n", class(e)[1L], e$message  ) )
 } )
@@ -30,4 +33,3 @@
 # just to check things carry on
 print( rnorm(10) )
 
-

Modified: pkg/Rcpp/inst/examples/RcppInline/external_pointer.r
===================================================================
--- pkg/Rcpp/inst/examples/RcppInline/external_pointer.r	2010-06-04 11:50:10 UTC (rev 1419)
+++ pkg/Rcpp/inst/examples/RcppInline/external_pointer.r	2010-06-04 14:31:44 UTC (rev 1420)
@@ -20,7 +20,7 @@
 require(Rcpp)
 require(inline)
 
-funx <- cfunction(signature(), '
+funx <- cxxfunction(signature(), '
 	/* creating a pointer to a vector<int> */
 	std::vector<int>* v = new std::vector<int> ;
 	v->push_back( 1 ) ;
@@ -35,12 +35,12 @@
 	   the external pointer is no more protected by p, but it gets 
 	   protected by being on the R side */
 	return( p ) ;
-', Rcpp=TRUE, verbose=FALSE)
+', plugin = "Rcpp" )
 xp <- funx()
 stopifnot( identical( typeof( xp ), "externalptr" ) )
 
 # passing the pointer back to C++
-funx <- cfunction(signature(x = "externalptr" ), '
+funx <- cxxfunction(signature(x = "externalptr" ), '
 	/* wrapping x as smart external pointer */
 	/* The SEXP based constructor does not protect the SEXP from 
 	   garbage collection automatically, it is already protected 
@@ -52,7 +52,7 @@
 	
 	/* just return the front of the vector as a SEXP */
 	return( Rcpp::wrap( p->front() ) ) ;
-', Rcpp=TRUE, verbose=FALSE)
+', plugin = "Rcpp" )
 front <- funx(xp)
 stopifnot( identical( front, 1L ) )
 



More information about the Rcpp-commits mailing list