[Rcpp-commits] r1381 - pkg/Rcpp/inst/doc/snippets

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 31 17:37:13 CEST 2010


Author: edd
Date: 2010-05-31 17:37:13 +0200 (Mon, 31 May 2010)
New Revision: 1381

Removed:
   pkg/Rcpp/inst/doc/snippets/S4dispatch.R
   pkg/Rcpp/inst/doc/snippets/World.cpp
   pkg/Rcpp/inst/doc/snippets/WorldModule.cpp
   pkg/Rcpp/inst/doc/snippets/WorldModuleR.R
   pkg/Rcpp/inst/doc/snippets/WorldRcpp.cpp
   pkg/Rcpp/inst/doc/snippets/WorldRcppR.R
   pkg/Rcpp/inst/doc/snippets/functions.cpp
   pkg/Rcpp/inst/doc/snippets/functionsModule.cpp
   pkg/Rcpp/inst/doc/snippets/functionsModuleR.R
   pkg/Rcpp/inst/doc/snippets/hello.cpp
   pkg/Rcpp/inst/doc/snippets/helloModule.cpp
   pkg/Rcpp/inst/doc/snippets/helloModuleR.cpp
   pkg/Rcpp/inst/doc/snippets/helloexpose.cpp
   pkg/Rcpp/inst/doc/snippets/helloexposerapi.cpp
   pkg/Rcpp/inst/doc/snippets/highlight.R
   pkg/Rcpp/inst/doc/snippets/highlight.sty
   pkg/Rcpp/inst/doc/snippets/modulestdvec.cpp
   pkg/Rcpp/inst/doc/snippets/stdvectorback.cpp
Log:
removed per Romain's suggestion


Deleted: pkg/Rcpp/inst/doc/snippets/S4dispatch.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/S4dispatch.R	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/S4dispatch.R	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,4 +0,0 @@
-setMethod( "show", "World", function(object){
-	msg <- paste( "World object with message : ", object$greet() )
-	writeLines( msg )
-} )

Deleted: pkg/Rcpp/inst/doc/snippets/World.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/World.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/World.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,10 +0,0 @@
-class World {
-public:
-    World() : msg("hello"){}
-    void set(std::string msg) { this->msg = msg; }
-    std::string greet() { return msg; }
-
-private:
-    std::string msg;
-};
-

Deleted: pkg/Rcpp/inst/doc/snippets/WorldModule.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/WorldModule.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/WorldModule.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,25 +0,0 @@
-class World {
-public:
-    World() : msg("hello"){}
-    void set(std::string msg) { this->msg = msg; }
-    std::string greet() { return msg; }
-
-private:
-    std::string msg;
-};
-
-void clearWorld( World* w){
-	w->set( "" ) ;
-}
-
-RCPP_MODULE(yada){
-	using namespace Rcpp ;
-	
-	class_<World>( "World" )
-		.method( "greet", &World::greet )
-		.method( "set", &World::set )
-		.method( "clear", &clearWorld )
-	;
-
-}                     
-

Deleted: pkg/Rcpp/inst/doc/snippets/WorldModuleR.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/WorldModuleR.R	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/WorldModuleR.R	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,18 +0,0 @@
-require( Rcpp )
-
-# load the module
-yada <- Module( "yada" )
-
-# grab the World class
-World <- yada$World
-
-# create a new World object
-w <- new( World )
-
-# use methods of the class
-w$greet()
-w$set( "hello world" ) 
-w$greet()
-w$clear()
-w$greet()
-

Deleted: pkg/Rcpp/inst/doc/snippets/WorldRcpp.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/WorldRcpp.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/WorldRcpp.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,19 +0,0 @@
-using namespace Rcpp ;
-
-/** create an external pointer to a World object */
-RcppExport SEXP World__new(){
-	return Rcpp::XPtr<World>( new World, true ) ;
-}
-
-/** invoke the greet method */
-RcppExport SEXP World__greet( SEXP xp ) {
-	Rcpp::XPtr<World> w(xp) ;
-	return Rcpp::wrap( w->greet() ) ;
-}
-
-/** invoke the set method */
-RcppExport SEXP World__set( SEXP xp, SEXP msg ){
-	Rcpp::XPtr<World> w(xp) ;
-	w->set( Rcpp::as<std::string>( msg ) ) ;
-	return R_NilValue ;
-}

Deleted: pkg/Rcpp/inst/doc/snippets/WorldRcppR.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/WorldRcppR.R	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/WorldRcppR.R	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,14 +0,0 @@
-setClass( "World", representation( pointer = "externalptr" ) )
-
-World_method <- function(name){
-	paste( "World", name, sep = "__" )
-}
-
-setMethod( "$", "World", function(x, name ){
-	function(...) .Call( World_method(name) , x at pointer, ... )
-} )
-
-w <- new( "World", .Call( World_method( "new" ) ) )
-w$set( "hello world" )
-w$greet()
-

