OpenBSD CVS

CVS log for src/usr.bin/dc/bcode.c


[BACK] Up to [local] / src / usr.bin / dc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.63 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:10 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.62: +1 -2 lines
Diff to previous 1.62 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.62 / (download) - annotate - [select for diffs], Fri Dec 29 08:16:55 2017 UTC (6 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.61: +5 -5 lines
Diff to previous 1.61 (colored)

small optimization in bexp; from kshe

Revision 1.61 / (download) - annotate - [select for diffs], Tue Dec 12 19:07:10 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.60: +17 -23 lines
Diff to previous 1.60 (colored)

Minor cleanup from kshe

Revision 1.60 / (download) - annotate - [select for diffs], Tue Dec 12 18:58:59 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.59: +15 -28 lines
Diff to previous 1.59 (colored)

optimize add, sub and mul; from kshe; ok tom@

Revision 1.59 / (download) - annotate - [select for diffs], Tue Dec 5 14:05:22 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.58: +18 -50 lines
Diff to previous 1.58 (colored)

use a global BN_CTX; from kshe with a twist from myself

Revision 1.58 / (download) - annotate - [select for diffs], Sat Dec 2 12:43:18 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

make 0Z do what the original dc and gnu bcc do; ok tom@

Revision 1.57 / (download) - annotate - [select for diffs], Fri Dec 1 19:04:15 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.56: +52 -20 lines
Diff to previous 1.56 (colored)

fix buglet in split_number() and optimize count_digits();
from kshe with a twist from myself; ok tb@

Revision 1.56 / (download) - annotate - [select for diffs], Wed Nov 29 19:13:31 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.55: +12 -27 lines
Diff to previous 1.55 (colored)

fold bsqrt_stop into bsqrt; from kshe; ok tom@

Revision 1.55 / (download) - annotate - [select for diffs], Tue Nov 28 17:43:45 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

zap newline in warn(); from kshe

Revision 1.54 / (download) - annotate - [select for diffs], Tue Nov 28 09:44:14 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.53: +3 -6 lines
Diff to previous 1.53 (colored)

zap dead stores; prompted by a diff from kshe

Revision 1.53 / (download) - annotate - [select for diffs], Tue Nov 28 08:03:01 2017 UTC (6 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.52: +6 -27 lines
Diff to previous 1.52 (colored)

garbage collect a few functions that are not really needed; from kshe

Revision 1.52 / (download) - annotate - [select for diffs], Mon Nov 27 21:32:33 2017 UTC (6 years, 5 months ago) by tom
Branch: MAIN
Changes since 1.51: +17 -8 lines
Diff to previous 1.51 (colored)

Safer handling of the jump_table[] in dc's bcode.c

Based on a diff sent to tech@ by kshe59 (at)zoho (dot) eu - thanks

ok otto@, who also remembered to check the regression tests

Revision 1.51 / (download) - annotate - [select for diffs], Sun Feb 26 11:29:55 2017 UTC (7 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.50: +4 -4 lines
Diff to previous 1.50 (colored)

Move away from BN_zero, the one returning an int is deprecated and the
new one is a void function. From Daniel Cegielka.

Revision 1.50 / (download) - annotate - [select for diffs], Thu Feb 23 06:40:17 2017 UTC (7 years, 2 months ago) by otto
Branch: MAIN
Changes since 1.49: +15 -1 lines
Diff to previous 1.49 (colored)

Introduce e command, equivalent to p, but writes to stderr

Revision 1.49 / (download) - annotate - [select for diffs], Sun Mar 27 15:55:13 2016 UTC (8 years, 1 month ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.48: +15 -28 lines
Diff to previous 1.48 (colored)

some style(9) and redundant tests for NULL, from Michael W. Bombardieri

Revision 1.48 / (download) - annotate - [select for diffs], Sat Oct 3 16:24:53 2015 UTC (8 years, 7 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.47: +2 -10 lines
Diff to previous 1.47 (colored)

disable ! command, makes dc(1) more tameable

Revision 1.47 / (download) - annotate - [select for diffs], Mon Feb 16 20:53:34 2015 UTC (9 years, 3 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.46: +1 -2 lines
Diff to previous 1.46 (colored)

Include bn.h and err.h from <openssl/...>, not the old <ssl/...> location.

Remove unneeded ssl.h includes.  Also built-checked against openssl-1.0.1e.

ok otto@

Revision 1.46 / (download) - annotate - [select for diffs], Wed Oct 8 03:59:56 2014 UTC (9 years, 7 months ago) by doug
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

userland reallocarray audit.

Replace malloc() and realloc() calls that may have integer overflow in the
multiplication of the arguments with reallocarray().

ok deraadt@

Revision 1.45 / (download) - annotate - [select for diffs], Wed Nov 7 11:06:14 2012 UTC (11 years, 6 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.44: +33 -22 lines
Diff to previous 1.44 (colored)

fix fractional number exponentiation, especially for negative exponents

Revision 1.44 / (download) - annotate - [select for diffs], Tue Nov 6 16:00:05 2012 UTC (11 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.43: +6 -10 lines
Diff to previous 1.43 (colored)

use BN_set_negative() and BN_is_negative() instead of subtracting or
comparing to zero

Revision 1.43 / (download) - annotate - [select for diffs], Tue Nov 6 15:46:46 2012 UTC (11 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.42: +21 -5 lines
Diff to previous 1.42 (colored)

For exponenttion, only warn if the fractional part of the exponent
is non-zero and avoid div by zero. Prompted by Andres Perera.

Revision 1.42 / (download) - annotate - [select for diffs], Thu Mar 8 08:15:37 2012 UTC (12 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

let length(0.000) conform to what gnu bc does; from AIDA Shinra

Revision 1.41 / (download) - annotate - [select for diffs], Sat May 15 10:59:29 2010 UTC (14 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

normalize() cannot be inline and extern at the same time; prompted by
jsg@

Revision 1.40 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:37 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.39: +1 -5 lines
Diff to previous 1.39 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.39 / (download) - annotate - [select for diffs], Sun Sep 6 13:33:33 2009 UTC (14 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored)

check for unitialized elements when accessing an array; from Simon Kellner.

Revision 1.38 / (download) - annotate - [select for diffs], Mon Nov 24 08:48:48 2008 UTC (15 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.37: +3 -2 lines
Diff to previous 1.37 (colored)

although there's no EOF condition defined for the handling of '?',
but anyway reset the eof condition on stdin, so you don't get an
infinite loop in the typical program after a ^D.
reported by Tamas TEVESZ.

Revision 1.37 / (download) - annotate - [select for diffs], Mon Apr 28 06:35:09 2008 UTC (16 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.36: +5 -4 lines
Diff to previous 1.36 (colored)

plug three leaks, one reported and fixed by Andreas Gunnarsson in PR 5802,
the others by myself

Revision 1.36 / (download) - annotate - [select for diffs], Sat Apr 26 20:13:22 2008 UTC (16 years ago) by otto
Branch: MAIN
Changes since 1.35: +4 -4 lines
Diff to previous 1.35 (colored)

use correct printf format for size_t (debug only code)

Revision 1.35 / (download) - annotate - [select for diffs], Sun Sep 2 23:50:04 2007 UTC (16 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.34: +4 -4 lines
Diff to previous 1.34 (colored)

more malloc(n * m) -> calloc(n, m); from Igor Zinovik

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jan 19 20:06:55 2006 UTC (18 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.33: +11 -10 lines
Diff to previous 1.33 (colored)

delint: check value against UINT_MAX before casting to u_int; while
there fix a buglet in bexp(): x * UINT_MAX only overflows if x > 0

Revision 1.33 / (download) - annotate - [select for diffs], Mon Jan 16 08:09:25 2006 UTC (18 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.32: +4 -4 lines
Diff to previous 1.32 (colored)

delint; use size_t as stack size and ssize_t as stack pointer.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Jan 15 19:14:40 2006 UTC (18 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.31: +50 -51 lines
Diff to previous 1.31 (colored)

delint; index is a global symbol, so rename some locals to avoid
hiding

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jan 15 19:11:59 2006 UTC (18 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.30: +28 -28 lines
Diff to previous 1.30 (colored)

delint wrt return values, including some missing BN return
values checks.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Sep 25 19:02:38 2005 UTC (18 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Fix wrong normalization in compare. From andreas@

Revision 1.29 / (download) - annotate - [select for diffs], Sat Apr 2 18:05:04 2005 UTC (19 years, 1 month ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.28: +7 -6 lines
Diff to previous 1.28 (colored)

- Fix raise for negative exponents (noted by naddy@)
- Fix wrong scale for mantissa < 1.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Mar 28 17:39:20 2005 UTC (19 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.27: +5 -5 lines
Diff to previous 1.27 (colored)

spacing

Revision 1.27 / (download) - annotate - [select for diffs], Sun Mar 27 17:50:55 2005 UTC (19 years, 1 month ago) by otto
Branch: MAIN
Changes since 1.26: +21 -7 lines
Diff to previous 1.26 (colored)

Make call stack auto-growing, instead of fixed size. Enables much deeper
recursion.

Revision 1.26 / (download) - annotate - [select for diffs], Wed Dec 1 08:40:12 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

use volatile sig_atomic_t for vars set in signal handlers. spotted by deraadt@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 1 08:29:38 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.24: +11 -8 lines
Diff to previous 1.24 (colored)

Fix stop condition for sqrt. Due to the fact that we're doing Newton
iteration with intgeres, the stop condition is reached if x_n == x_n+1, or
the difference is one, but only stop if that is hit a second time. Avoids
looping with difference 1,-1,1,-1... Problem spotted by Paul de Weerd.
Regress tested against 4.2BSD dc(1) and GNU dc(1).

Revision 1.24 / (download) - annotate - [select for diffs], Mon Oct 18 07:49:00 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Implement command line evaluation of expressions by implementing the -e option.
ok weingart@

Revision 1.23 / (download) - annotate - [select for diffs], Tue Sep 14 22:22:46 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.22 / (download) - annotate - [select for diffs], Wed Feb 11 20:44:31 2004 UTC (20 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.21: +4 -5 lines
Diff to previous 1.21 (colored)

Make flag set in signal handler volatile

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jan 20 21:41:20 2004 UTC (20 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.20: +2 -3 lines
Diff to previous 1.20 (colored)

duplicated entry; evarts@amazon.com

Revision 1.20 / (download) - annotate - [select for diffs], Fri Dec 19 19:23:16 2003 UTC (20 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.19: +21 -2 lines
Diff to previous 1.19 (colored)

Do something sensible on ^C: unwind stack and be ready for new input.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Dec 2 13:43:02 2003 UTC (20 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (colored)

Fix a max recursion off-by-one.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Dec 1 09:13:24 2003 UTC (20 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.17: +67 -39 lines
Diff to previous 1.17 (colored)

Allow for more registers using a 2 byte index. This feature is
enabled by supplying the -x option on the command line. Allows long
variable names in bc(1) (to appear soon). If no -x option is given,
behave exactly as before.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Nov 17 11:12:35 2003 UTC (20 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.16: +12 -2 lines
Diff to previous 1.16 (colored)

A basic stack operation that is missing from the original dc (and
GNU dc as well): drop ('R').

Revision 1.16 / (download) - annotate - [select for diffs], Fri Nov 14 20:25:16 2003 UTC (20 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.15: +124 -39 lines
Diff to previous 1.15 (colored)

Implement new boolean operations 'N' (not), 'G' (equals), '(' (less)
and '{' (less or equal). These operations push their result back
to the stack. Used by soon to appear boolean operations in bc(1).

man page tweaks and ok jmc@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Nov 9 20:33:09 2003 UTC (20 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.14: +3 -2 lines
Diff to previous 1.14 (colored)

Flush after 'n' operator.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 6 19:48:13 2003 UTC (20 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.13: +99 -49 lines
Diff to previous 1.13 (colored)

Implement non-portable extension # (comment), n (print w/o newline),
and a (byte to char).

Revision 1.13 / (download) - annotate - [select for diffs], Tue Nov 4 08:10:06 2003 UTC (20 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.12: +10 -2 lines
Diff to previous 1.12 (colored)

Duh, a stack machine without swap; implement GNU compatible 'r'
(swap) operator. Prompted by Michael Knudsen <e at molioner dot dk>

Revision 1.12 / (download) - annotate - [select for diffs], Wed Oct 22 14:58:32 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.11: +10 -2 lines
Diff to previous 1.11 (colored)

Make J operator handle extended comparisons correctly.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Oct 22 12:15:20 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.10: +18 -7 lines
Diff to previous 1.10 (colored)

Implement extended comparison operators, to allow for an if ... else construct
in bc(1).

Revision 1.10 / (download) - annotate - [select for diffs], Sat Oct 18 20:33:48 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

#ifdef debug code

Revision 1.9 / (download) - annotate - [select for diffs], Sat Oct 18 19:45:42 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.8: +87 -14 lines
Diff to previous 1.8 (colored)

o Implement new J (jump) and M (mark) operators. The J operator
  pops n recursion levels and then skips to the first occurence of the M
  operator. These operators are used to implement the "continue"
  statement in bc(1).
o Ifdef debug code.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Oct 11 18:31:18 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.7: +46 -2 lines
Diff to previous 1.7 (colored)

Division and modulus operator (~). From hugh@.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Sep 30 18:27:01 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.6: +5 -3 lines
Diff to previous 1.6 (colored)

Flush stdout after P operator. Improves interaction with bc(1).

Revision 1.6 / (download) - annotate - [select for diffs], Sun Sep 28 19:15:53 2003 UTC (20 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.5: +6 -5 lines
Diff to previous 1.5 (colored)

Fix error check for array store operator.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Sep 22 14:49:16 2003 UTC (20 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.4: +8 -6 lines
Diff to previous 1.4 (colored)

Make registers contain zero initially. Needed for new bc(1) and original dc(1)
compatible.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Sep 20 06:28:24 2003 UTC (20 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.3: +2 -6 lines
Diff to previous 1.3 (colored)

Remove bogus comment.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 19 20:58:58 2003 UTC (20 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

spaces

Revision 1.2 / (download) - annotate - [select for diffs], Fri Sep 19 19:00:36 2003 UTC (20 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +12 -12 lines
Diff to previous 1.1 (colored)

spaces

Revision 1.1 / (download) - annotate - [select for diffs], Fri Sep 19 17:58:25 2003 UTC (20 years, 8 months ago) by otto
Branch: MAIN

A complete, BSD licensed rewrite of dc(1), using the bn(3) big number routines.

ok toby@ deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.