Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/bc/dist bc(1): Prettify PostScript output some ...
details: https://anonhg.NetBSD.org/src/rev/7adf28c103d2
branches: trunk
changeset: 958496:7adf28c103d2
user: uwe <uwe%NetBSD.org@localhost>
date: Fri Jan 08 01:17:03 2021 +0000
description:
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...
diffstat:
external/bsd/bc/dist/bc.1 | 192 +++++++++++++++++++++++++++------------------
1 files changed, 115 insertions(+), 77 deletions(-)
diffs (truncated from 429 to 300 lines):
diff -r eb5544433118 -r 7adf28c103d2 external/bsd/bc/dist/bc.1
--- a/external/bsd/bc/dist/bc.1 Fri Jan 08 00:13:20 2021 +0000
+++ b/external/bsd/bc/dist/bc.1 Fri Jan 08 01:17:03 2021 +0000
@@ -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 @@
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 @@
.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 @@
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 <op>= expr"
+.It Ar var Ao Ns Ar op Ns Ac Ns Ic \&= Ar expr
This is equivalent to
-.Ic "var = var <op> 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 @@
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 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 greater than
+.Ar expr\s-2\d\&2\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 greater than or equal to
+.Ar expr\s-2\d\&2\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 equal to
+.Ar expr\s-2\d\&2\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 not equal to
+.Ar expr\s-2\d\&2\u\s+2 .
.El
.Pp
Boolean operations are also legal.
@@ -355,11 +373,13 @@
The boolean
operators are:
.Bl -tag -width 15n
-.It Ic "!expr"
-The result is 1 if expr is 0.
-.It Ic "expr && expr"
+.It Ic \&! Ns Ar expr
+The result is 1 if
+.Ar expr
+is 0.
+.It Ar expr Ic \&&& Ar expr
The result is 1 if both expressions are non-zero.
-.It Ic "expr || expr"
+.It Ar expr Ic \&|| Ar expr
The result is 1 if either expression is non-zero.
.El
.Pp
@@ -427,7 +447,7 @@
.Nm .
These have to do with user defined functions and standard functions.
They all appear as
-.Do Ar name Ns Li \&( Ns Ar parameters Ns Li \&) Dc .
+.Do Ar name Ns Ic \&( Ns Ar parameters Ns Ic \&) Dc .
See the section on functions for user defined functions.
The standard functions are:
.Bl -tag -width 20n
@@ -473,8 +493,10 @@
are statement separators, it is possible to hide a newline by using
the backslash character.
The sequence
-.Dq Ic \e<nl> ,
-where <nl> is the newline appears to
+.Dq Ic \e Ns Ao nl Ac ,
+where
+.Aq nl
+is the newline appears to
.Nm
as whitespace instead of a newline.
A statement list is a series of statements separated by semicolons and
@@ -496,9 +518,9 @@
expression is evaluated and printed to the output.
After the number is printed, a newline is printed.
For example,
-.Dq Ic a=1
+.Dq Li a=1
is an assignment statement and
-.Do Ic ( a=1 ) Dc
+.Dq Li (a=1)
is an expression that has an embedded assignment.
All numbers that are printed are printed in the base
specified by the variable
@@ -521,7 +543,7 @@
Since numbers are of arbitrary
precision, some numbers may not be printable on a single output line.
These long numbers will be split across lines using the
-.Dq \e
+.Ql \e
as the last character on a line.
The maximum number of characters printed
per line is 70.
@@ -544,7 +566,7 @@
.Pq Ql \&.
which is not part of a number as a short hand notation for
.Ic last . )
-.It Ar "string"
+.It Ic \*q Ns Ar string\| Ns Ic \*q
The
.Ar string
is printed to the output.
@@ -589,36 +611,37 @@
.Ql \e
(backslash).
Any other character following the backslash will be ignored.
-.It { Ar statement_list }
+.It Ic \&{ Ar statement_list Ic \&}
This is the compound statement.
It allows multiple statements to be grouped together for execution.
-.It Ic if ( Ar expression ) Ar statement1 [ Ic else Ar statement2 ]
+.It Ic if \&( Ns Ar expression Ns Ic \&) Ar statement\s-2\d\fR1\fP\u\s+2 \
+ Oo Ic else Ar statement\s-2\d\fR2\fP\u\s+2 Oc
The
.Ic if
statement evaluates the
.Ar expression
and executes
-.Ar statement1
+.Ar statement\s-2\d\fR1\fP\u\s+2
or
-.Ar statement2
+.Ar statement\s-2\d\fR2\fP\u\s+2
depending on the value of the
.Ar expression .
If the
.Ar expression
is non-zero,
-.Ar statement1
+.Ar statement\s-2\d\fR1\fP\u\s+2
is executed.
If
-.Ar statement2
+.Ar statement\s-2\d\fR2\fP\u\s+2
is present and the value of the
.Ar expression
is 0, then
-.Ar statement2
+.Ar statement\s-2\d\fR2\fP\u\s+2
is executed.
(The
.Ic else
clause is an extension.)
-.It Ic while ( Ar expression ) Ar statement
+.It Ic while \&( Ns Ar expression Ns Ic \&) Ar statement
The
.Ic while
statement will execute the
@@ -635,34 +658,39 @@
value or the execution of a
.Ic break
statement.
-.It Ic for ( [ Ar expression1 ] ; [ Ar expression2 ] ; [ Ar expression3 ] ) Ar statement
+.It Ic for \&( Ns \
+ Oo Ar expression\s-2\d\fR1\fP\u\s+2 Oc Ns Ic \&; \
+ Oo Ar expression\s-2\d\fR2\fP\u\s+2 Oc Ns Ic \&; \
+ Oo Ar expression\s-2\d\fR3\fP\u\s+2 Oc Ns Ic \&) \
+ Ar statement
The
.Ic for
statement controls repeated execution of the
.Ar statement .
-.Ar Expression1
+.Ar expression\s-2\d\fR1\fP\u\s+2
is evaluated before the loop.
-.Ar Expression2
+.Ar expression\s-2\d\fR2\fP\u\s+2
is evaluated
before each execution of the
.Ar statement .
If it is non-zero, the
.Ar statement
-is evaluated.
+is executed.
If it is zero, the loop is terminated.
-After each execution of the statement,
-.Ar expression3
+After each execution of the
+.Ar statement ,
+.Ar expression\s-2\d\fR3\fP\u\s+2
is evaluated before the reevaluation of
-.Ar expression2 .
Home |
Main Index |
Thread Index |
Old Index