-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdebug.h
More file actions
31 lines (27 loc) · 1.61 KB
/
debug.h
File metadata and controls
31 lines (27 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef Rcpp_macros_debug_h
#define Rcpp_macros_debug_h
#include <iostream>
#include <fstream>
// simple logging help
#ifndef RCPP_DEBUG_LEVEL
#define RCPP_DEBUG_LEVEL 0
#endif
#define PRETTY_BOOL(x) ( x ? "true" : "false" )
#if RCPP_DEBUG_LEVEL > 0
#define RCPP_DEBUG( fmt, ... ) Rprintf( "%20s:%4d " fmt "\n" , short_file_name(__FILE__), __LINE__, ##__VA_ARGS__ ) ;
#define RCPP_DEBUG_OBJECT(OBJ) Rf_PrintValue( Rf_eval( Rf_lang2( Rf_install( "str"), OBJ ), R_GlobalEnv ) ) ;
#define RCPP_INSPECT_OBJECT(OBJ) Rf_PrintValue( Rf_eval( Rf_lang2( Rf_install( ".Internal"), Rf_lang2( Rf_install( "inspect" ), OBJ ) ), R_GlobalEnv ) ) ;
#define RCPP_DEBUG_CLASS( CLASS, fmt, ... ) Rprintf( "%20s:%4d [%s]" fmt "\n" , short_file_name(__FILE__), __LINE__, DEMANGLE(CLASS), ##__VA_ARGS__ ) ;
#define RCPP_DEBUG_CTOR( CLASS, fmt, ... ) Rprintf( "%20s:%4d [%s]::ctor" fmt "\n" , short_file_name(__FILE__), __LINE__, DEMANGLE(CLASS), ##__VA_ARGS__ ) ;
#define RCPP_DEBUG_MOVE_CTOR( CLASS, fmt, ... ) Rprintf( "%20s:%4d [%s]::move_ctor" fmt "\n" , short_file_name(__FILE__), __LINE__, DEMANGLE(CLASS), ##__VA_ARGS__ ) ;
#define RCPP_DEBUG_DTOR( CLASS, fmt, ... ) Rprintf( "%20s:%4d [%s]::dtor" fmt "\n" , short_file_name(__FILE__), __LINE__, DEMANGLE(CLASS), ##__VA_ARGS__ ) ;
#else
#define RCPP_DEBUG( MSG, ... )
#define RCPP_DEBUG_OBJECT(OBJ)
#define RCPP_INSPECT_OBJECT(OBJ)
#define RCPP_DEBUG_CLASS( CLASS, fmt, ... )
#define RCPP_DEBUG_CTOR( CLASS, fmt, ... )
#define RCPP_DEBUG_MOVE_CTOR( CLASS, fmt, ... )
#define RCPP_DEBUG_DTOR( CLASS, fmt, ... )
#endif
#endif