Skip to content

Commit 6eac444

Browse files
committed
define Rcpp_list{2,3,4,5} in Rcpp namespace too
1 parent 20e462f commit 6eac444

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

ChangeLog

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
2020-03-18 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/lang.h: Define Rcpp_list{2,3,4,5} in Rcpp namespace
4+
15
2020-03-17 Davis Vaughan <[email protected]>
26

37
* inst/include/Rcpp/lang.h: Inline Rcpp_list6() to support R 3.3.
48

59
2020-03-17 Dirk Eddelbuettel <[email protected]>
610

7-
* DESCRIPTION (Version, Date): Roll minor version
11+
* DESCRIPTION (Version, Date): Roll minor version (twice)
812
* inst/include/Rcpp/config.h: Idem
913

1014
* inst/NEWS.Rd: Updated

inst/include/Rcpp/lang.h

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2-
//
1+
32
// lang.h: Rcpp R/C++ interface class library -- extra lang_* functions
43
//
5-
// Copyright (C) 2011 - 2013 Dirk Eddelbuettel and Romain Francois
4+
// Copyright (C) 2011 - 2020 Dirk Eddelbuettel and Romain Francois
65
//
76
// This file is part of Rcpp.
87
//
@@ -22,22 +21,54 @@
2221
#ifndef Rcpp__lang_h
2322
#define Rcpp__lang_h
2423

25-
#define Rcpp_list1 Rf_list1
2624
#define Rcpp_lang1 Rf_lang1
27-
#define Rcpp_list2 Rf_list2
2825
#define Rcpp_lang2 Rf_lang2
29-
#define Rcpp_list3 Rf_list3
3026
#define Rcpp_lang3 Rf_lang3
31-
#define Rcpp_list4 Rf_list4
3227
#define Rcpp_lang4 Rf_lang4
33-
#define Rcpp_list5 Rf_list5
3428
#define Rcpp_lang5 Rf_lang5
3529
#define Rcpp_lang6 Rf_lang6
3630

3731
#define Rcpp_lcons Rf_lcons
3832

3933
namespace Rcpp {
4034

35+
inline SEXP Rcpp_list1(SEXP x0) {
36+
PROTECT(x0);
37+
x0 = Rf_cons(x0);
38+
UNPROTECT(1);
39+
return x0;
40+
}
41+
42+
inline SEXP Rcpp_list2(SEXP x0, SEXP x1) {
43+
PROTECT(x0);
44+
x0 = Rf_cons(x0, Rcpp_list1(x1));
45+
UNPROTECT(1);
46+
return x0;
47+
}
48+
49+
inline SEXP Rcpp_list3(SEXP x0, SEXP x1, SEXP x2) {
50+
PROTECT(x0);
51+
x0 = Rf_cons(x0, Rcpp_list2(x1, x2));
52+
UNPROTECT(1);
53+
return x0;
54+
}
55+
56+
inline SEXP Rcpp_list4(SEXP x0, SEXP x1, SEXP x2, SEXP x3) {
57+
PROTECT(x0);
58+
x0 = Rf_cons(x0, Rcpp_list3(x1, x2, x3));
59+
UNPROTECT(1);
60+
return x0;
61+
}
62+
63+
inline SEXP Rcpp_list5(SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4) {
64+
PROTECT(x0);
65+
x0 = Rf_cons(x0, Rcpp_list4(x1, x2, x3, x4));
66+
UNPROTECT(1);
67+
return x0;
68+
}
69+
70+
71+
4172
// `Rf_lang6()` is available on R 3.3, but `Rf_list6()` is not
4273
inline SEXP Rcpp_list6( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5 )
4374
{
@@ -330,4 +361,3 @@ inline SEXP Rcpp_lang20( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, S
330361
}
331362

332363
#endif
333-

0 commit comments

Comments
 (0)