Commit Graph

41 Commits

Author SHA1 Message Date
Stefan Eßer
1a63323d17 vendor/bc: import version 6.2.2
This is a production release that fixes a bug.

The bug was that if an array element was used as a parameter, and then
a later parameter had the same name as the array whose element was
used, bc would grab the element from the new array parameter, not the
actual element from before the function call.
2023-01-28 21:08:43 +01:00
Stefan Eßer
3c2ba19f6b vendor/bc: import version 6.2.1
This fixes one bug  in the history editing functions.
2023-01-28 21:06:20 +01:00
Stefan Eßer
e7017237c9 vendor/bc: import version 6.2.0
This is a production release with a new feature and a few bug fixes.

The bug fixes include:

 - A crash when bc and dc are built using editline, but history is not
   activated.
 - A missing local in the uint*() family of functions in the extended
   math library.
 - A failure to clear the tail call list in dc on error.
 - A crash when attempting to swap characters in command-line history
   when no characters exist.
 - SIGWINCH was activated even when history was not.

The new feature is that stack traces are now given for runtime errors.
In debug mode, the C source file and line of errors are given as well.
2023-01-28 21:02:27 +01:00
Stefan Eßer
0b671e8cf1 vendor/bc: import version 6.1.0
This is a production release that fixes a discrepancy from the bc
standard, a couple of memory bugs, and adds new features.

The discrepancy from the bc standard was with regards to the behavior
of the quit command. This bc used to quit whenever it encountered quit
during parsing, even if it was parsing a full file. Now, bc only quits
when encountering quit after it has executed all executable statements
up to that point.

This behavior is slightly different from GNU bc, but users will only
notice the difference if they put quit on the same line as other
statements.

The first memory bug could be reproduced by assigning a string to a
non-local variable in a function, then redefining the function with
use of the same non-local variable, which would still refer to a
string in the previous version of the function.

The second memory bug was caused by passing an array argument to the
asciify() built-in function. In certain cases, that was wrongly
allowed, and the interpreter just assumed everything was correct and
accessed memory. Now that arrays are allowed as arguments (see below),
this is not an issue.

The first feature was the addition of the is_number() built-in
function (u in dc) that returns 1 if the runtime argument is a number
and 0 otherwise.

The second feature was the addition of the is_string() built-in
function (t in dc) that returns 1 if the runtime argument is a string
and 0 otherwise.

These features were added because I realized that type-checking is
necessary now that strings can be assigned to variables in bc and
because they've always been assignable to variables in dc.

The last added feature is the ability of the asciify() built-in
function in bc to convert a full array of numbers into a string. This
means that character-by-character printing will not be necessary, and
more strings than just single-character ones will be able to be
created.
2023-01-28 20:59:18 +01:00
Stefan Eßer
9471e6a095 vendor/bc: import version 6.0.4
This version fixes a bug in the BC library that only affected
OpenBSD.
2023-01-28 20:54:39 +01:00
Stefan Eßer
161a37cc71 vendor/bc: import version 6.0.2
Changes relative to the previous version in FreeBSD:

- Fix error message on certain syntax errors.
- Add digit clamping (build option and run-time option)
- Make -l options no longer overridee scale value set with -S
2022-08-30 20:37:36 +02:00
Stefan Eßer
1576f66712 vendor/bc: update to upstream commit ca53adf83b7a
The filter_text function in scripts/functions.sh in version 5.3.3 had
commented out a "rm" command, probably for debugging purposes. This
caused temporary files to persist in /tmp when the bc program had been
built.

This commit fixes the build process with no change of the resulting
artefacts.
2022-06-22 15:49:47 +02:00
Stefan Eßer
3f739b0595 vendor/bc: import version 5.3.3
This version fixes a build issue caused by the strict compiler
warnings used when building FreeBSD base system components.
2022-06-15 11:34:25 +02:00
Stefan Eßer
6982f79963 vendor/bc: import version 5.3.2
This update restores support for suppression of the prompt with -P
when using the libedit or libreadline libraries for command line
editing and history.
2022-06-14 22:06:28 +02:00
Stefan Eßer
bd54318046 vendor/bc: import of version 5.3.1
This update does not contain any functional change, but fixes two
minor build issues:

- Temporary files were created in the source directory, causing build
  failures if the sources were not writable at build time.
- A message catalogue contained extra characters that were ignored but
  made gencat print warning messages.
2022-06-11 11:54:23 +02:00
Stefan Eßer
5bdd626528 vendor/bc: import of version 5.3.0
This version adds support for command line editing and history using
the editline or readline libraries in addition to the line editing
features available in previous versions.
2022-06-11 11:50:28 +02:00
Stefan Eßer
ed06037041 vendor/bc: import of version 5.2.5
This is a production release that fixes this bc's behavior on ^D to
match GNU bc.
2022-05-10 14:47:43 +02:00
Stefan Eßer
bc75dcc4ce vendor/bc: import version 5.2.4
This update fixes an issue in input line editing: when going left to
the start of the line, the cursor would jump to the end of the line
instead.
2022-04-17 13:20:54 +02:00
Stefan Eßer
3673adf1ee vendor/bc: import version 5.2.3
This version fixes a parse error when passing a file to bc using -f
if that file has a multiline comment or string in it.

