XCALC(1) UNIX Programmer's Manual XCALC(1)

xcalc - scientific calculator for X

xcalc[-stipple] [-rpn] [-toolkitoption...]

xcalcis a scientific calculator desktop accessory that can emulate a TI-30 or an HP-10C.

xcalcaccepts all of the standard toolkit command line options along with two additional options:-stippleThis option indicates that the background of the calculator should be drawn using a stipple of the foreground and background colors. On monochrome displays improves the appearance.-rpnThis option indicates that Reverse Polish Notation should be used. In this mode the calculator will look and behave like an HP-10C. Without this flag, it will emulate a TI-30.

Pointer Usage: Operations may be performed with pointer but- ton 1, or in some cases, with the keyboard. Many common cal- culator operations have keyboard accelerators. To quit, press pointer button 3 on the AC key of the TI calculator, or the ON key of the HP calculator.Calculator Key Usage (TI mode): The numbered keys, the +/- key, and the +, -, *, /, and = keys all do exactly what you would expect them to. It should be noted that the operators obey the standard rules of precedence. Thus, entering "3+4*5=" results in "23", not "35". The parentheses can be used to override this. For example, "(1+2+3)*(4+5+6)=" results in "6*15=90". The entire number in the calculator display can be selected, in order to paste the result of a calculation into text. The action procedures associated with each function are given below. These are useful if you are interested in defining a custom calculator. The action used for all digit keys isdigit(n), wherenis the corresponding digit, 0..9.1/xReplaces the number in the display with its reciprocal. The corresponding action procedure isreciprocal(). XFree86 Version 4.5.0 1 XCALC(1) UNIX Programmer's Manual XCALC(1)x^2Squares the number in the display. The correspond- ing action procedure issquare().SQRTTakes the square root of the number in the display. The corresponding action procedure issquareRoot().CE/CWhen pressed once, clears the number in the display without clearing the state of the machine. Allows you to re-enter a number if you make a mis- take. Pressing it twice clears the state, also. The corresponding action procedure for TI mode isclear().ACClears the display, the state, and the memory. Pressing it with the third pointer button turns off the calculator, in that it exits the program. The action procedure to clear the state isoff(); to quit,quit().INVInvert function. See the individual function keys for details. The corresponding action procedure isinverse().sinComputes the sine of the number in the display, as interpreted by the current DRG mode (see DRG, below). If inverted, it computes the arcsine. The corresponding action procedure issine().cosComputes the cosine, or arccosine when inverted. The corresponding action procedure iscosine().tanComputes the tangent, or arctangent when inverted. The corresponding action procedure istangent().DRGChanges the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the bottom of of the calcula- tor ``liquid crystal'' display. When in 'DEG' mode, numbers in the display are taken as being degrees. In 'RAD' mode, numbers are in radians, and in 'GRAD' mode, numbers are in grads. When inverted, the DRG key has a feature of converting degrees to radians to grads and vice-versa. Exam- ple: put the calculator into 'DEG' mode, and enter "45 INV DRG". The display should now show something along the lines of ".785398", which is 45 degrees converted to radians. The corresponding action procedure isdegree().eThe constant 'e'. (2.7182818...). The correspond- ing action procedure ise(). XFree86 Version 4.5.0 2 XCALC(1) UNIX Programmer's Manual XCALC(1)EEUsed for entering exponential numbers. For exam- ple, to get "-2.3E-4" you'd enter "2 . 3 +/- EE 4 +/-". The corresponding action procedure isscien-tific().logCalculates the log (base 10) of the number in the display. When inverted, it raises "10.0" to the number in the display. For example, entering "3 INV log" should result in "1000". The correspond- ing action procedure islogarithm().lnCalculates the log (base e) of the number in the display. When inverted, it raises "e" to the number in the display. For example, entering "e ln" should result in "1". The corresponding action procedure isnaturalLog().y^xRaises the number on the left to the power of the number on the right. For example "2 y^x 3 =" results in "8", which is 2^3. For a further exam- ple, "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216". The corresponding action procedure ispower().PIThe constant 'pi'. (3.1415927....) The corresponding action procedure ispi().x!Computes the factorial of the number in the display. The number in the display must be an integer in the range 0-500, though, depending on your math library, it might overflow long before that. The corresponding action procedure isfac-torial().(Left parenthesis. The corresponding action pro- cedure for TI calculators isleftParen(). ) Right parenthesis. The corresponding action pro- cedure for TI calculators isrightParen()./Division. The corresponding action procedure isdivide().*Multiplication. The corresponding action pro- cedure ismultiply().-Subtraction. The corresponding action procedure issubtract().+Addition. The corresponding action procedure isadd(). XFree86 Version 4.5.0 3 XCALC(1) UNIX Programmer's Manual XCALC(1)=Perform calculation. The TI-specific action pro- cedure isequal().STOCopies the number in the display to the memory location. The corresponding action procedure isstore().RCLCopies the number from the memory location to the display. The corresponding action procedure isrecall().SUMAdds the number in the display to the number in the memory location. The corresponding action pro- cedure issum().EXCSwaps the number in the display with the number in the memory location. The corresponding action pro- cedure for the TI calculator isexchange().+/-Negate; change sign. The corresponding action procedure isnegate()..Decimal point. The action procedure isdecimal().Calculator Key Usage (RPN mode): The number keys, CHS (change sign), +, -, *, /, and ENTR keys all do exactly what you would expect them to do. Many of the remaining keys are the same as in TI mode. The differences are detailed below. The action procedure for the ENTR key isenter().<-This is a backspace key that can be used if you make a mistake while entering a number. It will erase digits from the display. (See BUGS). Inverse backspace will clear the X register. The corresponding action procedure isback().ONClears the display, the state, and the memory. Pressing it with the third pointer button turns off the calculator, in that it exits the program. To clear state, the action procedure isoff; to quit,quit().INVInverts the meaning of the function keys. This would be thefkey on an HP calculator, butxcalcdoes not display multiple legends on each key. See the individual function keys for details.10^xRaises "10.0" to the number in the top of the stack. When inverted, it calculates the log (base 10) of the number in the display. The XFree86 Version 4.5.0 4 XCALC(1) UNIX Programmer's Manual XCALC(1) corresponding action procedure istenpower().e^xRaises "e" to the number in the top of the stack. When inverted, it calculates the log (base e) of the number in the display. The action procedure isepower().STOCopies the number in the top of the stack to a memory location. There are 10 memory locations. The desired memory is specified by following this key with a digit key.RCLPushes the number from the specified memory loca- tion onto the stack.SUMAdds the number on top of the stack to the number in the specified memory location.x:yExchanges the numbers in the top two stack posi- tions, the X and Y registers. The corresponding action procedure isXexchangeY().R vRolls the stack downward. When inverted, it rolls the stack upward. The corresponding action pro- cedure isroll().blankThese keys were used for programming functions on the HP-10C. Their functionality has not been duplicated inxcalc. Finally, there are two additional action procedures:bell(), which rings the bell; andselection(), which performs a cut on the entire number in the calculator's ``liquid crystal'' display.

