


_O_n_l_i_n_e _M_a_n_u_a_l             User Commands                 XCALC(1X)



NNNNAAAAMMMMEEEE
     xcalc - scientific calculator for X

SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
     xxxxccccaaaallllcccc [-stipple] [-rpn] [-_t_o_o_l_k_i_t_o_p_t_i_o_n...]

DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
     _x_c_a_l_c is a scientific calculator desktop accessory that can
     emulate a TI-30 or an HP-10C.

OOOOPPPPTTTTIIIIOOOONNNNSSSS
     _x_c_a_l_c accepts all of the standard toolkit command line
     options along with two additional options:

     ----ssssttttiiiipppppppplllleeee
             This 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.

     ----rrrrppppnnnn    This 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.

OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN
     _P_o_i_n_t_e_r _U_s_a_g_e: 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.

     _C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_T_I _m_o_d_e): 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 is ddddiiiiggggiiiitttt((((_n)))), where _n is the corresponding digit, 0..9.

     1111////xxxx       Replaces the number in the display with its
               reciprocal.  The corresponding action procedure is
               rrrreeeecccciiiipppprrrrooooccccaaaallll(((()))).

     xxxx^^^^2222       Squares the number in the display.  The
               corresponding action procedure is ssssqqqquuuuaaaarrrreeee(((()))).

     SSSSQQQQRRRRTTTT      Takes the square root of the number in the
               display.  The corresponding action procedure is
               ssssqqqquuuuaaaarrrreeeeRRRRooooooootttt(((()))).







     CCCCEEEE////CCC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 mis-
               take.  Pressing it twice clears the state, also.
               The corresponding action procedure for TI mode is
               cccclllleeeeaaaarrrr(((()))).

     AAAACCCC        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 is ooooffffffff(((())));
               to quit, qqqquuuuiiiitttt(((()))).

     IIIINNNNVVVV       Invert function.  See the individual function keys
               for details.  The corresponding action procedure
               is iiiinnnnvvvveeeerrrrsssseeee(((()))).

     ssssiiiinnnn       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 is ssssiiiinnnneeee(((()))).

     ccccoooossss       Computes the cosine, or arccosine when inverted.
               The corresponding action procedure is ccccoooossssiiiinnnneeee(((()))).

     ttttaaaannnn       Computes the tangent, or arctangent when inverted.
               The corresponding action procedure is ttttaaaannnnggggeeeennnntttt(((()))).

     DDDDRRRRGGGG       Changes 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 correspond-
               ing action procedure is ddddeeeeggggrrrreeeeeeee(((()))).

     eeee         The constant 'e'.  (2.7182818...).  The
               corresponding action procedure is eeee(((()))).

     EEEEEEEE        Used for entering exponential numbers.  For exam-
               ple, to get "-2.3E-4" you'd enter "2 . 3 +/- EE 4
               +/-".  The corresponding action procedure is
               sssscccciiiieeeennnnttttiiiiffffiiiicccc(((()))).

     lllloooogggg       Calculates 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 is llllooooggggaaaarrrriiiitttthhhhmmmm(((()))).

     llllnnnn        Calculates 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 is nnnnaaaattttuuuurrrraaaallllLLLLoooogggg(((()))).

     yyyy^^^^xxxx       Raises 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
               is ppppoooowwwweeeerrrr(((()))).

     PPPPIIII        The constant 'pi'.  (3.1415927....) The
               corresponding action procedure is ppppiiii(((()))).

     xxx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 is ffffaaaacccc----
               ttttoooorrrriiiiaaaallll(((()))).

     ((((         Left parenthesis.  The corresponding action pro-
               cedure for TI calculators is lllleeeeffffttttPPPPaaaarrrreeeennnn(((()))).

     ))))         Right parenthesis.  The corresponding action pro-
               cedure for TI calculators is rrrriiiigggghhhhttttPPPPaaaarrrreeeennnn(((()))).

     ////         Division.  The corresponding action procedure is
               ddddiiiivvvviiiiddddeeee(((()))).

     ****         Multiplication.  The corresponding action pro-
               cedure is mmmmuuuullllttttiiiippppllllyyyy(((()))).

     ----         Subtraction.  The corresponding action procedure
               is ssssuuuubbbbttttrrrraaaacccctttt(((()))).

     ++++         Addition.  The corresponding action procedure is
               aaaadddddddd(((()))).

     ====         Perform calculation.  The TI-specific action pro-
               cedure is eeeeqqqquuuuaaaallll(((()))).

     SSSSTTTTOOOO       Copies the number in the display to the memory
               location.  The corresponding action procedure is
               ssssttttoooorrrreeee(((()))).

     RRRRCCCCLLLL       Copies the number from the memory location to the
               display.  The corresponding action procedure is
               rrrreeeeccccaaaallllllll(((()))).

     SSSSUUUUMMMM       Adds the number in the display to the number in
               the memory location.  The corresponding action
               procedure is ssssuuuummmm(((()))).

     EEEEXXXXCCCC       Swaps the number in the display with the number in
               the memory location.  The corresponding action
               procedure for the TI calculator is eeeexxxxcccchhhhaaaannnnggggeeee(((()))).

     ++++////----       Negate; change sign.  The corresponding action
               procedure is nnnneeeeggggaaaatttteeee(((()))).

     ....         Decimal point.  The action procedure is ddddeeeecccciiiimmmmaaaallll(((()))).






     _C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_R_P_N _m_o_d_e): 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 eeeennnntttteeeerrrr(((()))).


     <<<<----        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 is bbbbaaaacccckkkk(((()))).

     OOOONNNN        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 is ooooffffffff; to
               quit, qqqquuuuiiiitttt(((()))).

     IIIINNNNVVVV       Inverts the meaning of the function keys.  This
               would be the  _f key on an HP calculator, but _x_c_a_l_c
               does not display multiple legends on each key.
               See the individual function keys for details.

     11110000^^^^xxxx      Raises "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 correspond-
               ing action procedure is tttteeeennnnppppoooowwwweeeerrrr(((()))).

     eeee^^^^xxxx       Raises "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
               is eeeeppppoooowwwweeeerrrr(((()))).

     SSSSTTTTOOOO       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.

     RRRRCCCCLLLL       Pushes the number from the specified memory loca-
               tion onto the stack.

     SSSSUUUUMMMM       Adds the number on top of the stack to the number
               in the specified memory location.

     xxxx::::yyyy       Exchanges the numbers in the top two stack posi-
               tions, the X and Y registers.  The corresponding
               action procedure is XXXXeeeexxxxcccchhhhaaaannnnggggeeeeYYYY(((()))).

     RRRR vvvv       Rolls the stack downward.  When inverted, it rolls
               the stack upward.  The corresponding action pro-
               cedure is rrrroooollllllll(((()))).

     _b_l_a_n_k     These keys were used for programming functions on
               the HP-10C.  Their functionality has not been
               duplicated in _x_c_a_l_c.

     Finally, there are two additional action procedures: bbbbeeeellllllll(((()))),
     which rings the bell; and sssseeeelllleeeeccccttttiiiioooonnnn(((()))), which performs a cut
     on the entire number in the calculator's ``liquid crystal''






     display.

