


XCALC(1)						 XCALC(1)


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

SSYYNNOOPPSSIISS
       xxccaallcc [-stipple] [-rpn] [-_t_o_o_l_k_i_t_o_p_t_i_o_n_._._.]

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

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


       --ssttiipppplle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rppn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OPPEERRAATTIIOONN
       _P_o_i_n_t_e_r	_U_s_a_g_e_:	Operations  may be performed with pointer
       button 1, or in some cases, with the keyboard.  Many  com-
       mon  calculator operations have keyboard accelerators.  To
       quit, press pointer button 3 on the AC key of the TI  cal-
       culator, 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 paren-
       theses  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diiggiitt((_n)),	 where	_n  is  the  corresponding
       digit, 0..9.

       11//xx	 Replaces  the	number	in  the	 display with its
		 reciprocal.  The corresponding action	procedure



X Version 11		    Release 6				1





XCALC(1)						 XCALC(1)


		 is rreecciipprrooccaall(()).

       xx^^22	 Squares  the  number in the display.  The corre-
		 sponding action procedure is ssqquuaarree(()).

       SSQQRRTT	 Takes the square root of the number in the  dis-
		 play.	 The  corresponding  action  procedure is
		 ssqquuaarreeRRoooott(()).

       CCEE//CC	 When pressed once, clears the number in the dis-
		 play  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 is cclleeaarr(()).

       AAC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 pro-
		 gram.	The action procedure to clear  the  state
		 is ooffff(()); to quit, qquuiitt(()).

       IINNVV	 Invert	 function.   See  the individual function
		 keys for details.  The corresponding action pro-
		 cedure is iinnvveerrssee(()).

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

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

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

       DDRRGG	 Changes the DRG mode,	as  indicated  by  'DEG',
		 'RAD',	 or 'GRAD' at the bottom of of the calcu-
		 lator ``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	 convert-
		 ing  degrees to radians to grads and vice-versa.
		 Example:  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 is ddeeggrreeee(()).

       ee	 The constant 'e'.  (2.7182818...).   The  corre-
		 sponding action procedure is ee(()).



X Version 11		    Release 6				2





XCALC(1)						 XCALC(1)


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

       lloog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,  enter-
		 ing  "3  INV  log" should result in "1000".  The
		 corresponding action procedure is llooggaarriitthhmm(()).

       lln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naattuurraallLLoogg(()).

       yy^^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
		 example,  "(1+2+3) y^x (1+2) =" equals "6 y^x 3"
		 which equals "216".   The  corresponding  action
		 procedure is ppoowweerr(()).

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

       xx!!	 Computes the factorial of the number in the dis-
		 play.	 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faaccttoorriiaall(()).

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

       ))	 Right	parenthesis.   The  corresponding  action
		 procedure for TI calculators is rriigghhttPPaarreenn(()).

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

       **	 Multiplication.  The corresponding action proce-
		 dure is mmuullttiippllyy(()).

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

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

       ==	 Perform  calculation.	 The  TI-specific  action
		 procedure is eeqquuaall(()).



X Version 11		    Release 6				3





XCALC(1)						 XCALC(1)


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

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

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

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

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

       ..	 Decimal point.	 The action  procedure	is  ddeeccii--
		 mmaal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enntteer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baacckk(()).

       OON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  pro-
		 gram.	 To  clear state, the action procedure is
		 ooffff; to quit, qquuiitt(()).

       IINNV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100^^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
		 corresponding action procedure is tteennppoowweerr(()).



X Version 11		    Release 6				4





XCALC(1)						 XCALC(1)


       ee^^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eppoowweerr(()).

       SSTTO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RCCLL	 Pushes	 the  number  from  the	 specified memory
		 location onto the stack.

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

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

       RR vv	 Rolls	the  stack  downward.	When inverted, it
		 rolls	the  stack  upward.   The   corresponding
		 action procedure is rroolll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beellll(()), which rings the bell; and sseelleeccttiioonn(()), which  per-
       forms  a	 cut  on  the  entire  number in the calculator's
       ``liquid crystal'' display.

AACCCCEELLEERRAATTOORRS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()



X Version 11		    Release 6				5





XCALC(1)						 XCALC(1)


	    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CUUSSTTOOMMIIZZAATTIIOONN
       The application class name is XCalc.

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

       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:



X Version 11		    Release 6				6





XCALC(1)						 XCALC(1)


       XCalc.ti.button22.background: white
       XCalc.ti.button22.foreground: black

WWIIDDGGEETT HHIIEERRAARRCCHHY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
       notation below, indentation indicates hierarchical  struc-
       ture.   The  widget class name is given first, followed by
       the widget instance name.

       XCalc xcalc
	    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_)
		 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APPPPLLIICCAATTIIOONN RREESSOOUURRCCEESS
       rrppnn (Class RRppnn)
	       Specifies that the rpn mode should be  used.   The
	       default is TI mode.

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

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

CCOOLLOORRSS
       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: <XRoot>/lib/X11/app-
       defaults/XCalc-color.




X Version 11		    Release 6				7





XCALC(1)						 XCALC(1)


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

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

CCOOPPYYRRIIGGHHTT
       Copyright ([, X Consortium
       See _X_(_1_) for a full statement of rights and permissions.

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










































X Version 11		    Release 6				8


