|
1 | | -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- |
2 | | -// |
| 1 | + |
3 | 2 | // lang.h: Rcpp R/C++ interface class library -- extra lang_* functions |
4 | 3 | // |
5 | | -// Copyright (C) 2011 - 2013 Dirk Eddelbuettel and Romain Francois |
| 4 | +// Copyright (C) 2011 - 2020 Dirk Eddelbuettel and Romain Francois |
6 | 5 | // |
7 | 6 | // This file is part of Rcpp. |
8 | 7 | // |
|
22 | 21 | #ifndef Rcpp__lang_h |
23 | 22 | #define Rcpp__lang_h |
24 | 23 |
|
25 | | -#define Rcpp_list1 Rf_list1 |
26 | 24 | #define Rcpp_lang1 Rf_lang1 |
27 | | -#define Rcpp_list2 Rf_list2 |
28 | 25 | #define Rcpp_lang2 Rf_lang2 |
29 | | -#define Rcpp_list3 Rf_list3 |
30 | 26 | #define Rcpp_lang3 Rf_lang3 |
31 | | -#define Rcpp_list4 Rf_list4 |
32 | 27 | #define Rcpp_lang4 Rf_lang4 |
33 | | -#define Rcpp_list5 Rf_list5 |
34 | 28 | #define Rcpp_lang5 Rf_lang5 |
35 | 29 | #define Rcpp_lang6 Rf_lang6 |
36 | 30 |
|
37 | 31 | #define Rcpp_lcons Rf_lcons |
38 | 32 |
|
39 | 33 | namespace Rcpp { |
40 | 34 |
|
| 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 | + |
41 | 72 | // `Rf_lang6()` is available on R 3.3, but `Rf_list6()` is not |
42 | 73 | inline SEXP Rcpp_list6( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5 ) |
43 | 74 | { |
@@ -330,4 +361,3 @@ inline SEXP Rcpp_lang20( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, S |
330 | 361 | } |
331 | 362 |
|
332 | 363 | #endif |
333 | | - |
|
0 commit comments