Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-10-01 JJ Allaire <jj@rstudio.org>

* src/attributes.cpp: Avoid invalid function names when
generating C++ interfaces.

2015-11-14 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION: Release 0.12.2
Expand Down
9 changes: 9 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions src/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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())
Expand Down