From nobody Wed Jan 10 16:38:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T9D4n06Cvz57K7G; Wed, 10 Jan 2024 16:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T9D4m5tKBz58lB; Wed, 10 Jan 2024 16:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704904696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YuK4fVUqyFu26HN2o8ml+2eC7cW7vN/6lwZ1MSdBZq8=; b=O6h69LLuWuvWJ8Lw/5nEKsP55wclMf76PLuVbXD7WZoIrzeOYyGOS/iQaaZgi2zOlELt+6 Y8O5mqNSN2X1SaAZbzbn2/SAglZ4I+Xtx66SXi8ejFd9ng3MOS3cYgY/ZnmzzQXEh1tmm3 PcW3qXKFAJG+HDBAnPU4t4nWK8P+0tbaeOcPh3Znxkn1CcsdAjEGIlByI7mqYqtvz8FxE/ Zsbb4f9ipcXSEWx3pkvnb/1xSfgsIZPfa5o8awgDplqym7rUFfRs1iz/p85oGd2ssyTExi 9WBqDw6Q4k362kddt/oPTNqycGHgjzYYOHBraDSo3wJj/eRGCx+nP5AFgJAadA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704904696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YuK4fVUqyFu26HN2o8ml+2eC7cW7vN/6lwZ1MSdBZq8=; b=syZZqwLLdHE1kFTrTwpXNjgXg9Y7MCquSvXD8/LvGCgcFeBcTlDKTrJZTjtNssiHJNeSCZ Mg6QAEyBUpBzu8W/Rh4rS/mVNyp2assftvn475+q4urCKiG2Fpv4tG+X1w4iJQCAPJbJ70 SD80x7EpGzx5l+9o+16N2a/tsF+LyMwwLd0l/AugHoljLsCxo/9HbCvw4W8WFWoNA2vRpo 0U4STK5qAeNGs42LFX/Fy4CTwTPGHTjv8M2XJGSE73+zBtl0CLwgS5GTiMfOLzwVodl09t oQOHWXg+kyR4VXvunV/y57A2ThBjUDQT2jByvbGCygfTG39nhc781rJsGPnyDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704904696; a=rsa-sha256; cv=none; b=OoSuSPaH+6CbQMUBHGrN1WO1U82Vj7JpLeAhIx7UGmLPGbNJqtor72EIjuZPZ5gMN/pDsv HKDHEiW9o4BQKBW95L5ZnLSnuzgHzOz7sflxR+BUbe2Fp2cyIViJyCpcQ2f6lhv3Auu//P 4FiOM4rGXV6VIokjAhxamY+rXFoVW9jrAkDhSk+/uBhMj2Rd0dl9Ukffcx0UmvVXF2cJ7C 1n1+G0J4V3sR0qT6S7CDAqQrw/LWFSUl1UNZNu6lqwU5J9YsFTJh4/wB+sNVOWrl7coJ9k BJIMhYvc4Ek27VtUj7ITNdTXrxJL7c5FUYygBHAROuFCnEyjNElgywjjnrQZHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T9D4m4pjdzjp1; Wed, 10 Jan 2024 16:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40AGcGqp069271; Wed, 10 Jan 2024 16:38:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40AGcGGc069268; Wed, 10 Jan 2024 16:38:16 GMT (envelope-from git) Date: Wed, 10 Jan 2024 16:38:16 GMT Message-Id: <202401101638.40AGcGGc069268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: e6857bd4d7b4 - main - vendor/bc: upgrade to version 6.7.4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6857bd4d7b4bf39ea32b9dcd34f8371164c356e Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=e6857bd4d7b4bf39ea32b9dcd34f8371164c356e commit e6857bd4d7b4bf39ea32b9dcd34f8371164c356e Author: Stefan Eßer AuthorDate: 2024-01-02 13:05:20 +0000 Commit: Stefan Eßer CommitDate: 2024-01-10 16:35:14 +0000 vendor/bc: upgrade to version 6.7.4 Documentation updates only, no functional changes to the software. (cherry picked from commit a3f3a7b4dc80d577e4c8fc64dfbbb359d2e24228) --- contrib/bc/NEWS.md | 14 ++++- contrib/bc/configure.sh | 18 +++--- contrib/bc/include/version.h | 2 +- contrib/bc/manuals/bc/A.1 | 139 ++++++++++++------------------------------ contrib/bc/manuals/bc/A.1.md | 20 +++--- contrib/bc/manuals/bc/E.1 | 112 +++++++++------------------------- contrib/bc/manuals/bc/EH.1 | 110 +++++++++------------------------ contrib/bc/manuals/bc/EHN.1 | 109 +++++++++------------------------ contrib/bc/manuals/bc/EN.1 | 111 +++++++++------------------------ contrib/bc/manuals/bc/H.1 | 137 ++++++++++++----------------------------- contrib/bc/manuals/bc/H.1.md | 20 +++--- contrib/bc/manuals/bc/HN.1 | 136 ++++++++++++----------------------------- contrib/bc/manuals/bc/HN.1.md | 20 +++--- contrib/bc/manuals/bc/N.1 | 138 ++++++++++++----------------------------- contrib/bc/manuals/bc/N.1.md | 20 +++--- contrib/bc/manuals/bcl.3 | 43 +++---------- contrib/bc/manuals/dc/A.1 | 49 ++------------- contrib/bc/manuals/dc/E.1 | 48 ++------------- contrib/bc/manuals/dc/EH.1 | 46 ++------------ contrib/bc/manuals/dc/EHN.1 | 45 ++------------ contrib/bc/manuals/dc/EN.1 | 47 ++------------ contrib/bc/manuals/dc/H.1 | 47 ++------------ contrib/bc/manuals/dc/HN.1 | 46 ++------------ contrib/bc/manuals/dc/N.1 | 48 ++------------- 24 files changed, 392 insertions(+), 1133 deletions(-) diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index d4b160d74d35..240e02f11388 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,17 @@ # News +## 6.7.4 + +This is a production release to fix problems in the `bc` manual. + +Users only need to update if desired. + +## 6.7.3 + +This is a production release to fix the library build on Mac OSX. + +Users on other platforms do *not* need to update. + ## 6.7.2 This is a production release to remove some debugging code that I accidentally @@ -773,7 +785,7 @@ function, `strdup()`, which is not in POSIX 2001, and it is in the X/Open System Interfaces group 2001. It is, however, in POSIX 2008, and since POSIX 2008 is old enough to be supported anywhere that I care, that should be the requirement. -Second, the BcVm global variable was put into `bss`. This actually slightly +Second, the `BcVm` global variable was put into `bss`. This actually slightly reduces the size of the executable from a massive code shrink, and it will stop `bc` from allocating a large set of memory when `bc` starts. diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index 35d55058f8f1..9292f094bb17 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -461,7 +461,7 @@ find_src_files() { fi - _find_src_files_files=$(find "$scriptdir/src/" -depth -name "*.c" -print | LC_ALL=C sort) + _find_src_files_files=$(find "$scriptdir/src" -depth -name "*.c" -print | LC_ALL=C sort) _find_src_files_result="" @@ -772,7 +772,7 @@ predefined_build() { dc_default_digit_clamp=0;; GDH) - CFLAGS="-flto -Weverything -Wno-padded -Wno-unsafe-buffer-usage -Werror -pedantic -std=c11" + CFLAGS="-flto -Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories -Werror -pedantic -std=c11" bc_only=0 dc_only=0 coverage=0 @@ -806,7 +806,7 @@ predefined_build() { dc_default_digit_clamp=1;; DBG) - CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Werror -pedantic -std=c11" + CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories -Werror -pedantic -std=c11" bc_only=0 dc_only=0 coverage=0 @@ -1367,12 +1367,7 @@ if [ "$debug" -eq 1 ]; then CFLAGS="-g $CFLAGS" else - CPPFLAGS="-DNDEBUG $CPPFLAGS" - - if [ "$strip_bin" -ne 0 ]; then - LDFLAGS="-s $LDFLAGS" - fi fi # Set optimization CFLAGS. @@ -1694,6 +1689,11 @@ else apple="" fi +# We can't use the linker's strip flag on Mac OSX. +if [ "$debug" -eq 0 ] && [ "$apple" == "" ] && [ "$strip_bin" -ne 0 ]; then + LDFLAGS="-s $LDFLAGS" +fi + # Test OpenBSD. This is not in an if statement because regardless of whatever # the user says, we need to know if we are on OpenBSD to activate _BSD_SOURCE. # No, I cannot `#define _BSD_SOURCE` in a header because OpenBSD's patched GCC @@ -1866,6 +1866,8 @@ dc_tests=$(gen_std_test_targets dc) dc_script_tests=$(gen_script_test_targets dc) dc_err_tests=$(gen_err_test_targets dc) +printf 'unneeded: %s\n' "$unneeded" + # Print out the values; this is for debugging. printf 'Version: %s\n' "$version" diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h index 1cd13e9878c1..d481cb10abf1 100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h @@ -37,6 +37,6 @@ #define BC_VERSION_H /// The current version. -#define VERSION 6.7.2 +#define VERSION 6.7.4 #endif // BC_VERSION_H diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1 index fc75b5c70ac3..1810beaf9291 100644 --- a/contrib/bc/manuals/bc/A.1 +++ b/contrib/bc/manuals/bc/A.1 @@ -25,14 +25,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual" .nh .ad l .SH NAME -.PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS -.PP \f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]] [\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]] [\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] @@ -48,7 +46,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator [\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]] .SH DESCRIPTION -.PP bc(1) is an interactive processor for a language first standardized in 1991 by POSIX. (See the \f[B]STANDARDS\f[R] section.) @@ -77,7 +74,6 @@ If parsing scripts meant for other bc(1) implementations still does not work, that is a bug and should be reported. See the \f[B]BUGS\f[R] section. .SH OPTIONS -.PP The following are the options that bc(1) accepts. .TP \f[B]-C\f[R], \f[B]--no-digit-clamp\f[R] @@ -189,19 +185,16 @@ without worrying that the change will affect other functions. Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this: .IP -.nf -\f[C] +.EX define void output(x, b) { obase=b x } -\f[R] -.fi +.EE .PP instead of like this: .IP -.nf -\f[C] +.EX define void output(x, b) { auto c c=obase @@ -209,8 +202,7 @@ define void output(x, b) { x obase=c } -\f[R] -.fi +.EE .PP This makes writing functions much easier. .PP @@ -228,12 +220,10 @@ converter, it is possible to replace that capability with various shell aliases. Examples: .IP -.nf -\f[C] +.EX alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq] alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq] -\f[R] -.fi +.EE .PP Second, if the purpose of a function is to set \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any @@ -251,11 +241,9 @@ If a function desires to not affect the sequence of pseudo-random numbers of its parents, but wants to use the same \f[B]seed\f[R], it can use the following line: .IP -.nf -\f[C] +.EX seed = seed -\f[R] -.fi +.EE .PP If the behavior of this option is desired for every run of bc(1), then users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this @@ -485,7 +473,6 @@ This is a \f[B]non-portable extension\f[R]. .PP All long options are \f[B]non-portable extensions\f[R]. .SH STDIN -.PP If no files or expressions are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then bc(1) reads from \f[B]stdin\f[R]. @@ -502,7 +489,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an \f[B]else\f[R] statement will follow, so it will not execute until it knows there will not be an \f[B]else\f[R] statement. .SH STDOUT -.PP Any non-error output is written to \f[B]stdout\f[R]. In addition, if history (see the \f[B]HISTORY\f[R] section) and the prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output @@ -511,7 +497,7 @@ to \f[B]stdout\f[R]. \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in -\f[B]bc >&-\f[R], it will quit with an error. +\f[B]bc >&-\f[R], it will quit with an error. This is done so that bc(1) can report problems when \f[B]stdout\f[R] is redirected to a file. .PP @@ -519,13 +505,12 @@ If there are scripts that depend on the behavior of other bc(1) implementations, it is recommended that those scripts be changed to redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R]. .SH STDERR -.PP Any error output is written to \f[B]stderr\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in -\f[B]bc 2>&-\f[R], it will quit with an error. +\f[B]bc 2>&-\f[R], it will quit with an error. This is done so that bc(1) can exit with an error code when \f[B]stderr\f[R] is redirected to a file. .PP @@ -533,7 +518,6 @@ If there are scripts that depend on the behavior of other bc(1) implementations, it is recommended that those scripts be changed to redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R]. .SH SYNTAX -.PP The syntax for bc(1) programs is mostly C-like, with some differences. This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R] section), which is a much more thorough resource for the language this @@ -618,7 +602,6 @@ These are \f[B]non-portable extensions\f[R]. .PP Either semicolons or newlines may separate statements. .SS Comments -.PP There are two kinds of comments: .IP "1." 3 Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R]. @@ -627,7 +610,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next newline. This is a \f[B]non-portable extension\f[R]. .SS Named Expressions -.PP The following are named expressions in bc(1): .IP "1." 3 Variables: \f[B]I\f[R] @@ -684,7 +666,6 @@ Named expressions are required as the operand of of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R] subsection). .SS Operands -.PP The following are valid operands in bc(1): .IP " 1." 4 Numbers (see the \f[I]Numbers\f[R] subsection below). @@ -829,7 +810,6 @@ where a reproducible stream of pseudo-random numbers is \f[I]ESSENTIAL\f[R]. In any other case, use a non-seeded pseudo-random number generator. .SS Numbers -.PP Numbers are strings made up of digits, uppercase letters, and at most \f[B]1\f[R] period for a radix. Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits. @@ -901,7 +881,6 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be Accepting input as scientific notation is a \f[B]non-portable extension\f[R]. .SS Operators -.PP The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. @@ -1018,9 +997,9 @@ The operators will be described in more detail below. .TP \f[B]++\f[R] \f[B]--\f[R] The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R] -operators behave exactly like they would in C. -They require a named expression (see the \f[I]Named Expressions\f[R] -subsection) as an operand. +operators behave exactly like they would in C. They require a named +expression (see the \f[I]Named Expressions\f[R] subsection) as an +operand. .RS .PP The prefix versions of these operators are more efficient; use them @@ -1192,7 +1171,6 @@ This is \f[I]not\f[R] a short-circuit operator. This is a \f[B]non-portable extension\f[R]. .RE .SS Statements -.PP The following items are statements: .IP " 1." 4 \f[B]E\f[R] @@ -1270,11 +1248,9 @@ occur before the \f[B]quit\f[R] statement before exiting. .PP In other words, for the bc(1) code below: .IP -.nf -\f[C] +.EX for (i = 0; i < 3; ++i) i; quit -\f[R] -.fi +.EE .PP Other bc(1) implementations will print nothing, and this bc(1) will print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines @@ -1305,7 +1281,6 @@ run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options Printing numbers in scientific notation and/or engineering notation is a \f[B]non-portable extension\f[R]. .SS Strings -.PP If strings appear as a statement by themselves, they are printed without a trailing newline. .PP @@ -1324,7 +1299,6 @@ resets (see the \f[B]RESET\f[R] section). Assigning strings to variables and array elements and passing them to functions are \f[B]non-portable extensions\f[R]. .SS Print Statement -.PP The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be strings. If they are, there are backslash escape sequences that are interpreted @@ -1356,7 +1330,6 @@ character to be printed as-is. Any non-string expression in a print statement shall be assigned to \f[B]last\f[R], like any other expression that is printed. .SS Stream Statement -.PP The expressions in a \f[B]stream\f[R] statement may also be strings. .PP If a \f[B]stream\f[R] statement is given a string, it prints the string @@ -1370,17 +1343,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R] and each digit is interpreted as an 8-bit ASCII character, making it a byte stream. .SS Order of Evaluation -.PP All expressions in a statment are evaluated left to right, except as necessary to maintain order of operations. This means, for example, assuming that \f[B]i\f[R] is equal to \f[B]0\f[R], in the expression .IP -.nf -\f[C] +.EX a[i++] = i++ -\f[R] -.fi +.EE .PP the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and \f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression. @@ -1389,28 +1359,23 @@ This includes function arguments. Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in the expression .IP -.nf -\f[C] +.EX x(i++, i++) -\f[R] -.fi +.EE .PP the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to \f[B]2\f[R] before the function starts executing. .SH FUNCTIONS -.PP Function definitions are as follows: .IP -.nf -\f[C] +.EX define I(I,...,I){ auto I,...,I S;...;S return(E) } -\f[R] -.fi +.EE .PP Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an @@ -1438,18 +1403,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection below). .SS Void Functions -.PP Functions can also be \f[B]void\f[R] functions, defined as follows: .IP -.nf -\f[C] +.EX define void I(I,...,I){ auto I,...,I S;...;S return } -\f[R] -.fi +.EE .PP They can only be used as standalone expressions, where such an expression would be printed alone, except in a print statement. @@ -1465,15 +1427,12 @@ The word \[lq]void\[rq] is only treated specially right after the .PP This is a \f[B]non-portable extension\f[R]. .SS Array References -.PP For any array in the parameter list, if the array is declared in the form .IP -.nf -\f[C] +.EX *I[] -\f[R] -.fi +.EE .PP it is a \f[B]reference\f[R]. Any changes to the array in the function are reflected, when the @@ -1483,7 +1442,6 @@ Other than this, all function arguments are passed by value. .PP This is a \f[B]non-portable extension\f[R]. .SH LIBRARY -.PP All of the functions below, including the functions in the extended math library (see the \f[I]Extended Library\f[R] subsection below), are available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line @@ -1491,7 +1449,6 @@ flags are given, except that the extended math library is not available when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents are given. .SS Standard Library -.PP The standard (see the \f[B]STANDARDS\f[R] section) defines the following functions for the math library: .TP @@ -1544,7 +1501,6 @@ This is a transcendental function (see the \f[I]Transcendental Functions\f[R] subsection below). .RE .SS Extended Library -.PP The extended library is \f[I]not\f[R] loaded when the \f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R] options are given since they are not part of the library defined by the @@ -1866,7 +1822,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]bnot8(x)\f[R] Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as -though it has \f[B]8\f[R] binary digits (1 unsigned byte). +though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1875,7 +1831,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]bnot16(x)\f[R] Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as -though it has \f[B]16\f[R] binary digits (2 unsigned bytes). +though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1884,7 +1840,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]bnot32(x)\f[R] Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as -though it has \f[B]32\f[R] binary digits (4 unsigned bytes). +though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1893,7 +1849,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]bnot64(x)\f[R] Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as -though it has \f[B]64\f[R] binary digits (8 unsigned bytes). +though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1921,7 +1877,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brev8(x)\f[R] Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as -though it has 8 binary digits (1 unsigned byte). +though it has 8 binary digits (\f[B]1\f[R] unsigned byte). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1930,7 +1886,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brev16(x)\f[R] Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as -though it has 16 binary digits (2 unsigned bytes). +though it has 16 binary digits (\f[B]2\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1939,7 +1895,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brev32(x)\f[R] Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as -though it has 32 binary digits (4 unsigned bytes). +though it has 32 binary digits (\f[B]4\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -1948,7 +1904,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brev64(x)\f[R] Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as -though it has 64 binary digits (8 unsigned bytes). +though it has 64 binary digits (\f[B]8\f[R] unsigned bytes). .RS .PP If you want to a use signed two\[cq]s complement argument, use @@ -2001,7 +1957,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brol32(x, p)\f[R] Does a left bitwise rotatation of the truncated absolute value of -\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R] +\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes), by the number of places equal to the truncated absolute value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R]. .RS @@ -2012,7 +1968,7 @@ If you want to a use signed two\[cq]s complement argument, use .TP \f[B]brol64(x, p)\f[R] Does a left bitwise rotatation of the truncated absolute value of -\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R] +\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes), by the number of places equal to the truncated absolute value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R]. .RS @@ -2457,7 +2413,6 @@ This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection of the \f[B]FUNCTIONS\f[R] section). .RE .SS Transcendental Functions -.PP All transcendental functions can return slightly inaccurate results, up to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and the article at @@ -2513,7 +2468,6 @@ The transcendental functions in the extended math library are: .IP \[bu] 2 \f[B]d2r(x)\f[R] .SH RESET -.PP When bc(1) encounters an error or a signal that it has a non-default handler for, it resets. This means that several things happen. @@ -2534,7 +2488,6 @@ Note that this reset behavior is different from the GNU bc(1), which attempts to start executing the statement right after the one that caused an error. .SH PERFORMANCE -.PP Most bc(1) implementations use \f[B]char\f[R] types to calculate the value of \f[B]1\f[R] decimal digit at a time, but that can be slow. This bc(1) does something different. @@ -2557,7 +2510,6 @@ checking. This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is always at least twice as large as the integer type used to store digits. .SH LIMITS -.PP The following are the limits on bc(1): .TP \f[B]BC_LONG_BIT\f[R] @@ -2626,7 +2578,6 @@ large (at least on 64-bit machines) that there should not be any point at which they become a problem. In fact, memory should be exhausted before these limits should be hit. .SH ENVIRONMENT VARIABLES -.PP As \f[B]non-portable extensions\f[R], bc(1) recognizes the following environment variables: .TP @@ -2765,7 +2716,6 @@ This environment variable overrides the default, which can be queried with the \f[B]-h\f[R] or \f[B]--help\f[R] options. .RE .SH EXIT STATUS -.PP bc(1) returns the following exit statuses: .TP \f[B]0\f[R] @@ -2844,7 +2794,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the \f[B]-i\f[R] flag or \f[B]--interactive\f[R] option. .SH INTERACTIVE MODE -.PP Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both \f[B]stdin\f[R] @@ -2858,7 +2807,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R] environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section). .SH TTY MODE -.PP If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all connected to a TTY, then \[lq]TTY mode\[rq] is considered to be available, and thus, bc(1) can turn on TTY mode, subject to some @@ -2882,7 +2830,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section), and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to be connected to a terminal. .SS Command-Line History -.PP Command-line history is only enabled if TTY mode is, i.e., that \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the @@ -2890,7 +2837,6 @@ a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the TTY mode. See the \f[B]COMMAND LINE HISTORY\f[R] section for more information. .SS Prompt -.PP If TTY mode is available, then a prompt can be enabled. Like TTY mode itself, it can be turned on or off with an environment variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] @@ -2911,7 +2857,6 @@ and \f[B]--no-read-prompt\f[R] options. See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections for more details. .SH SIGNAL HANDLING -.PP Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things. .PP If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R] @@ -2946,7 +2891,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R] will cause bc(1) to clean up and exit. .SH COMMAND LINE HISTORY -.PP bc(1) supports interactive command-line editing. .PP If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section), @@ -2964,14 +2908,11 @@ the arrow keys. .PP \f[B]Note\f[R]: tabs are converted to 8 spaces. .SH LOCALES -.PP This bc(1) ships with support for adding error messages for different locales and thus, supports \f[B]LC_MESSAGES\f[R]. .SH SEE ALSO -.PP dc(1) .SH STANDARDS -.PP bc(1) is compliant with the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . @@ -2991,13 +2932,13 @@ the value of \f[B]LC_NUMERIC\f[R]. This bc(1) supports error messages for different locales, and thus, it supports \f[B]LC_MESSAGES\f[R]. .SH BUGS -.PP Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for the \f[B]quit\f[R] statement. .PP No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc . .SH AUTHORS -.PP -Gavin D. -Howard and contributors. +Gavin D. Howard \c +.MT gavin@gavinhoward.com +.ME \c +\ and contributors. diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 3e593e16b481..77004822f73d 100644 --- a/contrib/bc/manuals/bc/A.1.md +++ b/contrib/bc/manuals/bc/A.1.md @@ -1513,7 +1513,7 @@ The extended library is a **non-portable extension**. **bnot8(x)** : Does a bitwise not of the truncated absolute value of **x** as though it has - **8** binary digits (1 unsigned byte). + **8** binary digits (**1** unsigned byte). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1521,7 +1521,7 @@ The extended library is a **non-portable extension**. **bnot16(x)** : Does a bitwise not of the truncated absolute value of **x** as though it has - **16** binary digits (2 unsigned bytes). + **16** binary digits (**2** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1529,7 +1529,7 @@ The extended library is a **non-portable extension**. **bnot32(x)** : Does a bitwise not of the truncated absolute value of **x** as though it has - **32** binary digits (4 unsigned bytes). + **32** binary digits (**4** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1537,7 +1537,7 @@ The extended library is a **non-portable extension**. **bnot64(x)** : Does a bitwise not of the truncated absolute value of **x** as though it has - **64** binary digits (8 unsigned bytes). + **64** binary digits (**8** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1561,7 +1561,7 @@ The extended library is a **non-portable extension**. **brev8(x)** : Runs a bit reversal on the truncated absolute value of **x** as though it - has 8 binary digits (1 unsigned byte). + has 8 binary digits (**1** unsigned byte). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1569,7 +1569,7 @@ The extended library is a **non-portable extension**. **brev16(x)** : Runs a bit reversal on the truncated absolute value of **x** as though it - has 16 binary digits (2 unsigned bytes). + has 16 binary digits (**2** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1577,7 +1577,7 @@ The extended library is a **non-portable extension**. **brev32(x)** : Runs a bit reversal on the truncated absolute value of **x** as though it - has 32 binary digits (4 unsigned bytes). + has 32 binary digits (**4** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1585,7 +1585,7 @@ The extended library is a **non-portable extension**. **brev64(x)** : Runs a bit reversal on the truncated absolute value of **x** as though it - has 64 binary digits (8 unsigned bytes). + has 64 binary digits (**8** unsigned bytes). If you want to a use signed two's complement argument, use **s2u(x)** to convert. @@ -1632,7 +1632,7 @@ The extended library is a **non-portable extension**. **brol32(x, p)** : Does a left bitwise rotatation of the truncated absolute value of **x**, as - though it has **32** binary digits (**2** unsigned bytes), by the number of + though it has **32** binary digits (**4** unsigned bytes), by the number of places equal to the truncated absolute value of **p** modded by **2** to the power of **32**. @@ -1642,7 +1642,7 @@ The extended library is a **non-portable extension**. **brol64(x, p)** : Does a left bitwise rotatation of the truncated absolute value of **x**, as - though it has **64** binary digits (**2** unsigned bytes), by the number of + though it has **64** binary digits (**8** unsigned bytes), by the number of places equal to the truncated absolute value of **p** modded by **2** to the power of **64**. diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 24f49c701b46..549c1adae8a1 100644 --- a/contrib/bc/manuals/bc/E.1 +++ b/contrib/bc/manuals/bc/E.1 @@ -25,14 +25,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual" .nh .ad l .SH NAME -.PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS -.PP \f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]] [\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]] [\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] @@ -44,7 +42,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator [\f[B]--file\f[R]=\f[I]file\f[R]\&...] [\f[I]file\f[R]\&...] .SH DESCRIPTION -.PP bc(1) is an interactive processor for a language first standardized in 1991 by POSIX. (See the \f[B]STANDARDS\f[R] section.) @@ -73,7 +70,6 @@ If parsing scripts meant for other bc(1) implementations still does not work, that is a bug and should be reported. See the \f[B]BUGS\f[R] section. .SH OPTIONS -.PP The following are the options that bc(1) accepts. .TP \f[B]-C\f[R], \f[B]--no-digit-clamp\f[R] @@ -174,19 +170,16 @@ without worrying that the change will affect other functions. Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this: .IP -.nf -\f[C] +.EX define void output(x, b) { obase=b x } -\f[R] -.fi +.EE .PP instead of like this: .IP -.nf -\f[C] +.EX define void output(x, b) { auto c c=obase @@ -194,8 +187,7 @@ define void output(x, b) { x obase=c } -\f[R] -.fi +.EE .PP This makes writing functions much easier. .PP @@ -209,12 +201,10 @@ converter, it is possible to replace that capability with various shell aliases. Examples: .IP -.nf -\f[C] +.EX alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq] alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq] -\f[R] -.fi +.EE .PP Second, if the purpose of a function is to set \f[B]ibase\f[R], \f[B]obase\f[R], or \f[B]scale\f[R] globally for any other purpose, it @@ -441,7 +431,6 @@ This is a \f[B]non-portable extension\f[R]. .PP All long options are \f[B]non-portable extensions\f[R]. .SH STDIN -.PP If no files or expressions are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then bc(1) reads from \f[B]stdin\f[R]. @@ -458,7 +447,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an \f[B]else\f[R] statement will follow, so it will not execute until it knows there will not be an \f[B]else\f[R] statement. .SH STDOUT -.PP Any non-error output is written to \f[B]stdout\f[R]. In addition, if history (see the \f[B]HISTORY\f[R] section) and the prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output @@ -467,7 +455,7 @@ to \f[B]stdout\f[R]. \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in -\f[B]bc >&-\f[R], it will quit with an error. +\f[B]bc >&-\f[R], it will quit with an error. This is done so that bc(1) can report problems when \f[B]stdout\f[R] is redirected to a file. .PP @@ -475,13 +463,12 @@ If there are scripts that depend on the behavior of other bc(1) implementations, it is recommended that those scripts be changed to redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R]. .SH STDERR -.PP Any error output is written to \f[B]stderr\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in -\f[B]bc 2>&-\f[R], it will quit with an error. +\f[B]bc 2>&-\f[R], it will quit with an error. This is done so that bc(1) can exit with an error code when \f[B]stderr\f[R] is redirected to a file. .PP @@ -489,7 +476,6 @@ If there are scripts that depend on the behavior of other bc(1) implementations, it is recommended that those scripts be changed to redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R]. .SH SYNTAX -.PP The syntax for bc(1) programs is mostly C-like, with some differences. This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R] section), which is a much more thorough resource for the language this @@ -568,7 +554,6 @@ These are \f[B]non-portable extensions\f[R]. .PP Either semicolons or newlines may separate statements. .SS Comments -.PP There are two kinds of comments: .IP "1." 3 Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R]. @@ -577,7 +562,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next newline. This is a \f[B]non-portable extension\f[R]. .SS Named Expressions -.PP The following are named expressions in bc(1): .IP "1." 3 Variables: \f[B]I\f[R] @@ -606,7 +590,6 @@ Named expressions are required as the operand of of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R] subsection). .SS Operands -.PP The following are valid operands in bc(1): .IP " 1." 4 Numbers (see the \f[I]Numbers\f[R] subsection below). @@ -710,7 +693,6 @@ otherwise. See the \f[B]OPTIONS\f[R] section. This is a \f[B]non-portable extension\f[R]. .SS Numbers -.PP Numbers are strings made up of digits, uppercase letters, and at most *** 6187 LINES SKIPPED ***