From 9fe70827d57e23d61a11363ef5522104314654db Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sun, 24 Dec 2023 08:45:26 -0600 Subject: [PATCH] Support OBJSXP coming in R 4.4.0 (closes #1283) --- ChangeLog | 4 ++++ src/api.cpp | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d7cc8bde..e43f1b22b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2023-12-21 Dirk Eddelbuettel + + * src/api.cpp (type2name): Recognise OBJSXP added in R 4.4.0 + 2023-11-28 Dirk Eddelbuettel * inst/tinytest/testRcppInterfaceExporter/R/RcppExports.R: Regenerated diff --git a/src/api.cpp b/src/api.cpp index a775615c9..29892e8d4 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -3,7 +3,7 @@ // api.cpp: Rcpp R/C++ interface class library -- Rcpp api // // Copyright (C) 2012 - 2020 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2021 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar +// Copyright (C) 2021 - 2023 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar // // This file is part of Rcpp. // @@ -89,30 +89,33 @@ namespace Rcpp { // [[Rcpp::register]] const char * type2name(SEXP x) { // #nocov start switch (TYPEOF(x)) { - case NILSXP: return "NILSXP"; - case SYMSXP: return "SYMSXP"; - case RAWSXP: return "RAWSXP"; - case LISTSXP: return "LISTSXP"; - case CLOSXP: return "CLOSXP"; - case ENVSXP: return "ENVSXP"; - case PROMSXP: return "PROMSXP"; - case LANGSXP: return "LANGSXP"; + case NILSXP: return "NILSXP"; + case SYMSXP: return "SYMSXP"; + case RAWSXP: return "RAWSXP"; + case LISTSXP: return "LISTSXP"; + case CLOSXP: return "CLOSXP"; + case ENVSXP: return "ENVSXP"; + case PROMSXP: return "PROMSXP"; + case LANGSXP: return "LANGSXP"; case SPECIALSXP: return "SPECIALSXP"; case BUILTINSXP: return "BUILTINSXP"; - case CHARSXP: return "CHARSXP"; - case LGLSXP: return "LGLSXP"; - case INTSXP: return "INTSXP"; - case REALSXP: return "REALSXP"; - case CPLXSXP: return "CPLXSXP"; - case STRSXP: return "STRSXP"; - case DOTSXP: return "DOTSXP"; - case ANYSXP: return "ANYSXP"; - case VECSXP: return "VECSXP"; - case EXPRSXP: return "EXPRSXP"; - case BCODESXP: return "BCODESXP"; - case EXTPTRSXP: return "EXTPTRSXP"; + case CHARSXP: return "CHARSXP"; + case LGLSXP: return "LGLSXP"; + case INTSXP: return "INTSXP"; + case REALSXP: return "REALSXP"; + case CPLXSXP: return "CPLXSXP"; + case STRSXP: return "STRSXP"; + case DOTSXP: return "DOTSXP"; + case ANYSXP: return "ANYSXP"; + case VECSXP: return "VECSXP"; + case EXPRSXP: return "EXPRSXP"; + case BCODESXP: return "BCODESXP"; + case EXTPTRSXP: return "EXTPTRSXP"; case WEAKREFSXP: return "WEAKREFSXP"; - case S4SXP: return "S4SXP"; +#if R_Version >= R_Version(4,4,0) + case OBJSXP: return "OBJSXP"; // replaces S4SXP in R 4.4.0 +#endif + case S4SXP: return "S4SXP"; default: return ""; }