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 Convert bc(1) to mdoc.
details: https://anonhg.NetBSD.org/src/rev/0c48ea3d93d7
branches: trunk
changeset: 353017:0c48ea3d93d7
user: wiz <wiz%NetBSD.org@localhost>
date: Mon Apr 17 14:01:19 2017 +0000
description:
Convert bc(1) to mdoc.
diffstat:
external/bsd/bc/dist/bc.1 | 1619 ++++++++++++++++++++++++++++----------------
1 files changed, 1039 insertions(+), 580 deletions(-)
diffs (truncated from 1806 to 300 lines):
diff -r 493a81e43077 -r 0c48ea3d93d7 external/bsd/bc/dist/bc.1
--- a/external/bsd/bc/dist/bc.1 Mon Apr 17 13:29:07 2017 +0000
+++ b/external/bsd/bc/dist/bc.1 Mon Apr 17 14:01:19 2017 +0000
@@ -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 "XXinteractiveXXXXXX"
+.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
-is the total number of decimal digits after the decimal point. For
-example:
-.nf
-.RS
+is the total number of decimal digits after the decimal point.
+For example:
+.Bd -literal
.000001 has a length of 6 and scale of 6.
1935.000 has a length of 7 and a scale of 3.
-.RE
-.fi
-.SS VARIABLES
+.Ed
+.Ss VARIABLES
Numbers are stored in two types of variables, simple variables and
-arrays. Both simple variables and array variables are named. Names
-begin with a letter followed by any number of letters, digits and
-underscores. All letters must be lower case. (Full alpha-numeric
-names are an extension. In POSIX \fBbc\fR all names are a single
-lower case letter.) The type of variable is clear by the context
+arrays.
+Both simple variables and array variables are named.
+Names begin with a letter followed by any number of letters, digits and
+underscores.
+All letters must be lower case.
+(Full alpha-numeric names are an extension.
+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 ([]).
-.PP
-There are four special variables, \fBscale, ibase, obase,\fR and
-\fBlast\fR. \fBscale\fR defines how some operations use digits after the
-decimal point. The default value of \fBscale\fR is 0. \fBibase\fR
-and \fBobase\fR define the conversion base for input and output
-numbers. The default for both input and output is base 10.
-\fBlast\fR (an extension) is a variable that has the value of the last
-printed number. These will be discussed in further detail where
-appropriate. All of these variables may have values assigned to them
+.Pp
+There are four special variables,
+.Ic scale ,
+.Ic ibase ,
+.Ic obase ,
+and
+.Ic last .
+.Ic scale
+defines how some operations use digits after the decimal point.
+The default value of
+.Ic scale
+is 0.
+.Ic ibase
+and
+.Ic obase
+define the conversion base for input and output numbers.
+The default for both input and output is base 10.
+.Ic last
+(an extension) is a variable that has the value of the last
+printed number.
+These will be discussed in further detail where appropriate.
+All of these variables may have values assigned to them
as well as used in expressions.
-.SS COMMENTS
-Comments in \fBbc\fR start with the characters \fB/*\fR and end with
-the characters \fB*/\fR. 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
-a variable name.) Comments include any newlines (end of line) between
+.Ss COMMENTS
+Comments in
+.Nm
+start with the characters
+.Dq Ic /*
+and end with the characters
+.Dq Ic */ .
+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
+a variable name.)
+Comments include any newlines (end of line) between
the start and the end of the comment.
-.PP
-To support the use of scripts for \fBbc\fR, a single line comment has been
-added as an extension. A single line comment starts at a \fB#\fR
-character and continues to the next end of the line. The end of line
+.Pp
+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 #
+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.
-.SS EXPRESSIONS
-The numbers are manipulated by expressions and statements. Since
-the language was designed to be interactive, statements and expressions
-are executed as soon as possible. There is no "main" program. Instead,
-code is executed as it is encountered. (Functions, discussed in
+.Ss EXPRESSIONS
+The numbers are manipulated by expressions and statements.
+Since the language was designed to be interactive, statements and expressions
+are executed as soon as possible.
+There is no
+.Dq main
+program.
+Instead, code is executed as it is encountered.
+(Functions, discussed in
detail later, are defined when encountered.)
-.PP
-A simple expression is just a constant. \fBbc\fR converts constants
+.Pp
+A simple expression is just a constant.
+.Nm
+converts constants
into internal decimal numbers using the current input base, specified
-by the variable \fBibase\fR. (There is an exception in functions.)
-The legal values of \fBibase\fR are 2 through 36. (Base values
-greater than 16 are an extension.) Assigning a value outside this
-range to \fBibase\fR will result in a value of 2 or 36. Input numbers
-may contain the characters 0-9 and A-Z. (Note: They must be capitals.
-Lower case letters are variable names.) Single digit numbers always
+by the variable
+.Ic ibase .
+(There is an exception in functions.)
+The legal values of
+.Ic ibase
+are 2 through 36.
+(Base values greater than 16 are an extension.)
+Assigning a value outside this range to
+.Ic ibase
+will result in a value of 2 or 36.
+Input numbers may contain the characters 0-9 and A-Z.
+(Note: They must be capitals.
+Lower case letters are variable names.)
+Single digit numbers always
have the value of the digit regardless of the value of
-\fBibase\fR. (i.e. A = 10.) For multi-digit numbers, \fBbc\fR changes
-all input digits greater or equal to ibase to the value of
-\fBibase\fR-1. This makes the number \fBZZZ\fR always be the largest
-3 digit number of the input base.
-.PP
+.Ic ibase .
+(i.e. 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
+always be the largest 3 digit number of the input base.
+.Pp
Full expressions are similar to many other high level languages.
Since there is only one kind of number, there are no rules for mixing
-types. Instead, there are rules on the scale of expressions. Every
-expression has a scale. This is derived from the scale of original
+types.
+Instead, there are rules on the scale of expressions.
+Every expression has a scale.
+This is derived from the scale of original
numbers, the operation performed and in many cases, the value of the
-variable \fBscale\fR. Legal values of the variable \fBscale\fR are
-0 to the maximum number representable by a C integer.
-.PP
-In the following descriptions of legal expressions, "expr" refers to a
-complete expression and "var" refers to a simple or an array variable.
+variable
Home |
Main Index |
Thread Index |
Old Index