Accelerators are shortcuts for entering commands.xcalcprovides some sample keyboard accelerators; also users can customize accelerators. The numeric keypad accelerators pro- vided byxcalcshould be intuitively correct. The accelera- tors defined byxcalcon the main keyboard are given below: TI Key HP Key Keyboard Accelerator TI Function HP Function SQRT SQRT r squareRoot() squareRoot() AC ON space clear() clear() AC <- Delete clear() back() AC <- Backspace clear() back() AC <- Control-H clear() back() AC Clear clear() AC ON q quit() quit() AC ON Control-C quit() quit() XFree86 Version 4.5.0 5 XCALC(1) UNIX Programmer's Manual XCALC(1) INV i i inverse() inverse() sin s s sine() sine() cos c c cosine() cosine() tan t t tangent() tangent() DRG DRG d degree() degree() e e e() ln ln l naturalLog() naturalLog() y^x y^x ^ power() power() PI PI p pi() pi() x! x! ! factorial() factorial() ( ( leftParen() ) ) rightParen() / / / divide() divide() * * * multiply() multiply() - - - subtract() subtract() + + + add() add() = = equal() 0..9 0..9 0..9 digit() digit() . . . decimal() decimal() +/- CHS n negate() negate() x:y x XexchangeY() ENTR Return enter() ENTR Linefeed enter()

The application class name is XCalc.xcalchas an enormous application defaults file which speci- fies the position, label, and function of each key on the calculator. It also gives translations to serve as keyboard accelerators. Because these resources are not specified in the source code, you can create a customized calculator by writing a private application defaults file, using the Athena Command and Form widget resources to specify the size and position of buttons, the label for each button, and the function of each button. The foreground and background colors of each calculator key can be individually specified. For the TI calculator, a classical color resource specification might be: XCalc.ti.Command.background: gray50 XCalc.ti.Command.foreground: white For each of buttons 20, 25, 30, 35, and 40, specify: XCalc.ti.button20.background: black XCalc.ti.button20.foreground: white XFree86 Version 4.5.0 6 XCALC(1) UNIX Programmer's Manual XCALC(1) For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34, 37, 38, and 39: XCalc.ti.button22.background: white XCalc.ti.button22.foreground: black

In order to specify resources, it is useful to know the hierarchy of the widgets which composexcalc. In the nota- tion below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. XCalc xcalc Form tiorhp (the name depends on the mode) Form bevel Form screen Label M Toggle LCD Label INV Label DEG Label RAD Label GRAD Label P Command button1 Command button2 Command button3and so on, ... Command button38 Command button39 Command button40

rpn(ClassRpn) Specifies that the rpn mode should be used. The default is TI mode.stipple(ClassStipple) Indicates that the background should be stippled. The default is ``on'' for monochrome displays, and ``off'' for color displays.cursor(ClassCursor) The name of the symbol used to represent the pointer. The default is ``hand2''.

If you would like xcalc to use its ti colors, include the following in the #ifdef COLOR section of the file you read with xrdb: *customization: -color XFree86 Version 4.5.0 7 XCALC(1) UNIX Programmer's Manual XCALC(1) This will cause xcalc to pick up the colors in the app- defaults color customization file:/usr/X11R6/lib/X11/app-defaults/XCalc-color.

X(7), xrdb(1), the Athena Widget Set

HP mode: A bug report claims that the sequence of keys 5, ENTER, <- should clear the display, but it doesn't.

Copyright 1994 X Consortium SeeX(7)for a full statement of rights and permissions.

John Bradley, University of Pennsylvania Mark Rosenstein, MIT Project Athena Donna Converse, MIT X Consortium XFree86 Version 4.5.0 8

Generated on 2015-10-25 00:47:46 by
`$MirOS: src/scripts/roff2htm,v 1.81 2015/10/16 13:19:09 tg Exp $`

These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.

This product includes material
provided by *mirabilos*.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.