Skip to content

Commit 9c68536

Browse files
authored
Merge branch 'main' into issue/17350
2 parents fa7b99b + 489066b commit 9c68536

File tree

4 files changed

+75
-15
lines changed

4 files changed

+75
-15
lines changed

doc/NEWS.Rd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@
187187
embedded API entry points in the rendered versions. This is very
188188
preliminary and may be dropped if a better approach emerges.
189189

190+
Also now for Fortran-callable entry points which are part of the API.
191+
190192
\item \code{SET_TYPEOF} now signals an error unless the old and
191193
new types have compatible memory structure and content. Use of
192194
\code{SET_TYPE} in package C code should be avoided and may be
@@ -270,18 +272,15 @@
270272
variable\env{_R_CXX_USE_NO_REMAP_} to a false value (but that will
271273
be removed in the near future).
272274

273-
%% \item \command{R CMD check --as-cran} will compile C++ code with
274-
%% \code{-DR_NO_REMAP}.
275+
`Writing R Extensions' has been revised to describe the remapped
276+
entry points, for with the \code{Rf_} prefix remains optional when
277+
used from C code (but is recommended for new C code).
275278
276279
\item \command{R CMD check --as-cran} notes bad parts in the
277280
\file{DESCRIPTION} file's URL fields.
278281

279-
%% \item Installation will define \code{STRICT_R_HEADERS} if
280-
%% environment variable \env{_R_USE_STRICT_R_HEADERS_} is set to a
281-
%% true value: this is done by \command{R CMD check --as-cran}.
282-
283282
\item \command{R CMD check} now reports more warnings on
284-
long-deprecated/obsolete Fortran features from
283+
long-deprecated/obsolete Fortran features reported by
285284
\command{gfortran -Wall}. For hints on how to modernize these,
286285
see
287286
\url{https://fortranwiki.org/fortran/show/Modernizing+Old+Fortran}.

src/library/base/man/strptime.Rd

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ strptime(x, format, tz = "")
3939
methods is
4040
\code{"\%Y-\%m-\%d \%H:\%M:\%S"} if any element has a time
4141
component which is not midnight, and \code{"\%Y-\%m-\%d"}
42-
otherwise. If \code{\link{options}("digits.secs")} is set,
42+
otherwise. If \code{digits} is not \code{NULL}, i.e., by default when
43+
\code{\link{options}("digits.secs")} is set, up to
4344
the specified number of digits will be printed for seconds.}
4445
\item{\dots}{further arguments to be passed from or to other methods.}
4546
\item{usetz}{logical. Should the time zone abbreviation be appended
@@ -235,11 +236,10 @@ strptime(x, format, tz = "")
235236
236237
Specific to \R is \code{\%OSn}, which for output gives the seconds
237238
truncated to \code{0 <= n <= 6} decimal places (and if \code{\%OS} is
238-
not followed by a digit, it uses the setting of
239-
\code{\link{getOption}("digits.secs")}, or if that is unset, \code{n =
240-
0}). Further, for \code{strptime} \code{\%OS} will input seconds
241-
including fractional seconds. Note that \code{\%S} does not read
242-
fractional parts on output.
239+
not followed by a digit, it uses \code{digits} unless that is
240+
\code{NULL}, when \code{n = 0}). Further, for \code{strptime}
241+
\code{\%OS} will input seconds including fractional seconds. Note that
242+
\code{\%S} does not read fractional parts on output.
243243
244244
The behaviour of other conversion specifications (and even if other
245245
character sequences commencing with \code{\%} \emph{are} conversion
@@ -307,7 +307,7 @@ strptime(x, format, tz = "")
307307
year. (On some platforms this works better after conversion to
308308
\code{"POSIXct"}. Some platforms only recognize hour or half-hour
309309
offsets for output.)%% strftime in macOS 13.
310-
310+
311311
Using \code{\%z} for input makes most sense with \code{tz = "UTC"}.
312312
}
313313
@@ -426,7 +426,8 @@ stopifnot(identical(format(z2), as.character(z2)))
426426
427427
## time with fractional seconds
428428
z3 <- strptime("20/2/06 11:16:16.683", "\%d/\%m/\%y \%H:\%M:\%OS") \donttest{
429-
z3 # prints without fractional seconds by default, digits.sec = NULL ("= 0")}
429+
z3 # prints without fractional seconds by default, digits.sec = NULL ("= 0")
430+
print(z3, digits = 3) # shows extra digits}
430431
op <- options(digits.secs = 3)
431432
\donttest{z3 # shows the 3 extra digits}
432433
as.character(z3) # ditto

src/library/tools/R/check.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,19 @@ add_dummies <- function(dir, Log)
11941194
}
11951195
}
11961196

1197+
if(!is.na(lang <- db["Language"])) {
1198+
s <- unlist(strsplit(lang, ", *"), use.names = FALSE)
1199+
s <- s[!grepl(re_anchor(.make_RFC4646_langtag_regexp()), s)]
1200+
if(length(s)) {
1201+
if(!any) noteLog(Log)
1202+
any <- TRUE
1203+
printLog(Log,
1204+
paste(c("Language field contains the following invalid language tags:",
1205+
paste0(" ", s)),
1206+
collapse = "\n"),
1207+
"\n")
1208+
}
1209+
}
11971210

11981211
out <- format(.check_package_description2(dfile))
11991212
if (length(out)) {

src/library/tools/R/utils.R

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,53 @@ function(parent = parent.frame())
18421842
}
18431843
})
18441844

1845+
### ** .make_RFC4646_langtag_regexp
1846+
1847+
.make_RFC4646_langtag_regexp <-
1848+
function()
1849+
{
1850+
## See <https://www.ietf.org/rfc/rfc4646.html>.
1851+
## Language tags can be of the form (in ABNF, see
1852+
## <https://tools.ietf.org/rfc/rfc4234.txt>):
1853+
## langtag / privateuse / grandfathered
1854+
## where
1855+
## privateuse = ("x"/"X") 1*("-" (1*8alphanum))
1856+
## grandfathered = 1*3ALPHA 1*2("-" (2*8alphanum))
1857+
## We only allow langtag, for which in turn we have
1858+
## (language
1859+
## ["-" script]
1860+
## ["-" region]
1861+
## *(["-" variant])
1862+
## *(["-" extension])
1863+
## ["-" privateuse]
1864+
## where
1865+
## language = (2*3ALPHA [-extlang]) ; shortest ISO 639 code
1866+
## / 4ALPHA ; reserved for future use
1867+
## / 5*8ALPHA ; registered language subtag
1868+
## extlang = *3("-" 3*ALPHA) ; reserved for future use
1869+
## script = 4ALPHA ; ISO 15924 code
1870+
## region = 2ALPHA ; ISO 3166 code
1871+
## / 3DIGIT ; UN M.49 code
1872+
## variant = 5*8alphanum ; registered variants
1873+
## / (DIGIT 3alphanum)
1874+
## extension = singleton 1*("-" (2*8alphanum))
1875+
## singleton = %x41-57 / %x59-5A / %x61-77 / %x79-7A / DIGIT
1876+
## ; "a"-"w" / "y"-"z" / "A"-"W" / "Y"-"Z" / "0"-"9"
1877+
## alphanum = (ALPHA / DIGIT) ; letters and numbers
1878+
1879+
re_extlang <- "[[:alpha:]]{3}"
1880+
re_language <-
1881+
sprintf("[[:alpha:]]{2,3}(-%s){0,3}|[[:alpha:]]{4,8}", re_extlang)
1882+
re_script <- "[[:alpha:]]{4}"
1883+
re_region <- "[[:alpha:]]{2}|[[:digit:]]{3}"
1884+
re_variant <- "[[:alnum:]]{5,8}|[[:digit:]][[:alnum:]]{3}"
1885+
re_singleton <- "[abcdefghijklmnopqrstuvwyzABCDEFGHIJKLMNOPQRSTUVWYZ0123456789]"
1886+
re_extension <- sprintf("(%s)(-[[:alnum:]]{2,8}){1,}", re_singleton)
1887+
1888+
sprintf("(%s)((-%s)?)((-%s)?)((-%s)*)((-%s)*)",
1889+
re_language, re_script, re_region, re_variant, re_extension)
1890+
}
1891+
18451892
### ** nonS3methods [was .make_S3_methods_stop_list ]
18461893

18471894
nonS3methods <- function(package)

0 commit comments

Comments
 (0)