diff --git a/NEWS.md b/NEWS.md index 42bf0164f0..fe872d718c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,10 @@ 1. Custom binary operators from the `lubridate` package now work with objects of class `IDate` as with a `Date` subclass, [#6839](https://github.com/Rdatatable/data.table/issues/6839). Thanks @emallickhossain for the report and @aitap for the fix. +## NOTES + +1. Continued work to remove non-API C functions, [#6180](https://github.com/Rdatatable/data.table/issues/6180). Thanks Ivan Krylov for the PRs and for writing a clear and concise guide about the R API: https://aitap.codeberg.page/R-api/. + # data.table [v1.17.0](https://github.com/Rdatatable/data.table/milestone/34) (20 Feb 2025) ## POTENTIALLY BREAKING CHANGES diff --git a/src/data.table.h b/src/data.table.h index fd066c3b1d..af72145ae8 100644 --- a/src/data.table.h +++ b/src/data.table.h @@ -42,7 +42,12 @@ /* we mean the encoding bits, not CE_NATIVE in a UTF-8 locale */ #define IS_UTF8(x) (getCharCE(x) == CE_UTF8) #define IS_LATIN(x) (getCharCE(x) == CE_LATIN1) -#define IS_ASCII(x) (LEVELS(x) & 64) // API expected in R >= 4.5 +// TODO: remove the `R_SVN_VERSION` check when R 4.5.0 is released (circa Apr. 2025) +#if R_VERSION < R_Version(4, 5, 0) || R_SVN_REVISION < 86789 +# define IS_ASCII(x) (LEVELS(x) & 64) +#else +# define IS_ASCII(x) (Rf_charIsASCII(x)) // no CE_ASCII +#endif #define IS_TRUE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]==TRUE) #define IS_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]==FALSE) #define IS_TRUE_OR_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]!=NA_LOGICAL)