XCALC(1)
๐ XCALC(1) ๐
ok so this is the manual page for xcalc, straight out of X Version 11, section 1 of the manual. welcome bestie, let's get you calculator-pilled ๐งฎโจ
๐ธ NAME ๐ธ
xcalc โ a scientific calculator for X. that's it, that's the vibe. it's literally a calculator. for X. slay. ๐
๐ SYNOPSIS ๐
xcalc [-stipple] [-rpn] [-toolkitoption...]
xcalc -version
xcalc -help
okay so you've got three whole ways to summon her ๐ โ the normal "let me actually do math" invocation, the -version one, and the -help one. no cap.
๐ฆ DESCRIPTION ๐ฆ
xcalc is a scientific calculator desktop accessory โ yes, an accessory, like it's a handbag, and honestly? main character energy ๐.
here's the cute part: it can emulate a TI-30 or an HP-10C. two iconic calculators, one little X app. it's giving versatility. it's giving range. ๐ซถ
โจ OPTIONS โจ
so xcalc accepts all of the standard toolkit command line options โ like, the whole normal X toolkit menu, no notes โ along with these extra ones she brings to the group chat:
-stippleโ this one says: draw the background of the calculator using a stipple</> of the foreground and background colors ๐จ. and like, on monochrome displays it improves the appearance. so if you're out here on a black-and-white situation, this is your moment. ๐-rpnโ this flag means Reverse Polish Notation is the move ๐ฅ. in this mode the calculator will look and behave like an HP-10C. without this flag? she emulates a TI-30. that's the whole switch. periodt. โญ-helpโ this one indicates thatxcalcshould print its usage message and exit ๐ช๐จ. very "here's the info, bye bestie" of her.-versionโ this one indicates thatxcalcshould print its version and exit ๐ท๏ธโจ. short, sweet, informative. we love a queen who knows her own version number. ๐
ngl,-helpand-versionare both super quick exits โ they print and they're out, so don't expect a calculator window from those two. ๐
(more coming, bestie โ this was just part 1 ๐)
โจ OPERATION โจ
okay so pointer time ๐ฑ๏ธ โ you can do operations with pointer button 1, or sometimes with the keyboard. A bunch of the common calculator moves 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. ๐
๐ฑ๏ธ Pointer Usage
Pointer button 1 does the clicking, and some stuff also has keyboard shortcuts. Many common calculator 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 do. No cap. It should be noted that the operators obey the standard rules of precedence. So 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 is digit(n), where n is the corresponding digit, 0..9.
1/xโ Replaces the number in the display with its reciprocal. The corresponding action procedure isreciprocal(). ๐x^2โ Squares the number in the display. The corresponding action procedure issquare(). ๐ฅSQRTโ Takes the square root of the number in the display. The corresponding action procedure issquareRoot(). ๐ฑCE/Cโ When 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 mistake. Pressing it twice clears the state, also. The corresponding action procedure for TI mode isclear(). ๐งนACโ Clears 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(). ๐INVโ Invert function. See the individual function keys for details. The corresponding action procedure isinverse(). ๐sinโ Computes 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(). ๐cosโ Computes the cosine, or arccosine when inverted. The corresponding action procedure iscosine(). ๐tanโ Computes the tangent, or arctangent when inverted. The corresponding action procedure istangent(). โ๏ธDRGโ Changes the DRG mode, as indicated by'DEG','RAD', or'GRAD'at the bottom of the calculator โ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. Example: put the calculator into'DEG'mode, and enter45 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(). ๐eโ The constant'e'. (2.7182818...). The corresponding action procedure ise(). ๐งEEโ Used for entering exponential numbers. For example, to get-2.3E-4youโd enter2 . 3 +/- EE 4 +/-. The corresponding action procedure isscientific(). ๐ฌlogโ Calculates the log (base 10) of the number in the display. When inverted, it raises10.0to the number in the display. For example, entering3 INV logshould result in1000. The corresponding action procedure islogarithm(). ๐lnโ Calculates the log (base e) of the number in the display. When inverted, it raiseseto the number in the display. For example, enteringe lnshould result in1. The corresponding action procedure isnaturalLog(). ๐ฟy^xโ Raises the number on the left to the power of the number on the right. For example2 y^x 3 =results in8, which is2^3. For a further example,(1+2+3) y^x (1+2) =equals6 y^x 3which equals216. The corresponding action procedure ispower(). โกnotโ Performs a bitwise not. The corresponding action procedure isnot(). ๐ซandโ Performs a bitwise and. The corresponding action procedure isand(). ๐คorโ Performs a bitwise or. The corresponding action procedure isor(). ๐xorโ Performs a bitwise exclusive or. The corresponding action procedure isxor(). ๐ญtruncโ Truncates the number in the display to an integer. The corresponding action procedure istrunc(). โ๏ธPIโ The 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 range0-500, though, depending on your math library, it might overflow long before that. The corresponding action procedure isfactorial(). ๐ญ(โ Left parenthesis. The corresponding action procedure for TI calculators isleftParen(). ๐ซถ)โ Right parenthesis. The corresponding action procedure for TI calculators isrightParen(). ๐ซถbaseโ Changes the number base, as indicated by'DEC','HEX, or'OCT'at the bottom of the calculator display. When in'DEC'mode, numbers in the display are taken as being decimal (base 10). In'HEX'mode, numbers are in hexadecimal (base 16), and in'OCT'mode, numbers are in octal (base 8). The corresponding action procedure isbase(). ๐ขshlโ Performs an arithmetic bitwise shift left. For example, entering1 shl 2should result in4. The corresponding action procedure isshl(). โฌ ๏ธshrโ Performs an arithmetic bitwise shift right. For example, entering8 shr 1should result in4. The corresponding action procedure isshr(). โก๏ธmodโ Performs the modulo operation, which calculates the remainder when dividing the first number by the second. For example, entering14 mod 8should result in6. The corresponding action procedure ismod(). ๐ฉ/โ Division. The corresponding action procedure isdivide(). โ*โ Multiplication. The corresponding action procedure ismultiply(). โ๏ธ-โ Subtraction. The corresponding action procedure issubtract(). โ+โ Addition. The corresponding action procedure isadd(). โ=โ Perform calculation. The TI-specific action procedure isequal(). ๐ฐSTOโ Copies the number in the display to the memory location. The corresponding action procedure isstore(). ๐ฅRCLโ Copies the number from the memory location to the display. The corresponding action procedure isrecall(). ๐คSUMโ Adds the number in the display to the number in the memory location. The corresponding action procedure issum(). ๐งฎEXCโ Swaps the number in the display with the number in the memory location. The corresponding action procedure for the TI calculator isexchange(). ๐+/-โ Negate; change sign. The corresponding action procedure isnegate(). ๐.โ Decimal point. The corresponding 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 is enter(). ๐
<-โ 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(). โซONโ Clears 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(). ๐INVโ Inverts the meaning of the function keys. This would be thefkey on an HP calculator, but xcalc does not display multiple legends on each key. See the individual function keys for details. ๐10^xโ Raises10.0to the number in the top of the stack. When inverted, it calculates the log (base 10) of the number in the display. The corresponding action procedure istenpower(). ๐e^xโ Raiseseto 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(). ๐งSTOโ Copies 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. ๐ฅRCLโ Pushes the number from the specified memory location onto the stack. ๐คSUMโ Adds the number on top of the stack to the number in the specified memory location. ๐งฎx:yโ Exchanges the numbers in the top two stack positions, the X and Y registers. The corresponding action procedure isXexchangeY(). ๐R vโ Rolls the stack downward. When inverted, it rolls the stack upward. The corresponding action procedure isroll(). ๐blankโ These keys were used for programming functions on the HP-10C. Their functionality has not been duplicated in xcalc. ๐ซฅ
Finally, there are two additional action procedures: bell(), which rings the bell; and selection(), which performs a cut on the entire number in the calculatorโs โliquid crystalโ display. ๐โ๏ธ
๐ฅ ACCELERATORS ๐ฅ
okay so accelerators are literally shortcuts for entering commands ๐
. xcalc provides some sample keyboard accelerators; users can customize accelerators too. The numeric keypad accelerators provided by xcalc should be intuitively correct (yes, they ate that ๐). The accelerators defined by xcalc on the main keyboard are given below โ labels are TI key, HP key, keyboard accelerator, TI function, HP function, bestie:
rโ TI key:SQRT; HP key:SQRT; TI function:squareRoot(); HP function:squareRoot().spaceโ TI key:AC; HP key:ON; TI function:clear(); HP function:clear().Deleteโ TI key:AC; HP key:<-; TI function:clear(); HP function:back().Backspaceโ TI key:AC; HP key:<-; TI function:clear(); HP function:back().Control-Hโ TI key:AC; HP key:<-; TI function:clear(); HP function:back().Clearโ TI key:AC; HP key: (blank); TI function:clear(); HP function: (blank).qโ TI key:AC; HP key:ON; TI function:quit(); HP function:quit().Control-Cโ TI key:AC; HP key:ON; TI function:quit(); HP function:quit().iโ TI key:INV; HP key:i; TI function:inverse(); HP function:inverse().sโ TI key:sin; HP key:s; TI function:sine(); HP function:sine().cโ TI key:cos; HP key:c; TI function:cosine(); HP function:cosine().tโ TI key:tan; HP key:t; TI function:tangent(); HP function:tangent().dโ TI key:DRG; HP key:DRG; TI function:degree(); HP function:degree().eโ TI key:e; HP key: (blank); TI function:e(); HP function: (blank).lโ TI key:ln; HP key:ln; TI function:naturalLog(); HP function:naturalLog().^โ TI key:y^x; HP key:y^x; TI function:power(); HP function:power().pโ TI key:PI; HP key:PI; TI function:pi(); HP function:pi().!โ TI key:x!; HP key:x!; TI function:factorial(); HP function:factorial().(โ TI key:(; HP key: (blank); TI function:leftParen(); HP function: (blank).)โ TI key:); HP key: (blank); TI function:rightParen(); HP function: (blank)./โ TI key:/; HP key:/; TI function:divide(); HP function:divide().*โ TI key:*; HP key:*; TI function:multiply(); HP function:multiply().-โ TI key:-; HP key:-; TI function:subtract(); HP function:subtract().+โ TI key:+; HP key:+; TI function:add(); HP function:add().=โ TI key:=; HP key: (blank); TI function:equal(); HP function: (blank).0..9โ TI key:0..9; HP key:0..9; TI function:digit(); HP function:digit()..โ TI key:.; HP key:.; TI function:decimal(); HP function:decimal().nโ TI key:+/-; HP key:CHS; TI function:negate(); HP function:negate().xโ TI key: (blank); HP key:x:y; TI function: (blank); HP function:XexchangeY().Returnโ TI key: (blank); HP key:ENTR; TI function: (blank); HP function:enter().Linefeedโ TI key: (blank); HP key:ENTR; TI function: (blank); HP function:enter().
๐ CUSTOMIZATION ๐
the application class name is XCalc โจ.
xcalc has an enormous application defaults file which specifies 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. slay.
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
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
๐ฆ WIDGET HIERARCHY ๐ฆ
In order to specify resources, it is useful to know the hierarchy of the widgets which compose xcalc. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. iykyk ๐
:
XCalc xcalc
Form ti or hp (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 button3
and so on, ...
Command button38
Command button39
Command button40
๐ APPLICATION RESOURCES ๐
rpn(ClassRpn) โ specifies that the rpn mode should be used. The default is TI mode. no cap.stipple(ClassStipple) โ indicates that the background should be stippled. The default isonfor monochrome displays, andofffor color displays.cursor(ClassCursor) โ the name of the symbol used to represent the pointer. The default ishand2.
๐ COLORS ๐
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
This will cause xcalc to pick up the colors in the app-defaults color customization file: /usr/share/X11/app-defaults/XCalc-color. periodt ๐
.
๐ SEE ALSO ๐
Go peek at X(7), xrdb(1), and the Athena Widget Set ๐.
๐ BUGS ๐
โ ๏ธ HP mode is not completely debugged. In particular, the stack is not handled properly after errors. not me finding out like this ๐ญ.
๐ AUTHORS ๐
- John Bradley, University of Pennsylvania
- Mark Rosenstein, MIT Project Athena
- Donna Converse, MIT X Consortium
๐ that's the whole thing: xcalc version 1.1.3, dated 2023-02-05, and you've been reading XCALC(1). go calculate something iconic, bestie ๐ซถโจ
๐ฆ where this page comes from
- alpine 3.24: xcalc-doc 1.1.3-r0 ยท MIT
- arch rolling: xorg-xcalc 1.1.3-2 ยท X11-distribute-modifications-variant
- fedora 44: xcalc 1.1.3-1.fc44 ยท MIT
- Copyright (c) 1994 X Consortium
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms