Skip to content

Commit 02dbe5b

Browse files
s/Scoped/Shield/
1 parent 886ea55 commit 02dbe5b

26 files changed

Lines changed: 140 additions & 117 deletions

inst/include/Rcpp/Environment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ namespace Rcpp{
322322
we have to go back to R to do this operation */
323323
SEXP internalSym = Rf_install( ".Internal" );
324324
SEXP removeSym = Rf_install( "remove" );
325-
Scoped<SEXP> call = Rf_lang2(
325+
Shield<SEXP> call = Rf_lang2(
326326
internalSym,
327327
Rf_lang4(removeSym, Rf_mkString(name.c_str()), Storage::get__(), Rf_ScalarLogical( FALSE ))
328328
);

inst/include/Rcpp/Reference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace Rcpp{
5757
Reference_Impl( const std::string& klass ){
5858
// using callback to R as apparently R_do_new_object always makes the same environment
5959
SEXP newSym = Rf_install("new");
60-
Scoped<SEXP> call = Rf_lang2( newSym, Rf_mkString( klass.c_str() ) ) ;
60+
Shield<SEXP> call = Rf_lang2( newSym, Rf_mkString( klass.c_str() ) ) ;
6161
Storage::set__( Rcpp_eval( call ) ) ;
6262

6363
}

inst/include/Rcpp/api/meat/DataFrame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ namespace Rcpp{
9797
obj.erase(strings_as_factors_index) ;
9898
names.erase(strings_as_factors_index) ;
9999
obj.attr( "names") = names ;
100-
Scoped<SEXP> call = Rf_lang3(as_df_symb, obj, wrap( strings_as_factors ) ) ;
100+
Shield<SEXP> call = Rf_lang3(as_df_symb, obj, wrap( strings_as_factors ) ) ;
101101
SET_TAG( CDDR(call), strings_as_factors_symb ) ;
102-
Scoped<SEXP> res = Rcpp_eval( call ) ;
102+
Shield<SEXP> res = Rcpp_eval( call ) ;
103103
DataFrame out( res ) ;
104104
return out ;
105105
}

inst/include/Rcpp/api/meat/DottedPairImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace Rcpp{
4242
while( !Rf_isNull(CDR(x)) ){
4343
x = CDR(x) ;
4444
}
45-
Scoped<SEXP> tail = pairlist( object ) ;
45+
Shield<SEXP> tail = pairlist( object ) ;
4646
SETCDR( x, tail ) ;
4747
}
4848
}
@@ -64,7 +64,7 @@ namespace Rcpp{
6464
x = CDR(x) ;
6565
i++;
6666
}
67-
Scoped<SEXP> tail = grow( object, CDR(x) ) ;
67+
Shield<SEXP> tail = grow( object, CDR(x) ) ;
6868
SETCDR( x, tail ) ;
6969
}
7070
}
@@ -75,7 +75,7 @@ namespace Rcpp{
7575
CLASS& ref = static_cast<CLASS&>(*this) ;
7676
if( static_cast<R_len_t>(index) >= ::Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
7777

78-
Scoped<SEXP> x = pairlist( object );
78+
Shield<SEXP> x = pairlist( object );
7979
SEXP y = ref.get__() ;
8080
int i=0;
8181
while( i<index ){ y = CDR(y) ; i++; }

inst/include/Rcpp/api/meat/FieldProxy.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Rcpp{
2828

2929
template <typename CLASS>
3030
SEXP FieldProxyPolicy<CLASS>::FieldProxy::get() const {
31-
Scoped<SEXP> call = Rf_lang3(
31+
Shield<SEXP> call = Rf_lang3(
3232
R_DollarSymbol,
3333
parent,
3434
Rf_ScalarString(field_name)
@@ -39,8 +39,8 @@ namespace Rcpp{
3939
template <typename CLASS>
4040
void FieldProxyPolicy<CLASS>::FieldProxy::set( SEXP x) {
4141
SEXP dollarGetsSym = Rf_install( "$<-");
42-
Scoped<SEXP> name = Rf_ScalarString( field_name ) ;
43-
Scoped<SEXP> call = Rf_lang4(
42+
Shield<SEXP> name = Rf_ScalarString( field_name ) ;
43+
Shield<SEXP> call = Rf_lang4(
4444
dollarGetsSym,
4545
parent,
4646
name ,
@@ -75,7 +75,7 @@ namespace Rcpp{
7575

7676
template <typename CLASS>
7777
SEXP FieldProxyPolicy<CLASS>::const_FieldProxy::get() const {
78-
Scoped<SEXP> call = Rf_lang3(
78+
Shield<SEXP> call = Rf_lang3(
7979
R_DollarSymbol,
8080
parent,
8181
Rf_ScalarString(field_name)

inst/include/Rcpp/api/meat/Vector.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ namespace Rcpp{
160160
Storage::set__( target.get__() ) ;
161161
return begin()+i ;
162162
} else {
163-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n-1 );
163+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n-1 );
164164
int i= 0 ;
165165
for( ; it < position; ++it, ++target_it,i++){
166166
*target_it = *it;
@@ -203,7 +203,7 @@ namespace Rcpp{
203203
*target_it = *it ;
204204
}
205205
} else{
206-
Scoped<SEXP> newnames = ::Rf_allocVector(STRSXP, target_size);
206+
Shield<SEXP> newnames = ::Rf_allocVector(STRSXP, target_size);
207207
int i= 0 ;
208208
for( ; it < first; ++it, ++target_it, i++ ){
209209
*target_it = *it ;
@@ -234,7 +234,7 @@ namespace Rcpp{
234234
*target_it = *it ;
235235
}
236236
} else {
237-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1) ;
237+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1) ;
238238
int i = 0 ;
239239
for( ; it < this_end; ++it, ++target_it, i++ ){
240240
*target_it = *it ;
@@ -249,7 +249,7 @@ namespace Rcpp{
249249

250250
template <int RTYPE, template <class> class StoragePolicy>
251251
void Vector_Impl<RTYPE,StoragePolicy>::push_back__impl(const stored_type& object, std::true_type){
252-
Scoped<SEXP> object_sexp = object ;
252+
Shield<SEXP> object_sexp = object ;
253253
int n = size() ;
254254
Vector_Impl target( n + 1 ) ;
255255
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
@@ -261,7 +261,7 @@ namespace Rcpp{
261261
*target_it = *it ;
262262
}
263263
} else {
264-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1) ;
264+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1) ;
265265
int i = 0 ;
266266
for( ; it < this_end; ++it, ++target_it, i++ ){
267267
*target_it = *it ;
@@ -282,7 +282,7 @@ namespace Rcpp{
282282
iterator it(begin()) ;
283283
iterator this_end(end());
284284
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
285-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
285+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
286286
int i=0;
287287
if( names == R_NilValue ){
288288
SEXP dummy = Rf_mkChar("") ;
@@ -305,14 +305,14 @@ namespace Rcpp{
305305

306306
template <int RTYPE, template <class> class StoragePolicy>
307307
void Vector_Impl<RTYPE,StoragePolicy>::push_back_name__impl(const stored_type& object, const std::string& name, std::true_type ){
308-
Scoped<SEXP> object_sexp = object ;
308+
Shield<SEXP> object_sexp = object ;
309309
int n = size() ;
310310
Vector_Impl target( n + 1 ) ;
311311
iterator target_it( target.begin() ) ;
312312
iterator it(begin()) ;
313313
iterator this_end(end());
314314
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
315-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
315+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
316316
int i=0;
317317
if( names == R_NilValue ){
318318
SEXP dummy = Rf_mkChar("") ;
@@ -348,7 +348,7 @@ namespace Rcpp{
348348
*target_it = *it ;
349349
}
350350
} else{
351-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1);
351+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1);
352352
int i=1 ;
353353
SET_STRING_ELT( newnames, 0, Rf_mkChar("") ) ;
354354
for( ; it<this_end; ++it, ++target_it, i++){
@@ -362,7 +362,7 @@ namespace Rcpp{
362362

363363
template <int RTYPE, template <class> class StoragePolicy>
364364
void Vector_Impl<RTYPE,StoragePolicy>::push_front__impl(const stored_type& object, std::true_type ){
365-
Scoped<SEXP> object_sexp = object ;
365+
Shield<SEXP> object_sexp = object ;
366366
int n = size() ;
367367
Vector_Impl target( n+1);
368368
iterator target_it(target.begin());
@@ -376,7 +376,7 @@ namespace Rcpp{
376376
*target_it = *it ;
377377
}
378378
} else{
379-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1);
379+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1);
380380
int i=1 ;
381381
SET_STRING_ELT( newnames, 0, Rf_mkChar("") ) ;
382382
for( ; it<this_end; ++it, ++target_it, i++){
@@ -396,14 +396,14 @@ namespace Rcpp{
396396
iterator it(begin()) ;
397397
iterator this_end(end());
398398
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
399-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
399+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
400400
int i=1;
401401
SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
402402
*target_it = object;
403403
++target_it ;
404404

405405
if( names == R_NilValue ){
406-
Scoped<SEXP> dummy = Rf_mkChar("");
406+
Shield<SEXP> dummy = Rf_mkChar("");
407407
for( ; it < this_end; ++it, ++target_it,i++ ){
408408
*target_it = *it ;
409409
SET_STRING_ELT( newnames, i , dummy );
@@ -421,21 +421,21 @@ namespace Rcpp{
421421

422422
template <int RTYPE, template <class> class StoragePolicy>
423423
void Vector_Impl<RTYPE,StoragePolicy>::push_front_name__impl(const stored_type& object, const std::string& name, std::true_type ){
424-
Scoped<SEXP> object_sexp = object ;
424+
Shield<SEXP> object_sexp = object ;
425425
int n = size() ;
426426
Vector_Impl target( n + 1 ) ;
427427
iterator target_it( target.begin() ) ;
428428
iterator it(begin()) ;
429429
iterator this_end(end());
430430
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
431-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
431+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n+1 ) ;
432432
int i=1;
433433
SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
434434
*target_it = object_sexp;
435435
++target_it ;
436436

437437
if( names == R_NilValue ){
438-
Scoped<SEXP> dummy = Rf_mkChar("");
438+
Shield<SEXP> dummy = Rf_mkChar("");
439439
for( ; it < this_end; ++it, ++target_it,i++ ){
440440
*target_it = *it ;
441441
SET_STRING_ELT( newnames, i , dummy );
@@ -473,7 +473,7 @@ namespace Rcpp{
473473
*target_it = *it ;
474474
}
475475
} else{
476-
Scoped<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1 ) ;
476+
Shield<SEXP> newnames = ::Rf_allocVector( STRSXP, n + 1 ) ;
477477
int i=0;
478478
for( ; it < position; ++it, ++target_it, i++){
479479
*target_it = *it ;

inst/include/Rcpp/api/meat/wrap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace Rcpp{
4444
size_t size = std::distance( first, last ) ;
4545
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
4646

47-
Scoped<SEXP> names = Rf_allocVector(STRSXP, size) ;
48-
Scoped<SEXP> x = Rf_allocVector(RTYPE, size) ;
47+
Shield<SEXP> names = Rf_allocVector(STRSXP, size) ;
48+
Shield<SEXP> x = Rf_allocVector(RTYPE, size) ;
4949
STORAGE* ptr = Rcpp::internal::r_vector_start<RTYPE>( x ) ;
5050
Rcpp::String buffer ;
5151
for( size_t i = 0; i < size ; i++, ++first){
@@ -61,8 +61,8 @@ namespace Rcpp{
6161
inline SEXP range_wrap_dispatch___impl__pair( InputIterator first, InputIterator last, std::false_type ){
6262
size_t size = std::distance( first, last ) ;
6363

64-
Scoped<SEXP> names = Rf_allocVector(STRSXP, size) ;
65-
Scoped<SEXP> x = Rf_allocVector(VECSXP, size) ;
64+
Shield<SEXP> names = Rf_allocVector(STRSXP, size) ;
65+
Shield<SEXP> x = Rf_allocVector(VECSXP, size) ;
6666
Rcpp::String buffer ;
6767
for( size_t i = 0; i < size ; i++, ++first){
6868
buffer = first->first ;

inst/include/Rcpp/as.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Rcpp{
3131
template <typename T> T primitive_as( SEXP x ){
3232
if( ::Rf_length(x) != 1 ) throw ::Rcpp::not_compatible( "expecting a single value" ) ;
3333
const int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype ;
34-
Scoped<SEXP> y = r_cast<RTYPE>(x);
34+
Shield<SEXP> y = r_cast<RTYPE>(x);
3535
typedef typename ::Rcpp::traits::storage_type<RTYPE>::type STORAGE;
3636
T res = caster<STORAGE,T>( *r_vector_start<RTYPE>( y ) ) ;
3737
return res ;

inst/include/Rcpp/grow.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
namespace Rcpp {
2626

2727
inline SEXP grow( SEXP head, SEXP tail ){
28-
Scoped<SEXP> x = head ;
29-
Scoped<SEXP> res = Rf_cons( x, tail ) ;
28+
Shield<SEXP> x = head ;
29+
Shield<SEXP> res = Rf_cons( x, tail ) ;
3030
return res ;
3131
}
3232

@@ -39,8 +39,8 @@ namespace Rcpp {
3939

4040
template <typename T>
4141
inline SEXP grow__dispatch( std::true_type, const T& head, SEXP tail ){
42-
Scoped<SEXP> y = wrap( head.object) ;
43-
Scoped<SEXP> x = Rf_cons( y , tail) ;
42+
Shield<SEXP> y = wrap( head.object) ;
43+
Shield<SEXP> x = Rf_cons( y , tail) ;
4444
SEXP headNameSym = ::Rf_install( head.name.c_str() );
4545
SET_TAG( x, headNameSym );
4646
return x;

inst/include/Rcpp/internal/Exporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace Rcpp{
7575
~MatrixExporter(){}
7676

7777
T get() {
78-
Scoped<SEXP> dims = ::Rf_getAttrib( object, R_DimSymbol ) ;
78+
Shield<SEXP> dims = ::Rf_getAttrib( object, R_DimSymbol ) ;
7979
if( dims == R_NilValue || ::Rf_length(dims) != 2 ){
8080
throw ::Rcpp::not_a_matrix() ;
8181
}

0 commit comments

Comments
 (0)