[Rcpp-commits] r1552 - in pkg/Rcpp: . R inst inst/include/Rcpp
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 16 14:40:17 CEST 2010
Author: romain
Date: 2010-06-16 14:40:17 +0200 (Wed, 16 Jun 2010)
New Revision: 1552
Modified:
pkg/Rcpp/DESCRIPTION
pkg/Rcpp/R/Module.R
pkg/Rcpp/inst/ChangeLog
pkg/Rcpp/inst/include/Rcpp/Module.h
Log:
adding the LOAD_RCPP_MODULE macro to allow loading module from C++ (useful for RInside)
Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION 2010-06-16 12:00:32 UTC (rev 1551)
+++ pkg/Rcpp/DESCRIPTION 2010-06-16 12:40:17 UTC (rev 1552)
@@ -1,6 +1,6 @@
Package: Rcpp
Title: Rcpp R/C++ interface package
-Version: 0.8.2.6
+Version: 0.8.2.7
Date: $Date$
Author: Dirk Eddelbuettel and Romain Francois, with contributions
by Simon Urbanek, David Reiss and Douglas Bates; based on code written during
Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R 2010-06-16 12:00:32 UTC (rev 1551)
+++ pkg/Rcpp/R/Module.R 2010-06-16 12:40:17 UTC (rev 1552)
@@ -126,9 +126,13 @@
setReplaceMethod( "$", "C++Object", dollargets_cppobject )
Module <- function( module, PACKAGE = getPackageName(where), where = topenv(parent.frame()) ){
- name <- sprintf( "_rcpp_module_boot_%s", module )
- symbol <- getNativeSymbolInfo( name, PACKAGE )
- xp <- .Call( symbol )
+ if( identical( typeof( module ), "externalptr" ) ){
+ xp <- module
+ } else {
+ name <- sprintf( "_rcpp_module_boot_%s", module )
+ symbol <- getNativeSymbolInfo( name, PACKAGE )
+ xp <- .Call( symbol )
+ }
classes <- .Call( "Module__classes_info", xp, PACKAGE = "Rcpp" )
if( length( classes ) ){
clnames <- names( classes )
Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog 2010-06-16 12:00:32 UTC (rev 1551)
+++ pkg/Rcpp/inst/ChangeLog 2010-06-16 12:40:17 UTC (rev 1552)
@@ -2,6 +2,12 @@
* inst/include/Rcpp/InternalFunction.h: new class Rcpp::InternalFunction
* R/Module.R: R support for Rcpp::InternalFunction
+
+ * inst/include/Rcpp/Module.h: added the LOAD_RCPP_MODULE macro to
+ allow loading a module from C++
+
+ * R/Module.R: if the first argument is an external pointer already,
+ Module assumes it is a module pointer. (R support for the item above)
2010-06-15 Dirk Eddelbuettel <edd at debian.org>
Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h 2010-06-16 12:00:32 UTC (rev 1551)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h 2010-06-16 12:40:17 UTC (rev 1552)
@@ -325,6 +325,9 @@
return mod_xp ; \
} \
void _rcpp_module_##name##_init()
+
+#define LOAD_RCPP_MODULE(NAME) Rf_eval( Rf_lang2( Rf_install("Module"), _rcpp_module_boot_##NAME() ), R_GlobalEnv )
+
#endif
#endif
More information about the Rcpp-commits
mailing list