@@ -1772,8 +1772,9 @@ namespace attributes {
17721772
17731773 // write header/preamble
17741774 std::ostringstream headerStream;
1775- headerStream << commentPrefix_ << " This file was generated by "
1776- << " Rcpp::compileAttributes" << std::endl;
1775+ headerStream << commentPrefix_ << " Generated by using "
1776+ << " Rcpp::compileAttributes()"
1777+ << " -> do not edit by hand" << std::endl;
17771778 headerStream << commentPrefix_ << " Generator token: "
17781779 << generatorToken () << std::endl << std::endl;
17791780 if (!preamble.empty ())
@@ -2045,11 +2046,11 @@ namespace attributes {
20452046 << getCCallable (packageCpp () + " _" + function.name ()) << " ;"
20462047 << std::endl;
20472048 ostr () << " }" << std::endl;
2048- ostr () << " RObject __result ;" << std::endl;
2049+ ostr () << " RObject rcpp_result_gen ;" << std::endl;
20492050 ostr () << " {" << std::endl;
20502051 if (it->rng ())
2051- ostr () << " RNGScope __rngScope ;" << std::endl;
2052- ostr () << " __result = " << ptrName << " (" ;
2052+ ostr () << " RNGScope RCPP_rngScope_gen ;" << std::endl;
2053+ ostr () << " rcpp_result_gen = " << ptrName << " (" ;
20532054
20542055 const std::vector<Argument>& args = function.arguments ();
20552056 for (std::size_t i = 0 ; i<args.size (); i++) {
@@ -2061,18 +2062,18 @@ namespace attributes {
20612062 ostr () << " );" << std::endl;
20622063 ostr () << " }" << std::endl;
20632064
2064- ostr () << " if (__result .inherits(\" interrupted-error\" ))"
2065+ ostr () << " if (rcpp_result_gen .inherits(\" interrupted-error\" ))"
20652066 << std::endl
20662067 << " throw Rcpp::internal::InterruptedException();"
20672068 << std::endl;
2068- ostr () << " if (__result .inherits(\" try-error\" ))"
2069+ ostr () << " if (rcpp_result_gen .inherits(\" try-error\" ))"
20692070 << std::endl
20702071 << " throw Rcpp::exception(as<std::string>("
2071- << " __result ).c_str());"
2072+ << " rcpp_result_gen ).c_str());"
20722073 << std::endl;
20732074 if (!function.type ().isVoid ()) {
20742075 ostr () << " return Rcpp::as<" << function.type () << " >"
2075- << " (__result );" << std::endl;
2076+ << " (rcpp_result_gen );" << std::endl;
20762077 }
20772078
20782079 ostr () << " }" << std::endl << std::endl;
@@ -2148,7 +2149,7 @@ namespace attributes {
21482149 }
21492150
21502151 std::string CppExportsIncludeGenerator::getHeaderGuard () const {
2151- return " __ " + packageCpp () + " _RcppExports_h__ " ;
2152+ return " _RCPP_ " + packageCpp () + " _RCPPEXPORTS_H_GEN_ " ;
21522153 }
21532154
21542155 CppPackageIncludeGenerator::CppPackageIncludeGenerator (
@@ -2196,7 +2197,7 @@ namespace attributes {
21962197 }
21972198
21982199 std::string CppPackageIncludeGenerator::getHeaderGuard () const {
2199- return " __ " + packageCpp () + " _h__ " ;
2200+ return " _RCPP_ " + packageCpp () + " _H_GEN_ " ;
22002201 }
22012202
22022203 RExportsGenerator::RExportsGenerator (const std::string& packageDir,
@@ -2582,9 +2583,9 @@ namespace attributes {
25822583 ostr << args << " ) {" << std::endl;
25832584 ostr << " BEGIN_RCPP" << std::endl;
25842585 if (!function.type ().isVoid ())
2585- ostr << " Rcpp::RObject __result ;" << std::endl;
2586+ ostr << " Rcpp::RObject rcpp_result_gen ;" << std::endl;
25862587 if (!cppInterface && attribute.rng ())
2587- ostr << " Rcpp::RNGScope __rngScope ;" << std::endl;
2588+ ostr << " Rcpp::RNGScope rcpp_rngScope_gen ;" << std::endl;
25882589 for (size_t i = 0 ; i<arguments.size (); i++) {
25892590 const Argument& argument = arguments[i];
25902591
@@ -2595,7 +2596,7 @@ namespace attributes {
25952596
25962597 ostr << " " ;
25972598 if (!function.type ().isVoid ())
2598- ostr << " __result = Rcpp::wrap(" ;
2599+ ostr << " rcpp_result_gen = Rcpp::wrap(" ;
25992600 ostr << function.name () << " (" ;
26002601 for (size_t i = 0 ; i<arguments.size (); i++) {
26012602 const Argument& argument = arguments[i];
@@ -2609,7 +2610,7 @@ namespace attributes {
26092610
26102611 if (!function.type ().isVoid ())
26112612 {
2612- ostr << " return __result ;" << std::endl;
2613+ ostr << " return rcpp_result_gen ;" << std::endl;
26132614 }
26142615 else
26152616 {
@@ -2623,11 +2624,11 @@ namespace attributes {
26232624 if (cppInterface) {
26242625 ostr << " RcppExport SEXP " << funcName << " (" << args << " ) {"
26252626 << std::endl;
2626- ostr << " SEXP __result ;" << std::endl;
2627+ ostr << " SEXP rcpp_result_gen ;" << std::endl;
26272628 ostr << " {" << std::endl;
26282629 if (attribute.rng ())
2629- ostr << " Rcpp::RNGScope __rngScope ;" << std::endl;
2630- ostr << " __result = PROTECT(" << funcName
2630+ ostr << " Rcpp::RNGScope rcpp_rngScope_gen ;" << std::endl;
2631+ ostr << " rcpp_result_gen = PROTECT(" << funcName
26312632 << kTrySuffix << " (" ;
26322633 for (size_t i = 0 ; i<arguments.size (); i++) {
26332634 const Argument& argument = arguments[i];
@@ -2637,21 +2638,21 @@ namespace attributes {
26372638 }
26382639 ostr << " ));" << std::endl;
26392640 ostr << " }" << std::endl;
2640- ostr << " Rboolean __isInterrupt = Rf_inherits(__result , \" interrupted-error\" );"
2641+ ostr << " Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen , \" interrupted-error\" );"
26412642 << std::endl
2642- << " if (__isInterrupt ) {" << std::endl
2643+ << " if (rcpp_isError_gen ) {" << std::endl
26432644 << " UNPROTECT(1);" << std::endl
26442645 << " Rf_onintr();" << std::endl
26452646 << " }" << std::endl
2646- << " Rboolean __isError = Rf_inherits(__result , \" try-error\" );"
2647+ << " Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen , \" try-error\" );"
26472648 << std::endl
2648- << " if (__isError ) {" << std::endl
2649- << " SEXP __msgSEXP = Rf_asChar(__result );" << std::endl
2649+ << " if (rcpp_isError_gen ) {" << std::endl
2650+ << " SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen );" << std::endl
26502651 << " UNPROTECT(1);" << std::endl
2651- << " Rf_error(CHAR(__msgSEXP ));" << std::endl
2652+ << " Rf_error(CHAR(rcpp_msgSEXP_gen ));" << std::endl
26522653 << " }" << std::endl
26532654 << " UNPROTECT(1);" << std::endl
2654- << " return __result ;" << std::endl
2655+ << " return rcpp_result_gen ;" << std::endl
26552656 << " }" << std::endl;
26562657 }
26572658 }
0 commit comments