[Rcpp-commits] r802 - in pkg/Rcpp: inst/doc inst/doc/unitTests src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 1 12:13:32 CET 2010


Author: romain
Date: 2010-03-01 12:13:31 +0100 (Mon, 01 Mar 2010)
New Revision: 802

Removed:
   pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.Rnw
Modified:
   pkg/Rcpp/inst/doc/Makefile
   pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw
   pkg/Rcpp/src/Rcpp.h
   pkg/Rcpp/src/Rcpp/Named.h
Log:
syntactic sugar attempt

Modified: pkg/Rcpp/inst/doc/Makefile
===================================================================
--- pkg/Rcpp/inst/doc/Makefile	2010-03-01 09:06:25 UTC (rev 801)
+++ pkg/Rcpp/inst/doc/Makefile	2010-03-01 11:13:31 UTC (rev 802)
@@ -4,6 +4,7 @@
 clean:
 	touch Rcpp-unitTests.pdf
 	rm Rcpp-unitTests.pdf
+	touch index.html
 	rm index.html
 
 index.html: rcpp.index.html
@@ -11,9 +12,8 @@
 
 Rcpp-unitTests.pdf:
 	rm -fr unitTests-results/*
-	cp unitTests/Rcpp-unitTests.Rnw .
 	Rscript unitTests/Rcpp-unitTests.R
-	R CMD Sweave unitTests/Rcpp-unitTests.Rnw
+	R CMD Sweave Rcpp-unitTests.Rnw
 	Rscript -e "tools::texi2dvi( 'Rcpp-unitTests.tex', pdf = TRUE, clean = TRUE )"
 	rm -fr Rcpp-unitTests.tex
 

Modified: pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw	2010-03-01 09:06:25 UTC (rev 801)
+++ pkg/Rcpp/inst/doc/Rcpp-unitTests.Rnw	2010-03-01 11:13:31 UTC (rev 802)
@@ -11,7 +11,12 @@
 
 \begin{verbatim}
 <<echo=F,results=tex>>=
-writeLines( readLines( "unitTests-results/Rcpp-unitTests.txt" ) ) 
+results <- "unitTests-results/Rcpp-unitTests.txt"
+if( file.exists( results ) ){
+	writeLines( readLines( results ) ) 
+} else{
+	writeLines( "unit test results not available" ) 
+}
 @
 \end{verbatim}
 

Deleted: pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.Rnw	2010-03-01 09:06:25 UTC (rev 801)
+++ pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.Rnw	2010-03-01 11:13:31 UTC (rev 802)
@@ -1,18 +0,0 @@
-\documentclass[10pt]{article}
-%\VignetteIndexEntry{Rcpp-unitTests}
-\usepackage{vmargin}
-\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
-
-\usepackage[colorlinks]{hyperref}
-\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois}
-\title{Rcpp : Unit testing results}
-\begin{document}
-\maketitle
-
-\begin{verbatim}
-<<echo=F,results=tex>>=
-writeLines( readLines( "unitTests-results/Rcpp-unitTests.txt" ) ) 
-@
-\end{verbatim}
-
-\end{document}

Modified: pkg/Rcpp/src/Rcpp/Named.h
===================================================================
--- pkg/Rcpp/src/Rcpp/Named.h	2010-03-01 09:06:25 UTC (rev 801)
+++ pkg/Rcpp/src/Rcpp/Named.h	2010-03-01 11:13:31 UTC (rev 802)
@@ -64,6 +64,34 @@
 	std::string tag ;
 } ;
 
+namespace internal{
+	
+class NamedPlaceholderProxy{
+public:
+	NamedPlaceholderProxy( const std::string& arg) : name(arg) {}
+	~NamedPlaceholderProxy(){}
+	
+	template <typename T>
+	Named operator=( const T& object ){
+		return Named( name, object ) ;
+	}
+	
+private:
+	std::string name ;
+} ;
+	
+class NamedPlaceHolder {
+public:
+	NamedPlaceHolder(){}
+	~NamedPlaceHolder(){}
+	NamedPlaceholderProxy operator[]( const std::string& arg){
+		return NamedPlaceholderProxy( arg ) ;
+	}
+} ;
+} // internal
+
+static internal::NamedPlaceHolder _ ;
+
 } // namespace Rcpp
 
 #endif

Modified: pkg/Rcpp/src/Rcpp.h
===================================================================
--- pkg/Rcpp/src/Rcpp.h	2010-03-01 09:06:25 UTC (rev 801)
+++ pkg/Rcpp/src/Rcpp.h	2010-03-01 11:13:31 UTC (rev 802)
@@ -65,4 +65,6 @@
 #include <Rcpp/Function.h>
 #include <Rcpp/WeakReference.h>
 
+#define ARG(name) ::Rcpp::internal::NamedPlaceholderProxy name(#name) ;
+
 #endif



More information about the Rcpp-commits mailing list