MFC after:	3 days
2022-03-07 23:08:20 +01:00
Stefan Eßer
4dfc0fa287 vendor/bc: import release 5.2.2
This release assigns a default value to the internal program name
variable in case the program is invoked with argv[0] == NULL.

There was no security issue: the prevuous program version would have
been immediately terminated due to a NULL dereference.
2022-02-05 22:26:36 +01:00
Stefan Eßer
e63540eed2 vendor/bc: import release 5.2.1
This release fixes two parse bugs when in POSIX standard mode. One of
these bugs was due to a quirk of the POSIX grammar, and the other was
because bc was too strict.
2021-11-30 18:33:40 +01:00
Stefan Eßer
23aff12408 vendor/bc: import release 5.2.0
This version is imported only for documentary purposes since it does
not contain any changes that are relevant for the FreeBSD base system.
2021-11-30 18:26:22 +01:00
Stefan Eßer
6f49f5cdde vendor/bc: update to version 5.1.1
This update fixes a parser issue, which in special situations could
reject syntactically correct if statements.
2021-10-06 23:27:16 +02:00
Stefan Eßer
5d58a51571 vendor/bc: update to version 5.1.0
This version adds options and functions that allow to print numbers
in the open interval (-1 .. 1) with or without a leading 0 digit.

Additionally, an option has been added to prevent line wrap and
allows to print arbitrarily long results on a single line.
2021-10-04 21:22:35 +02:00
Stefan Eßer
a60ef1802a vendor/bc: update to upstream version 5.0.2 2021-09-19 14:41:20 +02:00
Stefan Eßer
2f57ecae4b vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 22:32:55 +02:00
Stefan Eßer
b46baf82c7 Add back Windows only VCXProj files 2021-07-28 15:35:16 +02:00
Stefan Eßer
3c83691798 Remove files that were checked in with wrong .gitattributes
These files will be added back in updated form, but are only relevant
for the Windows platform, anyway.
2021-07-28 15:31:57 +02:00
Stefan Eßer
2858419a0e Vendor import of Gavin D. Howard's bc version 4.0.2 2021-05-12 07:35:58 +02:00
Stefan Eßer
bd13672003 Vendor import of Gavin D. Howards bc version 4.0.1 2021-04-25 08:36:50 +02:00
Stefan Eßer
7a590c074c Vendor import of Gavin D. Howard's bc version 4.0.0 2021-04-06 10:44:52 +02:00
Stefan Eßer
893ecb52db Vendor import of bc 3.3.4 2021-03-19 09:39:56 +01:00
Stefan Eßer
1fa9712ce0 bc: Vendor import new version 3.3.3 2021-03-05 11:30:11 +01:00
Stefan Eßer
f131090388 Vendor import of Gavin Howard's bc-3.3.0 2021-02-17 22:29:31 +01:00
Stefan Eßer
47a52dc4d4 Vendor import of Gavin Howard's bc version 3.2.6 2021-01-31 20:58:45 +01:00
Stefan Eßer
7fe0a3f208 Import bc 3.2.4 2020-12-27 21:53:09 +01:00
Stefan Eßer
253e722024 Import version 3.2.3 2020-12-06 11:38:46 +00:00
Stefan Eßer
2e4772e823 Import version 3.2.0 2020-11-26 17:27:07 +00:00
Stefan Eßer
907a6834f7 Revert incomplete import of version 3.2.0 2020-11-26 17:18:18 +00:00
Stefan Eßer
04f2650428 Update to version 3.2.0 2020-11-26 16:52:17 +00:00
Stefan Eßer
9fef4b8de3 Update to version 3.1.6 2020-10-01 15:40:24 +00:00
Stefan Eßer
592e97f5f6 Upgrade to version 3.1.5
This version fixes a bug that only occurs when with chinese locale settings.
2020-08-05 10:07:43 +00:00
Stefan Eßer
a68dea2ff9 Import version 3.1.4
This version makes dc exit after processing all commands passed via -e or -f
instead of waiting for more input on STDIN (add "-f -" to the command line
to emulate the behavior of versionm 3.1.3 and earlier, if desired).

The version and copyright message are no longer printed for interactive
sessions as was the case with the prior implementation in the FreeBSD base
system.

Obtained from:	https://git.yzena.com/gavin/bc
2020-08-03 18:55:39 +00:00
Stefan Eßer
ee177a09be Upgrade to version 3.1.3
This version fixes an incompatibility with GNU bc.
2020-07-10 11:00:40 +00:00
Stefan Eßer
3960d8924a Update to release 3.1.1
This release fixes a regression from traditional bc behavior in FreeBSD
with regard to "-e quit" being passed on the command line and add Spanish
message catalogs.
2020-07-07 07:02:33 +00:00
Stefan Eßer
1f958cfad7 Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes, which the author of this version considers
  as a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

Approved by:	imp
Obtained from:	https://git.yzena.com/gavin/bc
Differential Revision:	https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00