Deleted: pkg/Rcpp/inst/doc/snippets/functions.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/functions.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/functions.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,24 +0,0 @@
-std::string hello(){
-	return "hello" ;
-}
-
-int bar( int x){
-	return x*2 ;
-}
-        
-double foo( int x, double y){
-	return x * y ;
-}
-
-void bla( ){
-	Rprintf( "hello\\n" ) ;
-}
-
-void bla1( int x){
-	Rprintf( "hello (x = %d)\\n", x ) ;
-}
-
-void bla2( int x, double y){
-	Rprintf( "hello (x = %d, y = %5.2f)\\n", x, y ) ;
-}
-

Deleted: pkg/Rcpp/inst/doc/snippets/functionsModule.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/functionsModule.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/functionsModule.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,11 +0,0 @@
-RCPP_MODULE(yada){
-	using namespace Rcpp ;
-	
-	function( "hello" , &hello ) ;
-	function( "bar"   , &bar   ) ;
-	function( "foo"   , &foo   ) ;
-	function( "bla"   , &bla   ) ;
-	function( "bla1"  , &bla1   ) ;
-	function( "bla2"  , &bla2   ) ;
-}
-

Deleted: pkg/Rcpp/inst/doc/snippets/functionsModuleR.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/functionsModuleR.R	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/functionsModuleR.R	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,10 +0,0 @@
-require( Rcpp )
-
-yada <- Module( "yada" )
-yada$bar( 2L )
-yada$foo( 2L, 10.0 )
-yada$hello() 
-yada$bla() 
-yada$bla1( 2L) 
-yada$bla2( 2L, 5.0 )
-

Deleted: pkg/Rcpp/inst/doc/snippets/hello.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/hello.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/hello.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,5 +0,0 @@
-const char* hello( std::string who ){
-	std::string result( "hello " ) ;
-	result += who ; 
-	return result.c_str() ;
-}

Deleted: pkg/Rcpp/inst/doc/snippets/helloModule.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/helloModule.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/helloModule.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,12 +0,0 @@
-
-const char* hello( std::string who ){
-	std::string result( "hello " ) ;
-	result += who ; 
-	return result.c_str() ;
-}
-
-RCPP_MODULE(yada){
-	using namespace Rcpp ;
-	function( "hello", &hello ) ;
-}
-

Deleted: pkg/Rcpp/inst/doc/snippets/helloModuleR.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/helloModuleR.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/helloModuleR.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,3 +0,0 @@
-require( Rcpp )
-yada <- Module( "yada" )
-yada$hello( "world" )

Deleted: pkg/Rcpp/inst/doc/snippets/helloexpose.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/helloexpose.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/helloexpose.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,5 +0,0 @@
-RcppExport SEXP hello_wrapper( SEXP who){
-    std::string input = Rcpp::as<std::string>( who )
-    const char* result = hello( input ) ;
-    return Rcpp::wrap( result );
-}

Deleted: pkg/Rcpp/inst/doc/snippets/helloexposerapi.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/helloexposerapi.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/helloexposerapi.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,5 +0,0 @@
-extern "C" SEXP hello_wrapper( SEXP who){
-    std::string input = CHAR(STRING_ELT(input,0)) ;
-    const char* result = hello( input ) ;
-    return mkString( result );
-}

Deleted: pkg/Rcpp/inst/doc/snippets/highlight.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/highlight.R	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/highlight.R	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,32 +0,0 @@
-#!/usr/bin/Rscript
-
-cppfiles <- list.files( pattern = "[.]cpp$" )
-for( f in cppfiles ){
-	base <- sub( "[.]cpp$", "", f )
-	output <- sprintf( "%s.tex", base )
-	system( sprintf( "highlight --input=%s --output=%s -L --pretty-symbols --replace-tabs=4", f, output ) )
-	
-	tex <- readLines( output )
-	keep <- seq( which( tex == "\\noindent" ), which( tex == "\\normalfont" ) )
-	tex <- c( 
-		"\\vspace{1em}\\noindent\\fbox{\\begin{minipage}{0.9\\textwidth}" , 
-		tex[ keep ],
-		"\\end{minipage}}\\vspace{1em}" )
-	
-	writeLines( tex, output )
-}
-
-require( highlight )
-if( compareVersion( "0.1-9", packageDescription( "highlight" )[["Version"]] ) ){
-	stop( "version 0.1-9 of highlight is required for the minipage argument" )
-}
-
-r <- renderer_latex( doc = FALSE, minipage = TRUE )
-rfiles <- setdiff( list.files( pattern = "[.]R$" ), "highlight.R" )
-for( f in rfiles ){
-	base <- sub( "[.]R$", "", f )
-	output <- sprintf( "%s.tex", base )
-	
-	highlight( f, renderer = r, output = output )
-}
-

