From noreply at r-forge.r-project.org Wed Feb 13 02:55:50 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 13 Feb 2013 02:55:50 +0100 (CET) Subject: [Rinside-commits] r273 - in pkg: . inst inst/examples/standard inst/include src Message-ID: <20130213015550.2A4AC184D8D@r-forge.r-project.org> Author: edd Date: 2013-02-13 02:55:49 +0100 (Wed, 13 Feb 2013) New Revision: 273 Modified: pkg/ChangeLog pkg/DESCRIPTION pkg/inst/NEWS.Rd pkg/inst/examples/standard/Makefile pkg/inst/include/RInside.h pkg/src/RInside.cpp Log: * inst/include/RInside.h: Set default value of loadRcpp to true * src/RInside.cpp: Assign R's global env. only after R has been loaded, also load Rcpp unconditionally * minor touch-up in examples/standard/Makefile to visuall separate runs Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/ChangeLog 2013-02-13 01:55:49 UTC (rev 273) @@ -1,3 +1,10 @@ +2013-02-12 Dirk Eddelbuettel + + * inst/include/RInside.h: Set default value of loadRcpp to true + + * src/RInside.cpp: Assign R's global env. only after R has been + loaded, also load Rcpp unconditionally + 2013-01-23 Dirk Eddelbuettel * inst/examples/mpi/rinside_mpi_sample4.cpp: Added new example Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/DESCRIPTION 2013-02-13 01:55:49 UTC (rev 273) @@ -1,6 +1,6 @@ Package: RInside Title: C++ classes to embed R in C++ applications -Version: 0.2.10 +Version: 0.2.10.1 Date: $Date$ Author: Dirk Eddelbuettel and Romain Francois Maintainer: Dirk Eddelbuettel @@ -20,7 +20,7 @@ . Doxygen-generated documentation of the C++ classes is available at the RInside website as well. -Depends: R (>= 2.10.0), Rcpp (>= 0.8.5) +Depends: R (>= 2.10.0), Rcpp (>= 0.10.2.4) LinkingTo: Rcpp URL: http://dirk.eddelbuettel.com/code/rinside.html License: GPL (>= 2) Modified: pkg/inst/NEWS.Rd =================================================================== --- pkg/inst/NEWS.Rd 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/inst/NEWS.Rd 2013-02-13 01:55:49 UTC (rev 273) @@ -6,6 +6,9 @@ \itemize{ \item Added new MPI example with worker functions and RInside instance, kindly contributed by Nicholas Pezolano and Martin Morgan + \item Ensure that Rcpp is loaded, and assign the global R environment + only after Rcpp has been loaded + \item Minimum Rcpp version is now 0.10.2.4 } } Modified: pkg/inst/examples/standard/Makefile =================================================================== --- pkg/inst/examples/standard/Makefile 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/inst/examples/standard/Makefile 2013-02-13 01:55:49 UTC (rev 273) @@ -49,4 +49,4 @@ rm -vrf *.dSYM runAll: - for p in $(programs); do echo "Running $$p"; ./$$p; done + for p in $(programs); do echo ""; echo ""; echo "Running $$p"; ./$$p; done Modified: pkg/inst/include/RInside.h =================================================================== --- pkg/inst/include/RInside.h 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/inst/include/RInside.h 2013-02-13 01:55:49 UTC (rev 273) @@ -3,7 +3,7 @@ // RInside.h: R/C++ interface class library -- Easier R embedding into C++ // // Copyright (C) 2009 Dirk Eddelbuettel -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of RInside. // @@ -81,7 +81,8 @@ RInside() ; RInside(const int argc, const char* const argv[], - const bool loadRcpp=false, const bool verbose=false, const bool interactive=false); + const bool loadRcpp=true, // overridden in code, cannot be set to false + const bool verbose=false, const bool interactive=false); ~RInside(); void setVerbose(const bool verbose) { verbose_m = verbose; } Modified: pkg/src/RInside.cpp =================================================================== --- pkg/src/RInside.cpp 2013-01-24 01:38:35 UTC (rev 272) +++ pkg/src/RInside.cpp 2013-02-13 01:55:49 UTC (rev 273) @@ -3,7 +3,7 @@ // RInside.cpp: R/C++ interface class library -- Easier R embedding into C++ // // Copyright (C) 2009 Dirk Eddelbuettel -// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of RInside. // @@ -90,7 +90,7 @@ RInside::RInside(const int argc, const char* const argv[], const bool loadRcpp, const bool verbose, const bool interactive) #ifdef RINSIDE_CALLBACKS -: callbacks(0) + : callbacks(0) #endif { initialize(argc, argv, loadRcpp, verbose, interactive); @@ -167,9 +167,7 @@ #endif R_SetParams(&Rst); - global_env_m = R_GlobalEnv ; - - if (loadRcpp) { // if asked for, load Rcpp (before the autoloads) + if (true || loadRcpp) { // we always need Rcpp, so load it anyway // Rf_install is used best by first assigning like this so that symbols get into the symbol table // where they cannot be garbage collected; doing it on the fly does expose a minuscule risk of garbage // collection -- with thanks to Doug Bates for the explanation and Luke Tierney for the heads-up @@ -178,8 +176,10 @@ Rf_eval(Rf_lang2(suppressMessagesSymbol, Rf_lang2(requireSymbol, Rf_mkString("Rcpp"))), R_GlobalEnv); } - autoloads(); // loads all default packages + global_env_m = R_GlobalEnv; // member variable for access to R's global environment + autoloads(); // loads all default packages, using code autogenerate from Makevars{,.win} + if ((argc - optind) > 1){ // for argv vector in Global Env */ Rcpp::CharacterVector s_argv( argv+(1+optind), argv+argc ); assign(s_argv, "argv");