home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / man / cat1 / xcalc.0 < prev    next >
Encoding:
Text File  |  1996-10-17  |  16.2 KB  |  529 lines

  1.  
  2.  
  3.  
  4. XCALC(1)                         XCALC(1)
  5.  
  6.  
  7. NNAAMMEE
  8.        xcalc - scientific calculator for X
  9.  
  10. SSYYNNOOPPSSIISS
  11.        xxccaallcc [-stipple] [-rpn] [-_t_o_o_l_k_i_t_o_p_t_i_o_n_._._.]
  12.  
  13. DDEESSCCRRIIPPTTIIOONN
  14.        _x_c_a_l_c  is  a  scientific calculator desktop accessory that
  15.        can emulate a TI-30 or an HP-10C.
  16.  
  17. OOPPTTIIOONNSS
  18.        _x_c_a_l_c accepts all of the     standard  toolkit  command  line
  19.        options along with two additional options:
  20.  
  21.  
  22.        --ssttiippppllee
  23.            This  option  indicates that the background of the
  24.            calculator should be drawn using a stipple of  the
  25.            foreground  and    background colors.  On monochrome
  26.            displays improves the appearance.
  27.  
  28.  
  29.        --rrppnn    This option indicates that Reverse Polish Notation
  30.            should  be used.     In this mode the calculator will
  31.            look and behave    like  an  HP-10C.   Without  this
  32.            flag, it will emulate a TI-30.
  33.  
  34. OOPPEERRAATTIIOONN
  35.        _P_o_i_n_t_e_r    _U_s_a_g_e_:    Operations  may be performed with pointer
  36.        button 1, or in some cases, with the keyboard.  Many  com-
  37.        mon  calculator operations have keyboard accelerators.  To
  38.        quit, press pointer button 3 on the AC key of the TI  cal-
  39.        culator, or the ON key of the HP calculator.
  40.  
  41.        _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 +/-
  42.        key, and the +, -, *, /, and = keys all    do  exactly  what
  43.        you  would  expect  them     to.  It should be noted that the
  44.        operators obey the standard rules  of  precedence.   Thus,
  45.        entering     "3+4*5="  results in "23", not "35".  The paren-
  46.        theses  can  be    used  to  override  this.   For     example,
  47.        "(1+2+3)*(4+5+6)=" results in "6*15=90".
  48.  
  49.        The  entire  number  in    the  calculator     display  can  be
  50.        selected, in order to paste the result  of  a  calculation
  51.        into text.
  52.  
  53.        The  action  procedures    associated with each function are
  54.        given below.  These are useful if you  are  interested  in
  55.        defining     a  custom  calculator.      The action used for all
  56.        digit keys is  ddiiggiitt((_n)),     where    _n  is  the  corresponding
  57.        digit, 0..9.
  58.  
  59.        11//xx     Replaces  the    number    in  the     display with its
  60.          reciprocal.  The corresponding action    procedure
  61.  
  62.  
  63.  
  64. X Version 11            Release 6                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XCALC(1)                         XCALC(1)
  71.  
  72.  
  73.          is rreecciipprrooccaall(()).
  74.  
  75.        xx^^22     Squares  the  number in the display.  The corre-
  76.          sponding action procedure is ssqquuaarree(()).
  77.  
  78.        SSQQRRTT     Takes the square root of the number in the  dis-
  79.          play.     The  corresponding  action  procedure is
  80.          ssqquuaarreeRRoooott(()).
  81.  
  82.        CCEE//CC     When pressed once, clears the number in the dis-
  83.          play  without clearing the state of the machine.
  84.          Allows you to re-enter a number if  you  make    a
  85.          mistake.   Pressing  it  twice clears the state,
  86.          also.    The corresponding action procedure for TI
  87.          mode is cclleeaarr(()).
  88.  
  89.        AACC     Clears     the  display, the state, and the memory.
  90.          Pressing it with the third pointer button  turns
  91.          off  the  calculator,    in that it exits the pro-
  92.          gram.    The action procedure to clear  the  state
  93.          is ooffff(()); to quit, qquuiitt(()).
  94.  
  95.        IINNVV     Invert     function.   See  the individual function
  96.          keys for details.  The corresponding action pro-
  97.          cedure is iinnvveerrssee(()).
  98.  
  99.        ssiinn     Computes  the sine of the number in the display,
  100.          as interpreted by the current DRG mode (see DRG,
  101.          below).   If  inverted, it computes the arcsine.
  102.          The corresponding action procedure is ssiinnee(()).
  103.  
  104.        ccooss     Computes the cosine, or arccosine when inverted.
  105.          The  corresponding action procedure is ccoossiinnee(()).
  106.  
  107.        ttaann     Computes  the    tangent,   or    arctangent   when
  108.          inverted.  The corresponding action procedure is
  109.          ttaannggeenntt(()).
  110.  
  111.        DDRRGG     Changes the DRG mode,    as  indicated  by  'DEG',
  112.          'RAD',     or 'GRAD' at the bottom of of the calcu-
  113.          lator ``liquid crystal'' display.  When in 'DEG'
  114.          mode,    numbers in the display are taken as being
  115.          degrees.  In 'RAD' mode, numbers are in radians,
  116.          and  in 'GRAD' mode, numbers are in grads.  When
  117.          inverted, the DRG key has a feature of     convert-
  118.          ing  degrees to radians to grads and vice-versa.
  119.          Example:  put the calculator  into  'DEG'  mode,
  120.          and  enter "45 INV DRG".  The display should now
  121.          show something along  the  lines  of  ".785398",
  122.          which    is  45 degrees converted to radians.  The
  123.          corresponding action procedure is ddeeggrreeee(()).
  124.  
  125.        ee     The constant 'e'.  (2.7182818...).   The  corre-
  126.          sponding action procedure is ee(()).
  127.  
  128.  
  129.  
  130. X Version 11            Release 6                2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XCALC(1)                         XCALC(1)
  137.  
  138.  
  139.        EEEE     Used  for  entering  exponential  numbers.   For
  140.          example, to get "-2.3E-4" you'd enter "2 . 3 +/-
  141.          EE  4    +/-".  The corresponding action procedure
  142.          is sscciieennttiiffiicc(()).
  143.  
  144.        lloogg     Calculates the log (base 10) of  the  number  in
  145.          the display.  When inverted, it raises "10.0" to
  146.          the number in the display.  For example,  enter-
  147.          ing  "3  INV  log" should result in "1000".  The
  148.          corresponding action procedure is llooggaarriitthhmm(()).
  149.  
  150.        llnn     Calculates the log (base e) of the number in the
  151.          display.   When  inverted,  it raises "e" to the
  152.          number in the display.     For example, entering "e
  153.          ln"  should  result  in  "1".    The corresponding
  154.          action procedure is nnaattuurraallLLoogg(()).
  155.  
  156.        yy^^xx     Raises the number on the left to  the    power  of
  157.          the  number  on the right.  For example "2 y^x 3
  158.          =" results in "8", which is 2^3.  For a  further
  159.          example,  "(1+2+3) y^x (1+2) =" equals "6 y^x 3"
  160.          which equals "216".   The  corresponding  action
  161.          procedure is ppoowweerr(()).
  162.  
  163.        PPII     The  constant 'pi'.  (3.1415927....)  The corre-
  164.          sponding action procedure is ppii(()).
  165.  
  166.        xx!!     Computes the factorial of the number in the dis-
  167.          play.     The  number  in  the  display must be an
  168.          integer in the range 0-500, though, depending on
  169.          your math library, it might overflow long before
  170.          that.    The  corresponding  action  procedure  is
  171.          ffaaccttoorriiaall(()).
  172.  
  173.        ((     Left parenthesis.  The corresponding action pro-
  174.          cedure for TI calculators is lleeffttPPaarreenn(()).
  175.  
  176.        ))     Right    parenthesis.   The  corresponding  action
  177.          procedure for TI calculators is rriigghhttPPaarreenn(()).
  178.  
  179.        //     Division.  The corresponding action procedure is
  180.          ddiivviiddee(()).
  181.  
  182.        **     Multiplication.  The corresponding action proce-
  183.          dure is mmuullttiippllyy(()).
  184.  
  185.        --     Subtraction.  The corresponding action procedure
  186.          is ssuubbttrraacctt(()).
  187.  
  188.        ++     Addition.  The corresponding action procedure is
  189.          aadddd(()).
  190.  
  191.        ==     Perform  calculation.     The  TI-specific  action
  192.          procedure is eeqquuaall(()).
  193.  
  194.  
  195.  
  196. X Version 11            Release 6                3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XCALC(1)                         XCALC(1)
  203.  
  204.  
  205.        SSTTOO     Copies the number in the display to  the  memory
  206.          location.  The corresponding action procedure is
  207.          ssttoorree(()).
  208.  
  209.        RRCCLL     Copies the number from the  memory  location  to
  210.          the display.  The corresponding action procedure
  211.          is rreeccaallll(()).
  212.  
  213.        SSUUMM     Adds the number in the display to the number  in
  214.          the  memory  location.     The corresponding action
  215.          procedure is ssuumm(()).
  216.  
  217.        EEXXCC     Swaps the number in the display with the  number
  218.          in   the  memory  location.   The  corresponding
  219.          action     procedure  for     the  TI  calculator   is
  220.          eexxcchhaannggee(()).
  221.  
  222.        ++//--     Negate;  change  sign.     The corresponding action
  223.          procedure is nneeggaattee(()).
  224.  
  225.        ..     Decimal point.     The action  procedure    is  ddeeccii--
  226.          mmaall(()).
  227.  
  228.  
  229.        _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
  230.        (change sign), +, -, *, /, and ENTR keys     all  do  exactly
  231.        what  you  would expect them to do.  Many of the remaining
  232.        keys are the same as in    TI  mode.   The     differences  are
  233.        detailed     below.     The action procedure for the ENTR key is
  234.        eenntteerr(()).
  235.  
  236.  
  237.        <<--     This is a backspace key that can be used if  you
  238.          make a mistake while entering a number.  It will
  239.          erase digits  from  the  display.   (See  BUGS).
  240.          Inverse  backspace  will  clear  the X register.
  241.          The corresponding action procedure is bbaacckk(()).
  242.  
  243.        OONN     Clears the display, the state, and  the  memory.
  244.          Pressing  it with the third pointer button turns
  245.          off the calculator, in that it     exits    the  pro-
  246.          gram.     To  clear state, the action procedure is
  247.          ooffff; to quit, qquuiitt(()).
  248.  
  249.        IINNVV     Inverts the meaning of the function keys.   This
  250.          would    be  the      _f  key on an HP calculator, but
  251.          _x_c_a_l_c does not display multiple legends on  each
  252.          key.    See  the  individual  function    keys  for
  253.          details.
  254.  
  255.        1100^^xx     Raises "10.0" to the number in the  top  of  the
  256.          stack.      When    inverted,  it  calculates the log
  257.          (base 10) of the number  in  the  display.   The
  258.          corresponding action procedure is tteennppoowweerr(()).
  259.  
  260.  
  261.  
  262. X Version 11            Release 6                4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. XCALC(1)                         XCALC(1)
  269.  
  270.  
  271.        ee^^xx     Raises     "e"  to  the  number  in  the top of the
  272.          stack.     When inverted,     it  calculates     the  log
  273.          (base    e)  of    the  number  in the display.  The
  274.          action procedure is eeppoowweerr(()).
  275.  
  276.        SSTTOO     Copies the number in the top of the stack  to    a
  277.          memory location.  There are 10 memory locations.
  278.          The desired memory  is     specified  by    following
  279.          this key with a digit key.
  280.  
  281.        RRCCLL     Pushes     the  number  from  the     specified memory
  282.          location onto the stack.
  283.  
  284.        SSUUMM     Adds the number on top of the stack to the  num-
  285.          ber in the specified memory location.
  286.  
  287.        xx::yy     Exchanges the numbers in the top two stack posi-
  288.          tions, the X and Y registers.    The corresponding
  289.          action procedure is XXeexxcchhaannggeeYY(()).
  290.  
  291.        RR vv     Rolls    the  stack  downward.    When inverted, it
  292.          rolls    the  stack  upward.   The   corresponding
  293.          action procedure is rroollll(()).
  294.  
  295.        _b_l_a_n_k     These    keys  were used for programming functions
  296.          on the HP-10C.     Their functionality has not been
  297.          duplicated in _x_c_a_l_c.
  298.  
  299.        Finally,     there    are  two  additional  action  procedures:
  300.        bbeellll(()), which rings the bell; and sseelleeccttiioonn(()), which  per-
  301.        forms  a     cut  on  the  entire  number in the calculator's
  302.        ``liquid crystal'' display.
  303.  
  304. AACCCCEELLEERRAATTOORRSS
  305.        Accelerators are shortcuts for entering    commands.   _x_c_a_l_c
  306.        provides some sample keyboard accelerators; also users can
  307.        customize accelerators.    The numeric  keypad  accelerators
  308.        provided     by  _x_c_a_l_c  should  be    intuitively correct.  The
  309.        accelerators defined by _x_c_a_l_c on     the  main  keyboard  are
  310.        given below:
  311.  
  312.         TI Key    HP Key    Keyboard Accelerator     TI Function    HP Function
  313.  
  314.         SQRT SQRT r             squareRoot()   squareRoot()
  315.         AC     ON   space          clear()     clear()
  316.         AC     <-   Delete          clear()     back()
  317.         AC     <-   Backspace         clear()        back()
  318.         AC     <-   Control-H         clear()        back()
  319.         AC          Clear          clear()
  320.         AC     ON   q             quit()        quit()
  321.         AC     ON   Control-C         quit()        quit()
  322.  
  323.         INV     i    i             inverse()        inverse()
  324.         sin     s    s             sine()        sine()
  325.  
  326.  
  327.  
  328. X Version 11            Release 6                5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. XCALC(1)                         XCALC(1)
  335.  
  336.  
  337.         cos     c    c             cosine()        cosine()
  338.         tan     t    t             tangent() tangent()
  339.         DRG     DRG  d             degree()        degree()
  340.  
  341.         e          e             e()
  342.         ln     ln   l             naturalLog()   naturalLog()
  343.         y^x     y^x  ^             power()        power()
  344.  
  345.         PI     PI   p             pi()      pi()
  346.         x!     x!   !             factorial()    factorial()
  347.         (          (             leftParen()
  348.         )          )             rightParen()
  349.  
  350.         /     /    /             divide()        divide()
  351.         *     *    *             multiply()        multiply()
  352.         -     -    -             subtract()        subtract()
  353.         +     +    +             add()        add()
  354.         =          =             equal()
  355.  
  356.         0..9 0..9 0..9         digit()        digit()
  357.         .     .    .             decimal() decimal()
  358.         +/-     CHS  n             negate()        negate()
  359.  
  360.          x:y  x                   XexchangeY()
  361.          ENTR Return                enter()
  362.          ENTR Linefeed                enter()
  363.  
  364.  
  365. CCUUSSTTOOMMIIZZAATTIIOONN
  366.        The application class name is XCalc.
  367.  
  368.        _x_c_a_l_c  has  an  enormous     application  defaults file which
  369.        specifies the position, label, and function of each key on
  370.        the  calculator.      It  also gives translations to serve as
  371.        keyboard accelerators.  Because these  resources     are  not
  372.        specified  in the source code, you can create a customized
  373.        calculator by writing a private application defaults file,
  374.        using  the  Athena  Command  and     Form widget resources to
  375.        specify the size and position of buttons,  the  label  for
  376.        each button, and the function of each button.
  377.  
  378.        The  foreground    and  background colors of each calculator
  379.        key can be individually specified.  For the TI calculator,
  380.        a classical color resource specification might be:
  381.  
  382.        XCalc.ti.Command.background:  gray50
  383.        XCalc.ti.Command.foreground:  white
  384.  
  385.        For each of buttons 20, 25, 30, 35, and 40, specify:
  386.        XCalc.ti.button20.background: black
  387.        XCalc.ti.button20.foreground: white
  388.  
  389.        For  each  of  buttons 22, 23, 24, 27, 28, 29, 32, 33, 34,
  390.        37, 38, and 39:
  391.  
  392.  
  393.  
  394. X Version 11            Release 6                6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. XCALC(1)                         XCALC(1)
  401.  
  402.  
  403.        XCalc.ti.button22.background: white
  404.        XCalc.ti.button22.foreground: black
  405.  
  406. WWIIDDGGEETT HHIIEERRAARRCCHHYY
  407.        In order to specify resources, it is useful  to    know  the
  408.        hierarchy  of  the  widgets  which  compose _x_c_a_l_c.  In the
  409.        notation below, indentation indicates hierarchical  struc-
  410.        ture.   The  widget class name is given first, followed by
  411.        the widget instance name.
  412.  
  413.        XCalc xcalc
  414.         Form  ti  _o_r  hp    _(_t_h_e _n_a_m_e _d_e_p_e_n_d_s _o_n _t_h_e _m_o_d_e_)
  415.          Form  bevel
  416.               Form  screen
  417.                Label  M
  418.                Toggle  LCD
  419.                Label  INV
  420.                Label  DEG
  421.                Label  RAD
  422.                Label  GRAD
  423.                Label  P
  424.          Command  button1
  425.          Command  button2
  426.          Command  button3
  427.        _a_n_d _s_o _o_n_, _._._.
  428.          Command  button38
  429.          Command  button39
  430.          Command  button40
  431.  
  432. AAPPPPLLIICCAATTIIOONN RREESSOOUURRCCEESS
  433.        rrppnn (Class RRppnn)
  434.            Specifies that the rpn mode should be  used.   The
  435.            default is TI mode.
  436.  
  437.        ssttiippppllee (Class SSttiippppllee)
  438.            Indicates  that the background should be stippled.
  439.            The default is ``on'' for monochrome displays, and
  440.            ``off'' for color displays.
  441.  
  442.        ccuurrssoorr (Class CCuurrssoorr)
  443.            The  name  of  the  symbol  used     to represent the
  444.            pointer.     The default is ``hand2''.
  445.  
  446. CCOOLLOORRSS
  447.        If you would like xcalc to use its ti colors, include  the
  448.        following in the #ifdef COLOR section of the file you read
  449.        with xrdb:
  450.  
  451.        *customization:               -color
  452.  
  453.        This will cause xcalc to pick up the colors  in    the  app-
  454.        defaults     color    customization  file: <XRoot>/lib/X11/app-
  455.        defaults/XCalc-color.
  456.  
  457.  
  458.  
  459.  
  460. X Version 11            Release 6                7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. XCALC(1)                         XCALC(1)
  467.  
  468.  
  469. SSEEEE AALLSSOO
  470.        X(1), xrdb(1), the Athena Widget Set
  471.  
  472. BBUUGGSS
  473.        HP mode:     A bug report claims that the sequence of keys 5,
  474.        ENTER, <- should clear the display, but it doesn't.
  475.  
  476. CCOOPPYYRRIIGGHHTT
  477.        Copyright ([, X Consortium
  478.        See _X_(_1_) for a full statement of rights and permissions.
  479.  
  480. AAUUTTHHOORRSS
  481.        John Bradley, University of Pennsylvania
  482.        Mark Rosenstein, MIT Project Athena
  483.        Donna Converse, MIT X Consortium
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526. X Version 11            Release 6                8
  527.  
  528.  
  529.