Deleted: pkg/Rcpp/inst/doc/snippets/highlight.sty
===================================================================
--- pkg/Rcpp/inst/doc/snippets/highlight.sty	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/highlight.sty	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,20 +0,0 @@
-% Style definition file generated by highlight 2.12, http://www.andre-simon.de/ 
-
-% Highlighting theme definition: 
-
-\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}}
-\newcommand{\hlnum}[1]{\textcolor[rgb]{0.16,0.16,1}{#1}}
-\newcommand{\hlesc}[1]{\textcolor[rgb]{1,0,1}{#1}}
-\newcommand{\hlstr}[1]{\textcolor[rgb]{1,0,0}{#1}}
-\newcommand{\hldstr}[1]{\textcolor[rgb]{0.51,0.51,0}{#1}}
-\newcommand{\hlslc}[1]{\textcolor[rgb]{0.51,0.51,0.51}{\it{#1}}}
-\newcommand{\hlcom}[1]{\textcolor[rgb]{0.51,0.51,0.51}{\it{#1}}}
-\newcommand{\hldir}[1]{\textcolor[rgb]{0,0.51,0}{#1}}
-\newcommand{\hlsym}[1]{\textcolor[rgb]{0,0,0}{#1}}
-\newcommand{\hlline}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}}
-\newcommand{\hlkwa}[1]{\textcolor[rgb]{0,0,0}{\bf{#1}}}
-\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.51,0,0}{#1}}
-\newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,0}{\bf{#1}}}
-\newcommand{\hlkwd}[1]{\textcolor[rgb]{0,0,0.51}{#1}}
-\definecolor{bgcolor}{rgb}{1,1,1}
-

Deleted: pkg/Rcpp/inst/doc/snippets/modulestdvec.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/modulestdvec.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/modulestdvec.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,56 +0,0 @@
-// convenience typedef
-typedef std::vector<double> vec ;
-
-// helpers
-void vec_assign( vec* obj, Rcpp::NumericVector data ){
-	obj->assign( data.begin(), data.end() ) ;
-}
-
-void vec_insert( vec* obj, int position, Rcpp::NumericVector data){
-	vec::iterator it = obj->begin() + position ;
-	obj->insert( it, data.begin(), data.end() ) ;
-}
-
-Rcpp::NumericVector vec_asR( vec* obj ){
-	return Rcpp::wrap( *obj ) ;
-}
-
-void vec_set( vec* obj, int i, double value ){
-	obj->at( i ) = value ;
-}
-
-RCPP_MODULE(yada){
-	using namespace Rcpp ;
-	
-	// we expose the class std::vector<double> as "vec" on the R side
-	class_<vec>( "vec")
-	
-		// exposing member functions
-	 	.method( "size", &vec::size)
- 		.method( "max_size", &vec::max_size) 
- 		.method( "resize", &vec::resize) 
- 		.method( "capacity", &vec::capacity) 
- 		.method( "empty", &vec::empty) 
- 		.method( "reserve", &vec::reserve) 
- 		.method( "push_back", &vec::push_back )
- 		.method( "pop_back", &vec::pop_back )
- 		.method( "clear", &vec::clear )
- 		
- 		// specifically exposing const member functions
- 		.const_method( "back", &vec::back )
-		.const_method( "front", &vec::front )
-		.const_method( "at", &vec::at )
-		
-		// exposing free functions taking a std::vector<double>*
-		// as their first argument
-		.method( "assign", &vec_assign )
-		.method( "insert", &vec_insert )
-		.method( "as.vector", &vec_asR ) 
-		
-		// special methods for indexing
-		.const_method( "[[", &vec::at )
-		.method( "[[<-", &vec_set )
-
-	;
-}                     
-

Deleted: pkg/Rcpp/inst/doc/snippets/stdvectorback.cpp
===================================================================
--- pkg/Rcpp/inst/doc/snippets/stdvectorback.cpp	2010-05-31 12:13:50 UTC (rev 1380)
+++ pkg/Rcpp/inst/doc/snippets/stdvectorback.cpp	2010-05-31 15:37:13 UTC (rev 1381)
@@ -1,2 +0,0 @@
-reference back ( );
-const_reference back ( ) const;



More information about the Rcpp-commits mailing list