AAAACCCCCCCCEEEELLLLEEEERRRRAAAATTTTOOOORRRRSSSS
     Accelerators are shortcuts for entering commands.  _x_c_a_l_c
     provides some sample keyboard accelerators; also users can
     customize accelerators.  The numeric keypad accelerators
     provided by _x_c_a_l_c should be intuitively correct.  The
     accelerators defined by _x_c_a_l_c on 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()

          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()

CCCCUUUUSSSSTTTTOOOOMMMMIIIIZZZZAAAATTTTIIIIOOOONNNN
     The application class name is XCalc.

     _x_c_a_l_c has 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

     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

WWWWIIIIDDDDGGGGEEEETTTT HHHHIIIIEEEERRRRAAAARRRRCCCCHHHHYYYY
     In order to specify resources, it is useful to know the
     hierarchy of the widgets which compose _x_c_a_l_c.  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  ti  _o_r  rpn    (_t_h_e _n_a_m_e _d_e_p_e_n_d_s _o_n _t_h_e _m_o_d_e)
               Form  bevel
                    Form  screen
                         Label  M
                         Toggle  LCD
                         Label  INV
                         Label  DEG
                         Label  RAD
                         Label  GRAD
                         Label  P
               Command  button1
               Command  button2
               Command  button3
     _a_n_d _s_o _o_n, ...
               Command  button38
               Command  button39
               Command  button40

AAAAPPPPPPPPLLLLIIIICCCCAAAATTTTIIIIOOOONNNN RRRREEEESSSSOOOOUUUURRRRCCCCEEEESSSS
     rrrrppppnnnn (Class RRRRppppnnnn)
             Specifies that the rpn mode should be used.  The
             default is TI mode.

     ssssttttiiiipppppppplllleeee (Class SSSSttttiiiipppppppplllleeee)
             Indicates that the background should be stippled.
             The default is ``on'' for monochrome displays, and
             ``off'' for color displays.

     ccccuuuurrrrssssoooorrrr (Class CCCCuuuurrrrssssoooorrrr)
             The name of the symbol used to represent the
             pointer.  The default is ``hand2''.








SSSSEEEEEEEE AAAALLLLSSSSOOOO
     X(1), xrdb(1), the Athena Widget Set

BBBBUUUUGGGGSSSS
     HP mode:  A bug report claims that the sequence of keys 5,
     ENTER, <- should clear the display, but it doesn't.

CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
     Copyright 1988, 1989, Massachusetts Institute of Technology.
     See _X(_1) for a full statement of rights and permissions.

AAAAUUUUTTTTHHHHOOOORRRRSSSS
     John Bradley, University of Pennsylvania
     Mark Rosenstein, MIT Project Athena
     Donna Converse, MIT X Consortium

August 1991                                   TX User's Reference











































