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.
This commit is contained in:
parent
9972b1376c
commit
07a893c8cf
6
.gitignore
vendored
6
.gitignore
vendored
@ -17,6 +17,12 @@ bc.old
|
||||
.math.txt
|
||||
.results.txt
|
||||
.ops.txt
|
||||
manuals/bc.1
|
||||
manuals/bc.1.ronn
|
||||
manuals/bc.1.md
|
||||
manuals/dc.1
|
||||
manuals/dc.1.ronn
|
||||
manuals/dc.1.md
|
||||
gen/strgen
|
||||
lib.c
|
||||
lib2.c
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Copyright (c) 2018-2020 Gavin D. Howard <yzena.tech@gmail.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
@ -35,8 +33,6 @@ Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com><br>
|
||||
Copyright (c) 2018 rain-1 <rain1@openmailbox.org><br>
|
||||
Copyright (c) 2018-2020, Gavin D. Howard <yzena.tech@gmail.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
|
16
Makefile.in
16
Makefile.in
@ -1,8 +1,8 @@
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
@ -29,7 +29,7 @@
|
||||
#
|
||||
.POSIX:
|
||||
|
||||
VERSION = 3.0.2
|
||||
VERSION = 3.1.1
|
||||
|
||||
SRC = %%SRC%%
|
||||
OBJ = %%OBJ%%
|
||||
@ -105,10 +105,10 @@ DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
|
||||
MANUALS = manuals
|
||||
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
|
||||
BC_MANPAGE = $(MANUALS)/$(BC).1
|
||||
BC_RONN = $(BC_MANPAGE).ronn
|
||||
BC_MD = $(BC_MANPAGE).md
|
||||
DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
|
||||
DC_MANPAGE = $(MANUALS)/$(DC).1
|
||||
DC_RONN = $(DC_MANPAGE).ronn
|
||||
DC_MD = $(DC_MANPAGE).md
|
||||
|
||||
MANPAGE_INSTALL_ARGS = -Dm644
|
||||
|
||||
@ -270,8 +270,8 @@ extra_math:
|
||||
@printf '%s' "$(BC_ENABLE_EXTRA_MATH)"
|
||||
|
||||
manpages:
|
||||
$(MANPAGE) $(BC_RONN) $(BC_MANPAGE)
|
||||
$(MANPAGE) $(DC_RONN) $(DC_MANPAGE)
|
||||
$(MANPAGE) bc
|
||||
$(MANPAGE) dc
|
||||
|
||||
clean_gen:
|
||||
@$(RM) -f $(GEN_EXEC)
|
||||
@ -295,6 +295,8 @@ clean:%%CLEAN_PREREQS%%
|
||||
clean_config: clean
|
||||
@printf 'Cleaning config...\n'
|
||||
@$(RM) -f Makefile
|
||||
@$(RM) -f $(BC_MD) $(DC_MD)
|
||||
@$(RM) -f $(BC_MANPAGE) $(DC_MANPAGE)
|
||||
|
||||
clean_coverage:
|
||||
@printf 'Cleaning coverage files...\n'
|
||||
|
62
NEWS.md
62
NEWS.md
@ -1,5 +1,54 @@
|
||||
# News
|
||||
|
||||
## 3.1.1
|
||||
|
||||
This is a production release that adds two Spanish locales. Users do ***NOT***
|
||||
need to upgrade, unless they want those locales.
|
||||
|
||||
## 3.1.0
|
||||
|
||||
This is a production release that adjusts one behavior, fixes eight bugs, and
|
||||
improves manpages for FreeBSD. Because this release fixes bugs, **users and
|
||||
package maintainers should update to this version as soon as possible**.
|
||||
|
||||
The behavior that was adjusted was how code from the `-e` and `-f` arguments
|
||||
(and equivalents) were executed. They used to be executed as one big chunk, but
|
||||
in this release, they are now executed line-by-line.
|
||||
|
||||
The first bug fix in how output to `stdout` was handled in `SIGINT`. If a
|
||||
`SIGINT` came in, the `stdout` buffer was not correctly flushed. In fact, a
|
||||
clean-up function was not getting called. This release fixes that bug.
|
||||
|
||||
The second bug is in how `dc` handled input from `stdin`. This affected `bc` as
|
||||
well since it was a mishandling of the `stdin` buffer.
|
||||
|
||||
The third fixed bug was that `bc` and `dc` could `abort()` (in debug mode) when
|
||||
receiving a `SIGTERM`. This one was a race condition with pushing and popping
|
||||
items onto and out of vectors.
|
||||
|
||||
The fourth bug fixed was that `bc` could leave extra items on the stack and
|
||||
thus, not properly clean up some memory. (The memory would still get
|
||||
`free()`'ed, but it would not be `free()`'ed when it could have been.)
|
||||
|
||||
The next two bugs were bugs in `bc`'s parser that caused crashes when executing
|
||||
the resulting code.
|
||||
|
||||
The last two bugs were crashes in `dc` that resulted from mishandling of
|
||||
strings.
|
||||
|
||||
The manpage improvement was done by switching from [ronn][20] to [Pandoc][21] to
|
||||
generate manpages. Pandoc generates much cleaner manpages and doesn't leave
|
||||
blank lines where they shouldn't be.
|
||||
|
||||
## 3.0.3
|
||||
|
||||
This is a production release that adds one new feature: specific manpages.
|
||||
|
||||
Before this release, `bc` and `dc` only used one manpage each that referred to
|
||||
various build options. This release changes it so there is one manpage set per
|
||||
relevant build type. Each manual only has information about its particular
|
||||
build, and `configure.sh` selects the correct set for install.
|
||||
|
||||
## 3.0.2
|
||||
|
||||
This is a production release that adds `utf8` locale symlinks and removes an
|
||||
@ -32,8 +81,9 @@ global ones that are already installed, so it will use the previous ones while
|
||||
running tests during install. **If `bc` segfaults while running arg tests when
|
||||
updating, it is because the global locale files have not been replaced. Make
|
||||
sure to either prevent the test suite from running on update or remove the old
|
||||
locale files before updating.** Once this is done, `bc` should install without
|
||||
problems.*
|
||||
locale files before updating.** (Removing the locale files can be done with
|
||||
`make uninstall` or by running the `locale_uninstall.sh` script.) Once this is
|
||||
done, `bc` should install without problems.*
|
||||
|
||||
*Second, **the option to build without signal support has been removed**. See
|
||||
below for the reasons why.*
|
||||
@ -811,14 +861,16 @@ not thoroughly tested.
|
||||
[6]: ./configure.sh
|
||||
[7]: https://github.com/rain-1/linenoise-mob
|
||||
[8]: https://github.com/antirez/linenoise
|
||||
[9]: ./manuals/bc.1.ronn
|
||||
[10]: ./manuals/dc.1.ronn
|
||||
[9]: ./manuals/bc/A.1.md
|
||||
[10]: ./manuals/dc/A.1.md
|
||||
[11]: https://scan.coverity.com/projects/gavinhoward-bc
|
||||
[12]: ./locale_install.sh
|
||||
[13]: ./manuals/build.md
|
||||
[14]: https://github.com/stesser
|
||||
[15]: https://github.com/bugcrazy
|
||||
[16]: ./manuals/bc.1.ronn#extended-library
|
||||
[16]: ./manuals/bc/A.1.md#extended-library
|
||||
[17]: https://github.com/skeeto/optparse
|
||||
[18]: https://www.deepl.com/translator
|
||||
[19]: ./manuals/benchmarks.md
|
||||
[20]: https://github.com/apjanke/ronn-ng
|
||||
[21]: https://pandoc.org/
|
||||
|
15
README.md
15
README.md
@ -11,7 +11,7 @@ This is an implementation of the [POSIX `bc` calculator][12] that implements
|
||||
[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD
|
||||
flavor of `bc`.
|
||||
|
||||
For more information, see this `bc`'s [full manual][2].
|
||||
For more information, see this `bc`'s full manual.
|
||||
|
||||
This `bc` also includes an implementation of `dc` in the same binary, accessible
|
||||
via a symbolic link, which implements all FreeBSD and GNU extensions. (If a
|
||||
@ -19,7 +19,7 @@ standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The
|
||||
`!` command is omitted; I believe this poses security concerns and that such
|
||||
functionality is unnecessary.
|
||||
|
||||
For more information, see the `dc`'s [full manual][3].
|
||||
For more information, see the `dc`'s full manual.
|
||||
|
||||
This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD
|
||||
2-clause License. Full license text may be found in the [`LICENSE.md`][4] file.
|
||||
@ -39,7 +39,7 @@ Systems that are known to work:
|
||||
* OpenBSD
|
||||
* NetBSD
|
||||
* Mac OSX
|
||||
* Solaris
|
||||
* Solaris* (as long as the Solaris version supports POSIX 2008)
|
||||
* AIX
|
||||
|
||||
Please submit bug reports if this `bc` does not build out of the box on any
|
||||
@ -261,6 +261,10 @@ Other projects based on this bc are:
|
||||
* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the
|
||||
toybox `bc` should be reported there.
|
||||
|
||||
* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better
|
||||
to report bugs there, and the maintainers of the package will contact me if
|
||||
necessary.
|
||||
|
||||
## Language
|
||||
|
||||
This `bc` is written in pure ISO C99, using POSIX 2008 APIs.
|
||||
@ -293,7 +297,7 @@ Files:
|
||||
locale_install.sh A script to install locales, if desired.
|
||||
locale_uninstall.sh A script to uninstall locales.
|
||||
Makefile.in The Makefile template.
|
||||
manpage.sh Script to generate man pages from ronn files.
|
||||
manpage.sh Script to generate man pages from markdown files.
|
||||
NOTICE.md List of contributors and copyright owners.
|
||||
RELEASE.md A checklist for making a release (maintainer use only).
|
||||
release.sh A script to test for release (maintainer use only).
|
||||
@ -309,8 +313,6 @@ Folders:
|
||||
tests All tests.
|
||||
|
||||
[1]: https://www.gnu.org/software/bc/
|
||||
[2]: ./manuals/bc.md
|
||||
[3]: ./manuals/dc.md
|
||||
[4]: ./LICENSE.md
|
||||
[5]: ./manuals/build.md
|
||||
[6]: https://pkg.musl.cc/bc/
|
||||
@ -330,3 +332,4 @@ Folders:
|
||||
[20]: https://git.yzena.com/gavin/bc
|
||||
[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/
|
||||
[22]: https://www.deepl.com/translator
|
||||
[23]: https://github.com/freebsd/freebsd/tree/master/contrib/bc
|
||||
|
5
TODO.md
5
TODO.md
@ -1,5 +0,0 @@
|
||||
# TODO
|
||||
|
||||
* Rerun benchmarks.
|
||||
* Redo executable size (with static binaries).
|
||||
* Redo Karatsuba number and update NEWS if necessary.
|
31
configure.sh
31
configure.sh
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@ -808,6 +808,28 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
manpage_args=""
|
||||
|
||||
if [ "$extra_math" -eq 0 ]; then
|
||||
manpage_args="E"
|
||||
fi
|
||||
|
||||
if [ "$hist" -eq 0 ]; then
|
||||
manpage_args="${manpage_args}H"
|
||||
fi
|
||||
|
||||
if [ "$nls" -eq 0 ]; then
|
||||
manpage_args="${manpage_args}N"
|
||||
fi
|
||||
|
||||
if [ "$prompt" -eq 0 ]; then
|
||||
manpage_args="${manpage_args}P"
|
||||
fi
|
||||
|
||||
if [ "$manpage_args" = "" ]; then
|
||||
manpage_args="A"
|
||||
fi
|
||||
|
||||
# Print out the values; this is for debugging.
|
||||
if [ "$bc" -ne 0 ]; then
|
||||
printf 'Building bc\n'
|
||||
@ -924,4 +946,9 @@ printf '%s\n' "$contents" > "$scriptdir/Makefile"
|
||||
|
||||
cd "$scriptdir"
|
||||
|
||||
cp -f manuals/bc/$manpage_args.1.md manuals/bc.1.md
|
||||
cp -f manuals/bc/$manpage_args.1 manuals/bc.1
|
||||
cp -f manuals/dc/$manpage_args.1.md manuals/dc.1.md
|
||||
cp -f manuals/dc/$manpage_args.1 manuals/dc.1
|
||||
|
||||
make clean > /dev/null
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -58,6 +58,8 @@ This bc has three differences to the GNU bc:
|
||||
3) This bc has many more extensions than the GNU bc does. For details, see the
|
||||
man page.
|
||||
|
||||
This bc also implements the dot (.) extension of the BSD bc.
|
||||
|
||||
Options:
|
||||
|
||||
-e expr --expression=expr
|
||||
@ -94,6 +96,9 @@ Options:
|
||||
e(expr) = raises e to the power of expr
|
||||
j(n, x) = Bessel function of integer order n of x
|
||||
|
||||
This bc may load more functions with these options. See the manpage for
|
||||
details.
|
||||
|
||||
-P --no-prompt
|
||||
|
||||
Disable the prompt in interactive mode.
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
10
include/bc.h
10
include/bc.h
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -130,13 +130,13 @@ void bc_lex_token(BcLex *l);
|
||||
#define BC_PARSE_LEAF(prev, bin_last, rparen) \
|
||||
(!(bin_last) && ((rparen) || bc_parse_inst_isLeaf(prev)))
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
#define BC_PARSE_INST_VAR(t) \
|
||||
((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY)
|
||||
#else // BC_ENABLE_EXTRA_MATH
|
||||
#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
#define BC_PARSE_INST_VAR(t) \
|
||||
((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY)
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
|
||||
#define BC_PARSE_PREV_PREFIX(p) \
|
||||
((p) >= BC_INST_NEG && (p) <= BC_INST_BOOL_NOT)
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -36,10 +36,6 @@
|
||||
#ifndef BC_DC_H
|
||||
#define BC_DC_H
|
||||
|
||||
#ifndef DC_ENABLE_RAND
|
||||
#define DC_ENABLE_RAND (1)
|
||||
#endif // DC_ENABLE_RAND
|
||||
|
||||
#if DC_ENABLED
|
||||
|
||||
#include <status.h>
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -47,8 +47,6 @@
|
||||
* Copyright (c) 2010-2016, Salvatore Sanfilippo <antirez at gmail dot com>
|
||||
* Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -129,6 +129,7 @@ typedef enum BcInst {
|
||||
BC_INST_ARRAY,
|
||||
#endif // BC_ENABLED
|
||||
|
||||
BC_INST_ZERO,
|
||||
BC_INST_ONE,
|
||||
|
||||
#if BC_ENABLED
|
||||
@ -137,26 +138,26 @@ typedef enum BcInst {
|
||||
BC_INST_IBASE,
|
||||
BC_INST_OBASE,
|
||||
BC_INST_SCALE,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_SEED,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_LENGTH,
|
||||
BC_INST_SCALE_FUNC,
|
||||
BC_INST_SQRT,
|
||||
BC_INST_ABS,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_IRAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_READ,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_RAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_MAXIBASE,
|
||||
BC_INST_MAXOBASE,
|
||||
BC_INST_MAXSCALE,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_INST_MAXRAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
|
||||
BC_INST_PRINT,
|
||||
BC_INST_PRINT_POP,
|
||||
@ -252,9 +253,9 @@ typedef enum BcResultType {
|
||||
|
||||
BC_RESULT_STR,
|
||||
|
||||
BC_RESULT_CONSTANT,
|
||||
BC_RESULT_TEMP,
|
||||
|
||||
BC_RESULT_ZERO,
|
||||
BC_RESULT_ONE,
|
||||
|
||||
#if BC_ENABLED
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -46,8 +46,23 @@
|
||||
#define bc_lex_err(l, e) (bc_vm_error((e), (l)->line))
|
||||
#define bc_lex_verr(l, e, ...) (bc_vm_error((e), (l)->line, __VA_ARGS__))
|
||||
|
||||
#if BC_ENABLED
|
||||
|
||||
#if DC_ENABLED
|
||||
#define BC_LEX_NEG_CHAR (BC_IS_BC ? '-' : '_')
|
||||
#define BC_LEX_LAST_NUM_CHAR (BC_IS_BC ? 'Z' : 'F')
|
||||
#else // DC_ENABLED
|
||||
#define BC_LEX_NEG_CHAR ('-')
|
||||
#define BC_LEX_LAST_NUM_CHAR ('Z')
|
||||
#endif // DC_ENABLED
|
||||
|
||||
#else // BC_ENABLED
|
||||
|
||||
#define BC_LEX_NEG_CHAR ('_')
|
||||
#define BC_LEX_LAST_NUM_CHAR ('F')
|
||||
|
||||
#endif // BC_ENABLED
|
||||
|
||||
#define BC_LEX_NUM_CHAR(c, pt, int_only) \
|
||||
(isdigit(c) || ((c) >= 'A' && (c) <= BC_LEX_LAST_NUM_CHAR) || \
|
||||
((c) == '.' && !(pt) && !(int_only)))
|
||||
@ -142,27 +157,27 @@ typedef enum BcLexType {
|
||||
BC_LEX_KW_IBASE,
|
||||
BC_LEX_KW_OBASE,
|
||||
BC_LEX_KW_SCALE,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_SEED,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_LENGTH,
|
||||
BC_LEX_KW_PRINT,
|
||||
BC_LEX_KW_SQRT,
|
||||
BC_LEX_KW_ABS,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_IRAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_QUIT,
|
||||
BC_LEX_KW_READ,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_RAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_MAXIBASE,
|
||||
BC_LEX_KW_MAXOBASE,
|
||||
BC_LEX_KW_MAXSCALE,
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_MAXRAND,
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BC_LEX_KW_ELSE,
|
||||
|
||||
#if DC_ENABLED
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -110,8 +110,16 @@ typedef struct BcNum {
|
||||
} BcNum;
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
|
||||
#ifndef BC_ENABLE_RAND
|
||||
#define BC_ENABLE_RAND (1)
|
||||
#endif // BC_ENABLE_RAND
|
||||
|
||||
#if BC_ENABLE_RAND
|
||||
// Forward declaration
|
||||
struct BcRNG;
|
||||
#endif // BC_ENABLE_RAND
|
||||
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
|
||||
#define BC_NUM_MIN_BASE (BC_NUM_BIGDIG_C(2))
|
||||
@ -173,12 +181,12 @@ void bc_num_bigdig(const BcNum *restrict n, BcBigDig *result);
|
||||
void bc_num_bigdig2(const BcNum *restrict n, BcBigDig *result);
|
||||
void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val);
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
void bc_num_irand(const BcNum *restrict a, BcNum *restrict b,
|
||||
struct BcRNG *restrict rng);
|
||||
void bc_num_rng(const BcNum *restrict n, struct BcRNG *rng);
|
||||
void bc_num_createFromRNG(BcNum *restrict n, struct BcRNG *rng);
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
|
||||
void bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale);
|
||||
void bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -110,6 +110,7 @@ void bc_parse_updateFunc(BcParse *p, size_t fidx);
|
||||
void bc_parse_pushName(const BcParse* p, char *name, bool var);
|
||||
void bc_parse_text(BcParse *p, const char *text);
|
||||
|
||||
extern const char bc_parse_zero[];
|
||||
extern const char bc_parse_one[];
|
||||
|
||||
#endif // BC_PARSE_H
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -61,9 +61,9 @@ typedef struct BcProgram {
|
||||
BcBigDig globals[BC_PROG_GLOBALS_LEN];
|
||||
BcVec globals_v[BC_PROG_GLOBALS_LEN];
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
BcRNG rng;
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
|
||||
|
||||
BcVec results;
|
||||
BcVec stack;
|
||||
@ -81,12 +81,15 @@ typedef struct BcProgram {
|
||||
BcVec arr_map;
|
||||
|
||||
#if DC_ENABLED
|
||||
BcVec strs_v;
|
||||
|
||||
BcVec tail_calls;
|
||||
|
||||
BcBigDig strm;
|
||||
BcNum strmb;
|
||||
#endif // DC_ENABLED
|
||||
|
||||
BcNum zero;
|
||||
BcNum one;
|
||||
|
||||
#if BC_ENABLED
|
||||
@ -99,6 +102,7 @@ typedef struct BcProgram {
|
||||
BcDig strmb_num[BC_NUM_BIGDIG_LOG10];
|
||||
#endif // DC_ENABLED
|
||||
|
||||
BcDig zero_num[BC_PROG_ONE_CAP];
|
||||
BcDig one_num[BC_PROG_ONE_CAP];
|
||||
|
||||
} BcProgram;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2019 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2019 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -69,14 +69,16 @@
|
||||
#ifndef BC_RAND_H
|
||||
#define BC_RAND_H
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <vector.h>
|
||||
#include <num.h>
|
||||
|
||||
#if BC_ENABLE_EXTRA_MATH
|
||||
|
||||
#if BC_ENABLE_RAND
|
||||
|
||||
typedef ulong (*BcRandUlong)(void*);
|
||||
|
||||
#if BC_LONG_BIT >= 64
|
||||
@ -224,6 +226,8 @@ void bc_rand_getRands(BcRNG *r, BcRand *s1, BcRand *s2, BcRand *i1, BcRand *i2);
|
||||
|
||||
extern const BcRandState bc_rand_multiplier;
|
||||
|
||||
#endif // BC_ENABLE_RAND
|
||||
|
||||
#endif // BC_ENABLE_EXTRA_MATH
|
||||
|
||||
#endif // BC_RAND_H
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -33,8 +33,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BC_IO_H
|
||||
#define BC_IO_H
|
||||
#ifndef BC_READ_H
|
||||
#define BC_READ_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -55,5 +55,6 @@
|
||||
BcStatus bc_read_line(BcVec *vec, const char *prompt);
|
||||
void bc_read_file(const char *path, char **buf);
|
||||
BcStatus bc_read_chars(BcVec *vec, const char *prompt);
|
||||
bool bc_read_buf(BcVec *vec, char *buf, size_t *buf_len);
|
||||
|
||||
#endif // BC_IO_H
|
||||
#endif // BC_READ_H
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
59
include/vm.h
59
include/vm.h
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -91,28 +91,64 @@
|
||||
#define isatty _isatty
|
||||
#endif // _WIN32
|
||||
|
||||
#if DC_ENABLED
|
||||
#define DC_FLAG_X (UINTMAX_C(1)<<0)
|
||||
#endif // DC_ENABLED
|
||||
|
||||
#if BC_ENABLED
|
||||
#define BC_FLAG_W (UINTMAX_C(1)<<1)
|
||||
#define BC_FLAG_S (UINTMAX_C(1)<<2)
|
||||
#define BC_FLAG_Q (UINTMAX_C(1)<<3)
|
||||
#define BC_FLAG_L (UINTMAX_C(1)<<4)
|
||||
#define BC_FLAG_I (UINTMAX_C(1)<<5)
|
||||
#define BC_FLAG_G (UINTMAX_C(1)<<6)
|
||||
#define BC_FLAG_L (UINTMAX_C(1)<<3)
|
||||
#define BC_FLAG_G (UINTMAX_C(1)<<4)
|
||||
#endif // BC_ENABLED
|
||||
|
||||
#define BC_FLAG_Q (UINTMAX_C(1)<<5)
|
||||
#define BC_FLAG_I (UINTMAX_C(1)<<6)
|
||||
#define BC_FLAG_P (UINTMAX_C(1)<<7)
|
||||
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<8)
|
||||
#define BC_FLAG_TTY (UINTMAX_C(1)<<9)
|
||||
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
|
||||
#define BC_TTY (vm.flags & BC_FLAG_TTY)
|
||||
|
||||
#if BC_ENABLED
|
||||
|
||||
#define BC_S (BC_ENABLED && (vm.flags & BC_FLAG_S))
|
||||
#define BC_W (BC_ENABLED && (vm.flags & BC_FLAG_W))
|
||||
#define BC_L (BC_ENABLED && (vm.flags & BC_FLAG_L))
|
||||
#define BC_I (vm.flags & BC_FLAG_I)
|
||||
#define BC_G (BC_ENABLED && (vm.flags & BC_FLAG_G))
|
||||
#define DC_X (DC_ENABLED && (vm.flags & DC_FLAG_X))
|
||||
|
||||
#endif // BC_ENABLED
|
||||
|
||||
#if DC_ENABLED
|
||||
#define DC_X (vm.flags & DC_FLAG_X)
|
||||
#endif // DC_ENABLED
|
||||
|
||||
#define BC_I (vm.flags & BC_FLAG_I)
|
||||
#define BC_P (vm.flags & BC_FLAG_P)
|
||||
|
||||
#if BC_ENABLED
|
||||
|
||||
#define BC_IS_POSIX (BC_S || BC_W)
|
||||
|
||||
#if DC_ENABLED
|
||||
#define BC_IS_BC (vm.name[0] != 'd')
|
||||
#define BC_IS_DC (vm.name[0] == 'd')
|
||||
#else // DC_ENABLED
|
||||
#define BC_IS_BC (1)
|
||||
#define BC_IS_DC (0)
|
||||
#endif // DC_ENABLED
|
||||
|
||||
#else // BC_ENABLED
|
||||
#define BC_IS_POSIX (0)
|
||||
#define BC_IS_BC (0)
|
||||
#define BC_IS_DC (1)
|
||||
#endif // BC_ENABLED
|
||||
|
||||
#if BC_ENABLED
|
||||
#define BC_USE_PROMPT (!BC_P && BC_TTY && !BC_IS_POSIX)
|
||||
#else // BC_ENABLED
|
||||
#define BC_USE_PROMPT (!BC_P && BC_TTY)
|
||||
#endif // BC_ENABLED
|
||||
|
||||
#define BC_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define BC_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
@ -131,9 +167,6 @@
|
||||
#define BC_MAX_EXP ((ulong) (BC_NUM_BIGDIG_MAX))
|
||||
#define BC_MAX_VARS ((ulong) (SIZE_MAX - 1))
|
||||
|
||||
#define BC_IS_BC (BC_ENABLED && (!DC_ENABLED || vm.name[0] != 'd'))
|
||||
#define BC_IS_POSIX (BC_S || BC_W)
|
||||
|
||||
#if BC_DEBUG_CODE
|
||||
#define BC_VM_JMP bc_vm_jmp(__func__)
|
||||
#else // BC_DEBUG_CODE
|
||||
@ -234,7 +267,9 @@
|
||||
#define BC_VM_BUF_SIZE (1<<12)
|
||||
#define BC_VM_STDOUT_BUF_SIZE (1<<11)
|
||||
#define BC_VM_STDERR_BUF_SIZE (1<<10)
|
||||
#define BC_VM_STDIN_BUF_SIZE BC_VM_STDERR_BUF_SIZE
|
||||
#define BC_VM_STDIN_BUF_SIZE (BC_VM_STDERR_BUF_SIZE - 1)
|
||||
|
||||
#define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP)
|
||||
|
||||
#define bc_vm_err(e) (bc_vm_error((e), 0))
|
||||
#define bc_vm_verr(e, ...) (bc_vm_error((e), 0, __VA_ARGS__))
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /usr/bin/python3 -B
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@ -44,6 +44,9 @@ def run(cmd, env=None):
|
||||
script = sys.argv[0]
|
||||
testdir = os.path.dirname(script)
|
||||
|
||||
if testdir == "":
|
||||
testdir = os.getcwd()
|
||||
|
||||
print("\nWARNING: This script is for distro and package maintainers.")
|
||||
print("It is for finding the optimal Karatsuba number.")
|
||||
print("Though it only needs to be run once per release/platform,")
|
||||
|
4
link.sh
4
link.sh
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Headers for printing errors/warnings.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Headers for printing errors/warnings.
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
108
locales/es_ES.ISO8859-1.msg
Normal file
108
locales/es_ES.ISO8859-1.msg
Normal file
@ -0,0 +1,108 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Miscellaneous messages.
|
||||
$set 1
|
||||
|
||||
1 "Función:"
|
||||
|
||||
$ Error types.
|
||||
$set 2
|
||||
|
||||
1 "Error de matemática:"
|
||||
2 "Error de syntaxis:"
|
||||
3 "Error de ejecución:"
|
||||
4 "Error fatal:"
|
||||
5 "Advertencia:"
|
||||
|
||||
$ Math errors.
|
||||
$set 3
|
||||
|
||||
1 "número negativo"
|
||||
2 "número no es entero"
|
||||
3 "desbordamiento de enteros: no se puede encajar el el hardware"
|
||||
4 "división por cero"
|
||||
|
||||
$ Parse errors.
|
||||
$set 4
|
||||
|
||||
1 "fin de archivo"
|
||||
2 "no válido '%c'"
|
||||
3 "no puede encontrar el fine de la cadena"
|
||||
4 "no puede encontrar el fine del comentario"
|
||||
5 "el token no es válido"
|
||||
6 "la expresión no es válida"
|
||||
7 "la expresión es vacía"
|
||||
8 "la expresión de print no es válida"
|
||||
9 "la definición de función no es válida"
|
||||
10 "la asignación no es valida: en la izquierda debe ser scale, ibase, obase, last, var, o un elemento de matriz"
|
||||
11 "no se encontró ninguna variable automática"
|
||||
12 "ya hay un parámetro de función o variable automatica que se llama \"%s%s\""
|
||||
13 "no se puede encontrar el final de del bloque de código"
|
||||
14 "no puede haber un valor de retorno de una función \"void\": %s()"
|
||||
15 "var no puede ser una referencia: %s"
|
||||
16 "POSIX no permite nombres de más de 1 carácter: %s"
|
||||
17 "POSIX no permite '#' script comentarios"
|
||||
18 "POSIX no permite este palabra clave %s"
|
||||
19 "POSIX no permite un punto ('.') como un atajo del resultado previoso"
|
||||
20 "POSIX requieres paréntesis en el expresión del \"return\""
|
||||
21 "POSIX no permite este operador: %s"
|
||||
22 "POSIX no permite operadores de comparación aparte de \"if\" expresión o bucles"
|
||||
23 "POSIX requiere 0 o 1 operadores de comparisón para cada condición"
|
||||
24 "POSIX requiere todos 3 partes de una bucla que no esta vacío"
|
||||
25 "POSIX no permite una notación exponencial"
|
||||
26 "POSIX no permite una referencia a una matriz como un parámetro de función"
|
||||
27 "POSIX requiere el llave de la izquierda que sea en la misma línea que los parámetros de la función"
|
||||
|
||||
$ Runtime errors.
|
||||
$set 5
|
||||
|
||||
1 "\"ibase\" no es válido: debe ser [%lu, %lu]"
|
||||
2 "\"obase\" no es válido: debe ser [%lu, %lu]"
|
||||
3 "\"scale\" no es válido: debe ser [%lu, %lu]"
|
||||
4 "read() expresión no es válido"
|
||||
5 "recursion en la invocación de read()"
|
||||
6 "variable o elemento del matriz de tipo equivocado"
|
||||
7 "la pila no ha demaciado elementos"
|
||||
8 "la función no tiene un número de argumentos correcto; necessita %zu, tiene %zu"
|
||||
9 "la función no esta definida: %s()"
|
||||
10 "no puede utilizar un valor vacío en una expresión"
|
||||
|
||||
$ Fatal errors.
|
||||
$set 6
|
||||
|
||||
1 "error en la asignación de memoria"
|
||||
2 "error de I/O"
|
||||
3 "no puede abrir el archivo: %s"
|
||||
4 "el archivo no es ASCII: %s"
|
||||
5 "el ruta es un directorio: %s"
|
||||
6 "una opción de línea de comandos no es válida: \"%s\""
|
||||
7 "una opción requiere un argumento: '%c' (\"%s\")"
|
||||
8 "una opción no tiene argumento: '%c' (\"%s\")"
|
1
locales/es_ES.ISO8859-15.msg
Symbolic link
1
locales/es_ES.ISO8859-15.msg
Symbolic link
@ -0,0 +1 @@
|
||||
es_ES.ISO8859-1.msg
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ その他のメッセージ。
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ その他のメッセージ。
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Diversen berichten.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Diversen berichten.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Ró¿ne wiadomo¶ci.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Różne wiadomości.
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Разные сообщения.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ <20> §ë¥ á®®¡é¥¨ï.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Разные сообщения.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Разные сообщения.
|
||||
|
@ -1,3 +1,31 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
$ * Redistributions of source code must retain the above copyright notice, this
|
||||
$ list of conditions and the following disclaimer.
|
||||
$ $
|
||||
$ * Redistributions in binary form must reproduce the above copyright notice,
|
||||
$ this list of conditions and the following disclaimer in the documentation
|
||||
$ and/or other materials provided with the distribution.
|
||||
$ $
|
||||
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
$ POSSIBILITY OF SUCH DAMAGE.
|
||||
$ $
|
||||
|
||||
$quote "
|
||||
|
||||
$ Разные сообщения.
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
@ -1,8 +1,8 @@
|
||||
$ $
|
||||
$ SPDX-License-Identifier: BSD-2-Clause
|
||||
$ $
|
||||
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
$ $
|
||||
$ All rights reserved.
|
||||
$ $
|
||||
$ Redistribution and use in source and binary forms, with or without
|
||||
$ modification, are permitted provided that the following conditions are met:
|
||||
$ $
|
||||
|
83
manpage.sh
83
manpage.sh
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@ -28,21 +28,86 @@
|
||||
#
|
||||
|
||||
usage() {
|
||||
printf "usage: %s ronn_file output_file\n" "$0" 1>&2
|
||||
printf "usage: %s manpage\n" "$0" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
gen_manpage() {
|
||||
|
||||
_gen_manpage_args="$1"
|
||||
shift
|
||||
|
||||
_gen_manpage_status="$ALL"
|
||||
_gen_manpage_out="$manualsdir/$manpage/$_gen_manpage_args.1"
|
||||
_gen_manpage_md="$manualsdir/$manpage/$_gen_manpage_args.1.md"
|
||||
_gen_manpage_temp="$manualsdir/temp.1.md"
|
||||
_gen_manpage_ifs="$IFS"
|
||||
|
||||
rm -rf "$_gen_manpage_out" "$_gen_manpage_md"
|
||||
|
||||
while IFS= read -r line; do
|
||||
|
||||
if [ "$line" = "{{ end }}" ]; then
|
||||
|
||||
if [ "$_gen_manpage_status" -eq "$ALL" ]; then
|
||||
err_exit "{{ end }} tag without corresponding start tag" 2
|
||||
fi
|
||||
|
||||
_gen_manpage_status="$ALL"
|
||||
|
||||
elif [ "${line#\{\{* $_gen_manpage_args *\}\}}" != "$line" ]; then
|
||||
|
||||
if [ "$_gen_manpage_status" -ne "$ALL" ]; then
|
||||
err_exit "start tag nested in start tag" 3
|
||||
fi
|
||||
|
||||
_gen_manpage_status="$NOSKIP"
|
||||
|
||||
elif [ "${line#\{\{*\}\}}" != "$line" ]; then
|
||||
|
||||
if [ "$_gen_manpage_status" -ne "$ALL" ]; then
|
||||
err_exit "start tag nested in start tag" 3
|
||||
fi
|
||||
|
||||
_gen_manpage_status="$SKIP"
|
||||
|
||||
else
|
||||
if [ "$_gen_manpage_status" -ne "$SKIP" ]; then
|
||||
printf '%s\n' "$line" >> "$_gen_manpage_temp"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < "$manualsdir/${manpage}.1.md.in"
|
||||
|
||||
uniq "$_gen_manpage_temp" "$_gen_manpage_md"
|
||||
rm -rf "$_gen_manpage_temp"
|
||||
|
||||
IFS="$_gen_manpage_ifs"
|
||||
|
||||
cat "$manualsdir/header.txt" > "$_gen_manpage_out"
|
||||
cat "$manualsdir/header_${manpage}.txt" >> "$_gen_manpage_out"
|
||||
|
||||
pandoc -f markdown -t man "$_gen_manpage_md" >> "$_gen_manpage_out"
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
script="$0"
|
||||
scriptdir=$(dirname "$script")
|
||||
manualsdir="$scriptdir/manuals"
|
||||
|
||||
test "$#" -ge 2 || usage
|
||||
. "$scriptdir/functions.sh"
|
||||
|
||||
ronn_file="$1"
|
||||
ARGS="A E H N P EH EN EP HN HP NP EHN EHP ENP HNP EHNP"
|
||||
ALL=0
|
||||
NOSKIP=1
|
||||
SKIP=2
|
||||
|
||||
test "$#" -eq 1 || usage
|
||||
|
||||
manpage="$1"
|
||||
shift
|
||||
|
||||
output_file="$1"
|
||||
shift
|
||||
|
||||
ronn --pipe --roff --organization="Gavin D. Howard" --manual="General Commands Manual" $ronn_file | sed 's|\\fB\\'"'"'\\fR|\\fB'"'"'\\fR|g' > $output_file
|
||||
for a in $ARGS; do
|
||||
gen_manpage "$a"
|
||||
done
|
||||
|
1566
manuals/bc.1
1566
manuals/bc.1
File diff suppressed because it is too large
Load Diff
1814
manuals/bc.1.md.in
Normal file
1814
manuals/bc.1.md.in
Normal file
File diff suppressed because it is too large
Load Diff
1556
manuals/bc.1.ronn
1556
manuals/bc.1.ronn
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
bc.1.ronn
|
2099
manuals/bc/A.1
Normal file
2099
manuals/bc/A.1
Normal file
File diff suppressed because it is too large
Load Diff
1697
manuals/bc/A.1.md
Normal file
1697
manuals/bc/A.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1341
manuals/bc/E.1
Normal file
1341
manuals/bc/E.1
Normal file
File diff suppressed because it is too large
Load Diff
1091
manuals/bc/E.1.md
Normal file
1091
manuals/bc/E.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1323
manuals/bc/EH.1
Normal file
1323
manuals/bc/EH.1
Normal file
File diff suppressed because it is too large
Load Diff
1075
manuals/bc/EH.1.md
Normal file
1075
manuals/bc/EH.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1316
manuals/bc/EHN.1
Normal file
1316
manuals/bc/EHN.1
Normal file
File diff suppressed because it is too large
Load Diff
1067
manuals/bc/EHN.1.md
Normal file
1067
manuals/bc/EHN.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1309
manuals/bc/EHNP.1
Normal file
1309
manuals/bc/EHNP.1
Normal file
File diff suppressed because it is too large
Load Diff
1061
manuals/bc/EHNP.1.md
Normal file
1061
manuals/bc/EHNP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1316
manuals/bc/EHP.1
Normal file
1316
manuals/bc/EHP.1
Normal file
File diff suppressed because it is too large
Load Diff
1069
manuals/bc/EHP.1.md
Normal file
1069
manuals/bc/EHP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1334
manuals/bc/EN.1
Normal file
1334
manuals/bc/EN.1
Normal file
File diff suppressed because it is too large
Load Diff
1083
manuals/bc/EN.1.md
Normal file
1083
manuals/bc/EN.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1327
manuals/bc/ENP.1
Normal file
1327
manuals/bc/ENP.1
Normal file
File diff suppressed because it is too large
Load Diff
1077
manuals/bc/ENP.1.md
Normal file
1077
manuals/bc/ENP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
1334
manuals/bc/EP.1
Normal file
1334
manuals/bc/EP.1
Normal file
File diff suppressed because it is too large
Load Diff
1085
manuals/bc/EP.1.md
Normal file
1085
manuals/bc/EP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2079
manuals/bc/H.1
Normal file
2079
manuals/bc/H.1
Normal file
File diff suppressed because it is too large
Load Diff
1680
manuals/bc/H.1.md
Normal file
1680
manuals/bc/H.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2072
manuals/bc/HN.1
Normal file
2072
manuals/bc/HN.1
Normal file
File diff suppressed because it is too large
Load Diff
1672
manuals/bc/HN.1.md
Normal file
1672
manuals/bc/HN.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2065
manuals/bc/HNP.1
Normal file
2065
manuals/bc/HNP.1
Normal file
File diff suppressed because it is too large
Load Diff
1666
manuals/bc/HNP.1.md
Normal file
1666
manuals/bc/HNP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2072
manuals/bc/HP.1
Normal file
2072
manuals/bc/HP.1
Normal file
File diff suppressed because it is too large
Load Diff
1674
manuals/bc/HP.1.md
Normal file
1674
manuals/bc/HP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2092
manuals/bc/N.1
Normal file
2092
manuals/bc/N.1
Normal file
File diff suppressed because it is too large
Load Diff
1689
manuals/bc/N.1.md
Normal file
1689
manuals/bc/N.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2085
manuals/bc/NP.1
Normal file
2085
manuals/bc/NP.1
Normal file
File diff suppressed because it is too large
Load Diff
1683
manuals/bc/NP.1.md
Normal file
1683
manuals/bc/NP.1.md
Normal file
File diff suppressed because it is too large
Load Diff
2092
manuals/bc/P.1
Normal file
2092
manuals/bc/P.1
Normal file
File diff suppressed because it is too large
Load Diff
1691
manuals/bc/P.1.md
Normal file
1691
manuals/bc/P.1.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -402,7 +402,7 @@ the others are, as the operators `$`, `@`, `H`, and `h`, respectively.
|
||||
In addition, this `bc` has the option of outputting in scientific notation or
|
||||
engineering notation. It can also take input in scientific or engineering
|
||||
notation. On top of that, it has a pseudo-random number generator. (See the
|
||||
[full manual](./bc.md) for more details.)
|
||||
full manual for more details.)
|
||||
|
||||
Extra operators, scientific notation, engineering notation, and the
|
||||
pseudo-random number generator can be disabled by passing either the `-E` flag
|
||||
@ -417,8 +417,7 @@ Both commands are equivalent.
|
||||
|
||||
This `bc` also has a larger library that is only enabled if extra operators and
|
||||
the pseudo-random number generator are. More information about the functions can
|
||||
be found in the [Extended Library](./bc.md#extended-library) section of the
|
||||
[full manual](./bc.md).
|
||||
be found in the Extended Library section of the full manual.
|
||||
|
||||
### Manpages
|
||||
|
||||
|
951
manuals/dc.1
951
manuals/dc.1
@ -1,951 +0,0 @@
|
||||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "DC" "1" "June 2020" "Gavin D. Howard" "General Commands Manual"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBdc\fR \- arbitrary\-precision reverse\-Polish notation calculator
|
||||
.
|
||||
.SH "SYNOPSIS"
|
||||
\fBdc\fR [\fB\-hiPvVx\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] [\fB\-\-interactive\fR] [\fB\-\-no\-prompt\fR] [\fB\-\-extended\-register\fR] [\fB\-e\fR \fIexpr\fR] [\fB\-\-expression=\fR\fIexpr\fR\.\.\.] [\fB\-f\fR \fIfile\fR\.\.\.] [\fB\-file=\fR\fIfile\fR\.\.\.] [\fIfile\fR\.\.\.]
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
dc(1) is an arbitrary\-precision calculator\. It uses a stack (reverse Polish notation) to store numbers and results of computations\. Arithmetic operations pop arguments off of the stack and push the results\.
|
||||
.
|
||||
.P
|
||||
If no files are given on the command\-line as extra arguments (i\.e\., not as \fB\-f\fR or \fB\-\-file\fR arguments), then dc(1) reads from \fBstdin\fR\. Otherwise, those files are processed, and dc(1) will then exit\.
|
||||
.
|
||||
.P
|
||||
This is different from the dc(1) on OpenBSD and possibly other dc(1) implementations, where \fB\-e\fR (\fB\-\-expression\fR) and \fB\-f\fR (\fB\-\-file\fR) arguments cause dc(1) to execute them and exit\. The reason for this is that this dc(1) allows users to set arguments in the environment variable \fBDC_ENV_ARGS\fR (see the ENVIRONMENT VARIABLES section)\. Any expressions given on the command\-line should be used to set up a standard environment\. For example, if a user wants the \fBscale\fR always set to \fB10\fR, they can set \fBDC_ENV_ARGS\fR to "\-e 10k", and this dc(1) will always start with a \fBscale\fR of \fB10\fR\.
|
||||
.
|
||||
.P
|
||||
If users want to have dc(1) exit after processing all input from \fB\-e\fR and \fB\-f\fR arguments (and their equivalents), then they can just simply add "\-e q" as the last command\-line argument or define the environment variable \fBDC_EXPR_EXIT\fR\.
|
||||
.
|
||||
.SH "OPTIONS"
|
||||
The following are the options that dc(1) accepts\.
|
||||
.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Prints a usage message and quits\.
|
||||
.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-V\fR, \fB\-\-version\fR
|
||||
Print the version information (copyright header) and exit\.
|
||||
.
|
||||
.TP
|
||||
\fB\-i\fR, \fB\-\-interactive\fR
|
||||
Forces interactive mode\. (See the INTERACTIVE MODE section\.)
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-P\fR, \fB\-\-no\-prompt\fR
|
||||
Disables the prompt in interactive mode\. This is mostly for those users that do not want a prompt or are not used to having them in \fBdc\fR\. Most of those users would want to put this option in \fBDC_ENV_ARGS\fR\.
|
||||
.
|
||||
.IP
|
||||
If the prompt has been disabled while building dc(1), this option is a no\-op\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-x\fR \fB\-\-extended\-register\fR
|
||||
Enables extended register mode\. See the REGISTERS section for more information\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-e\fR \fIexpr\fR, \fB\-\-expression\fR=\fIexpr\fR
|
||||
Evaluates \fBexpr\fR\. If multiple expressions are given, they are evaluated in order\. If files are given as well (see below), the expressions and files are evaluated in the order given\. This means that if a file is given before an expression, the file is read in and evaluated first\.
|
||||
.
|
||||
.IP
|
||||
In other dc(1) implementations, this option causes the program to execute the expressions and then exit\. This dc(1) does not, unless the \fBDC_EXPR_EXIT\fR is defined (see the ENVIRONMENT VARIABLES section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR
|
||||
Reads in \fBfile\fR and evaluates it\. If expressions are also given (see above), the expressions are evaluated in the order given\.
|
||||
.
|
||||
.IP
|
||||
In other dc(1) implementations, this option causes the program to execute the files and then exit\. This dc(1) does not, unless the \fBDC_EXPR_EXIT\fR is defined (see the ENVIRONMENT VARIABLES section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.P
|
||||
\fBNote\fR: long options are only accepted if dc(1) is built with them enabled\.
|
||||
.
|
||||
.SH "STDOUT"
|
||||
Any non\-error output is written to \fBstdout\fR\.
|
||||
.
|
||||
.P
|
||||
\fBNote\fR: Unlike other dc(1) implementations, this dc(1) will issue a fatal error (see the EXIT STATUS section) if it cannot write to \fBstdout\fR, so if \fBstdout\fR is closed, as in \fBdc <file> >&\-\fR, it will quit with an error\. This is done so that dc(1) can report problems when \fBstdout\fR is redirected to a file\.
|
||||
.
|
||||
.P
|
||||
If there are scripts that depend on the behavior of other dc(1) implementations, it is recommended that those scripts be changed to redirect \fBstdout\fR to \fB/dev/null\fR\.
|
||||
.
|
||||
.SH "STDERR"
|
||||
Any error output is written to \fBstderr\fR\.
|
||||
.
|
||||
.P
|
||||
\fBNote\fR: Unlike other dc(1) implementations, this dc(1) will issue a fatal error (see the EXIT STATUS section) if it cannot write to \fBstderr\fR, so if \fBstderr\fR is closed, as in \fBdc <file> 2>&\-\fR, it will quit with an error\. This is done so that dc(1) can report problems when \fBstderr\fR is redirected to a file\.
|
||||
.
|
||||
.P
|
||||
If there are scripts that depend on the behavior of other dc(1) implementations, it is recommended that those scripts be changed to redirect \fBstderr\fR to \fB/dev/null\fR\.
|
||||
.
|
||||
.SH "SYNTAX"
|
||||
\fBibase\fR is a register (see the REGISTERS section) determining how to interpret constant numbers\. It is the "input" base, or the number base used for interpreting input numbers\. \fBibase\fR is initially \fB10\fR\. The max allowable value for \fBibase\fR is \fB16\fR\. The min allowable value for \fBibase\fR is \fB2\fR\. The max allowable value for \fBibase\fR can be queried in dc(1) programs with the \fBT\fR command\.
|
||||
.
|
||||
.P
|
||||
\fBobase\fR is a register (see the REGISTERS section) determining how to output results\. It is the "output" base, or the number base used for outputting numbers\. \fBobase\fR is initially \fB10\fR\. The max allowable value for \fBobase\fR is \fBDC_BASE_MAX\fR\. The min allowable value for \fBobase\fR is \fB2\fR unless dc(1) was built with the extra math option\. If it was, then the min allowable value is \fB0\fR\. In this case, if \fBobase\fR is \fB0\fR, values are output in scientific notation, and if \fBobase\fR is \fB1\fR, values are output in engineering notation\. (Outputting in scientific or engineering notation are \fBnon\-portable extensions\fR\.) The max allowable value for \fBobase\fR can be queried in dc(1) programs with the \fBU\fR command\.
|
||||
.
|
||||
.P
|
||||
The \fBscale\fR of an expression is the number of digits in the result of the expression right of the decimal point, and \fBscale\fR is a register (see the REGISTERS section) that sets the precision of any operations (with exceptions)\. \fBscale\fR is initially \fB0\fR\. \fBscale\fR cannot be negative\. The max allowable value for \fBscale\fR can be queried in dc(1) programs with the \fBV\fR command\.
|
||||
.
|
||||
.P
|
||||
Each item in the input source code, either a number (see the NUMBERS section) or a command (see the COMMANDS section), is processed and executed, in order\. Input is processed immediately when entered\.
|
||||
.
|
||||
.P
|
||||
If dc(1) was built with the extra math option, there is an additional register named \fBseed\fR\. This is the current seed used by the pseudo\-random number generator\. If the current value of \fBseed\fR is queried and stored, then if it is assigned to \fBseed\fR later, the pseudo\-random number generator is guaranteed to produce the same sequence of pseudo\-random numbers that were generated after the value of \fBseed\fR was first queried\.
|
||||
.
|
||||
.P
|
||||
Multiple values assigned to \fBseed\fR can produce the same sequence of pseudo\-random numbers\. Likewise, when a value is assigned to \fBseed\fR, it is not guaranteed that querying \fBseed\fR immediately after will return the same value\. In addition, the value of \fBseed\fR will change after any call to the \fB'\fR or \fB"\fR commands\. The maximum integer returned by the \fB'\fR command can be queried with the \fBW\fR command\.
|
||||
.
|
||||
.P
|
||||
\fBNote\fR: The values returned by the pseudo\-random number generator with the \fB'\fR and \fB"\fR commands are guaranteed to \fBNOT\fR be cryptographically\-secure\. This is a consequence of using a seeded pseudo\-random number generator\. However, they \fBare\fR guaranteed to be reproducible with identical \fBseed\fR values\.
|
||||
.
|
||||
.P
|
||||
The pseudo\-random number generator, \fBseed\fR, and all associated operations are \fBnon\-portable extensions\fR\.
|
||||
.
|
||||
.SS "Comments"
|
||||
Comments go from \fB#\fR until, and not including, the next newline\. This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.SH "NUMBERS"
|
||||
Numbers are strings made up of digits, uppercase letters up to \fBF\fR, and at most \fB1\fR period for a radix\. Numbers can have up to \fBDC_NUM_MAX\fR digits\. Uppercase letters equal \fB9\fR + their position in the alphabet (i\.e\., \fBA\fR equals \fB10\fR, or \fB9 + 1\fR)\. If a digit or letter makes no sense with the current value of \fBibase\fR, they are set to the value of the highest valid digit in \fBibase\fR\.
|
||||
.
|
||||
.P
|
||||
Single\-character numbers (i\.e\., \fBA\fR) take the value that they would have if they were valid digits, regardless of the value of \fBibase\fR\. This means that \fBA\fR always equals decimal \fB10\fR and \fBF\fR always equals decimal \fB15\fR\.
|
||||
.
|
||||
.P
|
||||
In addition, if dc(1) was built with the extra math option, it accepts numbers in scientific notation\. For dc(1), an example is \fB1\.89237e9\fR, which is equal to \fB1892370000\fR\. Negative exponents are also allowed, so \fB4\.2890e_3\fR is equal to \fB0\.0042890\fR\.
|
||||
.
|
||||
.P
|
||||
\fBWARNING\fR: Both the number and the exponent in scientific notation are interpreted according to the current \fBibase\fR, but the number is still multiplied by \fB10^exponent\fR regardless of the current \fBibase\fR\. For example, if \fBibase\fR is \fB16\fR and dc(1) is given the number string \fB"FFeA"\fR, the resulting decimal number will be \fB2550000000000\fR, and if dc(1) is given the number string \fB"10e_4"\fR, the resulting decimal number will be \fB0\.0016\fR\.
|
||||
.
|
||||
.P
|
||||
Accepting input as scientific notation is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.SH "COMMANDS"
|
||||
The valid commands are listed below\.
|
||||
.
|
||||
.SS "Printing"
|
||||
These commands are used for printing\.
|
||||
.
|
||||
.P
|
||||
Note that if dc(1) has been built with the extra math option enabled, both scientific notation and engineering notation are available for printing numbers\. Scientific notation is activated by assigning \fB0\fR to \fBobase\fR using \fB0o\fR (in any other context, an \fBobase\fR of \fB0\fR is invalid), and engineering notation is activated by assigning \fB1\fR to \fBobase\fR using \fB1o\fR (which is also invalid in any other context)\. To deactivate them, just assign a different value to \fBobase\fR\.
|
||||
.
|
||||
.P
|
||||
Printing numbers in scientific notation and/or engineering notation is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBp\fR
|
||||
Prints the value on top of the stack, whether number or string, and prints a newline after\.
|
||||
.
|
||||
.IP
|
||||
This does not alter the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBn\fR
|
||||
Prints the value on top of the stack, whether number or string, and pops it off of the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBP\fR
|
||||
Pops a value off the stack\.
|
||||
.
|
||||
.IP
|
||||
If the value is a number, it is truncated and the absolute value of the result is printed as though \fBobase\fR is \fBUCHAR_MAX + 1\fR and each digit is interpreted as an ASCII character, making it a byte stream\.
|
||||
.
|
||||
.IP
|
||||
If the value is a string, it is printed without a trailing newline\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBf\fR
|
||||
Prints the entire contents of the stack, in order from newest to oldest, without altering anything\.
|
||||
.
|
||||
.IP
|
||||
Users should use this command when they get lost\.
|
||||
.
|
||||
.SS "Arithmetic"
|
||||
These are the commands used for arithmetic\.
|
||||
.
|
||||
.TP
|
||||
\fB+\fR
|
||||
The top two values are popped off the stack, added, and the result is pushed onto the stack\. The \fBscale\fR of the result is equal to the max \fBscale\fR of both operands\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\fR
|
||||
The top two values are popped off the stack, subtracted, and the result is pushed onto the stack\. The \fBscale\fR of the result is equal to the max \fBscale\fR of both operands\.
|
||||
.
|
||||
.TP
|
||||
\fB*\fR
|
||||
The top two values are popped off the stack, multiplied, and the result is pushed onto the stack\. If \fBa\fR is the \fBscale\fR of the first expression and \fBb\fR is the \fBscale\fR of the second expression, the \fBscale\fR of the result is equal to \fBmin(a+b,max(scale,a,b))\fR where \fBmin\fR and \fBmax\fR return the obvious values\.
|
||||
.
|
||||
.TP
|
||||
\fB/\fR
|
||||
The top two values are popped off the stack, divided, and the result is pushed onto the stack\. The \fBscale\fR of the result is equal to \fBscale\fR\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be non\-zero\.
|
||||
.
|
||||
.TP
|
||||
\fB%\fR
|
||||
The top two values are popped off the stack, remaindered, and the result is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
Remaindering is equivalent to 1) Computing \fBa/b\fR to current \fBscale\fR, and 2) Using the result of step 1 to calculate \fBa\-(a/b)*b\fR to \fBscale\fR \fBmax(scale + scale(b), scale(a))\fR\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be non\-zero\.
|
||||
.
|
||||
.TP
|
||||
\fB~\fR
|
||||
The top two values are popped off the stack, divided and remaindered, and the results (divided first, remainder second) are pushed onto the stack\. This is equivalent to \fBx y / x y %\fR except that \fBx\fR and \fBy\fR are only evaluated once\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be non\-zero\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB^\fR
|
||||
The top two values are popped off the stack, the second is raised to the power of the first, and the result is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be an integer, and if that value is negative, the second value popped off of the stack must be non\-zero\.
|
||||
.
|
||||
.TP
|
||||
\fBv\fR
|
||||
The top value is popped off the stack, its square root is computed, and the result is pushed onto the stack\. The \fBscale\fR of the result is equal to \fBscale\fR\.
|
||||
.
|
||||
.IP
|
||||
The value popped off of the stack must be non\-negative\.
|
||||
.
|
||||
.TP
|
||||
\fB_\fR
|
||||
If this command \fIimmediately\fR precedes a number (i\.e\., no spaces or other commands), then that number is input as a negative number\.
|
||||
.
|
||||
.IP
|
||||
Otherwise, the top value on the stack is popped and copied, and the copy is negated and pushed onto the stack\. This behavior without a number is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBb\fR
|
||||
The top value is popped off the stack, and if it is zero, it is pushed back onto the stack\. Otherwise, its absolute value is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB|\fR
|
||||
The top three values are popped off the stack, a modular exponentiation is computed, and the result is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
The first value popped is used as the reduction modulus and must be an integer and non\-zero\. The second value popped is used as the exponent and must be an integer and non\-negative\. The third value popped is the base and must be an integer\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB$\fR
|
||||
The top value is popped off the stack and copied, and the copy is truncated and pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB@\fR
|
||||
The top two values are popped off the stack, and the precision of the second is set to the value of the first, whether by truncation or extension\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be an integer and non\-negative\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBH\fR
|
||||
The top two values are popped off the stack, and the second is shifted left (radix shifted right) to the value of the first\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be an integer and non\-negative\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBh\fR
|
||||
The top two values are popped off the stack, and the second is shifted right (radix shifted left) to the value of the first\.
|
||||
.
|
||||
.IP
|
||||
The first value popped off of the stack must be an integer and non\-negative\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBG\fR
|
||||
The top two values are popped off of the stack, they are compared, and a \fB1\fR is pushed if they are equal, or \fB0\fR otherwise\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBN\fR
|
||||
The top value is popped off of the stack, and if it a \fB0\fR, a \fB1\fR is pushed; otherwise, a \fB0\fR is pushed\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB(\fR
|
||||
The top two values are popped off of the stack, they are compared, and a \fB1\fR is pushed if the first is less than the second, or \fB0\fR otherwise\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB{\fR
|
||||
The top two values are popped off of the stack, they are compared, and a \fB1\fR is pushed if the first is less than or equal to the second, or \fB0\fR otherwise\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB)\fR
|
||||
The top two values are popped off of the stack, they are compared, and a \fB1\fR is pushed if the first is greater than the second, or \fB0\fR otherwise\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB}\fR
|
||||
The top two values are popped off of the stack, they are compared, and a \fB1\fR is pushed if the first is greater than or equal to the second, or \fB0\fR otherwise\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBM\fR
|
||||
The top two values are popped off of the stack\. If they are both non\-zero, a \fB1\fR is pushed onto the stack\. If either of them is zero, or both of them are, then a \fB0\fR is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
This is like the \fB&&\fR operator in bc(1), and it is not a short\-circuit operator\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBm\fR
|
||||
The top two values are popped off of the stack\. If at least one of them is non\-zero, a \fB1\fR is pushed onto the stack\. If both of them are zero, then a \fB0\fR is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
This is like the \fB||\fR operator in bc(1), and it is not a short\-circuit operator\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.SS "Pseudo\-Random Number Generator"
|
||||
If dc(1) was built with the extra math option, it has a built\-in pseudo\-random number generator\. These commands query the pseudo\-random number generator\. (See Parameters for more information about the \fBseed\fR value that controls the pseudo\-random number generator\.)
|
||||
.
|
||||
.P
|
||||
The pseudo\-random number generator is guaranteed to \fBNOT\fR be cryptographically\-secure\.
|
||||
.
|
||||
.TP
|
||||
\fB'\fR
|
||||
Generates an integer between 0 and \fBDC_RAND_MAX\fR, inclusive (see the LIMITS section)\.
|
||||
.
|
||||
.IP
|
||||
The generated integer is made as unbiased as possible, subject to the limitations of the pseudo\-random number generator\.
|
||||
.
|
||||
.IP
|
||||
This command is only available if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB"\fR
|
||||
Pops a value off of the stack, which is used as an \fBexclusive\fR upper bound on the integer that will be generated\. If the bound is negative or is a non\-integer, an error is raised, and dc(1) resets (see the RESET section)\. If the bound is larger than \fBDC_RAND_MAX\fR, the higher bound is honored by generating several pseudo\-random integers, multiplying them by appropriate powers of \fBDC_RAND_MAX + 1\fR, and adding them together\. Thus, the size of integer that can be generated with this command is unbounded\. Using this command will change the value of \fBseed\fR\.
|
||||
.
|
||||
.IP
|
||||
If the operand is \fB0\fR or \fB1\fR, then the result pushed onto the stack is \fB0\fR, and \fBseed\fR is not changed\.
|
||||
.
|
||||
.IP
|
||||
The generated integer is made as unbiased as possible, subject to the limitations of the pseudo\-random number generator\.
|
||||
.
|
||||
.IP
|
||||
This command is only available if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.SS "Stack Control"
|
||||
These commands control the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBc\fR
|
||||
Removes all items from ("clears") the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBd\fR
|
||||
Copies the item on top of the stack ("duplicates") and pushes the copy onto the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBr\fR
|
||||
Swaps ("reverses") the two top items on the stack\.
|
||||
.
|
||||
.TP
|
||||
\fBR\fR
|
||||
Pops ("removes") the top value from the stack\.
|
||||
.
|
||||
.SS "Register Control"
|
||||
These commands control registers (see the REGISTERS section)\.
|
||||
.
|
||||
.TP
|
||||
\fBs\fR\fIr\fR
|
||||
Pops the value off the top of the stack and stores it into register \fBr\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBl\fR\fIr\fR
|
||||
Copies the value in register \fBr\fR and pushes it onto the stack\. This does not alter the contents of \fBr\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBS\fR\fIr\fR
|
||||
Pops the value off the top of the (main) stack and pushes it onto the stack of register \fBr\fR\. The previous value of the register becomes inaccessible\.
|
||||
.
|
||||
.TP
|
||||
\fBL\fR\fIr\fR
|
||||
Pops the value off the top of the stack for register \fBr\fR and push it onto the main stack\. The previous value in the stack for register \fBr\fR, if any, is now accessible via the \fBl\fR\fIr\fR command\.
|
||||
.
|
||||
.SS "Parameters"
|
||||
These commands control the values of \fBibase\fR, \fBobase\fR, \fBscale\fR, and \fBseed\fR (if dc(1) was built with the extra math option)\. Also see the SYNTAX section\.
|
||||
.
|
||||
.TP
|
||||
\fBi\fR
|
||||
Pops the value off of the top of the stack and uses it to set \fBibase\fR, which must be between \fB2\fR and \fB16\fR, inclusive\.
|
||||
.
|
||||
.IP
|
||||
If the value on top of the stack has any \fBscale\fR, the \fBscale\fR is ignored\.
|
||||
.
|
||||
.TP
|
||||
\fBo\fR
|
||||
Pops the value off of the top of the stack and uses it to set \fBobase\fR, which must be between \fB2\fR and \fBDC_BASE_MAX\fR, inclusive (see bc(1))\. The value can be either \fB0\fR or \fB1\fR if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
If the value on top of the stack has any \fBscale\fR, the \fBscale\fR is ignored\.
|
||||
.
|
||||
.TP
|
||||
\fBk\fR
|
||||
Pops the value off of the top of the stack and uses it to set \fBscale\fR, which must be non\-negative\.
|
||||
.
|
||||
.IP
|
||||
If the value on top of the stack has any \fBscale\fR, the \fBscale\fR is ignored\.
|
||||
.
|
||||
.TP
|
||||
\fBj\fR
|
||||
Pops the value off of the top of the stack and uses it to set \fBseed\fR\. The meaning of \fBseed\fR is dependent on the current pseudo\-random number generator but is guaranteed to not change except for new major versions\.
|
||||
.
|
||||
.IP
|
||||
The \fBscale\fR of the value may be significant\.
|
||||
.
|
||||
.IP
|
||||
If a previously used \fBseed\fR value is used again, the pseudo\-random number generator is guaranteed to produce the same sequence of pseudo\-random numbers as it did when the \fBseed\fR value was previously used\.
|
||||
.
|
||||
.IP
|
||||
The exact value assigned to \fBseed\fR is not guaranteed to be returned if the \fBJ\fR command is used\. However, if \fBseed\fR \fIdoes\fR return a different value, both values, when assigned to \fBseed\fR, are guaranteed to produce the same sequence of pseudo\-random numbers\. This means that certain values assigned to \fBseed\fR will not produce unique sequences of pseudo\-random numbers\.
|
||||
.
|
||||
.IP
|
||||
There is no limit to the length (number of significant decimal digits) or \fIscale\fR of the value that can be assigned to \fBseed\fR\.
|
||||
.
|
||||
.IP
|
||||
This command is only available if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBI\fR
|
||||
Pushes the current value of \fBibase\fR onto the main stack\.
|
||||
.
|
||||
.TP
|
||||
\fBO\fR
|
||||
Pushes the current value of \fBobase\fR onto the main stack\.
|
||||
.
|
||||
.TP
|
||||
\fBK\fR
|
||||
Pushes the current value of \fBscale\fR onto the main stack\.
|
||||
.
|
||||
.TP
|
||||
\fBJ\fR
|
||||
Pushes the current value of \fBseed\fR onto the main stack\.
|
||||
.
|
||||
.IP
|
||||
This command is only available if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBT\fR
|
||||
Pushes the maximum allowable value of \fBibase\fR onto the main stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBU\fR
|
||||
Pushes the maximum allowable value of \fBobase\fR onto the main stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBV\fR
|
||||
Pushes the maximum allowable value of \fBscale\fR onto the main stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBW\fR
|
||||
Pushes the maximum (inclusive) integer that can be generated with the \fB'\fR pseudo\-random number generator command\.
|
||||
.
|
||||
.IP
|
||||
This command is only available if dc(1) was built with the extra math option\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.SS "Strings"
|
||||
The following commands control strings\.
|
||||
.
|
||||
.P
|
||||
dc(1) can work with both numbers and strings, and registers (see the REGISTERS section) can hold both strings and numbers\. dc(1) always knows whether the contents of a register are a string or a number\.
|
||||
.
|
||||
.P
|
||||
While arithmetic operations have to have numbers, and will print an error if given a string, other commands accept strings\.
|
||||
.
|
||||
.P
|
||||
Strings can also be executed as macros\. For example, if the string \fB[1pR]\fR is executed as a macro, then the code \fB1pR\fR is executed, meaning that the \fB1\fR will be printed with a newline after and then popped from the stack\.
|
||||
.
|
||||
.TP
|
||||
\fB[\fR\fIcharacters\fR\fB]\fR
|
||||
Makes a string containing \fIcharacters\fR and pushes it onto the stack\.
|
||||
.
|
||||
.IP
|
||||
If there are brackets (\fB[\fR and \fB]\fR) in the string, then they must be balanced\. Unbalanced brackets can be escaped using a backslash (\fB\e\fR) character\.
|
||||
.
|
||||
.IP
|
||||
If there is a backslash character in the string, the character after it (even another backslash) is put into the string verbatim, but the (first) backslash is not\.
|
||||
.
|
||||
.TP
|
||||
\fBa\fR
|
||||
The value on top of the stack is popped\.
|
||||
.
|
||||
.IP
|
||||
If it is a number, it is truncated and its absolute value is taken\. The result mod \fBUCHAR_MAX + 1\fR is calculated\. If that result is \fB0\fR, push an empty string; otherwise, push a one\-character string where the character is the result of the mod interpreted as an ASCII character\.
|
||||
.
|
||||
.IP
|
||||
If it is a string, then a new string is made\. If the original string is empty, the new string is empty\. If it is not, then the first character of the original string is used to create the new string as a one\-character string\. The new string is then pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBx\fR
|
||||
Pops a value off of the top of the stack\.
|
||||
.
|
||||
.IP
|
||||
If it is a number, it is pushed onto the stack\.
|
||||
.
|
||||
.IP
|
||||
If it is a string, it is executed as a macro\.
|
||||
.
|
||||
.IP
|
||||
This behavior is the norm whenever a macro is executed, whether by this command or by the conditional execution commands below\.
|
||||
.
|
||||
.TP
|
||||
\fB>\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is greater than the second, then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
For example, \fB0 1>a\fR will execute the contents of register \fBa\fR, and \fB1 0>a\fR will not\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB>\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB!>\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is not greater than the second (less than or equal to), then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB!>\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB<\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is less than the second, then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB<\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB!<\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is not less than the second (greater than or equal to), then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB!<\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB=\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is equal to the second, then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB=\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB!=\fR\fIr\fR
|
||||
Pops two values off of the stack that must be numbers and compares them\. If the first value is not equal to the second, then the contents of register \fBr\fR are executed\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.TP
|
||||
\fB!=\fR\fIr\fR\fBe\fR\fIs\fR
|
||||
Like the above, but will execute register \fBs\fR if the comparison fails\.
|
||||
.
|
||||
.IP
|
||||
If either or both of the values are not numbers, dc(1) will raise an error and reset (see the RESET section)\.
|
||||
.
|
||||
.IP
|
||||
This is a \fBnon\-portable extension\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB?\fR
|
||||
Reads a line from the \fBstdin\fR and executes it\. This is to allow macros to request input from users\.
|
||||
.
|
||||
.TP
|
||||
\fBq\fR
|
||||
During execution of a macro, this exits the execution of that macro and the execution of the macro that executed it\. If there are no macros, or only one macro executing, dc(1) exits\.
|
||||
.
|
||||
.TP
|
||||
\fBQ\fR
|
||||
Pops a value from the stack which must be non\-negative and is used the number of macro executions to pop off of the execution stack\. If the number of levels to pop is greater than the number of executing macros, dc(1) exits\.
|
||||
.
|
||||
.SS "Status"
|
||||
These commands query status of the stack or its top value\.
|
||||
.
|
||||
.TP
|
||||
\fBZ\fR
|
||||
Pops a value off of the stack\.
|
||||
.
|
||||
.IP
|
||||
If it is a number, calculates the number of significant decimal digits it has and pushes the result\.
|
||||
.
|
||||
.IP
|
||||
If it is a string, pushes the number of characters the string has\.
|
||||
.
|
||||
.TP
|
||||
\fBX\fR
|
||||
Pops a value off of the stack\.
|
||||
.
|
||||
.IP
|
||||
If it is a number, pushes the \fBscale\fR of the value onto the stack\.
|
||||
.
|
||||
.IP
|
||||
If it is a string, pushes \fB0\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBz\fR
|
||||
Pushes the current stack depth (before execution of this command)\.
|
||||
.
|
||||
.SS "Arrays"
|
||||
These commands manipulate arrays\.
|
||||
.
|
||||
.TP
|
||||
\fB:\fR\fIr\fR
|
||||
Pops the top two values off of the stack\. The second value will be stored in the array \fBr\fR (see the REGISTERS section), indexed by the first value\.
|
||||
.
|
||||
.TP
|
||||
\fB;\fR\fIr\fR
|
||||
Pops the value on top of the stack and uses it as an index into the array \fBr\fR\. The selected value is then pushed onto the stack\.
|
||||
.
|
||||
.SH "REGISTERS"
|
||||
Registers are names that can store strings, numbers, and arrays\. (Number/string registers do not interfere with array registers\.)
|
||||
.
|
||||
.P
|
||||
Each register is also its own stack, so the current register value is the top of the stack for the register\. All registers, when first referenced, have one value (\fB0\fR) in their stack\.
|
||||
.
|
||||
.P
|
||||
In non\-extended register mode, a register name is just the single character that follows any command that needs a register name\. The only exception is a newline (\fB\'\en\'\fR); it is a parse error for a newline to be used as a register name\.
|
||||
.
|
||||
.SS "Extended Register Mode"
|
||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited amounts of registers, if extended register mode is enabled\.
|
||||
.
|
||||
.P
|
||||
If extended register mode is enabled (\fB\-x\fR or \fB\-\-extended\-register\fR command\-line arguments are given), then normal single character registers are used \fB\fIunless\fR\fR the character immediately following a command that needs a register name is a space (according to \fBisspace()\fR) and not a newline (\fB\'\en\'\fR)\.
|
||||
.
|
||||
.P
|
||||
In that case, the register name is found according to the regex \fB[a\-z][a\-z0\-9_]*\fR (like bc(1)), and it is a parse error if the next non\-space characters do not match that regex\.
|
||||
.
|
||||
.SH "RESET"
|
||||
When dc(1) encounters an error or a signal that it has a non\-default handler for, it resets\. This means that several things happen\.
|
||||
.
|
||||
.P
|
||||
First, any macros that are executing are stopped and popped off the stack\. The behavior is not unlike that of exceptions in programming languages\. Then the execution point is set so that any code waiting to execute (after all functions returned) is skipped\.
|
||||
.
|
||||
.P
|
||||
Thus, when dc(1) resets, it skips any remaining code waiting to be executed\. Then, if it is interactive mode, and the error was not a fatal error (see the EXIT STATUS section), it asks for more input; otherwise, it exits with the appropriate return code\.
|
||||
.
|
||||
.SH "PERFORMANCE"
|
||||
Most dc(1) implementations use \fBchar\fR types to calculate the value of \fB1\fR decimal digit at a time, but that can be slow\. This dc(1) does something different\.
|
||||
.
|
||||
.P
|
||||
It uses large integers to calculate more than \fB1\fR decimal digit at a time\. If built in a environment where \fBDC_LONG_BIT\fR (see the LIMITS section) is \fB64\fR, then each integer has \fB9\fR decimal digits\. If built in an environment where \fBDC_LONG_BIT\fR is \fB32\fR then each integer has \fB4\fR decimal digits\. This value (the number of decimal digits per large integer) is called \fBDC_BASE_DIGS\fR\.
|
||||
.
|
||||
.P
|
||||
In addition, this dc(1) uses an even larger integer for overflow checking\. This integer type depends on the value of \fBDC_LONG_BIT\fR, but is always at least twice as large as the integer type used to store digits\.
|
||||
.
|
||||
.SH "LIMITS"
|
||||
The following are the limits on dc(1):
|
||||
.
|
||||
.TP
|
||||
\fBDC_LONG_BIT\fR
|
||||
The number of bits in the \fBlong\fR type in the environment where dc(1) was built\. This determines how many decimal digits can be stored in a single large integer (see the PERFORMANCE section)\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_BASE_DIGS\fR
|
||||
The number of decimal digits per large integer (see the PERFORMANCE section)\. Depends on \fBDC_LONG_BIT\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_BASE_POW\fR
|
||||
The max decimal number that each large integer can store (see \fBDC_BASE_DIGS\fR) plus \fB1\fR\. Depends on \fBDC_BASE_DIGS\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_OVERFLOW_MAX\fR
|
||||
The max number that the overflow type (see the PERFORMANCE section) can hold\. Depends on \fBDC_LONG_BIT\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_BASE_DIGS\fR
|
||||
The number of decimal digits per large integer (see the PERFORMANCE section)\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_BASE_MAX\fR
|
||||
The maximum output base\. Set at \fBDC_BASE_POW\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_DIM_MAX\fR
|
||||
The maximum size of arrays\. Set at \fBSIZE_MAX\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_SCALE_MAX\fR
|
||||
The maximum \fBscale\fR\. Set at \fBDC_OVERFLOW_MAX\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_STRING_MAX\fR
|
||||
The maximum length of strings\. Set at \fBDC_OVERFLOW_MAX\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_NAME_MAX\fR
|
||||
The maximum length of identifiers\. Set at \fBDC_OVERFLOW_MAX\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_NUM_MAX\fR
|
||||
The maximum length of a number (in decimal digits), which includes digits after the decimal point\. Set at \fBDC_OVERFLOW_MAX\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_RAND_MAX\fR
|
||||
The maximum integer (inclusive) returned by the \fB'\fR command, if dc(1) has been built with the extra math option\. Set at \fB2^DC_LONG_BIT\-1\fR\.
|
||||
.
|
||||
.TP
|
||||
Exponent
|
||||
The maximum allowable exponent (positive or negative)\. Set at \fBDC_OVERFLOW_MAX\fR\.
|
||||
.
|
||||
.TP
|
||||
Number of vars
|
||||
The maximum number of vars/arrays\. Set at \fBSIZE_MAX\-1\fR\.
|
||||
.
|
||||
.P
|
||||
These limits are meant to be effectively non\-existent; the limits are so 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"
|
||||
dc(1) recognizes the following environment variables:
|
||||
.
|
||||
.TP
|
||||
\fBDC_ENV_ARGS\fR
|
||||
This is another way to give command\-line arguments to dc(1)\. They should be in the same format as all other command\-line arguments\. These are always processed first, so any files given in \fBDC_ENV_ARGS\fR will be processed before arguments and files given on the command\-line\. This gives the user the ability to set up "standard" options and files to be used at every invocation\. The most useful thing for such files to contain would be useful functions that the user might want every time dc(1) runs\. Another use would be to use the \fB\-e\fR option to set \fBscale\fR to a value other than \fB0\fR\.
|
||||
.
|
||||
.IP
|
||||
The code that parses \fBDC_ENV_ARGS\fR will correctly handle quoted arguments, but it does not understand escape sequences\. For example, the string \fB"/home/gavin/some dc file\.dc"\fR will be correctly parsed, but the string \fB"/home/gavin/some \e"dc\e" file\.dc"\fR will include the backslashes\.
|
||||
.
|
||||
.IP
|
||||
The quote parsing will handle either kind of quotes, \fB'\fR or \fB"\fR\. Thus, if you have a file with any number of single quotes in the name, you can use double quotes as the outside quotes, as in \fB"some \'bc\' file\.bc"\fR, and vice versa if you have a file with double quotes\. However, handling a file with both kinds of quotes in \fBDC_ENV_ARGS\fR is not supported due to the complexity of the parsing, though such files are still supported on the command\-line where the parsing is done by the shell\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_LINE_LENGTH\fR
|
||||
If this environment variable exists and contains an integer that is greater than \fB1\fR and is less than \fBUINT16_MAX\fR (\fB2^16\-1\fR), dc(1) will output lines to that length, including the backslash newline combo\. The default line length is \fB70\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBDC_EXPR_EXIT\fR
|
||||
If this variable exists (no matter the contents), dc(1) will exit immediately after executing expressions and files given by the \fB\-e\fR and/or \fB\-f\fR command\-line options (and any equivalents)\.
|
||||
.
|
||||
.SH "EXIT STATUS"
|
||||
dc(1) returns the following exit statuses:
|
||||
.
|
||||
.TP
|
||||
\fB0\fR
|
||||
No error\.
|
||||
.
|
||||
.TP
|
||||
\fB1\fR
|
||||
A math error occurred\. This follows standard practice of using \fB1\fR for expected errors, since math errors will happen in the process of normal execution\.
|
||||
.
|
||||
.IP
|
||||
Math errors include divide by \fB0\fR, taking the square root of a negative number, using a negative number as a bound for the pseudo\-random number generator, attempting to convert a negative number to a hardware integer, overflow when converting a number to a hardware integer, and attempting to use a non\-integer where an integer is required\.
|
||||
.
|
||||
.IP
|
||||
Converting to a hardware integer happens for the second operand of the power (\fB^\fR), places (\fB@\fR), left shift (\fBH\fR), and right shift (\fBh\fR) operators\.
|
||||
.
|
||||
.TP
|
||||
\fB2\fR
|
||||
A parse error occurred\.
|
||||
.
|
||||
.IP
|
||||
Parse errors include unexpected \fBEOF\fR, using an invalid character, failing to find the end of a string or comment, and using a token where it is invalid\.
|
||||
.
|
||||
.TP
|
||||
\fB3\fR
|
||||
A runtime error occurred\.
|
||||
.
|
||||
.IP
|
||||
Runtime errors include assigning an invalid number to \fBibase\fR, \fBobase\fR, or \fBscale\fR; give a bad expression to a \fBread()\fR call, calling \fBread()\fR inside of a \fBread()\fR call, type errors, and attempting an operation when the stack has too few elements\.
|
||||
.
|
||||
.TP
|
||||
\fB4\fR
|
||||
A fatal error occurred\.
|
||||
.
|
||||
.IP
|
||||
Fatal errors include memory allocation errors, I/O errors, failing to open files, attempting to use files that do not have only ASCII characters (dc(1) only accepts ASCII characters), attempting to open a directory as a file, and giving invalid command\-line options\.
|
||||
.
|
||||
.P
|
||||
The exit status \fB4\fR is special; when a fatal error occurs, dc(1) always exits and returns \fB4\fR, no matter what mode dc(1) is in\.
|
||||
.
|
||||
.P
|
||||
The other statuses will only be returned when dc(1) is not in interactive mode (see the INTERACTIVE MODE section), since dc(1) resets its state (see the RESET section) and accepts more input when one of those errors occurs in interactive mode\. This is also the case when interactive mode is forced by the \fB\-i\fR flag or \fB\-\-interactive\fR option\.
|
||||
.
|
||||
.P
|
||||
These exit statuses allow dc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the \fB\-i\fR flag or \fB\-\-interactive\fR option\.
|
||||
.
|
||||
.SH "INTERACTIVE MODE"
|
||||
Like bc(1), dc(1) has an interactive mode and a non\-interactive mode\. Interactive mode is turned on automatically when both \fBstdin\fR and \fBstdout\fR are hooked to a terminal, but the \fB\-i\fR flag and \fB\-\-interactive\fR option can turn it on in other cases\.
|
||||
.
|
||||
.P
|
||||
In interactive mode, dc(1) attempts to recover from errors (see the RESET section), and in normal execution, flushes \fBstdout\fR as soon as execution is done for the current input\.
|
||||
.
|
||||
.SH "TTY MODE"
|
||||
If \fBstdin\fR, \fBstdout\fR, and \fBstderr\fR are all connected to a TTY, dc(1) turns on "TTY mode\."
|
||||
.
|
||||
.P
|
||||
TTY mode is required for history to be enabled (see the COMMAND LINE HISTORY section)\. It is also required to enable special handling for \fBSIGINT\fR signals\.
|
||||
.
|
||||
.P
|
||||
TTY mode is different from interactive mode because interactive mode is required in the bc(1) specification \fIhttps://pubs\.opengroup\.org/onlinepubs/9699919799/utilities/bc\.html\fR, and interactive mode requires only \fBstdin\fR and \fBstdout\fR to be connected to a terminal\.
|
||||
.
|
||||
.SH "SIGNAL HANDLING"
|
||||
Sending a \fBSIGINT\fR will cause dc(1) to stop execution of the current input\. If dc(1) is in TTY mode (see the TTY MODE section), it will reset (see the RESET section)\. Otherwise, it will clean up and exit\.
|
||||
.
|
||||
.P
|
||||
Note that "current input" can mean one of two things\. If dc(1) is processing input from \fBstdin\fR in TTY mode, it will ask for more input\. If dc(1) is processing input from a file in TTY mode, it will stop processing the file and start processing the next file, if one exists, or ask for input from \fBstdin\fR if no other file exists\.
|
||||
.
|
||||
.P
|
||||
This means that if a \fBSIGINT\fR is sent to dc(1) as it is executing a file, it can seem as though dc(1) did not respond to the signal since it will immediately start executing the next file\. This is by design; most files that users execute when interacting with dc(1) have function definitions, which are quick to parse\. If a file takes a long time to execute, there may be a bug in that file\. The rest of the files could still be executed without problem, allowing the user to continue\.
|
||||
.
|
||||
.P
|
||||
\fBSIGTERM\fR and \fBSIGQUIT\fR cause dc(1) to clean up and exit, and it uses the default handler for all other signals\. The one exception is \fBSIGHUP\fR, if dc(1) was built with history support; in that case, when dc(1) is in TTY mode, a \fBSIGHUP\fR will cause dc(1) to clean up and exit\.
|
||||
.
|
||||
.SH "COMMAND LINE HISTORY"
|
||||
dc(1) supports interactive command\-line editing, if compiled with the history option enabled\. If dc(1) is in TTY mode (see the TTY MODE section), history is enabled\. Previous lines can be recalled and edited with the arrow keys\.
|
||||
.
|
||||
.P
|
||||
\fBNote\fR: when dc(1) is built with history support, tabs are converted to 8 spaces\.
|
||||
.
|
||||
.SH "LOCALES"
|
||||
This dc(1) ships with support for adding error messages for different locales\.
|
||||
.
|
||||
.SH "SEE ALSO"
|
||||
bc(1)
|
||||
.
|
||||
.SH "STANDARDS"
|
||||
The dc(1) utility operators are compliant with the operators in the bc(1) IEEE Std 1003\.1\-2017 (“POSIX\.1\-2017”) \fIhttps://pubs\.opengroup\.org/onlinepubs/9699919799/utilities/bc\.html\fR specification\.
|
||||
.
|
||||
.SH "AUTHOR"
|
||||
This dc(1) was made from scratch by Gavin D\. Howard\.
|
||||
.
|
||||
.SH "BUGS"
|
||||
None are known\. Report bugs at https://git\.yzena\.com/gavin/bc\.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user