Skip to content

Commit d8b3373

Browse files
committed
Updated variable & header style to match with comments
1 parent e517968 commit d8b3373

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/attributes.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,11 +2046,11 @@ namespace attributes {
20462046
<< getCCallable(packageCpp() + "_" + function.name()) << ";"
20472047
<< std::endl;
20482048
ostr() << " }" << std::endl;
2049-
ostr() << " RObject RCPP_result_gen_;" << std::endl;
2049+
ostr() << " RObject rcpp_result_gen;" << std::endl;
20502050
ostr() << " {" << std::endl;
20512051
if (it->rng())
20522052
ostr() << " RNGScope RCPP_rngScope_gen;" << std::endl;
2053-
ostr() << " RCPP_result_gen_ = " << ptrName << "(";
2053+
ostr() << " rcpp_result_gen = " << ptrName << "(";
20542054

20552055
const std::vector<Argument>& args = function.arguments();
20562056
for (std::size_t i = 0; i<args.size(); i++) {
@@ -2062,18 +2062,18 @@ namespace attributes {
20622062
ostr() << ");" << std::endl;
20632063
ostr() << " }" << std::endl;
20642064

2065-
ostr() << " if (RCPP_result_gen_.inherits(\"interrupted-error\"))"
2065+
ostr() << " if (rcpp_result_gen.inherits(\"interrupted-error\"))"
20662066
<< std::endl
20672067
<< " throw Rcpp::internal::InterruptedException();"
20682068
<< std::endl;
2069-
ostr() << " if (RCPP_result_gen_.inherits(\"try-error\"))"
2069+
ostr() << " if (rcpp_result_gen.inherits(\"try-error\"))"
20702070
<< std::endl
20712071
<< " throw Rcpp::exception(as<std::string>("
2072-
<< "RCPP_result_gen_).c_str());"
2072+
<< "rcpp_result_gen).c_str());"
20732073
<< std::endl;
20742074
if (!function.type().isVoid()) {
20752075
ostr() << " return Rcpp::as<" << function.type() << " >"
2076-
<< "(RCPP_result_gen_);" << std::endl;
2076+
<< "(rcpp_result_gen);" << std::endl;
20772077
}
20782078

20792079
ostr() << " }" << std::endl << std::endl;
@@ -2149,7 +2149,7 @@ namespace attributes {
21492149
}
21502150

21512151
std::string CppExportsIncludeGenerator::getHeaderGuard() const {
2152-
return "RCPP_" + packageCpp() + "_RcppExports_h_gen_";
2152+
return "_RCPP_" + packageCpp() + "_RcppExports_h_gen_";
21532153
}
21542154

21552155
CppPackageIncludeGenerator::CppPackageIncludeGenerator(
@@ -2197,7 +2197,7 @@ namespace attributes {
21972197
}
21982198

21992199
std::string CppPackageIncludeGenerator::getHeaderGuard() const {
2200-
return "RCPP_" + packageCpp() + "_h_gen_";
2200+
return "_RCPP_" + packageCpp() + "_h_gen_";
22012201
}
22022202

22032203
RExportsGenerator::RExportsGenerator(const std::string& packageDir,
@@ -2583,9 +2583,9 @@ namespace attributes {
25832583
ostr << args << ") {" << std::endl;
25842584
ostr << "BEGIN_RCPP" << std::endl;
25852585
if (!function.type().isVoid())
2586-
ostr << " Rcpp::RObject RCPP_result_gen_;" << std::endl;
2586+
ostr << " Rcpp::RObject rcpp_result_gen;" << std::endl;
25872587
if (!cppInterface && attribute.rng())
2588-
ostr << " Rcpp::RNGScope RCPP_rngScope_gen_;" << std::endl;
2588+
ostr << " Rcpp::RNGScope rcpp_rngScope_gen;" << std::endl;
25892589
for (size_t i = 0; i<arguments.size(); i++) {
25902590
const Argument& argument = arguments[i];
25912591

@@ -2596,7 +2596,7 @@ namespace attributes {
25962596

25972597
ostr << " ";
25982598
if (!function.type().isVoid())
2599-
ostr << "RCPP_result_gen_ = Rcpp::wrap(";
2599+
ostr << "rcpp_result_gen = Rcpp::wrap(";
26002600
ostr << function.name() << "(";
26012601
for (size_t i = 0; i<arguments.size(); i++) {
26022602
const Argument& argument = arguments[i];
@@ -2610,7 +2610,7 @@ namespace attributes {
26102610

26112611
if (!function.type().isVoid())
26122612
{
2613-
ostr << " return RCPP_result_gen_;" << std::endl;
2613+
ostr << " return rcpp_result_gen;" << std::endl;
26142614
}
26152615
else
26162616
{
@@ -2624,11 +2624,11 @@ namespace attributes {
26242624
if (cppInterface) {
26252625
ostr << "RcppExport SEXP " << funcName << "(" << args << ") {"
26262626
<< std::endl;
2627-
ostr << " SEXP RCPP_result_gen_;" << std::endl;
2627+
ostr << " SEXP rcpp_result_gen;" << std::endl;
26282628
ostr << " {" << std::endl;
26292629
if (attribute.rng())
2630-
ostr << " Rcpp::RNGScope RCPP_rngScope_gen_;" << std::endl;
2631-
ostr << " RCPP_result_gen_ = PROTECT(" << funcName
2630+
ostr << " Rcpp::RNGScope rcpp_rngScope_gen;" << std::endl;
2631+
ostr << " rcpp_result_gen = PROTECT(" << funcName
26322632
<< kTrySuffix << "(";
26332633
for (size_t i = 0; i<arguments.size(); i++) {
26342634
const Argument& argument = arguments[i];
@@ -2638,21 +2638,21 @@ namespace attributes {
26382638
}
26392639
ostr << "));" << std::endl;
26402640
ostr << " }" << std::endl;
2641-
ostr << " Rboolean RCPP_isInterrupt_gen_ = Rf_inherits(RCPP_result_gen_, \"interrupted-error\");"
2641+
ostr << " Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, \"interrupted-error\");"
26422642
<< std::endl
2643-
<< " if (RCPP_isInterrupt_gen_) {" << std::endl
2643+
<< " if (rcpp_isError_gen) {" << std::endl
26442644
<< " UNPROTECT(1);" << std::endl
26452645
<< " Rf_onintr();" << std::endl
26462646
<< " }" << std::endl
2647-
<< " Rboolean RCPP_isError_gen_ = Rf_inherits(RCPP_result_gen_, \"try-error\");"
2647+
<< " Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, \"try-error\");"
26482648
<< std::endl
2649-
<< " if (RCPP_isError_gen_) {" << std::endl
2650-
<< " SEXP RCPP_msgSEXP_gen_ = Rf_asChar(RCPP_result_gen_);" << std::endl
2649+
<< " if (rcpp_isError_gen) {" << std::endl
2650+
<< " SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);" << std::endl
26512651
<< " UNPROTECT(1);" << std::endl
2652-
<< " Rf_error(CHAR(RCPP_msgSEXP_gen_));" << std::endl
2652+
<< " Rf_error(CHAR(rcpp_msgSEXP_gen));" << std::endl
26532653
<< " }" << std::endl
26542654
<< " UNPROTECT(1);" << std::endl
2655-
<< " return RCPP_result_gen_;" << std::endl
2655+
<< " return rcpp_result_gen;" << std::endl
26562656
<< "}" << std::endl;
26572657
}
26582658
}

vignettes/Rcpp-package.Rnw

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ using namespace Rcpp;
184184
List rcpp_hello_world();
185185
RcppExport SEXP mypackage_rcpp_hello_world() {
186186
BEGIN_RCPP
187-
Rcpp::RObject RCPP_result_gen_;
188-
Rcpp::RNGScope RCPP_rngScope_gen_;
189-
RCPP_result_gen_ = Rcpp::wrap(rcpp_hello_world());
190-
return RCPP_result_gen_;
187+
Rcpp::RObject rcpp_result_gen;
188+
Rcpp::RNGScope rcpp_rngScope_gen;
189+
rcpp_result_gen = Rcpp::wrap(rcpp_hello_world());
190+
return rcpp_result_gen;
191191
END_RCPP
192192
}
193193
@

0 commit comments

Comments
 (0)