Skip to content

Commit 7fa80f2

Browse files
authored
Support OBJSXP coming in R 4.4.0 (closes #1283) (#1293)
* Support OBJSXP coming in R 4.4.0 (closes #1283) * Refined the OBJSXP return
1 parent 4a8d30f commit 7fa80f2

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2023-12-27 Dirk Eddelbuettel <[email protected]>
2+
3+
* src/api.cpp (type2name): Refine OBJSXP return
4+
5+
2023-12-21 Dirk Eddelbuettel <[email protected]>
6+
7+
* src/api.cpp (type2name): Recognise OBJSXP added in R 4.4.0
8+
19
2023-11-28 Dirk Eddelbuettel <[email protected]>
210

311
* inst/tinytest/testRcppInterfaceExporter/R/RcppExports.R: Regenerated

src/api.cpp

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// api.cpp: Rcpp R/C++ interface class library -- Rcpp api
44
//
55
// 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
77
//
88
// This file is part of Rcpp.
99
//
@@ -89,30 +89,34 @@ namespace Rcpp {
8989
// [[Rcpp::register]]
9090
const char * type2name(SEXP x) { // #nocov start
9191
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";
100100
case SPECIALSXP: return "SPECIALSXP";
101101
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";
114114
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
116120
default:
117121
return "<unknown>";
118122
}

0 commit comments

Comments
 (0)