[Rcpp-commits] r3918 - in pkg/Rcpp: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 8 13:31:32 CET 2012
Author: jjallaire
Date: 2012-11-08 13:31:31 +0100 (Thu, 08 Nov 2012)
New Revision: 3918
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/src/Attributes.cpp
Log:
add information on arguments to Rcpp module
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-11-08 08:14:04 UTC (rev 3917)
+++ pkg/Rcpp/ChangeLog 2012-11-08 12:31:31 UTC (rev 3918)
@@ -1,3 +1,9 @@
+
+2012-11-08 JJ Allaire <jj at rstudio.org>
+
+ * src/Attributes.cpp: add information on arguments to Rcpp module;
+ use inline rather than static linkage for generated C++ shims
+
2012-11-08 Romain Francois <romain at r-enthusiasts.com>
* R/Module.R: Module functions taking no arguments don't get the ellipsis
Modified: pkg/Rcpp/src/Attributes.cpp
===================================================================
--- pkg/Rcpp/src/Attributes.cpp 2012-11-08 08:14:04 UTC (rev 3917)
+++ pkg/Rcpp/src/Attributes.cpp 2012-11-08 12:31:31 UTC (rev 3918)
@@ -127,7 +127,19 @@
// add module function export
ostr << " Rcpp::function(\"" << exportedName(*it) << "\", &"
- << function.name() << ");" << std::endl;
+ << function.name();
+
+ // add information on arguments
+ const std::vector<Argument>& args =
+ it->function().arguments();
+ ostr << ", Rcpp::List::create(";
+ for (size_t i=0; i<args.size(); i++) {
+ ostr << "_[\"" << args[i].name() << "\"]";
+ if (i != (args.size()-1))
+ ostr << ", ";
+ }
+ ostr << ")";
+ ostr << ");" << std::endl;
}
}
@@ -490,7 +502,7 @@
if (function.isHidden())
continue;
- ostr() << " static " << function << " {"
+ ostr() << " inline " << function << " {"
<< std::endl;
std::string ptrName = "p_" + function.name();
@@ -601,12 +613,12 @@
virtual void writeEnd() {
ostr() << "Rcpp::loadModule(\"" << package() << "_RcppExports\", ";
-
if (rExports_.size() > 0) {
- ostr() << "what = c(";
+ ostr() << std::endl;
+ ostr() << " what = c(";
for (size_t i=0; i<rExports_.size(); i++) {
if (i != 0)
- ostr() << " ";
+ ostr() << " ";
ostr() << "\"" << rExports_[i] << "\"";
if (i != (rExports_.size()-1))
ostr() << "," << std::endl;
More information about the Rcpp-commits
mailing list