diff --git a/ChangeLog b/ChangeLog index 23781c2f9..19662ced6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-01 JJ Allaire + + * src/attributes.cpp: Avoid invalid function names when + generating C++ interfaces. + 2015-11-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.2 diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 64bbf00f7..19f8e43f4 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,15 @@ \newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}} +\section{Changes in Rcpp version 0.12.3 (Unreleased)}{ + \itemize{ + \item Changes in Rcpp Attributes: + \itemize{ + \item Avoid invalid function names when generating C++ interfaces. + } + } +} + \section{Changes in Rcpp version 0.12.2 (2015-11-14)}{ \itemize{ \item Changes in Rcpp API: diff --git a/src/attributes.cpp b/src/attributes.cpp index ad0f44a96..347ce75f5 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -343,6 +343,12 @@ namespace attributes { return function().name(); } } + + std::string exportedCppName() const { + std::string name = exportedName(); + std::replace(name.begin(), name.end(), '.', '_'); + return name; + } bool rng() const { Param rngParam = paramNamed(kExportRng); @@ -1795,7 +1801,7 @@ namespace attributes { it = attributes.begin(); it != attributes.end(); ++it) { if (it->isExportedFunction()) { // add it to the list if it's not hidden - Function fun = it->function().renamedTo(it->exportedName()); + Function fun = it->function().renamedTo(it->exportedCppName()); if (!fun.isHidden()) cppExports_.push_back(*it); } @@ -1978,7 +1984,7 @@ namespace attributes { if (it->isExportedFunction()) { Function function = - it->function().renamedTo(it->exportedName()); + it->function().renamedTo(it->exportedCppName()); // if it's hidden then don't generate a C++ interface if (function.isHidden())