Skip to content

Commit 1285268

Browse files
committed
re-format macros for legibility
1 parent 9de884f commit 1285268

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-12-29 Kevin Ushey <[email protected]>
2+
3+
* inst/include/Rcpp/macros/macros.h: reformat for legibility
4+
15
2014-12-11 Yixuan Qiu <[email protected]>
26

37
* inst/include/Rcpp/internal/r_vector.h: Internal functions to

inst/include/Rcpp/macros/macros.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,47 @@
2323
#define Rcpp_macros_macros_h
2424

2525
#define RCPP_DECORATE(__FUN__) __FUN__##__rcpp__wrapper__
26-
#define RCPP_GET_NAMES(x) Rf_getAttrib(x, R_NamesSymbol)
27-
#define RCPP_GET_CLASS(x) Rf_getAttrib(x, R_ClassSymbol)
26+
#define RCPP_GET_NAMES(x) Rf_getAttrib(x, R_NamesSymbol)
27+
#define RCPP_GET_CLASS(x) Rf_getAttrib(x, R_ClassSymbol)
2828

2929
#ifndef BEGIN_RCPP
30-
#define BEGIN_RCPP try{
30+
#define BEGIN_RCPP try {
3131
#endif
3232

3333
#ifndef VOID_END_RCPP
34-
#define VOID_END_RCPP } catch( Rcpp::internal::InterruptedException& __ex__ ) { Rf_onintr(); } catch( std::exception& __ex__ ){ forward_exception_to_r( __ex__ ) ; } catch(...){ ::Rf_error( "c++ exception (unknown reason)" ) ; }
34+
#define VOID_END_RCPP \
35+
} \
36+
catch (Rcpp::internal::InterruptedException &__ex__) { \
37+
Rf_onintr(); \
38+
} \
39+
catch (std::exception &__ex__) { \
40+
forward_exception_to_r(__ex__); \
41+
} \
42+
catch (...) { \
43+
::Rf_error("c++ exception (unknown reason)"); \
44+
}
3545
#endif
3646

3747
#ifndef END_RCPP
3848
#define END_RCPP VOID_END_RCPP return R_NilValue;
3949
#endif
4050

4151
#ifndef END_RCPP_RETURN_ERROR
42-
#define END_RCPP_RETURN_ERROR } catch( Rcpp::internal::InterruptedException& __ex__ ) { return Rcpp::internal::interruptedError(); } catch( std::exception& __ex__ ){ return exception_to_try_error( __ex__ ) ; } catch(...){ return string_to_try_error( "c++ exception (unknown reason)" ) ; } return R_NilValue;
52+
#define END_RCPP_RETURN_ERROR \
53+
} \
54+
catch (Rcpp::internal::InterruptedException &__ex__) { \
55+
return Rcpp::internal::interruptedError(); \
56+
} \
57+
catch (std::exception &__ex__) { \
58+
return exception_to_try_error(__ex__); \
59+
} \
60+
catch (...) { \
61+
return string_to_try_error("c++ exception (unknown reason)"); \
62+
} \
63+
return R_NilValue;
4364
#endif
4465

45-
#define Rcpp_error(MESSAGE) throw Rcpp::exception( MESSAGE, __FILE__, __LINE__ )
66+
#define Rcpp_error(MESSAGE) throw Rcpp::exception(MESSAGE, __FILE__, __LINE__)
4667

4768
#include <Rcpp/macros/debug.h>
4869
#include <Rcpp/macros/unroll.h>

0 commit comments

Comments
 (0)