Skip to content

Commit dad2ad7

Browse files
author
maechler
committed
extSoftVersion() now reports "zstd"`s version when available
git-svn-id: https://svn.r-project.org/R/trunk@88373 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 1efcd85 commit dad2ad7

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

doc/NEWS.Rd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
\item \code{untar(tar = "internal")} supports \code{extras =
5151
"-P"} to use unchanged the recorded file paths (as many external
5252
\command{tar} programs do).
53+
54+
\item \code{extSoftVersion()[["zstd"]]} now reports the version of
55+
the \command{zstd} compression library if available, thanks to
56+
\I{Trevor Davis}' patch proposal in \PR{18914}.
5357
}
5458
}
5559

@@ -151,7 +155,7 @@
151155
152156
\item \code{<Date> \%in\% set} is again as fast as it was
153157
before \R 4.3.0, \emph{via} a new S3 method \code{mtfrm.Date}.
154-
158+
155159
\code{<character> \%in\% <Date>} and vice versa are now
156160
documented to work in concordance with \code{==} and as an exception
157161
to the typical \code{match()} behaviour which relies on

src/library/base/man/extSoftVersion.Rd

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/extSoftVersion.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 2014-2023 R Core Team
3+
% Copyright 2014-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{extSoftVersion}
@@ -30,7 +30,7 @@ extSoftVersion()
3030
\item{libdeflate}{The version of \code{libdeflate} (if any otherwise
3131
\code{""}) used when \R was built.}
3232
\item{PCRE}{The version of \code{PCRE} in use. PCRE1 has versions < 10.00,
33-
PCRE2 has versions >= 10.00.}
33+
PCRE2 has versions >= 10.00.}
3434
\item{ICU}{The version of \code{ICU} in use (if any, otherwise \code{""}).}
3535
\item{TRE}{The version of \code{libtre} in use.}
3636
\item{iconv}{The implementation and version of the \code{iconv}
@@ -42,7 +42,9 @@ extSoftVersion()
4242
seen on macOS.
4343
}
4444
\item{BLAS}{Name of the binary/executable file with the implementation of
45-
\code{BLAS} in use (if known, otherwise \code{""}).}
45+
\code{BLAS} in use (if known, otherwise \code{""}).}
46+
\item{zstd}{The version of \code{zstd} (from \command{zstd}) in use (if
47+
any, otherwise \code{""}).}
4648

4749
Note that the values for \code{bzlib} and \code{pcre} normally contain
4850
a date as well as the version number, and that for \code{tre} includes
@@ -68,16 +70,20 @@ extSoftVersion()
6870
}
6971
\seealso{
7072
\code{\link{libcurlVersion}} for the version of \code{libCurl}.
71-
73+
7274
\code{\link{La_version}} for the version of LAPACK in use.
7375
7476
\code{\link{La_library}} for binary/executable file with LAPACK in use.
7577
7678
\code{\link{grSoftVersion}} for third-party graphics software.
7779
7880
\code{\link{tclVersion}} in package \pkg{tcltk} for the version of Tcl/Tk.
79-
81+
8082
\code{\link{pcre_config}} for PCRE configuration options.
83+
84+
\code{\link{connection}} for how to use the file and connection
85+
compression methods \code{"zlib"}, \code{"bzlib"}, \code{"xz"},
86+
\code{"libdeflate"}, and \code{"zstd"}.
8187
}
8288
\examples{
8389
extSoftVersion()

src/main/platform.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,12 +3644,13 @@ extern void *dlsym(void *handle, const char *symbol);
36443644
without loading any modules; libraries available via modules are
36453645
treated individually (libcurlVersion(), La_version(), etc)
36463646
*/
3647+
#define nr_softVersion 11
36473648
attribute_hidden SEXP
36483649
do_eSoftVersion(SEXP call, SEXP op, SEXP args, SEXP rho)
36493650
{
36503651
checkArity(op, args);
3651-
SEXP ans = PROTECT(allocVector(STRSXP, 10));
3652-
SEXP nms = PROTECT(allocVector(STRSXP, 10));
3652+
SEXP ans = PROTECT(allocVector(STRSXP, nr_softVersion));
3653+
SEXP nms = PROTECT(allocVector(STRSXP, nr_softVersion));
36533654
setAttrib(ans, R_NamesSymbol, nms);
36543655
unsigned int i = 0;
36553656
char p[256];
@@ -3669,6 +3670,15 @@ do_eSoftVersion(SEXP call, SEXP op, SEXP args, SEXP rho)
36693670
SET_STRING_ELT(ans, i, mkChar(""));
36703671
#endif
36713672
SET_STRING_ELT(nms, i++, mkChar("libdeflate"));
3673+
3674+
#ifdef HAVE_ZSTD
3675+
#include <zstd.h>
3676+
SET_STRING_ELT(ans, i, mkChar(ZSTD_versionString()));
3677+
#else
3678+
SET_STRING_ELT(ans, i, mkChar(""));
3679+
#endif
3680+
SET_STRING_ELT(nms, i++, mkChar("zstd"));
3681+
36723682
#ifdef HAVE_PCRE2
36733683
pcre2_config(PCRE2_CONFIG_VERSION, p);
36743684
#else

0 commit comments

Comments
 (0)