Debian Codegraph @

upstream/debian-unstable/man1/xcalc.1

raw
1 .\" t
2 .\" Copyright (c) 1994 X Consortium
3 .\"
4 .\" Permission is hereby granted, free of charge, to any person obtaining
5 .\" a copy of this software and associated documentation files (the
6 .\" "Software"), to deal in the Software without restriction, including
7 .\" without limitation the rights to use, copy, modify, merge, publish,
8 .\" distribute, sublicense, and/or sell copies of the Software, and to
9 .\" permit persons to whom the Software is furnished to do so, subject to
10 .\" the following conditions:
11 .\"
12 .\" The above copyright notice and this permission notice shall be included
13 .\" in all copies or substantial portions of the Software.
14 .\"
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 .\" OTHER DEALINGS IN THE SOFTWARE.
22 .\"
23 .\" Except as contained in this notice, the name of the X Consortium shall
24 .\" not be used in advertising or otherwise to promote the sale, use or
25 .\" other dealings in this Software without prior written authorization
26 .\" from the X Consortium.
27 .\"
28 .\"
29 .de EX \"Begin example
30 .ne 5
31 .if n .sp 1
32 .if t .sp .5
33 .nf
34 .in +.5i
35 ..
36 .de EE
37 .fi
38 .in -.5i
39 .if n .sp 1
40 .if t .sp .5
41 ..
42 .TH XCALC 1 "xcalc 1.1.2" "X Version 11"
43 .SH NAME
44 xcalc \- scientific calculator for X
45 .SH SYNOPSIS
46 .nf
47 \fBxcalc\fP [\fB-stipple\fP] [\fB-rpn\fP] [-\fItoolkitoption...\fP]
48 \fBxcalc -version\fP
49 \fBxcalc -help\fP
50 .fi
51 .SH DESCRIPTION
52 .I xcalc
53 is a scientific calculator desktop accessory that can emulate a TI-30
54 or an HP-10C.
55 .SH OPTIONS
56 .PP
57 \fIxcalc\fP accepts all of the standard toolkit command line options along
58 with these additional options:
59 .PP
60 .TP 8
61 .B \-stipple
62 This option indicates that the background of the calculator should be
63 drawn using a stipple of the foreground and background colors. On monochrome
64 displays improves the appearance.
65 .PP
66 .TP 8
67 .B \-rpn
68 This option indicates that Reverse Polish Notation should be used. In this
69 mode the calculator will look and behave like an HP-10C. Without this flag,
70 it will emulate a TI-30.
71 .TP 8
72 .B \-help
73 This option indicates that \fIxcalc\fP should print its usage message and exit.
74 .TP 8
75 .B \-version
76 This option indicates that \fIxcalc\fP should print its version and exit.
77 .SH OPERATION
78 .PP
79 .I Pointer Usage:
80 Operations may be performed with pointer button 1, or in some cases,
81 with the keyboard.
82 Many common calculator operations have keyboard accelerators.
83 To quit, press pointer button 3 on the AC key of the TI calculator,
84 or the ON key of the HP calculator.
85 .PP
86 .I Calculator Key Usage (TI mode):
87 The numbered keys, the +/- key, and the +, -, *, /, and = keys all do exactly
88 what you would expect them to. It should be noted that the operators obey
89 the standard rules of precedence. Thus, entering "3+4*5=" results in "23",
90 not "35". The parentheses can be used to override this. For example,
91 "(1+2+3)*(4+5+6)=" results in "6*15=90".
92 .PP
93 The entire number in the calculator display can be selected, in order to
94 paste the result of a calculation into text.
95 .PP
96 The action procedures associated with each function are given below. These
97 are useful if you are interested in defining a custom calculator.
98 The action used for all digit keys is \fBdigit(\fIn\fP)\fR, where \fIn\fR
99 is the corresponding digit, 0..9.
100 .TP 10
101 .B 1/x
102 Replaces the number in the display with its reciprocal.
103 The corresponding action procedure is \fBreciprocal()\fR.
104 .TP 10
105 .B x^2
106 Squares the number in the display.
107 The corresponding action procedure is \fBsquare()\fR.
108 .TP 10
109 .B SQRT
110 Takes the square root of the number in the display.
111 The corresponding action procedure is \fBsquareRoot()\fR.
112 .TP 10
113 .B CE/C
114 When pressed once, clears the number in the display without clearing the state
115 of the machine. Allows you to re-enter a number if you make a mistake.
116 Pressing it twice clears the state, also.
117 The corresponding action procedure for TI mode is \fBclear()\fR.
118 .TP 10
119 .B AC
120 Clears the display, the state, and the memory. Pressing it with the third
121 pointer button turns off the calculator, in that it exits the program.
122 The action procedure to clear the state is \fBoff()\fR; to quit, \fBquit()\fR.
123 .TP 10
124 .B INV
125 Invert function. See the individual function keys for details.
126 The corresponding action procedure is \fBinverse()\fR.
127 .TP 10
128 .B sin
129 Computes the sine of the number in the display, as interpreted by the current
130 DRG mode (see DRG, below). If inverted, it computes the arcsine.
131 The corresponding action procedure is \fBsine()\fR.
132 .TP 10
133 .B cos
134 Computes the cosine, or arccosine when inverted.
135 The corresponding action procedure is \fBcosine()\fP.
136 .TP 10
137 .B tan
138 Computes the tangent, or arctangent when inverted.
139 The corresponding action procedure is \fBtangent()\fP.
140 .TP 10
141 .B DRG
142 Changes the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the bottom
143 of the calculator ``liquid crystal'' display.
144 When in 'DEG' mode, numbers in the display are taken as being
145 degrees. In 'RAD' mode, numbers are in radians, and in 'GRAD' mode, numbers
146 are in grads. When inverted, the DRG key has a feature of
147 converting degrees to radians to grads and vice-versa. Example: put the
148 calculator into 'DEG' mode, and enter "45 INV DRG". The display should now
149 show something along the lines of ".785398", which is 45 degrees converted to
150 radians.
151 The corresponding action procedure is \fBdegree()\fP.
152 .TP 10
153 .B e
154 The constant 'e'. (2.7182818...).
155 The corresponding action procedure is \fBe()\fR.
156 .TP 10
157 .B EE
158 Used for entering exponential numbers. For example, to get "-2.3E-4" you'd
159 enter "2 . 3 +/- EE 4 +/-".
160 The corresponding action procedure is \fBscientific()\fR.
161 .TP 10
162 .B log
163 Calculates the log (base 10) of the number in the display. When inverted,
164 it raises "10.0" to the number in the display.
165 For example, entering "3 INV log" should result in "1000".
166 The corresponding action procedure is \fBlogarithm()\fP.
167 .TP 10
168 .B ln
169 Calculates the log (base e) of the number in the display. When inverted,
170 it raises "e" to the number in the display. For example, entering "e ln"
171 should result in "1".
172 The corresponding action procedure is \fBnaturalLog()\fR.
173 .TP 10
174 .B y^x
175 Raises the number on the left to the power of the number on the right. For
176 example "2 y^x 3 =" results in "8", which is 2^3. For a further example,
177 "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216".
178 The corresponding action procedure is \fBpower()\fR.
179 .TP 10
180 .B not
181 Performs a bitwise not.
182 The corresponding action procedure is \fBnot()\fP.
183 .TP 10
184 .B and
185 Performs a bitwise and.
186 The corresponding action procedure is \fBand()\fP.
187 .TP 10
188 .B or
189 Performs a bitwise or.
190 The corresponding action procedure is \fBor()\fP.
191 .TP 10
192 .B xor
193 Performs a bitwise exclusive or.
194 The corresponding action procedure is \fBxor()\fP.
195 .TP 10
196 .B trunc
197 Truncates the number in the display to an integer.
198 The corresponding action procedure is \fBtrunc()\fP.
199 .TP 10
200 .B PI
201 The constant 'pi'. (3.1415927....)
202 The corresponding action procedure is \fBpi()\fR.
203 .TP 10
204 .B x!
205 Computes the factorial of the number in the display. The number in the display
206 must be an integer in the range 0-500, though, depending on your math library,
207 it might overflow long before that.
208 The corresponding action procedure is \fBfactorial()\fR.
209 .TP 10
210 .B (
211 Left parenthesis. The corresponding action procedure for TI calculators
212 is \fBleftParen()\fR.
213 .TP 10
214 .B )
215 Right parenthesis. The corresponding action procedure for TI calculators
216 is \fBrightParen()\fR.
217 .TP 10
218 .B base
219 Changes the number base, as indicated by 'DEC', 'HEX, or 'OCT' at the bottom
220 of the calculator display.
221 When in 'DEC' mode, numbers in the display are taken as being decimal
222 (base 10). In 'HEX' mode, numbers are in hexadecimal (base 16), and in 'OCT'
223 mode, numbers are in octal (base 8).
224 The corresponding action procedure is \fBbase()\fP.
225 .TP 10
226 .B shl
227 Performs an arithmetic bitwise shift left, For example, entering "1 shl 2"
228 should result in "4".
229 The corresponding action procedure is \fBshl()\fR.
230 .TP 10
231 .B shr
232 Performs an arithmetic bitwise shift right, For example, entering "8 shr 1"
233 should result in "4".
234 The corresponding action procedure is \fBshr()\fR.
235 .TP 10
236 .B mod
237 Performs the modulo operation, which calculates the remainder when dividing
238 the first number by the second. For example, entering "14 mod 8" should
239 result in "6".
240 The corresponding action procedure is \fBmod()\fR.
241 .TP 10
242 .B /
243 Division. The corresponding action procedure is \fBdivide()\fR.
244 .TP 10
245 .B *
246 Multiplication. The corresponding action procedure is \fBmultiply()\fR.
247 .TP 10
248 .B -
249 Subtraction. The corresponding action procedure is \fBsubtract()\fR.
250 .TP 10
251 .B +
252 Addition. The corresponding action procedure is \fBadd()\fR.
253 .TP 10
254 .B =
255 Perform calculation. The TI-specific action procedure is \fBequal()\fR.
256 .TP 10
257 .B STO
258 Copies the number in the display to the memory location.
259 The corresponding action procedure is \fBstore()\fR.
260 .TP 10
261 .B RCL
262 Copies the number from the memory location to the display.
263 The corresponding action procedure is \fBrecall()\fR.
264 .TP 10
265 .B SUM
266 Adds the number in the display to the number in the memory location.
267 The corresponding action procedure is \fBsum()\fR.
268 .TP 10
269 .B EXC
270 Swaps the number in the display with the number in the memory location.
271 The corresponding action procedure for the TI calculator is \fBexchange()\fR.
272 .TP 10
273 .B +/-
274 Negate; change sign. The corresponding action procedure is \fBnegate()\fR.
275 .TP 10
276 .B .
277 Decimal point. The action procedure is \fBdecimal()\fP.
278 .sp
279 .PP
280 .I Calculator Key Usage (RPN mode):
281 The number keys, CHS (change sign), +, -, *, /, and ENTR keys all do exactly
282 what you would expect them to do. Many of the remaining keys are the same as
283 in TI mode. The differences are detailed below. The action procedure
284 for the ENTR key is \fBenter()\fR.
285 .sp
286 .TP 10
287 .B <-
288 This is a backspace key that can be used if you make a mistake while entering
289 a number. It will erase digits from the display. (See BUGS).
290 Inverse backspace will clear the X register.
291 The corresponding action procedure is \fBback()\fR.
292 .TP 10
293 .B ON
294 Clears the display, the state, and the memory. Pressing it with the third
295 pointer button turns off the calculator, in that it exits the program.
296 To clear state, the action procedure is \fBoff\fR; to quit, \fBquit()\fR.
297 .TP 10
298 .B INV
299 Inverts the meaning of the function keys. This would be the \fIf\fR key
300 on an HP calculator, but \fIxcalc\fR does not display
301 multiple legends on each key. See the individual function keys for details.
302 .TP 10
303 .B 10^x
304 Raises "10.0" to the number in the top of the stack.
305 When inverted, it calculates the log (base 10) of the number in the display.
306 The corresponding action procedure is \fBtenpower()\fR.
307 .TP 10
308 .B e^x
309 Raises "e" to the number in the top of the stack.
310 When inverted, it calculates the log (base e) of the number in the display.
311 The action procedure is \fBepower()\fR.
312 .TP 10
313 .B STO
314 Copies the number in the top of the stack to a memory location. There are 10
315 memory locations. The desired memory is specified by following this
316 key with a digit key.
317 .TP 10
318 .B RCL
319 Pushes the number from the specified memory location onto the stack.
320 .TP 10
321 .B SUM
322 Adds the number on top of the stack to the number in the specified
323 memory location.
324 .TP 10
325 .B x:y
326 Exchanges the numbers in the top two stack positions, the X and Y registers.
327 The corresponding action procedure is \fBXexchangeY()\fR.
328 .TP 10
329 .B R v
330 Rolls the stack downward. When inverted, it rolls the stack upward.
331 The corresponding action procedure is \fBroll()\fR.
332 .TP 10
333 .I blank
334 These keys were used for programming functions on the HP-10C. Their
335 functionality has not been duplicated in \fIxcalc\fR.
336 .PP
337 Finally, there are two additional action procedures:
338 \fBbell()\fR, which rings the bell;
339 and \fBselection()\fR, which performs a cut on the
340 entire number in the calculator's ``liquid crystal'' display.
341 .SH ACCELERATORS
342 .PP
343 Accelerators are shortcuts for entering commands. \fIxcalc\fP provides
344 some sample keyboard accelerators; also users can customize accelerators.
345 The numeric keypad accelerators provided by \fIxcalc\fP
346 should be intuitively correct.
347 The accelerators defined by \fIxcalc\fP on the main keyboard are given below:
348 .PP
349 .TS
350 l l l l l.
351 TI Key HP Key Keyboard Accelerator TI Function HP Function
352 _
353 SQRT SQRT r squareRoot() squareRoot()
354 AC ON space clear() clear()
355 AC <- Delete clear() back()
356 AC <- Backspace clear() back()
357 AC <- Control-H clear() back()
358 AC Clear clear()
359 AC ON q quit() quit()
360 AC ON Control-C quit() quit()
361
362 INV i i inverse() inverse()
363 sin s s sine() sine()
364 cos c c cosine() cosine()
365 tan t t tangent() tangent()
366 DRG DRG d degree() degree()
367
368 e e e()
369 ln ln l naturalLog() naturalLog()
370 y^x y^x ^ power() power()
371
372 PI PI p pi() pi()
373 x! x! ! factorial() factorial()
374 ( ( leftParen()
375 ) ) rightParen()
376
377 / / / divide() divide()
378 * * * multiply() multiply()
379 - - - subtract() subtract()
380 + + + add() add()
381 \&= \&= equal()
382
383 0..9 0..9 0..9 digit() digit()
384 . . . decimal() decimal()
385 +/- CHS n negate() negate()
386
387 x:y x XexchangeY()
388 ENTR Return enter()
389 ENTR Linefeed enter()
390 .TE
391 .PP
392 .SH CUSTOMIZATION
393 The application class name is XCalc.
394 .PP
395 \fIxcalc\fP has an enormous application defaults file which specifies
396 the position, label, and function of each key on the calculator.
397 It also gives translations to serve as keyboard accelerators.
398 Because these resources are not specified in the source code, you can create
399 a customized calculator by writing a private application defaults file,
400 using the Athena Command and Form widget resources to specify the size and
401 position of buttons, the label for each button, and the function of
402 each button.
403 .PP
404 The foreground and background colors of each calculator key can be
405 individually specified.
406 For the TI calculator, a classical color resource specification might be:
407 .sp
408 .br
409 XCalc.ti.Command.background: gray50
410 .br
411 XCalc.ti.Command.foreground: white
412 .sp
413 For each of buttons 20, 25, 30, 35, and 40, specify:
414 .br
415 XCalc.ti.button20.background: black
416 .br
417 XCalc.ti.button20.foreground: white
418 .sp
419 For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34, 37, 38, and 39:
420 .br
421 XCalc.ti.button22.background: white
422 .br
423 XCalc.ti.button22.foreground: black
424 .SH WIDGET HIERARCHY
425 In order to specify resources, it is useful to know the hierarchy of
426 the widgets which compose \fIxcalc\fR. In the notation below,
427 indentation indicates hierarchical structure. The widget class name
428 is given first, followed by the widget instance name.
429 .nf
430 .ft CW
431 XCalc xcalc
432 Form ti \fIor\fR hp \fI(the name depends on the mode)\fR
433 Form bevel
434 Form screen
435 Label M
436 Toggle LCD
437 Label INV
438 Label DEG
439 Label RAD
440 Label GRAD
441 Label P
442 Command button1
443 Command button2
444 Command button3
445 \fIand so on, ...\fR
446 Command button38
447 Command button39
448 Command button40
449 .ft
450 .fi
451 .SH APPLICATION RESOURCES
452 .PP
453 .TP 8
454 \fBrpn\fR (Class \fBRpn\fR)
455 Specifies that the rpn mode should be used. The default is TI mode.
456 .TP 8
457 \fBstipple\fR (Class \fBStipple\fR)
458 Indicates that the background should be stippled. The default is ``on''
459 for monochrome displays, and ``off'' for color displays.
460 .TP 8
461 \fBcursor\fR (Class \fBCursor\fR)
462 The name of the symbol used to represent the pointer.
463 The default is ``hand2''.
464 .fi
465 .SH COLORS
466 If you would like xcalc to use its ti colors, include the following
467 in the #ifdef COLOR section of the file you read with xrdb:
468 .sp 1
469 *customization: -color
470 .sp 1
471 .br
472 This will cause xcalc to pick up the colors in the app-defaults color
473 customization file:
474 .IR /etc/X11/app-defaults/XCalc-color .
475 .fi
476 .SH "SEE ALSO"
477 X(7), xrdb(1), the Athena Widget Set
478 .SH BUGS
479 .PP
480 HP mode is not completely debugged. In particular, the stack is
481 not handled properly after errors.
482 .SH AUTHORS
483 John Bradley, University of Pennsylvania
484 .br
485 Mark Rosenstein, MIT Project Athena
486 .br
487 Donna Converse, MIT X Consortium
488 .\" --------------------------------------------------------------------
489 .\" Emacs settings
490 .\" --------------------------------------------------------------------
491 .\" Local Variables:
492 .\" mode: nroff
493 .\" tab-width: 15
494 .\" End: