Skip to content

Commit 18777ed

Browse files
author
Florian Plaza Oñate
committed
Merge remote-tracking branch 'upstream/master' into subsetter-patch
2 parents a43c44c + e4868b8 commit 18777ed

24 files changed

+332
-170
lines changed

ChangeLog

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,62 @@
1+
2015-08-31 Dirk Eddelbuettel <[email protected]>
2+
3+
* DESCRIPTION (Version, Date): Roll Version and Date
4+
5+
2015-08-30 Dirk Eddelbuettel <[email protected]>
6+
7+
* vignettes/Rcpp.bib: Updated RcppGSL entry
8+
9+
2015-08-29 Dirk Eddelbuettel <[email protected]>
10+
11+
* vignettes/Rcpp.bib: Add RcppZiggurat entry
12+
13+
* inst/include/Rcpp/utils/tinyformat.h: Updated to current upstream
14+
version keeping our local modifications / adaptations (PR #357)
15+
16+
2015-08-29 Qiang Kou <[email protected]>
17+
18+
* inst/include/Rcpp/vector/Subsetter.h: Enable logical subsetting on
19+
both LHS and RHS, eg 'a[b > 3] = b[b > 3]' (pull request #352 addressing
20+
issue #345)
21+
* inst/unitTests/cpp/Subset.cpp: Ditto
22+
* inst/unitTests/runit.subset.R: Unit tests for above
23+
24+
2015-08-26 Dirk Eddelbuettel <[email protected]>
25+
26+
* inst/unitTests/testRcppClass/src/rcpp_module.cpp: Renamed Module
27+
'World' to 'RcppClassWorld' to avoid multiple modules with same name
28+
(pull request #351, fixed issue #350)
29+
30+
* inst/unitTests/testRcppClass/man/Rcpp_class_examples.Rd: Ditto
31+
* inst/unitTests/testRcppClass/R/load.R: Ditto
32+
* inst/unitTests/testRcppClass/NAMESPACE: Ditto
33+
* inst/unitTests/runit.Module.client.package.R: Re-enable test
34+
35+
* inst/unitTests/testRcppModule/src/rcpp_module.cpp: Renamed Module
36+
'World' to 'RcppModuleWorld' to avoid multiple modules with same name
37+
38+
* inst/unitTests/cpp/modref.cpp: Rename 'World' to 'ModRefWorld'
39+
* inst/unitTests/runit.modref.R (test.modRef): Ditto
40+
41+
* inst/unitTests/cpp/Module.cpp: Rename 'World' to 'ModuleWorld'
42+
* inst/unitTests/runit.Module.R (test.Module): Ditto
43+
44+
2015-08-25 Kurt Hornik <[email protected]>
45+
46+
* R/loadModule.R: For now=TRUE, always set .botched to FALSE which
47+
corresponds to the case of the methods package being in the search path
48+
* inst/include/Rcpp/Reference.h: Call call with the internal Namespace
49+
150
2015-08-24 Dirk Eddelbuettel <[email protected]>
251

352
* vignettes/Rcpp.bib: Updated R / R Core references
453

5-
2015-08-19 Florian Plaza Oñate <[email protected]>
54+
2015-08-23 Romain Francois <[email protected]>
55+
56+
* inst/include/Rcpp/Benchmark/Timer.h: Silence 'g++ -pedantic' by
57+
replaceing one R_xlen_t by size_t (pull request #348)
58+
59+
2015-08-19 Florian Plaza Onate <[email protected]>
660
* inst/include/Rcpp/vector/Vector.h: Add 'at' methods which implement
761
accessors with bounds cheking (pull request #342, fixes issue #341)
862
* inst/include/Rcpp/vector/Matrix.h: Ditto
@@ -16,12 +70,12 @@
1670
* inst/unitTests/runit.Module.client.package.R: Disabled for bad
1771
interaction of Rcpp Modules and R 3.2.2
1872

19-
2015-08-15 Florian Plaza Oñate <[email protected]>
73+
2015-08-15 Florian Plaza Onate <[email protected]>
2074

2175
* inst/include/Rcpp/vector/converter.h: Correct conversion from const
2276
char argument (pull request #344, fixes issue #343)
2377

24-
2015-08-14 Florian Plaza Oñate <[email protected]>
78+
2015-08-14 Florian Plaza Onate <[email protected]>
2579

2680
* inst/include/Rcpp/vector/DimNameProxy.h: Add assignment operator,
2781
refactor code, update error message formatting (pull request #339)
@@ -33,7 +87,8 @@
3387
2015-08-02 Dirk Eddelbuettel <[email protected]>
3488

3589
* R/Attributes.R (sourceCpp): In no-rebuild-needed case, also set a
36-
default directory restoration via on.exit()
90+
default directory restoration via on.exit() (pull request #335,
91+
addressing issue #309)
3792

3893
2015-07-24 Dirk Eddelbuettel <[email protected]>
3994

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.12.0.2
4-
Date: 2015-08-17
3+
Version: 0.12.0.5
4+
Date: 2015-08-31
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Qiang Kou, Douglas Bates and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>

R/loadModule.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2010 - 2012 John Chambers, Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2010 - 2015 John Chambers, Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -67,7 +67,9 @@ loadModule <- function( module, what = character(), loadNow,
6767
loadNow <- !is(loadM, "error")
6868
}
6969
if(loadNow) {
70-
.botched <- isBotchedSession()
70+
## .botched <- isBotchedSession()
71+
.botched <- FALSE
72+
7173
if(is.null(loadM))
7274
loadM <- tryCatch(Module( module, mustStart = TRUE, where = env ),
7375
error = function(e)e)

inst/NEWS.Rd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
\item Correctly reset directory in case of no-rebuilding but Windows code
2020
(PR #335)
2121
}
22+
\item Changes in Rcpp Modules:
23+
\itemize{
24+
\item We no longer define multiple Modules objects named \code{World} in
25+
the unit tests with was seen to have a bad effect with R 3.2.2 or later.
26+
\item Applied patch by Kurt Hornik which improves how Rcpp loads Modules
27+
}
2228
}
2329
}
2430

inst/include/Rcpp/Reference.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Reference.h: Rcpp R/C++ interface class library -- Reference class objects
44
//
5-
// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -59,15 +59,15 @@ namespace Rcpp{
5959
Reference_Impl( const std::string& klass ) {
6060
SEXP newSym = Rf_install("new");
6161
Shield<SEXP> call( Rf_lang2( newSym, Rf_mkString( klass.c_str() ) ) );
62-
Storage::set__( Rcpp_eval( call ) ) ;
62+
Storage::set__( Rcpp_eval( call , Rcpp::internal::get_Rcpp_namespace()) );
6363
}
6464

6565
void update( SEXP x){
66-
if( ! ::Rf_isS4(x) ) throw not_reference() ;
66+
if( ! ::Rf_isS4(x) ) throw not_reference();
6767
}
6868
} ;
6969

70-
typedef Reference_Impl<PreserveStorage> Reference ;
70+
typedef Reference_Impl<PreserveStorage> Reference;
7171

7272
} // namespace Rcpp
7373

inst/include/Rcpp/utils/tinyformat.h

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ namespace Rcpp {
128128
}
129129
#define TINYFORMAT_ERROR(REASON) ::Rcpp::stop(REASON)
130130

131+
// Define for C++11 variadic templates which make the code shorter & more
132+
// general. If you don't define this, C++11 support is autodetected below.
133+
// #define TINYFORMAT_USE_VARIADIC_TEMPLATES
134+
131135
// don't use C++11 features (support older compilers)
132136
#define TINYFORMAT_NO_VARIADIC_TEMPLATES
133137

@@ -148,12 +152,29 @@ namespace Rcpp {
148152
# endif
149153
#endif
150154

155+
#ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
156+
# include <array>
157+
# if defined(_MSC_VER) && _MSC_VER <= 1800 // VS2013
158+
# define TINYFORMAT_BRACED_INIT_WORKAROUND(x) (x)
159+
# else
160+
# define TINYFORMAT_BRACED_INIT_WORKAROUND(x) {x}
161+
# endif
162+
#endif
163+
151164
#if defined(__GLIBCXX__) && __GLIBCXX__ < 20080201
152165
// std::showpos is broken on old libstdc++ as provided with OSX. See
153166
// http://gcc.gnu.org/ml/libstdc++/2007-11/msg00075.html
154167
# define TINYFORMAT_OLD_LIBSTDCPLUSPLUS_WORKAROUND
155168
#endif
156169

170+
#ifdef __APPLE__
171+
// Workaround OSX linker warning: xcode uses different default symbol
172+
// visibilities for static libs vs executables (see issue #25)
173+
# define TINYFORMAT_HIDDEN __attribute__((visibility("hidden")))
174+
#else
175+
# define TINYFORMAT_HIDDEN
176+
#endif
177+
157178
namespace tinyformat {
158179

159180
//------------------------------------------------------------------------------
@@ -203,7 +224,7 @@ template<int n> struct is_wchar<wchar_t[n]> {};
203224
template<typename T, typename fmtT, bool convertible = is_convertible<T, fmtT>::value>
204225
struct formatValueAsType
205226
{
206-
static void invoke(std::ostream& /*out*/, const T& /*value*/) {}
227+
static void invoke(std::ostream& /*out*/, const T& /*value*/) { /*assert(0);*/ }
207228
};
208229
// Specialized version for types that can actually be converted to fmtT, as
209230
// indicated by the "convertible" template parameter.
@@ -311,8 +332,8 @@ inline void formatValue(std::ostream& out, const char* /*fmtBegin*/,
311332
// void* respectively and format that instead of the value itself. For the
312333
// %p conversion it's important to avoid dereferencing the pointer, which
313334
// could otherwise lead to a crash when printing a dangling (const char*).
314-
const bool canConvertToChar = detail::is_convertible<T,char>::value;
315-
const bool canConvertToVoidPtr = detail::is_convertible<T, const void*>::value;
335+
bool canConvertToChar = detail::is_convertible<T,char>::value;
336+
bool canConvertToVoidPtr = detail::is_convertible<T, const void*>::value;
316337
if(canConvertToChar && *(fmtEnd-1) == 'c')
317338
detail::formatValueAsType<T, char>::invoke(out, value);
318339
else if(canConvertToVoidPtr && *(fmtEnd-1) == 'p')
@@ -502,14 +523,14 @@ class FormatArg
502523

503524
private:
504525
template<typename T>
505-
static void formatImpl(std::ostream& out, const char* fmtBegin,
526+
TINYFORMAT_HIDDEN static void formatImpl(std::ostream& out, const char* fmtBegin,
506527
const char* fmtEnd, int ntrunc, const void* value)
507528
{
508529
formatValue(out, fmtBegin, fmtEnd, ntrunc, *static_cast<const T*>(value));
509530
}
510531

511532
template<typename T>
512-
static int toIntImpl(const void* value)
533+
TINYFORMAT_HIDDEN static int toIntImpl(const void* value)
513534
{
514535
return convertToInt<T>::invoke(*static_cast<const T*>(value));
515536
}
@@ -540,7 +561,7 @@ inline int parseIntAndAdvance(const char*& c)
540561
inline const char* printFormatStringLiteral(std::ostream& out, const char* fmt)
541562
{
542563
const char* c = fmt;
543-
for(; true; ++c)
564+
for(;; ++c)
544565
{
545566
switch(*c)
546567
{
@@ -848,7 +869,7 @@ class FormatListN : public FormatList
848869
template<typename... Args>
849870
FormatListN(const Args&... args)
850871
: FormatList(&m_formatterStore[0], N),
851-
m_formatterStore{FormatArg(args)...}
872+
m_formatterStore TINYFORMAT_BRACED_INIT_WORKAROUND({ FormatArg(args)... })
852873
{ static_assert(sizeof...(args) == N, "Number of args must be N"); }
853874
#else // C++98 version
854875
void init(int) {}
@@ -857,7 +878,7 @@ class FormatListN : public FormatList
857878
template<TINYFORMAT_ARGTYPES(n)> \
858879
FormatListN(TINYFORMAT_VARARGS(n)) \
859880
: FormatList(&m_formatterStore[0], n) \
860-
{ init(0, TINYFORMAT_PASSARGS(n)); } \
881+
{/*assert*n == N);*/init(0, TINYFORMAT_PASSARGS(n)); } \
861882
\
862883
template<TINYFORMAT_ARGTYPES(n)> \
863884
void init(int i, TINYFORMAT_VARARGS(n)) \
@@ -871,7 +892,11 @@ class FormatListN : public FormatList
871892
#endif
872893

873894
private:
895+
#ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
896+
std::array<FormatArg, N> m_formatterStore;
897+
#else // C++98 version
874898
FormatArg m_formatterStore[N];
899+
#endif
875900
};
876901

877902
// Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard

inst/include/Rcpp/vector/Subsetter.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,30 @@ class SubsetProxy {
9797
return *this;
9898
}
9999

100+
template <int RTYPE_OTHER, template <class> class StoragePolicyOther,int RHS_RTYPE_OTHER, bool RHS_NA_OTHER, typename RHS_T_OTHER>
101+
SubsetProxy& operator=(const SubsetProxy<RTYPE_OTHER, StoragePolicyOther, RHS_RTYPE_OTHER, RHS_NA_OTHER, RHS_T_OTHER>& other) {
102+
103+
Vector<RTYPE_OTHER, StoragePolicyOther> other_vec = other;
104+
*this = other_vec;
105+
return *this;
106+
}
107+
108+
SubsetProxy& operator=(const SubsetProxy& other) {
109+
if (other.indices_n == 1) {
110+
for (int i=0; i < indices_n; ++i) {
111+
lhs[ indices[i] ] = other.lhs[other.indices[0]];
112+
}
113+
}
114+
else if (indices_n == other.indices_n) {
115+
for (int i=0; i < indices_n; ++i)
116+
lhs[ indices[i] ] = other.lhs[other.indices[i]];
117+
}
118+
else {
119+
stop("index error");
120+
}
121+
return *this;
122+
}
123+
100124
operator Vector<RTYPE, StoragePolicy>() const {
101125
return get_vec();
102126
}

0 commit comments

Comments
 (0)