]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - manuals/dc/EP.1
Import version 3.2.0
[FreeBSD/FreeBSD.git] / manuals / dc / EP.1
1 .\"
2 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\"
4 .\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions are met:
8 .\"
9 .\" * Redistributions of source code must retain the above copyright notice,
10 .\"   this list of conditions and the following disclaimer.
11 .\"
12 .\" * Redistributions in binary form must reproduce the above copyright notice,
13 .\"   this list of conditions and the following disclaimer in the documentation
14 .\"   and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 .\" POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
29 .SH Name
30 .PP
31 dc - arbitrary-precision decimal reverse-Polish notation calculator
32 .SH SYNOPSIS
33 .PP
34 \f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
35 [\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
36 [\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
37 [\f[B]-e\f[R] \f[I]expr\f[R]]
38 [\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
39 \f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
40 [\f[I]file\f[R]\&...]
41 .SH DESCRIPTION
42 .PP
43 dc(1) is an arbitrary-precision calculator.
44 It uses a stack (reverse Polish notation) to store numbers and results
45 of computations.
46 Arithmetic operations pop arguments off of the stack and push the
47 results.
48 .PP
49 If no files are given on the command-line as extra arguments (i.e., not
50 as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
51 \f[B]stdin\f[R].
52 Otherwise, those files are processed, and dc(1) will then exit.
53 .PP
54 This is different from the dc(1) on OpenBSD and possibly other dc(1)
55 implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
56 \f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
57 and exit.
58 The reason for this is that this dc(1) allows users to set arguments in
59 the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
60 VARIABLES\f[R] section).
61 Any expressions given on the command-line should be used to set up a
62 standard environment.
63 For example, if a user wants the \f[B]scale\f[R] always set to
64 \f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
65 and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
66 .PP
67 If users want to have dc(1) exit after processing all input from
68 \f[B]-e\f[R] and \f[B]-f\f[R] arguments (and their equivalents), then
69 they can just simply add \f[B]-e q\f[R] as the last command-line
70 argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
71 .SH OPTIONS
72 .PP
73 The following are the options that dc(1) accepts.
74 .TP
75 \f[B]-h\f[R], \f[B]\[en]help\f[R]
76 Prints a usage message and quits.
77 .TP
78 \f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
79 Print the version information (copyright header) and exit.
80 .TP
81 \f[B]-i\f[R], \f[B]\[en]interactive\f[R]
82 Forces interactive mode.
83 (See the \f[B]INTERACTIVE MODE\f[R] section.)
84 .RS
85 .PP
86 This is a \f[B]non-portable extension\f[R].
87 .RE
88 .TP
89 \f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
90 This option is a no-op.
91 .RS
92 .PP
93 This is a \f[B]non-portable extension\f[R].
94 .RE
95 .TP
96 \f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
97 Enables extended register mode.
98 See the \f[I]Extended Register Mode\f[R] subsection of the
99 \f[B]REGISTERS\f[R] section for more information.
100 .RS
101 .PP
102 This is a \f[B]non-portable extension\f[R].
103 .RE
104 .TP
105 \f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
106 Evaluates \f[I]expr\f[R].
107 If multiple expressions are given, they are evaluated in order.
108 If files are given as well (see below), the expressions and files are
109 evaluated in the order given.
110 This means that if a file is given before an expression, the file is
111 read in and evaluated first.
112 .RS
113 .PP
114 After processing all expressions and files, dc(1) will exit, unless
115 \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
116 \f[B]-f\f[R] or \f[B]\[en]file\f[R].
117 .PP
118 This is a \f[B]non-portable extension\f[R].
119 .RE
120 .TP
121 \f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
122 Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
123 were read through \f[B]stdin\f[R].
124 If expressions are also given (see above), the expressions are evaluated
125 in the order given.
126 .RS
127 .PP
128 After processing all expressions and files, dc(1) will exit, unless
129 \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
130 \f[B]-f\f[R] or \f[B]\[en]file\f[R].
131 However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
132 \f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
133 bc(1) will give a fatal error and exit.
134 .PP
135 This is a \f[B]non-portable extension\f[R].
136 .RE
137 .PP
138 All long options are \f[B]non-portable extensions\f[R].
139 .SH STDOUT
140 .PP
141 Any non-error output is written to \f[B]stdout\f[R].
142 .PP
143 \f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
144 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
145 write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
146 \f[B]dc >&-\f[R], it will quit with an error.
147 This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
148 redirected to a file.
149 .PP
150 If there are scripts that depend on the behavior of other dc(1)
151 implementations, it is recommended that those scripts be changed to
152 redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
153 .SH STDERR
154 .PP
155 Any error output is written to \f[B]stderr\f[R].
156 .PP
157 \f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
158 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
159 write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
160 \f[B]dc 2>&-\f[R], it will quit with an error.
161 This is done so that dc(1) can exit with an error code when
162 \f[B]stderr\f[R] is redirected to a file.
163 .PP
164 If there are scripts that depend on the behavior of other dc(1)
165 implementations, it is recommended that those scripts be changed to
166 redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
167 .SH SYNTAX
168 .PP
169 Each item in the input source code, either a number (see the
170 \f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
171 section), is processed and executed, in order.
172 Input is processed immediately when entered.
173 .PP
174 \f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
175 determines how to interpret constant numbers.
176 It is the \[lq]input\[rq] base, or the number base used for interpreting
177 input numbers.
178 \f[B]ibase\f[R] is initially \f[B]10\f[R].
179 The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
180 The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
181 The max allowable value for \f[B]ibase\f[R] can be queried in dc(1)
182 programs with the \f[B]T\f[R] command.
183 .PP
184 \f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
185 determines how to output results.
186 It is the \[lq]output\[rq] base, or the number base used for outputting
187 numbers.
188 \f[B]obase\f[R] is initially \f[B]10\f[R].
189 The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
190 can be queried with the \f[B]U\f[R] command.
191 The min allowable value for \f[B]obase\f[R] is \f[B]2\f[R].
192 Values are output in the specified base.
193 .PP
194 The \f[I]scale\f[R] of an expression is the number of digits in the
195 result of the expression right of the decimal point, and \f[B]scale\f[R]
196 is a register (see the \f[B]REGISTERS\f[R] section) that sets the
197 precision of any operations (with exceptions).
198 \f[B]scale\f[R] is initially \f[B]0\f[R].
199 \f[B]scale\f[R] cannot be negative.
200 The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
201 programs with the \f[B]V\f[R] command.
202 .SS Comments
203 .PP
204 Comments go from \f[B]#\f[R] until, and not including, the next newline.
205 This is a \f[B]non-portable extension\f[R].
206 .SH NUMBERS
207 .PP
208 Numbers are strings made up of digits, uppercase letters up to
209 \f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
210 Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
211 Uppercase letters are equal to \f[B]9\f[R] + their position in the
212 alphabet (i.e., \f[B]A\f[R] equals \f[B]10\f[R], or \f[B]9+1\f[R]).
213 If a digit or letter makes no sense with the current value of
214 \f[B]ibase\f[R], they are set to the value of the highest valid digit in
215 \f[B]ibase\f[R].
216 .PP
217 Single-character numbers (i.e., \f[B]A\f[R] alone) take the value that
218 they would have if they were valid digits, regardless of the value of
219 \f[B]ibase\f[R].
220 This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
221 \f[B]F\f[R] alone always equals decimal \f[B]15\f[R].
222 .SH COMMANDS
223 .PP
224 The valid commands are listed below.
225 .SS Printing
226 .PP
227 These commands are used for printing.
228 .TP
229 \f[B]p\f[R]
230 Prints the value on top of the stack, whether number or string, and
231 prints a newline after.
232 .RS
233 .PP
234 This does not alter the stack.
235 .RE
236 .TP
237 \f[B]n\f[R]
238 Prints the value on top of the stack, whether number or string, and pops
239 it off of the stack.
240 .TP
241 \f[B]P\f[R]
242 Pops a value off the stack.
243 .RS
244 .PP
245 If the value is a number, it is truncated and the absolute value of the
246 result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
247 each digit is interpreted as an ASCII character, making it a byte
248 stream.
249 .PP
250 If the value is a string, it is printed without a trailing newline.
251 .PP
252 This is a \f[B]non-portable extension\f[R].
253 .RE
254 .TP
255 \f[B]f\f[R]
256 Prints the entire contents of the stack, in order from newest to oldest,
257 without altering anything.
258 .RS
259 .PP
260 Users should use this command when they get lost.
261 .RE
262 .SS Arithmetic
263 .PP
264 These are the commands used for arithmetic.
265 .TP
266 \f[B]+\f[R]
267 The top two values are popped off the stack, added, and the result is
268 pushed onto the stack.
269 The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
270 both operands.
271 .TP
272 \f[B]-\f[R]
273 The top two values are popped off the stack, subtracted, and the result
274 is pushed onto the stack.
275 The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
276 both operands.
277 .TP
278 \f[B]*\f[R]
279 The top two values are popped off the stack, multiplied, and the result
280 is pushed onto the stack.
281 If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
282 \f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
283 \f[I]scale\f[R] of the result is equal to
284 \f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
285 \f[B]max()\f[R] return the obvious values.
286 .TP
287 \f[B]/\f[R]
288 The top two values are popped off the stack, divided, and the result is
289 pushed onto the stack.
290 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
291 .RS
292 .PP
293 The first value popped off of the stack must be non-zero.
294 .RE
295 .TP
296 \f[B]%\f[R]
297 The top two values are popped off the stack, remaindered, and the result
298 is pushed onto the stack.
299 .RS
300 .PP
301 Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
302 \f[B]scale\f[R], and 2) Using the result of step 1 to calculate
303 \f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
304 \f[B]max(scale+scale(b),scale(a))\f[R].
305 .PP
306 The first value popped off of the stack must be non-zero.
307 .RE
308 .TP
309 \f[B]\[ti]\f[R]
310 The top two values are popped off the stack, divided and remaindered,
311 and the results (divided first, remainder second) are pushed onto the
312 stack.
313 This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
314 \f[B]y\f[R] are only evaluated once.
315 .RS
316 .PP
317 The first value popped off of the stack must be non-zero.
318 .PP
319 This is a \f[B]non-portable extension\f[R].
320 .RE
321 .TP
322 \f[B]\[ha]\f[R]
323 The top two values are popped off the stack, the second is raised to the
324 power of the first, and the result is pushed onto the stack.
325 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
326 .RS
327 .PP
328 The first value popped off of the stack must be an integer, and if that
329 value is negative, the second value popped off of the stack must be
330 non-zero.
331 .RE
332 .TP
333 \f[B]v\f[R]
334 The top value is popped off the stack, its square root is computed, and
335 the result is pushed onto the stack.
336 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
337 .RS
338 .PP
339 The value popped off of the stack must be non-negative.
340 .RE
341 .TP
342 \f[B]_\f[R]
343 If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
344 or other commands), then that number is input as a negative number.
345 .RS
346 .PP
347 Otherwise, the top value on the stack is popped and copied, and the copy
348 is negated and pushed onto the stack.
349 This behavior without a number is a \f[B]non-portable extension\f[R].
350 .RE
351 .TP
352 \f[B]b\f[R]
353 The top value is popped off the stack, and if it is zero, it is pushed
354 back onto the stack.
355 Otherwise, its absolute value is pushed onto the stack.
356 .RS
357 .PP
358 This is a \f[B]non-portable extension\f[R].
359 .RE
360 .TP
361 \f[B]|\f[R]
362 The top three values are popped off the stack, a modular exponentiation
363 is computed, and the result is pushed onto the stack.
364 .RS
365 .PP
366 The first value popped is used as the reduction modulus and must be an
367 integer and non-zero.
368 The second value popped is used as the exponent and must be an integer
369 and non-negative.
370 The third value popped is the base and must be an integer.
371 .PP
372 This is a \f[B]non-portable extension\f[R].
373 .RE
374 .TP
375 \f[B]G\f[R]
376 The top two values are popped off of the stack, they are compared, and a
377 \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
378 .RS
379 .PP
380 This is a \f[B]non-portable extension\f[R].
381 .RE
382 .TP
383 \f[B]N\f[R]
384 The top value is popped off of the stack, and if it a \f[B]0\f[R], a
385 \f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
386 .RS
387 .PP
388 This is a \f[B]non-portable extension\f[R].
389 .RE
390 .TP
391 \f[B](\f[R]
392 The top two values are popped off of the stack, they are compared, and a
393 \f[B]1\f[R] is pushed if the first is less than the second, or
394 \f[B]0\f[R] otherwise.
395 .RS
396 .PP
397 This is a \f[B]non-portable extension\f[R].
398 .RE
399 .TP
400 \f[B]{\f[R]
401 The top two values are popped off of the stack, they are compared, and a
402 \f[B]1\f[R] is pushed if the first is less than or equal to the second,
403 or \f[B]0\f[R] otherwise.
404 .RS
405 .PP
406 This is a \f[B]non-portable extension\f[R].
407 .RE
408 .TP
409 \f[B])\f[R]
410 The top two values are popped off of the stack, they are compared, and a
411 \f[B]1\f[R] is pushed if the first is greater than the second, or
412 \f[B]0\f[R] otherwise.
413 .RS
414 .PP
415 This is a \f[B]non-portable extension\f[R].
416 .RE
417 .TP
418 \f[B]}\f[R]
419 The top two values are popped off of the stack, they are compared, and a
420 \f[B]1\f[R] is pushed if the first is greater than or equal to the
421 second, or \f[B]0\f[R] otherwise.
422 .RS
423 .PP
424 This is a \f[B]non-portable extension\f[R].
425 .RE
426 .TP
427 \f[B]M\f[R]
428 The top two values are popped off of the stack.
429 If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
430 If either of them is zero, or both of them are, then a \f[B]0\f[R] is
431 pushed onto the stack.
432 .RS
433 .PP
434 This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
435 a short-circuit operator.
436 .PP
437 This is a \f[B]non-portable extension\f[R].
438 .RE
439 .TP
440 \f[B]m\f[R]
441 The top two values are popped off of the stack.
442 If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
443 stack.
444 If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
445 .RS
446 .PP
447 This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
448 a short-circuit operator.
449 .PP
450 This is a \f[B]non-portable extension\f[R].
451 .RE
452 .SS Stack Control
453 .PP
454 These commands control the stack.
455 .TP
456 \f[B]c\f[R]
457 Removes all items from (\[lq]clears\[rq]) the stack.
458 .TP
459 \f[B]d\f[R]
460 Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
461 the copy onto the stack.
462 .TP
463 \f[B]r\f[R]
464 Swaps (\[lq]reverses\[rq]) the two top items on the stack.
465 .TP
466 \f[B]R\f[R]
467 Pops (\[lq]removes\[rq]) the top value from the stack.
468 .SS Register Control
469 .PP
470 These commands control registers (see the \f[B]REGISTERS\f[R] section).
471 .TP
472 \f[B]s\f[R]\f[I]r\f[R]
473 Pops the value off the top of the stack and stores it into register
474 \f[I]r\f[R].
475 .TP
476 \f[B]l\f[R]\f[I]r\f[R]
477 Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
478 This does not alter the contents of \f[I]r\f[R].
479 .TP
480 \f[B]S\f[R]\f[I]r\f[R]
481 Pops the value off the top of the (main) stack and pushes it onto the
482 stack of register \f[I]r\f[R].
483 The previous value of the register becomes inaccessible.
484 .TP
485 \f[B]L\f[R]\f[I]r\f[R]
486 Pops the value off the top of the stack for register \f[I]r\f[R] and
487 push it onto the main stack.
488 The previous value in the stack for register \f[I]r\f[R], if any, is now
489 accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
490 .SS Parameters
491 .PP
492 These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
493 and \f[B]scale\f[R].
494 Also see the \f[B]SYNTAX\f[R] section.
495 .TP
496 \f[B]i\f[R]
497 Pops the value off of the top of the stack and uses it to set
498 \f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
499 inclusive.
500 .RS
501 .PP
502 If the value on top of the stack has any \f[I]scale\f[R], the
503 \f[I]scale\f[R] is ignored.
504 .RE
505 .TP
506 \f[B]o\f[R]
507 Pops the value off of the top of the stack and uses it to set
508 \f[B]obase\f[R], which must be between \f[B]2\f[R] and
509 \f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
510 .RS
511 .PP
512 If the value on top of the stack has any \f[I]scale\f[R], the
513 \f[I]scale\f[R] is ignored.
514 .RE
515 .TP
516 \f[B]k\f[R]
517 Pops the value off of the top of the stack and uses it to set
518 \f[B]scale\f[R], which must be non-negative.
519 .RS
520 .PP
521 If the value on top of the stack has any \f[I]scale\f[R], the
522 \f[I]scale\f[R] is ignored.
523 .RE
524 .TP
525 \f[B]I\f[R]
526 Pushes the current value of \f[B]ibase\f[R] onto the main stack.
527 .TP
528 \f[B]O\f[R]
529 Pushes the current value of \f[B]obase\f[R] onto the main stack.
530 .TP
531 \f[B]K\f[R]
532 Pushes the current value of \f[B]scale\f[R] onto the main stack.
533 .TP
534 \f[B]T\f[R]
535 Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
536 stack.
537 .RS
538 .PP
539 This is a \f[B]non-portable extension\f[R].
540 .RE
541 .TP
542 \f[B]U\f[R]
543 Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
544 stack.
545 .RS
546 .PP
547 This is a \f[B]non-portable extension\f[R].
548 .RE
549 .TP
550 \f[B]V\f[R]
551 Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
552 stack.
553 .RS
554 .PP
555 This is a \f[B]non-portable extension\f[R].
556 .RE
557 .SS Strings
558 .PP
559 The following commands control strings.
560 .PP
561 dc(1) can work with both numbers and strings, and registers (see the
562 \f[B]REGISTERS\f[R] section) can hold both strings and numbers.
563 dc(1) always knows whether the contents of a register are a string or a
564 number.
565 .PP
566 While arithmetic operations have to have numbers, and will print an
567 error if given a string, other commands accept strings.
568 .PP
569 Strings can also be executed as macros.
570 For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
571 the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
572 printed with a newline after and then popped from the stack.
573 .TP
574 \f[B][\f[R]_characters_\f[B]]\f[R]
575 Makes a string containing \f[I]characters\f[R] and pushes it onto the
576 stack.
577 .RS
578 .PP
579 If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
580 they must be balanced.
581 Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
582 character.
583 .PP
584 If there is a backslash character in the string, the character after it
585 (even another backslash) is put into the string verbatim, but the
586 (first) backslash is not.
587 .RE
588 .TP
589 \f[B]a\f[R]
590 The value on top of the stack is popped.
591 .RS
592 .PP
593 If it is a number, it is truncated and its absolute value is taken.
594 The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
595 If that result is \f[B]0\f[R], push an empty string; otherwise, push a
596 one-character string where the character is the result of the mod
597 interpreted as an ASCII character.
598 .PP
599 If it is a string, then a new string is made.
600 If the original string is empty, the new string is empty.
601 If it is not, then the first character of the original string is used to
602 create the new string as a one-character string.
603 The new string is then pushed onto the stack.
604 .PP
605 This is a \f[B]non-portable extension\f[R].
606 .RE
607 .TP
608 \f[B]x\f[R]
609 Pops a value off of the top of the stack.
610 .RS
611 .PP
612 If it is a number, it is pushed back onto the stack.
613 .PP
614 If it is a string, it is executed as a macro.
615 .PP
616 This behavior is the norm whenever a macro is executed, whether by this
617 command or by the conditional execution commands below.
618 .RE
619 .TP
620 \f[B]>\f[R]\f[I]r\f[R]
621 Pops two values off of the stack that must be numbers and compares them.
622 If the first value is greater than the second, then the contents of
623 register \f[I]r\f[R] are executed.
624 .RS
625 .PP
626 For example, \f[B]0 1>a\f[R] will execute the contents of register
627 \f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
628 .PP
629 If either or both of the values are not numbers, dc(1) will raise an
630 error and reset (see the \f[B]RESET\f[R] section).
631 .RE
632 .TP
633 \f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
634 Like the above, but will execute register \f[I]s\f[R] if the comparison
635 fails.
636 .RS
637 .PP
638 If either or both of the values are not numbers, dc(1) will raise an
639 error and reset (see the \f[B]RESET\f[R] section).
640 .PP
641 This is a \f[B]non-portable extension\f[R].
642 .RE
643 .TP
644 \f[B]!>\f[R]\f[I]r\f[R]
645 Pops two values off of the stack that must be numbers and compares them.
646 If the first value is not greater than the second (less than or equal
647 to), then the contents of register \f[I]r\f[R] are executed.
648 .RS
649 .PP
650 If either or both of the values are not numbers, dc(1) will raise an
651 error and reset (see the \f[B]RESET\f[R] section).
652 .RE
653 .TP
654 \f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
655 Like the above, but will execute register \f[I]s\f[R] if the comparison
656 fails.
657 .RS
658 .PP
659 If either or both of the values are not numbers, dc(1) will raise an
660 error and reset (see the \f[B]RESET\f[R] section).
661 .PP
662 This is a \f[B]non-portable extension\f[R].
663 .RE
664 .TP
665 \f[B]<\f[R]\f[I]r\f[R]
666 Pops two values off of the stack that must be numbers and compares them.
667 If the first value is less than the second, then the contents of
668 register \f[I]r\f[R] are executed.
669 .RS
670 .PP
671 If either or both of the values are not numbers, dc(1) will raise an
672 error and reset (see the \f[B]RESET\f[R] section).
673 .RE
674 .TP
675 \f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
676 Like the above, but will execute register \f[I]s\f[R] if the comparison
677 fails.
678 .RS
679 .PP
680 If either or both of the values are not numbers, dc(1) will raise an
681 error and reset (see the \f[B]RESET\f[R] section).
682 .PP
683 This is a \f[B]non-portable extension\f[R].
684 .RE
685 .TP
686 \f[B]!<\f[R]\f[I]r\f[R]
687 Pops two values off of the stack that must be numbers and compares them.
688 If the first value is not less than the second (greater than or equal
689 to), then the contents of register \f[I]r\f[R] are executed.
690 .RS
691 .PP
692 If either or both of the values are not numbers, dc(1) will raise an
693 error and reset (see the \f[B]RESET\f[R] section).
694 .RE
695 .TP
696 \f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
697 Like the above, but will execute register \f[I]s\f[R] if the comparison
698 fails.
699 .RS
700 .PP
701 If either or both of the values are not numbers, dc(1) will raise an
702 error and reset (see the \f[B]RESET\f[R] section).
703 .PP
704 This is a \f[B]non-portable extension\f[R].
705 .RE
706 .TP
707 \f[B]=\f[R]\f[I]r\f[R]
708 Pops two values off of the stack that must be numbers and compares them.
709 If the first value is equal to the second, then the contents of register
710 \f[I]r\f[R] are executed.
711 .RS
712 .PP
713 If either or both of the values are not numbers, dc(1) will raise an
714 error and reset (see the \f[B]RESET\f[R] section).
715 .RE
716 .TP
717 \f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
718 Like the above, but will execute register \f[I]s\f[R] if the comparison
719 fails.
720 .RS
721 .PP
722 If either or both of the values are not numbers, dc(1) will raise an
723 error and reset (see the \f[B]RESET\f[R] section).
724 .PP
725 This is a \f[B]non-portable extension\f[R].
726 .RE
727 .TP
728 \f[B]!=\f[R]\f[I]r\f[R]
729 Pops two values off of the stack that must be numbers and compares them.
730 If the first value is not equal to the second, then the contents of
731 register \f[I]r\f[R] are executed.
732 .RS
733 .PP
734 If either or both of the values are not numbers, dc(1) will raise an
735 error and reset (see the \f[B]RESET\f[R] section).
736 .RE
737 .TP
738 \f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
739 Like the above, but will execute register \f[I]s\f[R] if the comparison
740 fails.
741 .RS
742 .PP
743 If either or both of the values are not numbers, dc(1) will raise an
744 error and reset (see the \f[B]RESET\f[R] section).
745 .PP
746 This is a \f[B]non-portable extension\f[R].
747 .RE
748 .TP
749 \f[B]?\f[R]
750 Reads a line from the \f[B]stdin\f[R] and executes it.
751 This is to allow macros to request input from users.
752 .TP
753 \f[B]q\f[R]
754 During execution of a macro, this exits the execution of that macro and
755 the execution of the macro that executed it.
756 If there are no macros, or only one macro executing, dc(1) exits.
757 .TP
758 \f[B]Q\f[R]
759 Pops a value from the stack which must be non-negative and is used the
760 number of macro executions to pop off of the execution stack.
761 If the number of levels to pop is greater than the number of executing
762 macros, dc(1) exits.
763 .SS Status
764 .PP
765 These commands query status of the stack or its top value.
766 .TP
767 \f[B]Z\f[R]
768 Pops a value off of the stack.
769 .RS
770 .PP
771 If it is a number, calculates the number of significant decimal digits
772 it has and pushes the result.
773 .PP
774 If it is a string, pushes the number of characters the string has.
775 .RE
776 .TP
777 \f[B]X\f[R]
778 Pops a value off of the stack.
779 .RS
780 .PP
781 If it is a number, pushes the \f[I]scale\f[R] of the value onto the
782 stack.
783 .PP
784 If it is a string, pushes \f[B]0\f[R].
785 .RE
786 .TP
787 \f[B]z\f[R]
788 Pushes the current stack depth (before execution of this command).
789 .SS Arrays
790 .PP
791 These commands manipulate arrays.
792 .TP
793 \f[B]:\f[R]\f[I]r\f[R]
794 Pops the top two values off of the stack.
795 The second value will be stored in the array \f[I]r\f[R] (see the
796 \f[B]REGISTERS\f[R] section), indexed by the first value.
797 .TP
798 \f[B];\f[R]\f[I]r\f[R]
799 Pops the value on top of the stack and uses it as an index into the
800 array \f[I]r\f[R].
801 The selected value is then pushed onto the stack.
802 .SH REGISTERS
803 .PP
804 Registers are names that can store strings, numbers, and arrays.
805 (Number/string registers do not interfere with array registers.)
806 .PP
807 Each register is also its own stack, so the current register value is
808 the top of the stack for the register.
809 All registers, when first referenced, have one value (\f[B]0\f[R]) in
810 their stack.
811 .PP
812 In non-extended register mode, a register name is just the single
813 character that follows any command that needs a register name.
814 The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
815 error for a newline to be used as a register name.
816 .SS Extended Register Mode
817 .PP
818 Unlike most other dc(1) implentations, this dc(1) provides nearly
819 unlimited amounts of registers, if extended register mode is enabled.
820 .PP
821 If extended register mode is enabled (\f[B]-x\f[R] or
822 \f[B]\[en]extended-register\f[R] command-line arguments are given), then
823 normal single character registers are used \f[I]unless\f[R] the
824 character immediately following a command that needs a register name is
825 a space (according to \f[B]isspace()\f[R]) and not a newline
826 (\f[B]`\[rs]n'\f[R]).
827 .PP
828 In that case, the register name is found according to the regex
829 \f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
830 error if the next non-space characters do not match that regex.
831 .SH RESET
832 .PP
833 When dc(1) encounters an error or a signal that it has a non-default
834 handler for, it resets.
835 This means that several things happen.
836 .PP
837 First, any macros that are executing are stopped and popped off the
838 stack.
839 The behavior is not unlike that of exceptions in programming languages.
840 Then the execution point is set so that any code waiting to execute
841 (after all macros returned) is skipped.
842 .PP
843 Thus, when dc(1) resets, it skips any remaining code waiting to be
844 executed.
845 Then, if it is interactive mode, and the error was not a fatal error
846 (see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
847 otherwise, it exits with the appropriate return code.
848 .SH PERFORMANCE
849 .PP
850 Most dc(1) implementations use \f[B]char\f[R] types to calculate the
851 value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
852 This dc(1) does something different.
853 .PP
854 It uses large integers to calculate more than \f[B]1\f[R] decimal digit
855 at a time.
856 If built in a environment where \f[B]DC_LONG_BIT\f[R] (see the
857 \f[B]LIMITS\f[R] section) is \f[B]64\f[R], then each integer has
858 \f[B]9\f[R] decimal digits.
859 If built in an environment where \f[B]DC_LONG_BIT\f[R] is \f[B]32\f[R]
860 then each integer has \f[B]4\f[R] decimal digits.
861 This value (the number of decimal digits per large integer) is called
862 \f[B]DC_BASE_DIGS\f[R].
863 .PP
864 In addition, this dc(1) uses an even larger integer for overflow
865 checking.
866 This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
867 always at least twice as large as the integer type used to store digits.
868 .SH LIMITS
869 .PP
870 The following are the limits on dc(1):
871 .TP
872 \f[B]DC_LONG_BIT\f[R]
873 The number of bits in the \f[B]long\f[R] type in the environment where
874 dc(1) was built.
875 This determines how many decimal digits can be stored in a single large
876 integer (see the \f[B]PERFORMANCE\f[R] section).
877 .TP
878 \f[B]DC_BASE_DIGS\f[R]
879 The number of decimal digits per large integer (see the
880 \f[B]PERFORMANCE\f[R] section).
881 Depends on \f[B]DC_LONG_BIT\f[R].
882 .TP
883 \f[B]DC_BASE_POW\f[R]
884 The max decimal number that each large integer can store (see
885 \f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
886 Depends on \f[B]DC_BASE_DIGS\f[R].
887 .TP
888 \f[B]DC_OVERFLOW_MAX\f[R]
889 The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
890 section) can hold.
891 Depends on \f[B]DC_LONG_BIT\f[R].
892 .TP
893 \f[B]DC_BASE_MAX\f[R]
894 The maximum output base.
895 Set at \f[B]DC_BASE_POW\f[R].
896 .TP
897 \f[B]DC_DIM_MAX\f[R]
898 The maximum size of arrays.
899 Set at \f[B]SIZE_MAX-1\f[R].
900 .TP
901 \f[B]DC_SCALE_MAX\f[R]
902 The maximum \f[B]scale\f[R].
903 Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
904 .TP
905 \f[B]DC_STRING_MAX\f[R]
906 The maximum length of strings.
907 Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
908 .TP
909 \f[B]DC_NAME_MAX\f[R]
910 The maximum length of identifiers.
911 Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
912 .TP
913 \f[B]DC_NUM_MAX\f[R]
914 The maximum length of a number (in decimal digits), which includes
915 digits after the decimal point.
916 Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
917 .TP
918 Exponent
919 The maximum allowable exponent (positive or negative).
920 Set at \f[B]DC_OVERFLOW_MAX\f[R].
921 .TP
922 Number of vars
923 The maximum number of vars/arrays.
924 Set at \f[B]SIZE_MAX-1\f[R].
925 .PP
926 These limits are meant to be effectively non-existent; the limits are so
927 large (at least on 64-bit machines) that there should not be any point
928 at which they become a problem.
929 In fact, memory should be exhausted before these limits should be hit.
930 .SH ENVIRONMENT VARIABLES
931 .PP
932 dc(1) recognizes the following environment variables:
933 .TP
934 \f[B]DC_ENV_ARGS\f[R]
935 This is another way to give command-line arguments to dc(1).
936 They should be in the same format as all other command-line arguments.
937 These are always processed first, so any files given in
938 \f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
939 on the command-line.
940 This gives the user the ability to set up \[lq]standard\[rq] options and
941 files to be used at every invocation.
942 The most useful thing for such files to contain would be useful
943 functions that the user might want every time dc(1) runs.
944 Another use would be to use the \f[B]-e\f[R] option to set
945 \f[B]scale\f[R] to a value other than \f[B]0\f[R].
946 .RS
947 .PP
948 The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
949 arguments, but it does not understand escape sequences.
950 For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
951 will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
952 \[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
953 .PP
954 The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
955 \f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
956 quotes in the name, you can use double quotes as the outside quotes, as
957 in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
958 file with double quotes.
959 However, handling a file with both kinds of quotes in
960 \f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
961 parsing, though such files are still supported on the command-line where
962 the parsing is done by the shell.
963 .RE
964 .TP
965 \f[B]DC_LINE_LENGTH\f[R]
966 If this environment variable exists and contains an integer that is
967 greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
968 (\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
969 including the backslash newline combo.
970 The default line length is \f[B]70\f[R].
971 .TP
972 \f[B]DC_EXPR_EXIT\f[R]
973 If this variable exists (no matter the contents), dc(1) will exit
974 immediately after executing expressions and files given by the
975 \f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
976 equivalents).
977 .SH EXIT STATUS
978 .PP
979 dc(1) returns the following exit statuses:
980 .TP
981 \f[B]0\f[R]
982 No error.
983 .TP
984 \f[B]1\f[R]
985 A math error occurred.
986 This follows standard practice of using \f[B]1\f[R] for expected errors,
987 since math errors will happen in the process of normal execution.
988 .RS
989 .PP
990 Math errors include divide by \f[B]0\f[R], taking the square root of a
991 negative number, attempting to convert a negative number to a hardware
992 integer, overflow when converting a number to a hardware integer, and
993 attempting to use a non-integer where an integer is required.
994 .PP
995 Converting to a hardware integer happens for the second operand of the
996 power (\f[B]\[ha]\f[R]) operator.
997 .RE
998 .TP
999 \f[B]2\f[R]
1000 A parse error occurred.
1001 .RS
1002 .PP
1003 Parse errors include unexpected \f[B]EOF\f[R], using an invalid
1004 character, failing to find the end of a string or comment, and using a
1005 token where it is invalid.
1006 .RE
1007 .TP
1008 \f[B]3\f[R]
1009 A runtime error occurred.
1010 .RS
1011 .PP
1012 Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
1013 \f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
1014 \f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
1015 \f[B]read()\f[R] call, type errors, and attempting an operation when the
1016 stack has too few elements.
1017 .RE
1018 .TP
1019 \f[B]4\f[R]
1020 A fatal error occurred.
1021 .RS
1022 .PP
1023 Fatal errors include memory allocation errors, I/O errors, failing to
1024 open files, attempting to use files that do not have only ASCII
1025 characters (dc(1) only accepts ASCII characters), attempting to open a
1026 directory as a file, and giving invalid command-line options.
1027 .RE
1028 .PP
1029 The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
1030 always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
1031 .PP
1032 The other statuses will only be returned when dc(1) is not in
1033 interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
1034 dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
1035 more input when one of those errors occurs in interactive mode.
1036 This is also the case when interactive mode is forced by the
1037 \f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
1038 .PP
1039 These exit statuses allow dc(1) to be used in shell scripting with error
1040 checking, and its normal behavior can be forced by using the
1041 \f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
1042 .SH INTERACTIVE MODE
1043 .PP
1044 Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
1045 Interactive mode is turned on automatically when both \f[B]stdin\f[R]
1046 and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
1047 and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
1048 .PP
1049 In interactive mode, dc(1) attempts to recover from errors (see the
1050 \f[B]RESET\f[R] section), and in normal execution, flushes
1051 \f[B]stdout\f[R] as soon as execution is done for the current input.
1052 .SH TTY MODE
1053 .PP
1054 If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
1055 connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
1056 .PP
1057 TTY mode is required for history to be enabled (see the \f[B]COMMAND
1058 LINE HISTORY\f[R] section).
1059 It is also required to enable special handling for \f[B]SIGINT\f[R]
1060 signals.
1061 .PP
1062 TTY mode is different from interactive mode because interactive mode is
1063 required in the bc(1)
1064 specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
1065 and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
1066 to be connected to a terminal.
1067 .SH SIGNAL HANDLING
1068 .PP
1069 Sending a \f[B]SIGINT\f[R] will cause dc(1) to stop execution of the
1070 current input.
1071 If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
1072 reset (see the \f[B]RESET\f[R] section).
1073 Otherwise, it will clean up and exit.
1074 .PP
1075 Note that \[lq]current input\[rq] can mean one of two things.
1076 If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
1077 ask for more input.
1078 If dc(1) is processing input from a file in TTY mode, it will stop
1079 processing the file and start processing the next file, if one exists,
1080 or ask for input from \f[B]stdin\f[R] if no other file exists.
1081 .PP
1082 This means that if a \f[B]SIGINT\f[R] is sent to dc(1) as it is
1083 executing a file, it can seem as though dc(1) did not respond to the
1084 signal since it will immediately start executing the next file.
1085 This is by design; most files that users execute when interacting with
1086 dc(1) have function definitions, which are quick to parse.
1087 If a file takes a long time to execute, there may be a bug in that file.
1088 The rest of the files could still be executed without problem, allowing
1089 the user to continue.
1090 .PP
1091 \f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
1092 exit, and it uses the default handler for all other signals.
1093 The one exception is \f[B]SIGHUP\f[R]; in that case, when dc(1) is in
1094 TTY mode, a \f[B]SIGHUP\f[R] will cause dc(1) to clean up and exit.
1095 .SH COMMAND LINE HISTORY
1096 .PP
1097 dc(1) supports interactive command-line editing.
1098 If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), history is
1099 enabled.
1100 Previous lines can be recalled and edited with the arrow keys.
1101 .PP
1102 \f[B]Note\f[R]: tabs are converted to 8 spaces.
1103 .SH LOCALES
1104 .PP
1105 This dc(1) ships with support for adding error messages for different
1106 locales and thus, supports \f[B]LC_MESSAGS\f[R].
1107 .SH SEE ALSO
1108 .PP
1109 bc(1)
1110 .SH STANDARDS
1111 .PP
1112 The dc(1) utility operators are compliant with the operators in the
1113 bc(1) IEEE Std 1003.1-2017
1114 (\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
1115 specification.
1116 .SH BUGS
1117 .PP
1118 None are known.
1119 Report bugs at https://git.yzena.com/gavin/bc.
1120 .SH AUTHOR
1121 .PP
1122 Gavin D.
1123 Howard <gavin@yzena.com> and contributors.