|
3 | 3 | // api.cpp: Rcpp R/C++ interface class library -- Rcpp api
|
4 | 4 | //
|
5 | 5 | // Copyright (C) 2012 - 2020 Dirk Eddelbuettel and Romain Francois
|
6 |
| -// Copyright (C) 2021 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar |
| 6 | +// Copyright (C) 2021 - 2023 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar |
7 | 7 | //
|
8 | 8 | // This file is part of Rcpp.
|
9 | 9 | //
|
@@ -89,30 +89,34 @@ namespace Rcpp {
|
89 | 89 | // [[Rcpp::register]]
|
90 | 90 | const char * type2name(SEXP x) { // #nocov start
|
91 | 91 | switch (TYPEOF(x)) {
|
92 |
| - case NILSXP: return "NILSXP"; |
93 |
| - case SYMSXP: return "SYMSXP"; |
94 |
| - case RAWSXP: return "RAWSXP"; |
95 |
| - case LISTSXP: return "LISTSXP"; |
96 |
| - case CLOSXP: return "CLOSXP"; |
97 |
| - case ENVSXP: return "ENVSXP"; |
98 |
| - case PROMSXP: return "PROMSXP"; |
99 |
| - case LANGSXP: return "LANGSXP"; |
| 92 | + case NILSXP: return "NILSXP"; |
| 93 | + case SYMSXP: return "SYMSXP"; |
| 94 | + case RAWSXP: return "RAWSXP"; |
| 95 | + case LISTSXP: return "LISTSXP"; |
| 96 | + case CLOSXP: return "CLOSXP"; |
| 97 | + case ENVSXP: return "ENVSXP"; |
| 98 | + case PROMSXP: return "PROMSXP"; |
| 99 | + case LANGSXP: return "LANGSXP"; |
100 | 100 | case SPECIALSXP: return "SPECIALSXP";
|
101 | 101 | case BUILTINSXP: return "BUILTINSXP";
|
102 |
| - case CHARSXP: return "CHARSXP"; |
103 |
| - case LGLSXP: return "LGLSXP"; |
104 |
| - case INTSXP: return "INTSXP"; |
105 |
| - case REALSXP: return "REALSXP"; |
106 |
| - case CPLXSXP: return "CPLXSXP"; |
107 |
| - case STRSXP: return "STRSXP"; |
108 |
| - case DOTSXP: return "DOTSXP"; |
109 |
| - case ANYSXP: return "ANYSXP"; |
110 |
| - case VECSXP: return "VECSXP"; |
111 |
| - case EXPRSXP: return "EXPRSXP"; |
112 |
| - case BCODESXP: return "BCODESXP"; |
113 |
| - case EXTPTRSXP: return "EXTPTRSXP"; |
| 102 | + case CHARSXP: return "CHARSXP"; |
| 103 | + case LGLSXP: return "LGLSXP"; |
| 104 | + case INTSXP: return "INTSXP"; |
| 105 | + case REALSXP: return "REALSXP"; |
| 106 | + case CPLXSXP: return "CPLXSXP"; |
| 107 | + case STRSXP: return "STRSXP"; |
| 108 | + case DOTSXP: return "DOTSXP"; |
| 109 | + case ANYSXP: return "ANYSXP"; |
| 110 | + case VECSXP: return "VECSXP"; |
| 111 | + case EXPRSXP: return "EXPRSXP"; |
| 112 | + case BCODESXP: return "BCODESXP"; |
| 113 | + case EXTPTRSXP: return "EXTPTRSXP"; |
114 | 114 | case WEAKREFSXP: return "WEAKREFSXP";
|
115 |
| - case S4SXP: return "S4SXP"; |
| 115 | +#if R_Version >= R_Version(4,4,0) // replaces S4SXP in R 4.4.0 |
| 116 | + case OBJSXP: return Rf_isS4(x) ? "S4SXP" : "OBJSXP"; // cf src/main/inspect.c |
| 117 | +#else |
| 118 | + case S4SXP: return "S4SXP"; |
| 119 | +#endif |
116 | 120 | default:
|
117 | 121 | return "<unknown>";
|
118 | 122 | }
|
|
0 commit comments