CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: mrg Date: Mon Apr 12 08:54:11 UTC 2021 Modified Files: src/external/bsd/bc/dist: global.h Log Message: avoid common symbols. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/bc/dist/global.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/global.h diff -u src/external/bsd/bc/dist/global.h:1.1 src/external/bsd/bc/dist/global.h:1.2 --- src/external/bsd/bc/dist/global.h:1.1 Mon Apr 10 02:28:23 2017 +++ src/external/bsd/bc/dist/global.h Mon Apr 12 08:54:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: global.h,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: global.h,v 1.2 2021/04/12 08:54:11 mrg Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -118,9 +118,9 @@ EXTERN int n_history; #if defined(LIBEDIT) /* LIBEDIT data */ -EditLine *edit INIT(NULL); -History *hist; -HistEvent histev; +EXTERN EditLine *edit INIT(NULL); +EXTERN History *hist; +EXTERN HistEvent histev; #endif /* "Condition code" -- false (0) or true (1) */
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Fri Jan 8 01:17:55 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Consistently use "parentheses" in plural. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.9 src/external/bsd/bc/dist/bc.1:1.10 --- src/external/bsd/bc/dist/bc.1:1.9 Fri Jan 8 01:17:03 2021 +++ src/external/bsd/bc/dist/bc.1 Fri Jan 8 01:17:55 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.9 2021/01/08 01:17:03 uwe Exp $ +.\" $NetBSD: bc.1,v 1.10 2021/01/08 01:17:55 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -440,7 +440,7 @@ What this does in is assign the value 3 to the variable .Va a and then compare 3 to 5. -It is best to use parenthesis when using relational and logical operators +It is best to use parentheses when using relational and logical operators with the assignment operators. .Pp There are a few more special expressions that are provided in @@ -735,7 +735,7 @@ Return the value 0 from a function. .It Ic return Ic \&( Ns Ar expression Ns Ic \&) Return the value of the expression from a function. (See the section on functions.) -As an extension, the parenthesis are not required. +As an extension, the parentheses are not required. .El .Ss PSEUDO STATEMENTS These statements are not statements in the traditional sense.
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Fri Jan 8 01:17:03 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Prettify PostScript output some more. Don't set BNF in all bold .Ic, instead use .Ar for "expr" and "var" so that only the literal stuff that is being defined is bold. Arrange for subscripts to actually be subscripted in PostScript. Make sure meta-syntactic [] are set differently than literal (). Etc... To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.8 src/external/bsd/bc/dist/bc.1:1.9 --- src/external/bsd/bc/dist/bc.1:1.8 Thu Jan 7 23:57:25 2021 +++ src/external/bsd/bc/dist/bc.1 Fri Jan 8 01:17:03 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.8 2021/01/07 23:57:25 uwe Exp $ +.\" $NetBSD: bc.1,v 1.9 2021/01/08 01:17:03 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -231,42 +231,42 @@ Legal values of the variable are 0 to the maximum number representable by a C integer. .Pp In the following descriptions of legal expressions, -.Dq expr +.Ar expr refers to a complete expression and -.Dq var +.Ar var refers to a simple or an array variable. A simple variable is just a -.Ic name +.Dq Ar name and an array variable is specified as -.Ic name[expr] . +.Do Ar name Ns Ic \&[ Ns Ar expr Ns Ic \&] Dc . Unless specifically mentioned the scale of the result is the maximum scale of the expressions involved. .Bl -tag -width 15n -.It Ic "- expr" +.It Ic \&- Ns Ar expr The result is the negation of the expression. -.It Ic "++ var" +.It Ic \&++ Ns Ar var The variable is incremented by one and the new value is the result of the expression. -.It Ic "-- var" +.It Ic \&-- Ns Ar var The variable is decremented by one and the new value is the result of the expression. -.It Ic "var ++" +.It Ar var Ns Ic \&++ The result of the expression is the value of the variable and then the variable is incremented by one. -.It Ic "var --" +.It Ar var Ns Ic \&-- The result of the expression is the value of the variable and then the variable is decremented by one. -.It Ic "expr + expr" +.It Ar expr Ic \&+ Ar expr The result of the expression is the sum of the two expressions. -.It Ic "expr - expr" +.It Ar expr Ic \&- Ar expr The result of the expression is the difference of the two expressions. -.It Ic "expr * expr" +.It Ar expr Ic \&* Ar expr The result of the expression is the product of the two expressions. -.It Ic "expr / expr" +.It Ar expr Ic \&/ Ar expr The result of the expression is the quotient of the two expressions. The scale of the result is the value of the variable .Ic scale . -.It Ic "expr % expr" +.It Ar expr Ic \&% Ar expr The result of the expression is the remainder and it is computed in the following way: To compute a%b, first a/b is computed to @@ -280,7 +280,7 @@ If .Ic scale is set to zero and both expressions are integers this expression is the integer remainder function. -.It Ic "expr ^ expr" +.It Ar expr Ic \&^ Ar expr The result of the expression is the value of the first raised to the second. The second expression must be an integer. @@ -299,19 +299,19 @@ and the scale of the first expression. scale(a))).) It should be noted that expr^0 will always return the value of 1. -.It Ic "( expr )" +.It Ic \&( Ns Ar expr Ns Ic \&) This alters the standard precedence to force the evaluation of the expression. -.It Ic "var = expr" +.It Ar var Ic \&= Ar expr The variable is assigned the value of the expression. -.It Ic "var = expr" +.It Ar var Ao Ns Ar op Ns Ac Ns Ic \&= Ar expr This is equivalent to -.Ic "var = var expr" +.Ar var Ic \&= Ar var Ao Ns Ar op Ns Ac Ar expr with the exception that the -.Dq Ic var +.Ar var part is evaluated only once. This can make a difference if -.Dq Ic var +.Ar var is an array. .El .Pp @@ -330,18 +330,36 @@ statements and that only one relational done in them.) The relational operators are: .Bl -tag -width 15n -.It Ic "expr1 < expr2" -The result is 1 if expr1 is strictly less than expr2. -.It Ic "expr1 <= expr2" -The result is 1 if expr1 is less than or equal to expr2. -.It Ic "expr1 > expr2" -The result is 1 if expr1 is strictly greater than expr2. -.It Ic "expr1 >= expr2" -The result is 1 if expr1 is greater than or equal to expr2. -.It Ic "expr1 == expr2" -The result is 1 if expr1 is equal to expr2. -.It Ic "expr1 != expr2" -The result is 1 if expr1 is not equal to expr2. +.It Ar expr\s-2\d\fR1\fP\u\s+2 Ic \&< Ar expr\s-2\d\fR2\fP\u\s+2 +The result is 1 if +.Ar expr\s-2\d\fR1\fP\u\s+2 +is strictly less than +.Ar expr\s-2\d\fR2\fP\u\s+2 . +.It Ar expr\s-2\d\fR1\fP\u\s+2 Ic \&<= Ar expr\s-2\d\fR2\fP\u\s+2 +The result is 1 if +.Ar expr\s-2\d\fR1\fP\u\s+2 +is less than or equal to +.Ar expr\s-2\d\&2\u\s+2 . +.It Ar expr\s-2\d\fR1\fP\u\s+2
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 23:57:25 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Replace one last missed \f with semantic markup. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.7 src/external/bsd/bc/dist/bc.1:1.8 --- src/external/bsd/bc/dist/bc.1:1.7 Thu Jan 7 21:21:35 2021 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 23:57:25 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.7 2021/01/07 21:21:35 uwe Exp $ +.\" $NetBSD: bc.1,v 1.8 2021/01/07 23:57:25 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -264,7 +264,8 @@ The result of the expression is the diff The result of the expression is the product of the two expressions. .It Ic "expr / expr" The result of the expression is the quotient of the two expressions. -The scale of the result is the value of the variable \fBscale\fR. +The scale of the result is the value of the variable +.Ic scale . .It Ic "expr % expr" The result of the expression is the remainder and it is computed in the following way:
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 21:21:35 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Use more .Ql, misc related fixes. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.6 src/external/bsd/bc/dist/bc.1:1.7 --- src/external/bsd/bc/dist/bc.1:1.6 Thu Jan 7 20:37:33 2021 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 21:21:35 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.6 2021/01/07 20:37:33 uwe Exp $ +.\" $NetBSD: bc.1,v 1.7 2021/01/07 21:21:35 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -128,7 +128,8 @@ In POSIX .Nm all names are a single lower case letter.) The type of variable is clear by the context -because all array variable names will be followed by brackets ([]). +because all array variable names will be followed by brackets +.Pq Ql [] . .Pp There are four special variables, .Ic scale , @@ -156,9 +157,9 @@ as well as used in expressions. Comments in .Nm start with the characters -.Dq Ic /* +.Ql /* and end with the characters -.Dq Ic */ . +.Ql */ . Comments may start anywhere and appear as a single space in the input. (This causes comments to delimit other input items. For example, a comment can not be found in the middle of @@ -170,7 +171,7 @@ To support the use of scripts for .Nm , a single line comment has been added as an extension. A single line comment starts at a -.Dq Ic # +.Ql # character and continues to the next end of the line. The end of line character is not part of the comment and is processed normally. @@ -205,13 +206,15 @@ Lower case letters are variable names.) Single digit numbers always have the value of the digit regardless of the value of .Ic ibase . -(i.e. A = 10.) +(i.e.\& +.Ql A +=\~10.) For multi-digit numbers, .Nm changes all input digits greater or equal to ibase to the value of .Ic ibase - 1 . This makes the number -.Dq ZZZ +.Ql ZZZ always be the largest 3 digit number of the input base. .Pp Full expressions are similar to many other high level languages. @@ -362,25 +365,41 @@ The result is 1 if either expression is The expression precedence is as follows: (lowest to highest) .Bl -enum -offset indent .It -|| operator, left associative +.Ql || +operator, left associative .It -&& operator, left associative +.Ql && +operator, left associative .It -! operator, nonassociative +.Ql \&! +operator, nonassociative .It Relational operators, left associative .It Assignment operator, right associative .It -+ and - operators, left associative +.Ql + +and +.Ql - +operators, left associative .It -*, / and % operators, left associative +.Ql * , +.Ql / +and +.Ql % +operators, left associative .It -^ operator, right associative +.Ql ^ +operator, right associative .It -unary - operator, nonassociative +unary +.Ql - +operator, nonassociative .It -++ and -- operators, nonassociative +.Ql ++ +and +.Ql -- +operators, nonassociative .El .Pp This precedence was chosen so that POSIX compliant @@ -389,16 +408,16 @@ programs will run correctly. This will cause the use of the relational and logical operators to have some unusual behavior when used with assignment expressions. Consider the expression: -.Dl Ic a = 3 < 5 +.Dl a = 3 < 5 .Pp Most C programmers would assume this would assign the result of -.Dq Ic 3 < 5 +.Dq Li 3 < 5 (the value 1) to the variable -.Dq Ic a . +.Va a . What this does in .Nm is assign the value 3 to the variable -.Dq Ic a +.Va a and then compare 3 to 5. It is best to use parenthesis when using relational and logical operators with the assignment operators. @@ -407,7 +426,7 @@ There are a few more special expressions .Nm . These have to do with user defined functions and standard functions. They all appear as -.Do Ar name ( Ar parameters ) Dc . +.Do Ar name Ns Li \&( Ns Ar parameters Ns Li \&) Dc . See the section on functions for user defined functions. The standard functions are: .Bl -tag -width 20n @@ -462,7 +481,9 @@ newlines. The following is a list of .Nm statements and what they do: -(Things enclosed in brackets ([]) are optional parts of the +(Things enclosed in brackets +.Pq Oo Oc +are optional parts of the statement.) .Bl -tag -width 15n .It Ar expression @@ -518,8 +539,9 @@ The newly assigned value will remain unt or another value is assigned to .Ic last . (Some installations may allow the -use of a single period (.) which is not part of a number as a short -hand notation for +use of a single period +.Pq Ql \&. +which is not part of a number as a short hand notation for .Ic last . ) .It Ar "string" The @@ -544,25 +566,26 @@ value is printed and assigned to the var Strings in the .Ic print statement are printed to the output and may contain special characters. -Special
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 20:37:33 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Use .Fn and .Fa for functions and their arguments. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.5 src/external/bsd/bc/dist/bc.1:1.6 --- src/external/bsd/bc/dist/bc.1:1.5 Thu Jan 7 20:22:34 2021 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 20:37:33 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.5 2021/01/07 20:22:34 uwe Exp $ +.\" $NetBSD: bc.1,v 1.6 2021/01/07 20:37:33 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -411,10 +411,10 @@ They all appear as See the section on functions for user defined functions. The standard functions are: .Bl -tag -width 20n -.It Ic length ( Ar expression ) +.It Fn length expression The value of the length function is the number of significant digits in the expression. -.It Ic read ( ) +.It Fn read The read function (an extension) will read a number from the standard input, regardless of where the function occurs. Beware, this can cause problems with the mixing of data and program in @@ -426,10 +426,10 @@ The value of the read function is the nu the standard input using the current value of the variable .Ic ibase for the conversion base. -.It Ic scale ( Ar expression ) +.It Fn scale expression The value of the scale function is the number of digits after the decimal point in the expression. -.It Ic sqrt ( Ar expression ) +.It Fn sqrt expression The value of the sqrt function is the square root of the expression. If the expression is negative, a run time error is generated. @@ -813,7 +813,7 @@ Changes of .Ic ibase will be ignored during the execution of the function except for the standard function -.Ic read , +.Fn read , which will always use the current value of .Ic ibase @@ -863,22 +863,22 @@ px(1) .Ed .Pp Since -.Ar py +.Fn py is not a void function, the call of -.Ar py ( 1 ) +.Ql py(1) prints the desired output and then prints a second line that is the value of the function. Since the value of a function that is not given an explicit return statement is zero, the zero is printed. For -.Ar px ( 1 ) , +.Ql px(1) , no zero is printed because the function is a void function. .Pp Also, call by variable for arrays was added. To declare a call by variable array, the declaration of the array parameter in the function definition looks like -.Do Ar name [ ] Dc . +.Do Fa name Ns Li [] Dc . The call to the function remains the same as call by value arrays. .Ss MATH LIBRARY @@ -891,18 +891,33 @@ The math functions will calculate their results to the scale set at the time of their call. The math library defines the following functions: .Bl -tag -width 15n -.It Ic s ( Ar x ) -The sine of x, x is in radians. -.It Ic c ( Ar x ) -The cosine of x, x is in radians. -.It Ic a ( Ar x ) -The arctangent of x, arctangent returns radians. -.It Ic l ( Ar x ) -The natural logarithm of x. -.It Ic e ( Ar x ) -The exponential function of raising e to the value x. -.It Ic j ( n , x ) -The Bessel function of integer order n of x. +.It Fn s x +The sine of +.Fa x , +.Fa x +is in radians. +.It Fn c x +The cosine of +.Fa x , +.Fa x +is in radians. +.It Fn a x +The arctangent of +.FA x , +arctangent returns radians. +.It Fn l x +The natural logarithm of +.Fa x . +.It Fn e x +The exponential function of raising +.Va e +to the value +.Fa x . +.It Fn j n x +The Bessel function of integer order +.Fa n +of +.Fa x . .El .Sh ENVIRONMENT The following environment variables are processed by
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 20:22:34 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Indent displays with code examples. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.4 src/external/bsd/bc/dist/bc.1:1.5 --- src/external/bsd/bc/dist/bc.1:1.4 Thu Jan 7 20:12:59 2021 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 20:22:34 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.4 2021/01/07 20:12:59 uwe Exp $ +.\" $NetBSD: bc.1,v 1.5 2021/01/07 20:22:34 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -726,10 +726,11 @@ That definition is then used until anoth definition function for the same name is encountered. The new definition then replaces the older definition. A function is defined as follows: -.Bd -literal +.Bd -literal -offset indent define name ( parameters ) { newline auto_list statement_list } .Ed +.Pp A function call is just an expression of the form .Do Ar name ( Ar parameters ) Dc . .Pp @@ -829,7 +830,7 @@ This version of will allow any number of newlines before and after the opening brace of the function. For example, the following definitions are legal. -.Bd -literal +.Bd -literal -offset indent define d (n) { return (2*n); } define d (n) { return (2*n); } @@ -851,7 +852,7 @@ is placed between the key word .Ic define and the function name. For example, consider the following session. -.Bd -literal +.Bd -literal -offset indent define py (y) { print "--->", y, "<---", "\n"; } define void px (x) { print "--->", x, "<---", "\n"; } py(1) @@ -860,6 +861,7 @@ py(1) px(1) --->1<--- .Ed +.Pp Since .Ar py is not a void function, the call of @@ -938,7 +940,7 @@ the following will assign the value of .Ar pi to the shell variable .Ar pi . -.Bd -literal +.Bd -literal -offset indent pi=$(echo "scale=10; 4*a(1)" | bc -l) .Ed .Pp @@ -946,7 +948,7 @@ The following is the definition of the e math library. This function is written in POSIX .Nm . -.Bd -literal +.Bd -literal -offset indent scale = 20 /* Uses the fact that e^x = (e^(x/2))^2 @@ -994,7 +996,7 @@ The following is code that uses the exte to implement a simple program for calculating checkbook balances. This program is best kept in a file so that it can be used many times without having to retype it at every use. -.Bd -literal +.Bd -literal -offset indent scale=2 print "\enCheck book program!\en" print " Remember, deposits are negative transactions.\en" @@ -1014,7 +1016,7 @@ quit .Ed .Pp The following is the definition of the recursive factorial function. -.Bd -literal +.Bd -literal -offset indent define f (x) { if (x <= 1) return (1); return (f(x-1) * x);
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 20:12:59 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): Misc fixes in the DIFFERENCES section. Make "last" an item, as intended. Make operators literal. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.3 src/external/bsd/bc/dist/bc.1:1.4 --- src/external/bsd/bc/dist/bc.1:1.3 Thu Jan 7 19:49:13 2021 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 20:12:59 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.3 2021/01/07 19:49:13 uwe Exp $ +.\" $NetBSD: bc.1,v 1.4 2021/01/07 20:12:59 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -1085,7 +1085,7 @@ may contain letters, numbers and the und .It strings Strings are not allowed to contain NUL characters. POSIX says all characters must be included in strings. -.Ic last +.It Ic last POSIX .Nm does not have a @@ -1094,7 +1094,9 @@ variable. Some implementations of .Nm -use the period (.) in a similar way. +use the period +.Pq Ql \&. +in a similar way. .It comparisons POSIX .Nm @@ -1118,7 +1120,7 @@ POSIX requires all expressions to be present in the .Ic for statement. -.It && , || , \&! +.It Li && , || , \&! POSIX .Nm does not have the logical operators. @@ -1162,7 +1164,7 @@ requires the opening brace on the same l key word and the .Ic auto statement on the next line. -.It =+ , =- , =* , =/ , =% , =^ +.It Li =+ , =- , =* , =/ , =% , =^ POSIX .Nm does not require these
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: uwe Date: Thu Jan 7 19:49:13 UTC 2021 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: bc(1): small mdoc fixes to improve PostScript output. The length/scale example at the beginning is not all literal. Fix remaining "quoted" words to use .Dq Fix a few small inline code snippets to be literal. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.2 src/external/bsd/bc/dist/bc.1:1.3 --- src/external/bsd/bc/dist/bc.1:1.2 Mon Apr 17 14:01:19 2017 +++ src/external/bsd/bc/dist/bc.1 Thu Jan 7 19:49:13 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.2 2017/04/17 14:01:19 wiz Exp $ +.\" $NetBSD: bc.1,v 1.3 2021/01/07 19:49:13 uwe Exp $ .\" .\" bc.1 - the bc manual .\" @@ -109,10 +109,13 @@ The length is the total number of significant decimal digits in a number and the scale is the total number of decimal digits after the decimal point. For example: -.Bd -literal - .01 has a length of 6 and scale of 6. - 1935.000 has a length of 7 and a scale of 3. -.Ed +.Pp +.Bl -inset -offset indent -compact +.It Li .01 +has a length of 6 and scale of 6. +.It Li 1935.000 +has a length of 7 and a scale of 3. +.El .Ss VARIABLES Numbers are stored in two types of variables, simple variables and arrays. @@ -685,7 +688,9 @@ As an extension, the parenthesis are not .Ss PSEUDO STATEMENTS These statements are not statements in the traditional sense. They are not executed statements. -Their function is performed at "compile" time. +Their function is performed at +.Dq compile +time. .Bl -tag -width 15n .It Ic limits Print the local limits enforced by the local version of @@ -713,7 +718,9 @@ later. Functions in .Nm always compute a value and return it to the caller. -Function definitions are "dynamic" in the sense that a function is +Function definitions are +.Dq dynamic +in the sense that a function is undefined until a definition is encountered in the input. That definition is then used until another definition function for the same name is encountered. @@ -745,7 +752,9 @@ A runtime error will also occur for the .Pp The .Ar auto_list -is an optional list of variables that are for "local" use. +is an optional list of variables that are for +.Dq local +use. The syntax of the auto list (if present) is .Do Ic auto Ar name , ... ; Dc . (The semicolon is optional.) @@ -908,7 +917,9 @@ The format is the same as the command li These arguments are processed first, so any files listed in the environment arguments are processed before any command line argument files. -This allows the user to set up "standard" options and files to be +This allows the user to set up +.Dq standard +options and files to be processed at every invocation of .Nm . The files in the environment variables would typically contain @@ -1044,7 +1055,9 @@ It is not implemented in the traditional .Xr dc 1 . This version is a single process which parses and runs a byte code translation of the program. -There is an "undocumented" option +There is an +.Dq undocumented +option .Fl ( c ) that causes the program to output the byte code to the standard output instead of running it. @@ -1152,27 +1165,32 @@ statement on the next line. .It =+ , =- , =* , =/ , =% , =^ POSIX .Nm -does not require these "old style" assignment operators to -be defined. -This version may allow these "old style" assignments. +does not require these +.Dq old style +assignment operators to be defined. +This version may allow these +.Dq old style +assignments. Use the .Ic limits statement to see if the installed version supports them. -If it does support the "old style" assignment operators, the statement -.Dq a =- 1 +If it does support the +.Dq old style +assignment operators, the statement +.Dq Li a =- 1 will decrement -.Ar a +.Va a by 1 instead of setting -.Ar a +.Va a to the value \-1. .It spaces in numbers Other implementations of .Nm allow spaces in numbers. For example, -.Dq x=1 3 +.Dq Li x=1 3 would assign the value 13 to the variable -.Ar x . +.Va x . The same statement would cause a syntax error in this version of .Nm . @@ -1209,7 +1227,8 @@ During an interactive session, the signal (usually generated by the control-C character from the terminal) will cause execution of the current execution block to be interrupted. -It will display a "runtime" +It will display a +.Dq runtime error indicating which function was interrupted. After all runtime structures have been cleaned up, a message will be printed to notify the user that @@ -1251,7 +1270,9 @@ The limit on the number of characters in .Dv INT_MAX characters. .It exponent -The value of the exponent in the raise operation (^) is limited to +The value of the exponent in the
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: maya Date: Tue Apr 18 04:35:18 UTC 2017 Modified Files: src/external/bsd/bc/dist: execute.c main.c util.c Log Message: Remove dummy breaks and returns after bc_exit bc_exit being marked nonreturn silences compiler warnings. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/bc/dist/execute.c \ src/external/bsd/bc/dist/main.c src/external/bsd/bc/dist/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/execute.c diff -u src/external/bsd/bc/dist/execute.c:1.1 src/external/bsd/bc/dist/execute.c:1.2 --- src/external/bsd/bc/dist/execute.c:1.1 Mon Apr 10 02:28:23 2017 +++ src/external/bsd/bc/dist/execute.c Tue Apr 18 04:35:18 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: execute.c,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: execute.c,v 1.2 2017/04/18 04:35:18 maya Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -313,8 +313,7 @@ execute (void) case 'h' : /* Halt the machine. */ bc_exit (0); -/* NOTREACHED */ -break; + /* NOTREACHED */ case 'i' : /* increment number */ var_name = byte(); Index: src/external/bsd/bc/dist/main.c diff -u src/external/bsd/bc/dist/main.c:1.1 src/external/bsd/bc/dist/main.c:1.2 --- src/external/bsd/bc/dist/main.c:1.1 Mon Apr 10 02:28:23 2017 +++ src/external/bsd/bc/dist/main.c Tue Apr 18 04:35:18 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: main.c,v 1.2 2017/04/18 04:35:18 maya Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -113,7 +113,7 @@ parse_args (int argc, char **argv) case 'h': /* help */ usage(argv[0]); bc_exit (0); - break; + /* NOTREACHED */ case 'i': /* force interactive */ interactive = TRUE; @@ -134,7 +134,7 @@ parse_args (int argc, char **argv) case 'v': /* Print the version. */ show_bc_version (); bc_exit (0); - break; + /* NOTREACHED */ case 'w': /* Non standard features give warnings. */ warn_not_std = TRUE; @@ -270,7 +270,6 @@ main (int argc, char **argv) printf ("\n"); bc_exit (0); - return 0; // to keep the compiler from complaining } Index: src/external/bsd/bc/dist/util.c diff -u src/external/bsd/bc/dist/util.c:1.1 src/external/bsd/bc/dist/util.c:1.2 --- src/external/bsd/bc/dist/util.c:1.1 Mon Apr 10 02:28:23 2017 +++ src/external/bsd/bc/dist/util.c Tue Apr 18 04:35:18 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: util.c,v 1.2 2017/04/18 04:35:18 maya Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -628,7 +628,6 @@ lookup (char *name, int namekind) yyerror ("End of util.c/lookup() reached. Please report this bug."); bc_exit (1); /*NOTREACHED*/ - return 0; } /* Print out the limits of this program. */
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: wiz Date: Mon Apr 17 14:01:19 UTC 2017 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: Convert bc(1) to mdoc. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.1 src/external/bsd/bc/dist/bc.1:1.2 --- src/external/bsd/bc/dist/bc.1:1.1 Mon Apr 10 02:28:23 2017 +++ src/external/bsd/bc/dist/bc.1 Mon Apr 17 14:01:19 2017 @@ -1,9 +1,10 @@ -.\" $NetBSD: bc.1,v 1.1 2017/04/10 02:28:23 phil Exp $ +.\" $NetBSD: bc.1,v 1.2 2017/04/17 14:01:19 wiz Exp $ .\" -.\" bc.1 - the *roff document processor source for the bc manual +.\" bc.1 - the bc manual .\" .\" Copyright (C) 1991-1994, 1997, 2000, 2003, 2012-2017 Free Software Foundation, Inc. .\" Copyright (C) 2004, 2017 Philip A. Nelson +.\" Copyright (C) 2017 Thomas Klausner .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -32,480 +33,816 @@ .\" .\" .\" -.TH bc 1 .\" "Command Manual" nb1.0 "Jan 23, 2017" -.SH NAME -bc - An arbitrary precision calculator language -.SH SYNTAX -\fBbc\fR [ \fB-hlwsqv\fR ] [long-options] [ \fI file ...\fR ] -.SH VERSION -This man page documents bc version nb1.0. -.SH DESCRIPTION -\fBbc\fR is a language that supports arbitrary precision numbers -with interactive execution of statements. There are some similarities -in the syntax to the C programming language. +.Dd April 16, 2017 +.Dt BC 1 +.Os +.Sh NAME +.Nm bc +.Nd arbitrary precision calculator language +.Sh SYNOPSIS +.Nm +.Op Fl hilqsvw +.Op long-options +.Op Ar +.Sh DESCRIPTION +.Nm +is a language that supports arbitrary precision numbers +with interactive execution of statements. +There are some similarities +in the syntax to the C programming language. A standard math library is available by command line option. If requested, the math library is defined before processing any files. -\fBbc\fR starts by processing code from all the files listed -on the command line in the order listed. After all files have been -processed, \fBbc\fR reads from the standard input. All code is -executed as it is read. (If a file contains a command to halt the -processor, \fBbc\fR will never read from the standard input.) -.PP -This version of \fBbc\fR contains several extensions beyond -traditional \fBbc\fR implementations and the POSIX draft standard. -Command line options can cause these extensions to print a warning -or to be rejected. This -document describes the language accepted by this processor. +.Nm +starts by processing code from all the files listed +on the command line in the order listed. +After all files have been processed, +.Nm +reads from the standard input. +All code is executed as it is read. +(If a file contains a command to halt the processor, +.Nm +will never read from the standard input.) +.Pp +This version of +.Nm +contains several extensions beyond traditional +.Nm +implementations and the POSIX draft standard. +Command line options can cause these extensions to print a warning +or to be rejected. +This document describes the language accepted by this processor. Extensions will be identified as such. -.SS OPTIONS -.IP "-h, --help" +.Ss OPTIONS +.Bl -tag -width "XXinteractiveXX" +.It Fl h , Fl Fl help Print the usage and exit. -.IP "-i, --interactive" +.It Fl i , Fl Fl interactive Force interactive mode. -.IP "-l, --mathlib" +.It Fl l , Fl Fl mathlib Define the standard math library. -.IP "-w, --warn" -Give warnings for extensions to POSIX \fBbc\fR. -.IP "-s, --standard" -Process exactly the POSIX \fBbc\fR language. -.IP "-v, --version" +.It Fl q , Fl Fl quiet +Quiet mode. +.It Fl s , Fl Fl standard +Process exactly the POSIX +.Nm +language. +.It Fl v , Fl Fl version Print the version number and copyright and quit. -.SS NUMBERS -The most basic element in \fBbc\fR is the number. Numbers are -arbitrary precision numbers. This precision is both in the integer -part and the fractional part. All numbers are represented internally -in decimal and all computation is done in decimal. (This version -truncates results from divide and multiply operations.) There are two -attributes of numbers, the length and the scale. The length is the +.It Fl w , Fl Fl warn +Give warnings for extensions to POSIX +.Nm . +.El +.Ss NUMBERS +The most basic element in +.Nm +is the number. +Numbers are arbitrary precision numbers. +This precision is both in the integer +part and the fractional part. +All numbers are represented internally +in decimal and all computation is done in decimal. +(This version of +.Nm +truncates results from divide and multiply operations.) +There are two attributes of numbers, the length and the scale. +The length is the total number of significant decimal digits in a number and the scale
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: christos Date: Mon Apr 10 15:13:22 UTC 2017 Modified Files: src/external/bsd/bc/dist: proto.h Log Message: Add missing attributes to fix clang compilation To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/bc/dist/proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/proto.h diff -u src/external/bsd/bc/dist/proto.h:1.1 src/external/bsd/bc/dist/proto.h:1.2 --- src/external/bsd/bc/dist/proto.h:1.1 Sun Apr 9 22:28:23 2017 +++ src/external/bsd/bc/dist/proto.h Mon Apr 10 11:13:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: proto.h,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: proto.h,v 1.2 2017/04/10 15:13:22 christos Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -80,16 +80,20 @@ int insert_id_rec (id_rec **root, id_rec void init_tree (void); int lookup (char *name, int namekind); void *bc_malloc (size_t); -void out_of_memory (void); +void out_of_memory (void) __attribute__((__noreturn__)); void welcome (void); void warranty (const char *); void show_bc_version (void); void limits (void); -void yyerror (const char *str ,...); -void ct_warn (const char *mesg ,...); -void rt_error (const char *mesg ,...); -void rt_warn (const char *mesg ,...); -void bc_exit (int); +void yyerror (const char *str, ...) +__attribute__((__format__ (__printf__, 1, 2))); +void ct_warn (const char *mesg, ...) +__attribute__((__format__ (__printf__, 1, 2))); +void rt_error (const char *mesg, ...) +__attribute__((__format__ (__printf__, 1, 2))); +void rt_warn (const char *mesg, ...) +__attribute__((__format__ (__printf__, 1, 2))); +void bc_exit (int) __attribute__((__noreturn__)); /* From load.c */ void init_load (void); @@ -101,7 +105,7 @@ void load_code (const char *code); /* From main.c */ int open_new_file (void); void new_yy_file (FILE *file); -void use_quit (int); +void use_quit (int) __attribute__((__noreturn__)); /* From storage.c */ void init_storage (void);
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: christos Date: Mon Apr 10 15:13:04 UTC 2017 Modified Files: src/external/bsd/bc/dist: bc.y Log Message: Add missign % (yyerror argument is a printf format) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/bc/dist/bc.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.y diff -u src/external/bsd/bc/dist/bc.y:1.1 src/external/bsd/bc/dist/bc.y:1.2 --- src/external/bsd/bc/dist/bc.y:1.1 Sun Apr 9 22:28:23 2017 +++ src/external/bsd/bc/dist/bc.y Mon Apr 10 11:13:04 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bc.y,v 1.1 2017/04/10 02:28:23 phil Exp $ */ +/* $NetBSD: bc.y,v 1.2 2017/04/10 15:13:04 christos Exp $ */ /* * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. @@ -618,7 +618,7 @@ expression : named_expression ASSIGN_O | expression '%' expression { if (($1 & EX_VOID) || ($3 & EX_VOID)) -yyerror ("void expression with %"); +yyerror ("void expression with %%"); generate ("%"); $$ = ($1 | $3) & ~EX_PAREN; }