[Rcpp-commits] r1779 - in pkg/Rcpp/inst: . include include/Rcpp include/Rcpp/vector

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 5 13:26:51 CEST 2010


Author: romain
Date: 2010-07-05 13:26:50 +0200 (Mon, 05 Jul 2010)
New Revision: 1779

Modified:
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/as.h
   pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
   pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
   pkg/Rcpp/inst/include/Rcpp/vector/string_proxy.h
   pkg/Rcpp/inst/include/RcppCommon.h
Log:
no more variadic macros

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/ChangeLog	2010-07-05 11:26:50 UTC (rev 1779)
@@ -1,3 +1,7 @@
+2010-07-05  Romain Francois <romain at r-enthusiasts.com>
+
+	* inst/include/Rcpp/RcppCommon.h : no more using variadic macros in RCPP_DEBUG
+
 2010-07-02  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/traits/result_of.h : also deal with functions

Modified: pkg/Rcpp/inst/include/Rcpp/as.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/as.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/Rcpp/as.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -47,9 +47,9 @@
 	}
 	
 	template <typename T> T as(SEXP x, ::Rcpp::traits::r_type_generic_tag ) throw(::Rcpp::not_compatible) {
-		RCPP_DEBUG( "as(SEXP = <%p>, r_type_generic_tag )", x ) ;
+		RCPP_DEBUG_1( "as(SEXP = <%p>, r_type_generic_tag )", x ) ;
 		::Rcpp::traits::Exporter<T> exporter(x);
-		RCPP_DEBUG( "exporter type = %s", DEMANGLE(exporter) ) ;
+		RCPP_DEBUG_1( "exporter type = %s", DEMANGLE(exporter) ) ;
 		return exporter.get() ;
 	}
 	

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -115,7 +115,7 @@
     
 private:
 	virtual void update(){
-		RCPP_DEBUG( "%s::update", DEMANGLE(Matrix) ) ;
+		RCPP_DEBUG_1( "%s::update", DEMANGLE(Matrix) ) ;
 		VECTOR::update_vector() ;
 	}
 	

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -40,12 +40,12 @@
 	typedef MatrixColumn<RTYPE> Column ;
 	
 	Vector() : RObject() {
-		RCPP_DEBUG( "Vector()", 0 ) ;
+		RCPP_DEBUG( "Vector()" ) ;
 		RObject::setSEXP( Rf_allocVector( RTYPE, 0 ) ) ;
 		init() ;
 	} ;
     ~Vector(){
-    	RCPP_DEBUG( "~Vector()", 0 ) ;
+    	RCPP_DEBUG( "~Vector()" ) ;
 	};
     
 	Vector( const Vector& other) : RObject() {
@@ -77,9 +77,9 @@
 	}
 	
     Vector( SEXP x ) throw(not_compatible) : RObject() {
-    	RCPP_DEBUG( "Vector<%d>( SEXP = <%p> )", RTYPE, x) ;
+    	RCPP_DEBUG_2( "Vector<%d>( SEXP = <%p> )", RTYPE, x) ;
     	RObject::setSEXP( r_cast<RTYPE>( x ) ) ;
-    	RCPP_DEBUG( "===========", 0) ;
+    	RCPP_DEBUG( "===========" ) ;
     }
     
     Vector( const int& size ) : RObject()  {
@@ -658,7 +658,7 @@
 	}
 
 	virtual void update(){
-		RCPP_DEBUG( "%s::update", DEMANGLE(Vector) ) ;
+		RCPP_DEBUG_1( "%s::update", DEMANGLE(Vector) ) ;
 		update_vector() ;
 	}
 	

Modified: pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/proxy.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/Rcpp/vector/proxy.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -135,7 +135,7 @@
 		typedef ::Rcpp::Vector<RTYPE> VECTOR ;
 		generic_name_proxy( VECTOR& v, const std::string& name_) :
 			parent(v), name(name_){
-				RCPP_DEBUG( "generic_name_proxy( VECTOR& = %p, const string& = %s)", v.asSexp(), name_.c_str() );
+				RCPP_DEBUG_2( "generic_name_proxy( VECTOR& = %p, const string& = %s)", v.asSexp(), name_.c_str() );
 		} ;
 		generic_name_proxy( const generic_name_proxy& other ) : 
 			parent(other.parent), name(other.name){} ;
@@ -166,7 +166,7 @@
 		operator T(){
 			#if RCPP_DEBUG_LEVEL > 0
 			SEXP res = get() ;
-			RCPP_DEBUG( "generic_name_proxy::get() = <%p> ", res ) ;
+			RCPP_DEBUG_1( "generic_name_proxy::get() = <%p> ", res ) ;
 			return ::Rcpp::as<T>( res ) ;
 			#else
 			return ::Rcpp::as<T>( get() ) ;

Modified: pkg/Rcpp/inst/include/Rcpp/vector/string_proxy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/string_proxy.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/Rcpp/vector/string_proxy.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -41,7 +41,7 @@
 		 */
 		string_proxy( VECTOR& v, int index_ ) : 
 			parent(&v), index(index_){
-				RCPP_DEBUG( "string_proxy( VECTOR& = <%p>, index_ = %d) ", v.asSexp(), index_ ) ;
+				RCPP_DEBUG_2( "string_proxy( VECTOR& = <%p>, index_ = %d) ", v.asSexp(), index_ ) ;
 		}
 			
 		string_proxy( const string_proxy& other ) : 

Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h	2010-07-04 22:46:47 UTC (rev 1778)
+++ pkg/Rcpp/inst/include/RcppCommon.h	2010-07-05 11:26:50 UTC (rev 1779)
@@ -195,9 +195,13 @@
 #endif
 
 #if RCPP_DEBUG_LEVEL > 0
-	#define RCPP_DEBUG( fmt , ... ) Rprintf( "%s:%d " fmt "\n" , __FILE__, __LINE__,##__VA_ARGS__ ) ;
+	#define RCPP_DEBUG( MSG ) Rprintf( "%s:%d %s" , __FILE__, __LINE__, MSG ) ;
+	#define RCPP_DEBUG_1( fmt, MSG ) Rprintf( "%s:%d " fmt "%s" , __FILE__, __LINE__, MSG ) ;
+	#define RCPP_DEBUG_2( fmt, M1, M2 ) Rprintf( "%s:%d " fmt "%s" , __FILE__, __LINE__, M1, M2 ) ;
 #else
-	#define RCPP_DEBUG( fmt , ... )
+	#define RCPP_DEBUG( MSG )
+	#define RCPP_DEBUG_1( fmt, MSG )
+	#define RCPP_DEBUG_2( fmt, M1, M2 )
 #endif
 
 SEXP stack_trace( const char *file, int line) ;



More information about the Rcpp-commits mailing list