| 1956 | } |
| 1957 | |
| 1958 | void CppExportsGenerator::doWriteFunctions( |
| 1959 | const SourceFileAttributes& attributes, |
| 1960 | bool verbose) { |
| 1961 | |
| 1962 | // generate functions |
| 1963 | generateCpp(ostr(), |
| 1964 | attributes, |
| 1965 | true, |
| 1966 | attributes.hasInterface(kInterfaceCpp), |
| 1967 | packageCppPrefix()); |
| 1968 | |
| 1969 | // track cppExports, signatures, and native routines (we use these |
| 1970 | // at the end to generate the ValidateSignature and RegisterCCallable |
| 1971 | // functions, and to generate a package init function with native |
| 1972 | // routine registration) |
| 1973 | for (SourceFileAttributes::const_iterator // #nocov start |
| 1974 | it = attributes.begin(); it != attributes.end(); ++it) { |
| 1975 | |
| 1976 | if (it->isExportedFunction()) { |
| 1977 | |
| 1978 | // add it to the cpp exports list if we are generating |
| 1979 | // a C++ interface and it's not hidden |
| 1980 | if (attributes.hasInterface(kInterfaceCpp)) { |
| 1981 | Function fun = it->function().renamedTo(it->exportedCppName()); |
| 1982 | if (!fun.isHidden()) |
| 1983 | cppExports_.push_back(*it); |
| 1984 | } |
| 1985 | |
| 1986 | // add it to the native routines list |
| 1987 | nativeRoutines_.push_back(*it); |
| 1988 | } else if (it->name() == kInitAttribute) { |
| 1989 | initFunctions_.push_back(*it); |
| 1990 | } |
| 1991 | } // #nocov end |
| 1992 | |
| 1993 | // record modules |
| 1994 | const std::vector<std::string>& modules = attributes.modules(); |
| 1995 | modules_.insert(modules_.end(), modules.begin(), modules.end()); |
| 1996 | |
| 1997 | // verbose if requested |
| 1998 | if (verbose) { // #nocov start |
| 1999 | Rcpp::Rcout << "Exports from " << attributes.sourceFile() << ":" |
| 2000 | << std::endl; |
| 2001 | for (std::vector<Attribute>::const_iterator |
| 2002 | it = attributes.begin(); it != attributes.end(); ++it) { |
| 2003 | if (it->isExportedFunction()) |
| 2004 | Rcpp::Rcout << " " << it->function() << std::endl; |
| 2005 | } |
| 2006 | Rcpp::Rcout << std::endl; // #nocov end |
| 2007 | } |
| 2008 | } |
| 2009 | |
| 2010 | void CppExportsGenerator::writeEnd(bool hasPackageInit) |
| 2011 | { |
nothing calls this directly
no test coverage detected