22 #ifndef Rcpp_macros_debug_h
23 #define Rcpp_macros_debug_h
26 #ifndef RCPP_DEBUG_LEVEL
27 #define RCPP_DEBUG_LEVEL 0
30 #ifndef RCPP_DEBUG_MODULE_LEVEL
31 #define RCPP_DEBUG_MODULE_LEVEL RCPP_DEBUG_LEVEL
35 #if RCPP_DEBUG_LEVEL > 0
36 #define RCPP_DEBUG( MSG ) Rprintf( "%40s:%4d %s\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ;
37 #define RCPP_DEBUG_1( fmt, MSG ) Rprintf( "%40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ;
38 #define RCPP_DEBUG_2( fmt, M1, M2 ) Rprintf( "%40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2 ) ;
39 #define RCPP_DEBUG_3( fmt, M1, M2, M3 ) Rprintf( "%40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3) ;
40 #define RCPP_DEBUG_4( fmt, M1, M2, M3, M4 ) Rprintf( "%40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4) ;
41 #define RCPP_DEBUG_5( fmt, M1, M2, M3, M4, M5 ) Rprintf( "%40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4, M5) ;
43 #define RCPP_DEBUG( MSG )
44 #define RCPP_DEBUG_1( fmt, MSG )
45 #define RCPP_DEBUG_2( fmt, M1, M2 )
46 #define RCPP_DEBUG_3( fmt, M1, M2, M3 )
47 #define RCPP_DEBUG_4( fmt, M1, M2, M3, M4 )
48 #define RCPP_DEBUG_5( fmt, M1, M2, M3, M4, M5 )
51 #if RCPP_DEBUG_MODULE_LEVEL > 0
52 #define RCPP_DEBUG_MODULE( MSG ) { \
53 Rcpp::Module * mod__ = getCurrentScope() ; \
55 Rprintf( "[module (%s) <%p> ] %40s:%4d %s\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ;\
57 Rprintf( "[module () ] %40s:%4d %s\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ; \
60 #define RCPP_DEBUG_MODULE_1( fmt, MSG ) { \
61 Rcpp::Module * mod__ = getCurrentScope() ; \
63 Rprintf( "[module (%s) <%p> ] %40s:%4d " fmt "\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ;\
65 Rprintf( "[module () ] %40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, MSG ) ; \
68 #define RCPP_DEBUG_MODULE_2( fmt, M1, M2 ) { \
69 Rcpp::Module * mod__ = getCurrentScope() ; \
71 Rprintf( "[module (%s) <%p> ] %40s:%4d " fmt "\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2 ) ;\
73 Rprintf( "[module () ] %40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2 ) ; \
76 #define RCPP_DEBUG_MODULE_3( fmt, M1, M2, M3 ) { \
77 Rcpp::Module * mod__ = getCurrentScope() ; \
79 Rprintf( "[module (%s) <%p> ] %40s:%4d " fmt "\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3 ) ;\
81 Rprintf( "[module () ] %40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3 ) ; \
84 #define RCPP_DEBUG_MODULE_4( fmt, M1, M2, M3, M4 ) { \
85 Rcpp::Module * mod__ = getCurrentScope() ; \
87 Rprintf( "[module (%s) <%p> ] %40s:%4d " fmt "\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4 ) ;\
89 Rprintf( "[module () ] %40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4 ) ; \
92 #define RCPP_DEBUG_MODULE_5( fmt, M1, M2, M3, M4, M5 ) { \
93 Rcpp::Module * mod__ = getCurrentScope() ; \
95 Rprintf( "[module (%s) <%p> ] %40s:%4d " fmt "\n" , mod__->name.c_str(), mod__, ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4, M5 ) ;\
97 Rprintf( "[module () ] %40s:%4d " fmt "\n" , ::Rcpp::internal::debug::short_file_name(__FILE__).c_str(), __LINE__, M1, M2, M3, M4, M5 ) ; \
101 #define RCPP_DEBUG_MODULE( MSG )
102 #define RCPP_DEBUG_MODULE_1( fmt, MSG )
103 #define RCPP_DEBUG_MODULE_2( fmt, M1, M2 )
104 #define RCPP_DEBUG_MODULE_3( fmt, M1, M2, M3 )
105 #define RCPP_DEBUG_MODULE_4( fmt, M1, M2, M3, M4 )
106 #define RCPP_DEBUG_MODULE_5( fmt, M1, M2, M3, M4, M5 )