home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume10 / calctool24 / part01 next >
Encoding:
Text File  |  1990-01-15  |  45.7 KB  |  1,558 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v10i006: Calctool V2.4 - a simple calculator (Part 1 of 6).
  3. from: richb@Aus.Sun.COM (Rich Burridge)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 10, Issue 6
  7. Submitted-by: richb@Aus.Sun.COM (Rich Burridge)
  8. Archive-name: calctool24/part01
  9.  
  10. This is V2.4 of a desktop calculator for the Sun workstation.
  11. This version works under SunView, XView, X11, NeWS, MGR and for
  12. dumb tty terminals.
  13.  
  14. It is almost visually identical to V2.1 which was released in August
  15. 1988, but internally most of the code has been reworked to include a
  16. level of graphics abstraction, to make porting this code to other
  17. window systems a trivial task.
  18.  
  19. V2.4 includes display in scientific notation, color icons, a correct
  20. factorial function and fixes for a few minor bugs. It introduces the
  21. new versions for XView, X11, MGR and dumb terminals. New functions
  22. include hyperbolic and inverse hyperbolic trigonometrical functions,
  23. register exchange, constants and the input of numbers in exponential
  24. notation. You can also have a .calctoolrc file in your home directory,
  25. which can define upto ten new values for constants, and ten function
  26. definitions which are used in conjunction with the FUN key.
  27.  
  28. **IMPORTANT NOTE**
  29.  
  30. Several of the keyboard equivalents for various calctool functions
  31. have been changed to allow for the new functionality and to be more
  32. intuitive.
  33.  
  34. See the online help, the README file or the manual pages for more details.
  35.  
  36. Suggestions for furthur improvement would be most welcome, plus bugs,
  37. comments and flames.
  38.  
  39. Rich Burridge,          DOMAIN: richb@sunaus.oz.au
  40. PHONE: +61 2 413 2666   UUCP:   {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
  41.  
  42. ---- Cut Here and unpack ----
  43. #!/bin/sh
  44. # shar:    Shell Archiver  (v1.22)
  45. #    Packed Tue Jan  9 12:17:18 EST 1990 by stard!richb
  46. #    from directory /extra/richb/rich_stuff/calctool
  47. #
  48. # This is part 1 of a multipart archive                                    
  49. # do not concatenate these parts, unpack them in order with /bin/sh        
  50. #
  51. #    Run the following text with /bin/sh to create:
  52. #      README
  53. #      Makefile
  54. #      TODO
  55. #      calctool.help
  56. #      calctool.1
  57. #      calctool.ps
  58. #      patchlevel.h
  59. #      .calctoolrc
  60. #      graphics.c
  61. #      display.c
  62. #      functions.c
  63. #      get.c
  64. #      calctool.c
  65. #      mgr.c
  66. #      news.c
  67. #      sunview.c
  68. #      tty.c
  69. #      x11.c
  70. #      xview.c
  71. #      calctool.h
  72. #      color.h
  73. #      extern.h
  74. #      calctool.icon
  75. #      calctool.color.icon
  76. #      help.cursor
  77. #
  78. if test -r s2_seq_.tmp
  79. then echo "Must unpack archives in sequence!"
  80.      next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
  81.      exit 1; fi
  82. echo "x - extracting README (Text)"
  83. sed 's/^X//' << 'SHAR_EOF' > README &&
  84. X
  85. Xcalctool  -  README  -  November 1989.
  86. X
  87. XThis is V2.4 of a desktop calculator for the Sun workstation.
  88. XThis version works under SunView, XView, X11, NeWS, MGR and for
  89. Xdumb tty terminals.
  90. X
  91. XIt is almost visually identical to V2.1 which was released in August
  92. X1988, but internally most of the code has been reworked to include a
  93. Xlevel of graphics abstraction, to make porting this code to other
  94. Xwindow systems a trivial task.
  95. X
  96. XV2.4 includes display in scientific notation, color icons, a correct
  97. Xfactorial function and fixes for a few minor bugs. It introduces the
  98. Xnew versions for XView, X11, MGR and dumb terminals. New functions
  99. Xinclude hyperbolic and inverse hyperbolic trigonometrical functions,
  100. Xregister exchange, constants and the input of numbers in exponential
  101. Xnotation. You can also have a .calctoolrc file in your home directory,
  102. Xwhich can define upto ten new values for constants, and ten function
  103. Xdefinitions which are used in conjunction with the FUN key.
  104. X
  105. X**IMPORTANT NOTE**
  106. X
  107. XSeveral of the keyboard equivalents for various calctool functions
  108. Xhave been changed to allow for the new functionality and to be more
  109. Xintuitive.
  110. X
  111. XSee the online help or the manual pages for more details.
  112. X
  113. XThis code has been tested on a range of different Sun machines under a
  114. Xvariety of O/Ss. See the beginning of the Makefile for details of what
  115. Xyou might have to tweak in order to get it working under different O/Ss
  116. Xor on other machines, and also how to compile and link for the different
  117. Xversions. Note that calctool creates a library before generating the
  118. Xappropriate calctool binary. By default, this is a normal 'ar' type
  119. Xlibrary, but with SunOS v4.x it is possible to create a shared library.
  120. XIn order to do this, you should type 'make shared' before making the
  121. Xcalctool of your choice. It will install this library in the directory
  122. Xdefined by the Makefile macro definition LIBDIR, so you might need root
  123. Xpermission to successfully do this.
  124. X
  125. XThere is a TODO file included, which lists the current known bugs, and
  126. Xa set of possible enhancements, some relatively trivial, others that
  127. Xare fairly major enhancements which would make interesting future
  128. Xprojects.
  129. X
  130. X
  131. XAcknowledgements.
  132. X
  133. XThanks to Ed Falk at Sun Microsystems (Mountain View) for most of the
  134. Xbasic arithmetical algorithms used, to Andrew Nicholson for revising the
  135. Xprevious version of the NeWS code, to Sriram Ramachandran for fixing up
  136. Xthe XView code, and Hala Abdalla for the original implementation of the
  137. Xpopup menu and function keyboard support.
  138. X
  139. XThanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
  140. XCharles Tierney, Trevor Watson and Marla Berg for bug reports and sugggested
  141. Xenhancements.
  142. X
  143. XSuggestions for furthur improvement would be most welcome, plus bugs,
  144. Xcomments and flames.
  145. X
  146. XRich Burridge,          DOMAIN: richb@sunaus.oz.au
  147. XPHONE: +61 2 413 2666   UUCP:   {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
  148. SHAR_EOF
  149. chmod 0444 README || echo "restore of README fails"
  150. set `wc -c README`;Sum=$1
  151. if test "$Sum" != "2888"
  152. then echo original size 2888, current size $Sum;fi
  153. echo "x - extracting Makefile (Text)"
  154. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  155. X#
  156. X#  Makefile for calctool, a calculator program.
  157. X#
  158. X#  @(#)Makefile 1.16 89/12/21
  159. X#
  160. X#  Copyright (c) Rich Burridge.
  161. X#                Sun Microsystems, Australia - All rights reserved.
  162. X#
  163. X#  Permission is given to distribute these sources, as long as the
  164. X#  copyright messages are not removed, and no monies are exchanged.
  165. X#
  166. X#  No responsibility is taken for any errors inherent either in the comments
  167. X#  or the code of this program, but if reported to me then an attempt will
  168. X#  be made to fix them.
  169. X#
  170. X#======================================================================
  171. X#
  172. X#  There are various small changes needed when compiling calctool on
  173. X#  different systems. These have been isolated here, and should
  174. X#  be uncommented if needed.
  175. X#
  176. X#======================================================================
  177. X#
  178. X#  Calctool uses an helpfile to supply online help for each key.
  179. X#  By default this file is called "calctool.help", and is looked
  180. X#  for in every directory on the users search path. You can also
  181. X#  override it's location and name at runtime with the -h option.
  182. X#  It can also be specified here by uncommenting the following
  183. X#  macro definition and setting appropriately.
  184. X#
  185. X#HELPNAME        = -DHELPGIVEN -DHELPNAME=\"$(LIBDIR)/calctool.help\"
  186. X#
  187. X#  If you are compiling the MGR version, then the following three
  188. X#  definitions should be uncommented.
  189. X#
  190. X#MGRHOME         = /usr/mgr
  191. X#MGRPARAM        = -DMGRHOME=\"$(MGRHOME)\"
  192. X#MGRINCDIR       = -I$(MGRHOME)/include
  193. X#
  194. X#  If you are compiling the NeWS version, then the following definition
  195. X#  should be uncommented and set to the default location for the calctool
  196. X#  PostScript file, which is downloaded to the NeWS server.
  197. X#
  198. X#NEWSFILE        = -DNEWSGIVEN -DNEWSFILE=\"$(LIBDIR)/calctool.ps\"
  199. X#
  200. X#  Calctool loads a run control file when it starts. By default
  201. X#  this file is called ".calctoolrc", and is taken from the users
  202. X#  home directory. If there is a similar file in the current directory,
  203. X#  then these values override the default ones. Its name and location
  204. X#  can also be specified here by uncommenting the following macro
  205. X#  definition and setting appropriately.
  206. X#
  207. X#RCNAME          = -DRCGIVEN   -DRCNAME=\".calctoolrc\"
  208. X#
  209. X#  If you not running under a BSD4.3 derived system, the parameters
  210. X#  to the select call are different, and this definition should be
  211. X#  uncommented. You need to uncomment this for SunOS v3.x.
  212. X#
  213. X#SELTYPE        = -DNO_4.3SELECT
  214. X#
  215. X#  Note that with SunOS v4.x it is possible to create a shared library
  216. X#  for the calctool routines. If you wish to do this, then you should
  217. X#  change LIBNAME below to libcalctool.so.1.1, and uncomment the SHLIB
  218. X#  line.
  219. X#
  220. XLIBNAME         = libcalctool.a
  221. X#
  222. X#LIBNAME         = libcalctool.so.1.1
  223. X#SHLIB           = -pic
  224. X#
  225. X#  If you are not running under a BSD4.3 derived system, then the
  226. X#  second parameter to a select call is a pointer to an integer function,
  227. X#  and this definition needs to be uncommented. You need to uncomment this
  228. X#  for SunOS v3.x.
  229. X#
  230. X#SIGRET         = -DNO_4.3SIGNAL
  231. X#
  232. X#  Calctool endevours to provide a numeric keypad using the right function
  233. X#  keypad. The Sun3 keyboard has a different pad setup to the Sun4 keyboard.
  234. X#  If you wish to use these function keys with a Sun4 keyboard, then you
  235. X#  need to uncomment the following definition.
  236. X#
  237. X#SUN4_KEYBOARD  = -DSUN4_KEYBOARD
  238. X#
  239. X#  If you are running SunOS v3.x, then pr_ttext doesn't exist, and
  240. X#  you must uncomment this definition.
  241. X#
  242. X#TTEXT          = -DNO_PR_TTEXT
  243. X#
  244. X#  If you are compiling the X11 version and the X11 include and
  245. X#  library files are not in a standard place, then the following
  246. X#  two lines should be uncommented, and set appropriately.
  247. X#
  248. X#X11INCDIR         = -I$(XNEWSHOME)/include
  249. X#X11LIBDIR         = -L$(XNEWSHOME)/lib
  250. X#
  251. X#  If you are compiling the XView version, then the following two lines
  252. X#  should be uncommented.
  253. X#
  254. X#XVIEWINCDIR      = -I$(XNEWSHOME)/include
  255. X#XVIEWLIBDIR      = -L$(XNEWSHOME)/lib
  256. X#
  257. X#=========================================================================
  258. X#
  259. X#  Default locations where calctool files will be installed.
  260. X#  You might wish to alter these values.
  261. X#
  262. XBINDIR          = /usr/local/bin
  263. XLIBDIR          = /usr/local/lib
  264. XMANDIR          = /usr/man/man$(MANSECT)
  265. XMANSECT         = l
  266. X#
  267. X#  Compilation flags and standard macro definitions.
  268. X#
  269. XCFLAGS        = -g $(HELPNAME) $(NEWSFILE) $(RCNAME) $(SELTYPE) $(SHLIB) \
  270. X             $(SIGRET) $(SUN4_KEYBOARD) $(TTEXT) \
  271. X             $(MGRPARAM) $(MGRINCDIR) $(X11INCDIR) $(XVIEWINCDIR)
  272. X#
  273. X#=========================================================================
  274. X
  275. XBINARIES        = mgr_calctool ps_calctool sv_calctool \
  276. X          tty_calctool xcalctool xv_calctool
  277. X
  278. XLIBSRCS         = graphics.c display.c functions.c get.c
  279. XLIBOBJS         = graphics.o display.o functions.o get.o
  280. XSTDSRCS         = calctool.c
  281. XSTDOBJS         = calctool.o
  282. XOBJS            = $(STDOBJS) $(LIBNAME)
  283. X
  284. XGSRCS           = mgr.c news.c sunview.c tty.c x11.c xview.c
  285. XHDRS            = calctool.h color.h extern.h
  286. XIMAGES          = calctool.icon calctool.color.icon help.cursor
  287. XOTHERS          = Makefile README TODO calctool.help calctool.1 \
  288. X          calctool.ps patchlevel.h .calctoolrc
  289. X
  290. XSFILES1         = $(LIBSRCS) $(STDSRCS)
  291. XSFILES2         = $(GSRCS)
  292. XSFILES3         = $(HDRS) $(IMAGES)
  293. XSFILES4         = $(OTHERS)
  294. X
  295. XCALCLIB         = -L. -lcalctool
  296. XMGRLIBS         = $(CALCLIB) $(MGRHOME)/lib/libmgr.a -lm
  297. XNEWSLIBS        = $(CALCLIB) $$NEWSHOME/lib/libcps.a -lm
  298. XSVIEWLIBS       = $(CALCLIB) -lsuntool -lsunwindow -lpixrect -lm
  299. XTTYLIBS         = $(CALCLIB) -ltermcap -lm
  300. XX11LIBS         = $(CALCLIB) -lX11 -lm
  301. XXVIEWLIBS       = $(CALCLIB) -lxview -lX11 -lm
  302. X
  303. X.PRECIOUS:      $(LIBNAME)
  304. X
  305. Xhelp:
  306. X        @echo
  307. X        @echo "You need to specify one of the following options:"
  308. X        @echo
  309. X        @echo "  make mgr        - to make the MGR version."
  310. X        @echo "  make news       - to make the NeWS version."
  311. X        @echo "  make sunview    - to make the SunView version."
  312. X        @echo "  make tty        - to make the dumb tty version."
  313. X        @echo "  make x11        - to make the X11 version."
  314. X        @echo "  make xview      - to make the XView version."
  315. X        @echo
  316. X        @echo "This should be followed by:"
  317. X        @echo
  318. X        @echo "  make install"
  319. X        @echo "  make clean"
  320. X        @echo
  321. X
  322. Xall:            $(BINARIES)
  323. X
  324. Xmgr:            $(OBJS) mgr.o
  325. X        cc -o mgr_calctool $(CFLAGS) $(STDOBJS) mgr.o $(MGRLIBS)
  326. X        -cp mgr_calctool calctool
  327. X
  328. Xnews:           $(OBJS) news.o
  329. X        cc -o ps_calctool $(CFLAGS) $(STDOBJS) news.o $(NEWSLIBS)
  330. X        -cp ps_calctool calctool
  331. X
  332. Xsunview:        $(OBJS) sunview.o
  333. X        cc -o sv_calctool $(CFLAGS) $(STDOBJS) sunview.o $(SVIEWLIBS)
  334. X        -cp sv_calctool calctool
  335. X
  336. Xtty:            $(OBJS) tty.o
  337. X        cc -o tty_calctool $(CFLAGS) $(STDOBJS) tty.o $(TTYLIBS)
  338. X        -cp tty_calctool calctool
  339. X
  340. Xx11:            $(OBJS) x11.o
  341. X        cc -o xcalctool $(X11LIBDIR) $(CFLAGS) $(STDOBJS) x11.o \
  342. X                $(X11LIBS)
  343. X        -cp xcalctool calctool
  344. X
  345. Xxview:          $(OBJS) xview.o
  346. X        cc -o xv_calctool $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) xview.o \
  347. X                  $(XVIEWLIBS)
  348. X        -cp xv_calctool calctool
  349. X
  350. Xlibcalctool.a:  $(LIBOBJS)
  351. X        ar rv $@ $?
  352. X        ranlib $@
  353. X                 
  354. X#  These are the library creation rules for making the shared calctool
  355. X#  library (available with SunOS v4.x).
  356. Xlibcalctool.so.1.1:     $(LIBOBJS)
  357. X            ld -o libcalctool.so.1.1 -assert pure-text $?
  358. X
  359. Xinstall:
  360. X        install -c -m 644 $(LIBNAME) $(LIBDIR)
  361. X        install -s -m 751 calctool $(BINDIR)
  362. X        install -c -m 644 calctool.help $(LIBDIR)
  363. X        install -c -m 644 calctool.ps $(LIBDIR)
  364. X        install -c -m 644 calctool.1 $(MANDIR)/calctool.$(MANSECT)
  365. X
  366. Xclean:;         rm -f *.o archive.* *~ *.a $(BINARIES) core
  367. X
  368. Xlint:;        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) tty.c $(TTYLIBS)
  369. X        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) sunview.c $(SVIEWLIBS)
  370. X        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) xview.c $(XVIEWLIBS)
  371. X        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) x11.c $(X11LIBS)
  372. X        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) news.c $(NEWSLIBS)
  373. X        lint $(CFLAGS) $(STDSRCS) $(LIBSRCS) mgr.c $(MGRLIBS)
  374. X
  375. Xshar:;          shar.script $(SFILES1) > archive.1
  376. X        shar.script $(SFILES2) > archive.2
  377. X        shar.script $(SFILES3) > archive.3
  378. X        shar.script $(SFILES4) > archive.4
  379. X
  380. Xcreate:        SCCS
  381. X        -sccs create $(STDSRCS) $(GSRCS) $(HDRS) $(IMAGES) $(OTHERS)
  382. XSCCS:
  383. X        -mkdir SCCS
  384. X        chmod 755 SCCS
  385. SHAR_EOF
  386. chmod 0444 Makefile || echo "restore of Makefile fails"
  387. set `wc -c Makefile`;Sum=$1
  388. if test "$Sum" != "8158"
  389. then echo original size 8158, current size $Sum;fi
  390. echo "x - extracting TODO (Text)"
  391. sed 's/^X//' << 'SHAR_EOF' > TODO &&
  392. XBugs:
  393. X
  394. X1/ The following problems exist for the NeWS v1.1 version:
  395. X
  396. X   a) The calctool icon (color and mono) is not being displayed correctly.
  397. X
  398. X   b) The initial position of the icon should be settable via the
  399. X      -WP flag.
  400. X
  401. X   c) It should be possible for calctool to start iconically.
  402. X
  403. X   d) Popup menu support needs to be fully implemented.
  404. X
  405. X   e) The NeWS code should be commented.
  406. X
  407. X
  408. X2/ The following problems exist with the mgr version:
  409. X
  410. X   a) The fonts aren't being loaded correctly.
  411. X
  412. X   b) After a reshape, the "panel items" are not being redisplayed.
  413. X
  414. X   c) The right button popup menu support is not correctly working.
  415. X
  416. X
  417. X3/ The following problem exists with the SunView version:
  418. X
  419. X   a) The ENTER key (Right function keypad) is not recognised.
  420. X
  421. X
  422. X4/ The following problems exist with the XView version:
  423. X
  424. X   a) The memory register window is coming up in the wrong place.
  425. X      This is because of bug 1022495 (xview/library).
  426. X   b) The following right keypad function keys are currently not recognised:
  427. X      0    .     -     +    ENTER
  428. X
  429. X
  430. X5/ The following problems exist with the X11 version.
  431. X
  432. X   a) The size of the calctool icon on the monochrome version is incorrect.
  433. X
  434. X
  435. XEnhancements:
  436. X
  437. X1/ Incorporate a multi-precision arithmetic package as the basis of all
  438. X   calculations. The display could then include two little arrow icons,
  439. X   one at each side of the numeric display, which would shift the contents
  440. X   to the left or the right.
  441. X
  442. X2/ Add some more functions. Some suggested functions are:
  443. X
  444. X  a) Common antilogarithm and natural antilogarithm.
  445. X
  446. X  b) Cube root key.
  447. X
  448. X  c) Root key. The y root of x.
  449. X
  450. X  d) Rectangular to polar and polar to rectangular keys.
  451. X
  452. X  e) Random number key. Return a random number between 0.0 and < 1.0.
  453. X
  454. X3/ Add Reverse Polish notation.
  455. X
  456. X4/ Support multiple graphics version in the same binary or write a front-end
  457. X   shell script that with select the appropriate binary depending on the
  458. X   environment [MGR/NeWS/SunView/tty/X11] [Sun3/Sun4/Sun386i] etc..
  459. X
  460. X5/ See if it's possible to get the GET and PUT function keys working with
  461. X   the NeWS and the X11 versions.
  462. SHAR_EOF
  463. chmod 0444 TODO || echo "restore of TODO fails"
  464. set `wc -c TODO`;Sum=$1
  465. if test "$Sum" != "2100"
  466. then echo original size 2100, current size $Sum;fi
  467. echo "x - extracting calctool.help (Text)"
  468. sed 's/^X//' << 'SHAR_EOF' > calctool.help &&
  469. X_calctool.help_
  470. X_EXCH_
  471. XRegister exchange n        ( ^e ).
  472. X
  473. XThis must be followed by a digit
  474. Xin the range 0 - 9 to indicate
  475. Xwhich register should be inter-
  476. Xchanged with the current display.
  477. X_CON _
  478. XConstant n                  ( # ).
  479. X
  480. XThis must be followed by a digit
  481. Xin the range 0 - 9 to indicate
  482. Xwhich constant should be shown.
  483. X
  484. XThe ten default constants are:
  485. X
  486. X0 - kms per hour / miles per hour.
  487. X1 - square root of 2.
  488. X2 - e.
  489. X3 - pi.
  490. X4 - cms / inches.
  491. X5 - degrees in a radian.
  492. X4 - 2 ^ 20.
  493. X6 - gms / oz.
  494. X8 - kilojoules / British thermals.
  495. X9 - cubic cms / cubic inches.
  496. X_BIN _
  497. XChange base to binary       ( B ).
  498. X
  499. XThe display value is shown in
  500. Xbinary. A maximum of 32 digits
  501. Xare allowed.
  502. X_MEM _
  503. XToggle register window      ( M ).
  504. X
  505. XDisplay popup window with the
  506. Xvalues of the ten memory
  507. Xregisters given in the current
  508. Xbase, to the current accuracy.
  509. X_OCT _
  510. XChange base to octal        ( O ).
  511. X
  512. XThe display value is shown in
  513. Xoctal. A maximum of 15 digits
  514. Xare allowed.
  515. X_D   _
  516. XHex D (decimal 13)          ( d ).
  517. X
  518. XThis selection is valid only if
  519. Xthe current base is hexidecimal.
  520. X_DEC _
  521. XChange base to decimal      ( D ).
  522. X
  523. XThe display value is shown in
  524. Xdecimal. This is the default
  525. Xbase. A maximum of 12 digits
  526. Xare allowed.
  527. X_E   _
  528. XHex E (decimal 14)          ( e ).
  529. X
  530. XThis selection is valid only if
  531. Xthe current base is hexidecimal.
  532. X_HEX _
  533. XChange base to hexidecimal  ( H ).
  534. XThe display value is shown in
  535. Xhexidecimal. A maximum of 12
  536. Xdigits are allowed.
  537. X_F   _
  538. XHex F (decimal 15)          ( f ).
  539. X
  540. XThis selection is valid only if
  541. Xthe current base is hexidecimal.
  542. X_FIX _
  543. XFixed Notation             ( ^n ).
  544. X
  545. XNumerical values will be
  546. Xdisplayed in fixed point
  547. Xnotation. This button toggles
  548. Xbetween fixed and scientific
  549. Xnotation.
  550. X_SCI _
  551. XScientific notation        ( ^n ).
  552. X
  553. XNumerical values will be
  554. Xdisplayed in scientific notation.
  555. XThis button toggles between
  556. Xscientific and fixed point
  557. Xnotation.
  558. X_FUN _
  559. XFunction key n             ( ^f ).
  560. XThis must be followed by a digit 
  561. Xin the range 0 - 9, to indicate
  562. Xwhich user defined function is 
  563. Xto be performed. 
  564. XThese functions are defined in a
  565. X.calctoolrc file, in your home 
  566. Xdirectory. See the calctool
  567. Xmanual page for the format of 
  568. Xthis file.
  569. X_&32 _
  570. XGet 32 bit unsigned int     ( [ ).
  571. X
  572. XThis is a logical function, that
  573. Xwill truncate the given number to
  574. Xreturn a 32 bit unsigned integer.
  575. X_STO _
  576. XStore memory register n     ( s ).
  577. X
  578. XThis must be followed by an
  579. Xarithmetic operation (addition,
  580. Xsubtraction, multiplication or
  581. Xdivision), then a digit in the
  582. Xrange 0 to 9 to indicate the
  583. Xmemory register in which to
  584. Xstore the current display value.
  585. XThe arithmetic operator is
  586. Xoptional in which case the
  587. Xcurrent display is stored in the
  588. Xmemory register.
  589. X_&16 _
  590. XGet 16 bit unsigned int     ( ] ).
  591. X
  592. XThis is a logical function, that
  593. Xwill truncate the given number to
  594. Xreturn a 16 bit unsigned integer.
  595. X_RCL _
  596. XRetrieve memory register n  ( r ).
  597. X
  598. XThis must be followed by a digit
  599. Xin the range 0 to 9 to indicate
  600. Xthe memory register from which
  601. Xdata is to be to retrieved.
  602. X_<   _
  603. XLeft shift n                ( < ).
  604. X
  605. XThis must be followed by a digit
  606. Xin the range 0 to 9 to indicate
  607. Xhow many places to shift.
  608. X_A   _
  609. XHex A (decimal 10)          ( a ).
  610. X
  611. XThis selection is valid only if
  612. Xthe current base is hexidecimal.
  613. X_>   _
  614. XRight shift n               ( > ).
  615. XThis must be followed by a digit
  616. Xin the range 0 to 9 to indicate
  617. Xhow many places to shift.
  618. X_B   _
  619. XHex B (decimal 11)          ( b ).
  620. X
  621. XThis selection is valid only if
  622. Xthe current base is hexidecimal.
  623. X_%   _
  624. XPercentage                  ( % ).
  625. X
  626. XThis calculation takes the last
  627. Xnumber enter and the next number
  628. Xgiven, and performs a percentage
  629. Xcalculation on them.
  630. X_C   _
  631. XHex C (decimal 12)          ( c ).
  632. XThis selection is valid only if
  633. Xthe current base is hexidecimal.
  634. X_clr _
  635. XClear display          ( Delete ).
  636. X
  637. XThis will clear the value of the
  638. Xcalculators display.
  639. X_bsp _
  640. XErase character     ( BackSpace ).
  641. XThe right most character of the
  642. Xcurrent calculator display value
  643. Xis removed, and the value of the
  644. Xdisplay is recalculated. (Note:
  645. Xinternal accuracy is lost with
  646. Xthis operation.)
  647. X_OR  _
  648. XLogical OR                  ( | ).
  649. X
  650. XThis operation takes the last
  651. Xnumber and the next number
  652. Xentered, and performs a logical
  653. XOR operation on them, treating
  654. Xboth numbers as unsigned long
  655. Xintegers.
  656. X_AND _
  657. XLogical AND                 ( & ).
  658. X
  659. XThis operation takes the last
  660. Xnumber and the next number
  661. Xentered, and performs a logical
  662. XAND operation on them, treating
  663. Xboth numbers as unsigned long
  664. Xintegers.
  665. X_HYP _
  666. XHyperbolic flag.            ( h ).
  667. X
  668. XThis button is a toggle for
  669. Xsetting or unsetting the
  670. Xhyperbolic function flag. This
  671. Xflag affects SIN, COS and TAN
  672. Xtrigonometrical functions.
  673. X_SIN _
  674. XSine function              ( ^s ).
  675. X
  676. XReturns the trigonometric sine,
  677. Xarc sine, hyperbolic sine or
  678. Xinverse hyperbolic sine of
  679. Xthe current value, depending
  680. Xupon the settings of the
  681. XHYP and INV flags. The result
  682. Xis displayed in the current
  683. Xunits (degrees, radians or
  684. Xgradients).
  685. X_e^x _
  686. Xe to the x power            ( { ).
  687. X
  688. XReturn e raised to the power of
  689. Xthe current display value.
  690. X_7   _
  691. XNumeric 7                   ( 7 ).
  692. X
  693. XThis selection is ignored if
  694. Xthe current base is binary.
  695. X_10^x_
  696. X10 to the x power           ( } ).
  697. X
  698. XReturn 10 raised to the power of
  699. Xthe current display value.
  700. X_8   _
  701. XNumeric 8                   ( 8 ).
  702. X
  703. XThis selection is ignored if
  704. Xthe current base is octal or
  705. Xbinary.
  706. X_y^x _
  707. Xy to the power of x         ( Y ).
  708. X
  709. XThe operation takes the last
  710. Xnumber and raises it to the power
  711. Xof the next number given.
  712. X_9   _
  713. XNumeric 9                   ( 9 ).
  714. X
  715. XThis selection is ignored if
  716. Xthe current base is octal or
  717. Xbinary.
  718. X_INT _
  719. XInteger portion             ( I ).
  720. X
  721. XReturn the integer portion of the
  722. Xcurrent displayed value.
  723. X_X   _
  724. XMultiplication    ( * or x or X ).
  725. X
  726. XThis operation takes the last
  727. Xnumber and the next number
  728. Xentered, and performs an
  729. Xarithmetic multiplication on
  730. Xthem.
  731. X_XNOR_
  732. XLogical XNOR           ( n or N ).
  733. X
  734. XThis operation takes the last
  735. Xnumber and the next number
  736. Xentered, and performs a logical
  737. XXNOR operation on them, treating
  738. Xboth numbers as unsigned long
  739. Xintegers.
  740. X_XOR _
  741. XLogical XOR                 ( ^ ).
  742. X
  743. XThis operation takes the last
  744. Xnumber and the next number
  745. Xentered, and performs a logical
  746. XXOR operation on them, treating
  747. Xboth numbers as unsigned long
  748. Xintegers.
  749. X_INV _
  750. XInverse function flag       ( i ).
  751. X
  752. XThis button is a toggle for
  753. Xsetting or unsetting the
  754. Xinverse function flag. This
  755. Xflag affects SIN, COS and TAN
  756. Xtrigonometrical functions.
  757. X_COS _
  758. XCosine function           ( ^c ).
  759. X
  760. XReturns the trigonometric cosine,
  761. Xarc cosine, hyperbolic cosine or
  762. Xinverse hyperbolic cosine of
  763. Xthe current value, depending
  764. Xupon the settings of the
  765. XHYP and INV flags. The result
  766. Xis displayed in the current
  767. Xunits (degrees, radians or
  768. Xgradients).
  769. X_ln  _
  770. XNatural log                 ( N ).
  771. X
  772. XThis operation returns the
  773. Xnatural logarithm of the current
  774. Xdisplayed value.
  775. X_4   _
  776. XNumeric 4                   ( 4 ).
  777. X
  778. XThis selection is ignored if
  779. Xthe current base is binary.
  780. X_log _
  781. XBase 10 log                 ( G ).
  782. X
  783. XThis operation returns the base
  784. X10 logarithm of the current
  785. Xdisplayed value.
  786. X_5   _
  787. XNumeric 5                   ( 5 ).
  788. X
  789. XThis selection is ignored if
  790. Xthe current base is binary.
  791. X_SQRT_
  792. XSquare root                 ( S ).
  793. X
  794. XThis operation will perform a
  795. Xsquare root operation on the
  796. Xcurrent value of the calculator
  797. Xdisplay.
  798. X_6   _
  799. XNumeric 6                   ( 6 ).
  800. X
  801. XThis selection is ignored if
  802. Xthe current base is binary.
  803. X_FRAC_
  804. XFractional portion          ( F ).
  805. X
  806. XReturn the fractional portion of
  807. Xthe current displayed value.
  808. X_/   _
  809. XDivision                    ( / ).
  810. X
  811. XThis operation takes the last
  812. Xnumber and performs an
  813. Xarithemetic division by the
  814. Xnext number entered.
  815. X_NOT _
  816. XLogical NOT                 ( ~ ).
  817. X
  818. XThis operation will perform the
  819. Xlogical NOT operation of the
  820. Xcurrent value of the calculators
  821. Xdisplay.
  822. X_ACC _
  823. XAccuracy n                  ( A ).
  824. X
  825. XThis must be followed by a digit
  826. Xin the range 0 to 9 to indicate
  827. Xhow many digits of precision are
  828. Xto be displayed.
  829. X_EXP _
  830. XEnter exponental number     ( E ).
  831. X
  832. XThis operation starts exponential
  833. Xinput. Any numbers typed from now
  834. Xon are the exponent. If no
  835. Xnumerical input had occured upto
  836. Xthis point, then a mantissa of
  837. X1.0 is assumed.
  838. X_TAN _
  839. XTangent function           ( ^t ).
  840. XReturns the trigonometric tangent,
  841. Xarc tangent, hyperbolic tangent or
  842. Xinverse hyperbolic tangent of
  843. Xthe current value, depending
  844. Xupon the settings of the
  845. XHYP and INV flags. The result
  846. Xis displayed in the current
  847. Xunits (degrees, radians or
  848. Xgradients).
  849. X_1/x _
  850. XReciprocal                  ( R ).
  851. X
  852. XThe will return the current the
  853. Xvalue of 1 divided by the current
  854. Xdisplay value.
  855. X_1   _
  856. XNumeric 1                   ( 1 ).
  857. X_x!  _
  858. XFactorial                   ( ! ).
  859. X
  860. XThis will return the factorial of
  861. Xthe current displayed value.
  862. X_2   _
  863. XNumeric 2                   ( 2 ).
  864. X
  865. XThis selection is ignored if
  866. Xthe current base is binary.
  867. X_x^2 _
  868. XSquare                      ( @ ).
  869. X
  870. XThis will reurn the square of the
  871. Xcurrent displayed value.
  872. X_3   _
  873. XNumeric 3                   ( 3 ).
  874. X
  875. XThis selection is ignored if
  876. Xthe current base is binary.
  877. X_CHS _
  878. XChange sign                 ( C ).
  879. X
  880. XChange the arithmetic sign of the
  881. Xcurrent displayed value or the
  882. Xexponent being entered.
  883. X_-   _
  884. XSubtraction                 ( - ).
  885. X
  886. XThis operation takes the last
  887. Xnumber and performs an
  888. Xarithemetic subtraction of the
  889. Xnext number entered.
  890. X_QUIT_
  891. XQuit calctool          ( q or Q ).
  892. X
  893. XThe calctool program is exited,
  894. Xwithout user verification.
  895. X_OFF _
  896. XTurn calctool iconic        ( o ).
  897. X_KEYS_
  898. XToggle button labels        ( K ).
  899. X
  900. XToggle the labels on the calctool
  901. Xbuttons between the mouse and
  902. Xkeyboard equivalents.
  903. X_?   _
  904. XCalctool Help v2.4.         ( ? ).
  905. XAll calculations are in double
  906. Xprecision. The display can be
  907. Xused with the [Get] and [Put]
  908. Xfunction keys with other Sunview
  909. Xwindows. For every mouse
  910. Xselection, there is an equivalent
  911. Xkeystroke. These can be found by
  912. Xselecting the KEYS button.
  913. XIf an error condition occurs, you
  914. Xmust clear the calculator.
  915. XAfter this, when you select [?]
  916. Xyou will get help on the next
  917. Xselection you make.
  918. X_DEG _
  919. XTrig base to degrees       ( ^d ).
  920. X
  921. XChange the current trigonometrical
  922. Xbase to degrees.
  923. X_0   _
  924. XNumeric 0                   ( 0 ).
  925. X_RAD _
  926. XTrig base to radians       ( ^r ).
  927. X
  928. XChange the current trigonometrical
  929. Xbase to radians.
  930. X_.   _
  931. XNumeric point               ( . ).
  932. X
  933. XSelecting this starts the
  934. Xfractional part of numeric entry.
  935. X_GRAD_
  936. XTrig base to gradients     ( ^g ).
  937. X
  938. XChange the current trigonometrical
  939. Xbase to gradients.
  940. X_=   _
  941. XCalculate result  ( = or Return ).
  942. X
  943. XThe result of the current
  944. Xcalculation is displayed in
  945. Xthe current base.
  946. X_ABS _
  947. XAbsolute value.             ( U ).
  948. X
  949. XReturn the absolute value of the
  950. Xcurrent displayed value.
  951. X_+   _
  952. XAddition                    ( + ).
  953. XThis operation takes the last
  954. Xnumber and the next number
  955. Xentered, and performs an
  956. Xarithmetic addition on them.
  957. X______
  958. SHAR_EOF
  959. chmod 0444 calctool.help || echo "restore of calctool.help fails"
  960. set `wc -c calctool.help`;Sum=$1
  961. if test "$Sum" != "10856"
  962. then echo original size 10856, current size $Sum;fi
  963. echo "x - extracting calctool.1 (Text)"
  964. sed 's/^X//' << 'SHAR_EOF' > calctool.1 &&
  965. X.\" @(#)calctool.1 1.8 89/12/13
  966. X.TH CALCTOOL 1L "13 December 1989"
  967. X.SH NAME
  968. Xcalctool \- a simple calculator
  969. X.SH SYNOPSIS
  970. X.B "calctool
  971. X[
  972. X.B -a
  973. X.I accuracy
  974. X]
  975. X[
  976. X.B -d
  977. X.I display
  978. X]
  979. X[
  980. X.B -g
  981. X.I geometry
  982. X]
  983. X[
  984. X.B -h
  985. X.I helpfile
  986. X]
  987. X[
  988. X.B -i
  989. X]
  990. X[
  991. X.B -v
  992. X]
  993. X[
  994. X.B \-Wi
  995. X]
  996. X[
  997. X.B \-Wp
  998. X.I x y
  999. X]
  1000. X[
  1001. X.B \-WP
  1002. X.I x y
  1003. X]
  1004. X.SH DESCRIPTION
  1005. X.I Calctool
  1006. Xis a simple calculator. It contains graphical interfaces for MGR, NeWS,
  1007. XSunView, X11 and XView, as well as being able to function on normal display
  1008. Xterminals using a termcap interface. It can receive input via the keyboard,
  1009. Xor the mouse where applicable. Each calculator button has two functions
  1010. Xassociated with it.
  1011. X.LP
  1012. XInternal arithmetic is done with double precision floating point numbers.
  1013. XAccuracy can be adjusted from zero to nine numeric places in fixed notation,
  1014. Xbut numbers can be displayed in scientific notation as well. The calculator
  1015. Xreverts to scientific notation when the number is larger than the display
  1016. Xwould allow in fixed notation. The base of operation can be changed between
  1017. Xbinary, octal, decimal and hexidecimal.  Numbers are initially displayed in
  1018. Xfixed notation to two numeric places, in the decimal base.
  1019. X.LP
  1020. XYou can use the SunView / XView
  1021. X.I Put
  1022. Xand
  1023. X.I Get
  1024. Xfunction keys in conjunction with the numeric display to store or retrieve
  1025. Xcharacters from the text shelf. The previous digit entered can be removed
  1026. Xand the whole display cleared.
  1027. X.LP
  1028. XThere are ten memory registers; numbers can be retrieved or stored in
  1029. Xthese locations, and arithmetic can be performed upon register contents.
  1030. X.LP
  1031. XThe display windows contains the current numerical value plus the current
  1032. Xbase and trigonometric type. There are also indicators which show if the
  1033. Xhyperbolic and inverse function switches are set, and which numerical mode
  1034. Xis currently in operation. If an operation needing more than one numerical
  1035. Xinput is partially complete, the operation is also displayed in this window
  1036. Xas a reminder.
  1037. X.LP
  1038. XThe calculator has arithmetical, logical and trigonometrical functions.
  1039. XThese are grouped together and color coded on color workstations.
  1040. X.LP
  1041. XWith the SunView and XView versions, there is support for popup menus with
  1042. Xthe right mouse button. Only certain buttons which have multiple options
  1043. Xhave this ability. These are the ACC, CON, EXCH, FUN, <, >, RCL and STO keys.
  1044. X.LP
  1045. XOnline help is provided via a help button.  Select this button, and then
  1046. Xthe function you wish to be described. The calctool windows can be redrawn
  1047. Xby typing ^L (control-l). This is very useful with the tty version after
  1048. Xsomebody has written system messages all over your screen.
  1049. X.LP
  1050. XOn startup,
  1051. X.I calctool
  1052. Xwill look for a
  1053. X.I .calctoolrc
  1054. Xfile in the users' home directory. This file allows the user to define
  1055. Xtheir own constants and function definitions. It then looks for a
  1056. X.I .calctoolrc
  1057. Xfile in the current directory. With the
  1058. X.I .calctoolrc
  1059. Xfile, there are currently four valid record types; comments, constants,
  1060. Xfunction definitions and initial memory register values.
  1061. X.LP
  1062. XLines starting with a '#' are treated as comments and ignored.
  1063. X.LP
  1064. XLines starting with 'c' or 'C' in the first column are definitions for
  1065. Xconstants. The cC is followed by a digit in the range 0-9, then a space.
  1066. XThis is followed by a number in fixed or scientific notation. Following
  1067. Xthis is an optional comment, which if found, will be used in the popup
  1068. Xmenu for the constants. If the comment is present, then there must be at
  1069. Xleast one space between this and the preceding number.
  1070. X.LP
  1071. XLines starting with 'f' or 'F' in the first column are definitions
  1072. Xfor functions. The fF is followed by a digit in the range 0-9, then a
  1073. Xspace. This is followed by a function definition. Following this is an
  1074. Xoptional comment, which if found, will be used in the popup menu for the
  1075. Xfunctions. If the comment is present, then there must be at least one
  1076. Xspace between this and the preceding function definition.
  1077. X.LP
  1078. XLines starting with 'r' or 'R' in the first column are definitions
  1079. Xfor the initial contents of the memory registers. The rR is followed
  1080. Xby a digit in the range 0-9, then a space. This is followed by a number
  1081. Xin fixed or scientific notation. The rest of the line is ignored.
  1082. X.LP
  1083. XAll other lines are ignored. There should be no embedded spaces in the
  1084. Xfunction definitions. Whenever a backslash is found, this and the following
  1085. Xcharacter signify a control character, for example \\g would be ASCII 7.
  1086. X.SH OPTIONS
  1087. X.TP
  1088. X.BI \-a " accuracy"
  1089. XInitial number of significant digits displayed. This value must be in
  1090. Xthe range 0 to 9. If not specified, this value defaults to 2.
  1091. X.TP
  1092. X.BI \-d " display"
  1093. XUsed with the X11 variant of calctool to give a display type.
  1094. X.TP
  1095. X.BI \-g " geometry"
  1096. XUsed with the X11 variant of calctool to give geometry information.
  1097. X.TP
  1098. X.BI \-h " helpfile"
  1099. XUse an alternate helpfile.
  1100. X.TP
  1101. X.B \-i
  1102. XInvert the calctool window before displaying it. For use by people who
  1103. Xstarted their graphics environment in inverse mode.
  1104. X.TP
  1105. X.B \-v
  1106. XPrint the version number of this release of the
  1107. X.B calctool
  1108. Xprogram.
  1109. X.TP
  1110. X.B \-Wi
  1111. XStart the
  1112. X.B calctool
  1113. Xprogram up in iconic form. SunView automatically uses this flag, but the
  1114. XNeWS version will also.
  1115. X.TP
  1116. X.BI \-Wp " x y"
  1117. XStart the open window position at
  1118. X.I x y
  1119. X.TP
  1120. X.BI \-WP " x y"
  1121. XStart the icon position at
  1122. X.I x y
  1123. X.SH CALCULATOR BUTTONS
  1124. X[Keyboard equivalents appear in brackets]
  1125. X.SS "Numerical Keys [ 0-9 a-f . = <RETURN> ]."
  1126. X.LP
  1127. XEnter a digit (decimal digits 0-9 or hexidecimal digits A-F) in the display.
  1128. XThe . acts as the decimal point and = is used for completion of numerical
  1129. Xentry (<RETURN> can be also be used from the keyboard to terminate numerical
  1130. Xentry).
  1131. X.SS "Arithmetical Operations [ + - x X * / ]."
  1132. X.LP
  1133. XPerform an arithmetical operation using the previous entry and the next entry
  1134. Xas operands.  Addition, subtraction, multiplication and division are denoted
  1135. Xby the buttons +, \-, x and / respectively (the keyboard keys * and X are
  1136. Xsynonymous with x for multiplication).
  1137. X.SS Base Changes.
  1138. X.LP
  1139. X.IP "\fBBIN  [ B ]\fP" 18
  1140. XChange display base to binary (maximum: 32 digits).
  1141. X.IP "\fBOCT  [ O ]\fP" 18
  1142. XChange display base to octal (maximum: 15 digits). are allowed.
  1143. X.IP "\fBDEC  [ D ]\fP" 18
  1144. XChange display base to decimal (default; maximum: 12 digits).
  1145. X.IP "\fBHEX  [ H ]\fP" 18
  1146. XChange display base to hexidecimal (maximum: 12 digits).
  1147. X.SS Trigonometric Unit Changes.
  1148. X.LP
  1149. X.IP "\fBDEG  [ ^d ]\fP" 18
  1150. XChange current trigonometrical base to degrees.
  1151. X.IP "\fBRAD  [ ^r ]\fP" 18
  1152. XChange the current trigonometrical base to radians.
  1153. X.IP "\fBGRAD [ ^g ]\fP" 18
  1154. XChange the current trigonometrical base to gradients.
  1155. X.SS Logical Operations.
  1156. X.LP
  1157. X.IP "\fBAND  [ & ]\fP" 18
  1158. XPerform a logical AND operation on the current entry and the next entry,
  1159. Xtreating both numbers as unsigned long integers.
  1160. X.IP "\fBNOT  [ ~ ]\fP" 18
  1161. XPerform the logical NOT operation of the current entry.
  1162. X.IP "\fBOR   [ | ]\fP" 18
  1163. XPerform a logical OR operation on the current entry and the next entry,
  1164. Xtreating both numbers as unsigned long integers.
  1165. X.IP "\fBXNOR [ n or N ]\fP" 18
  1166. XPerform a logical XNOR operation on the current entry and the next entry,
  1167. Xtreating both numbers as unsigned long integers.
  1168. X.IP "\fBXOR  [ ^ ]\fP" 18
  1169. XPerform a logical XOR operation on the current entry and the next entry,
  1170. Xtreating both numbers as unsigned long integers.
  1171. X.SS Trigonometrical Operators.
  1172. X.LP
  1173. X.IP "\fBSIN [ ^s ]\fP" 18
  1174. XReturn the trigonometric sine, arc sine hyperbolic sine or inverse
  1175. Xhyperbolic sine of the current display, depending upon the current
  1176. Xsettings of the hyperbolic and inverse function switches. The result
  1177. Xis displayed in the current trigonometric units (degrees, radians or
  1178. Xgradients).
  1179. X.IP "\fBCOS  [ ^c ]\fP" 18
  1180. XReturn the trigonometric cosine, arc cosine hyperbolic cosine or inverse
  1181. Xhyperbolic cosine of the current display, depending upon the current
  1182. Xsettings of the hyperbolic and inverse function switches. The result
  1183. Xis displayed in the current trigonometric units (degrees, radians or
  1184. Xgradients).
  1185. X.IP "\fBTAN  [ ^t ]\fP" 18
  1186. XReturn the trigonometric tangent, arc tangent hyperbolic tangent or inverse
  1187. Xhyperbolic tangent of the current display, depending upon the current
  1188. Xsettings of the hyperbolic and inverse function switches. The result
  1189. Xis displayed in the current trigonometric units (degrees, radians or
  1190. Xgradients).
  1191. X.SS Memory Register Operators.
  1192. X.LP
  1193. X.IP "\fBRCL  [ r ]\fP" 18
  1194. XRetrieve memory register n.  This selection must be followed by a digit
  1195. Xin the range 0 to 9 to indicate a memory register.
  1196. X.IP "\fBSTO  [ s ]\fP" 18
  1197. XStore memory register n.  This must be followed by a digit in the range
  1198. X0 to 9 to indicate a memory register.  The register number may be preceded
  1199. Xby an arithmetic operation (addition, subtraction, multiplication or division),
  1200. Xin which case the specifed operation is carred out between the
  1201. Xdisplayed entry and the value currently in register n, and the result is placed
  1202. Xin register n.
  1203. X.IP "\fBEXCH [ ^e ]\fP" 18
  1204. XExchange the current display with the contents of memory register n.
  1205. XThis selection must be followed by a digit in the range 0 to 9, to
  1206. Xindicate a memory register.
  1207. X.SS Mathematical Operators.
  1208. X.LP
  1209. X.IP "\fB%    [ % ]\fP" 18
  1210. XPerform a percentage calculation using the last entry and the next entry.
  1211. X.IP "\fBe^x  [ { ]\fP" 18
  1212. XReturn e raised to the power of the current entry.
  1213. X.IP "\fB10^x [ } ]\fP" 18
  1214. XReturn 10 raised to the power of the current entry.
  1215. X.IP "\fBy^x  [ Y ]\fP" 18
  1216. XTake the last entry and raise it to the power of the next entry.
  1217. X.IP "\fBln   [ N ]\fP" 18
  1218. XReturn the natural logarithm of the current entry.
  1219. X.IP "\fBlog  [ G ]\fP" 18
  1220. XReturns the base 10 logarithm of the current entry.
  1221. X.IP "\fBSQRT [ S ]\fP" 18
  1222. XPerform a square root operation on the current entry.
  1223. X.IP "\fB1/x  [ R ]\fP" 18
  1224. XReturn the value of 1 divided by the current entry.
  1225. X.IP "\fBx!   [ ! ]\fP" 18
  1226. XReturn the factorial of the current entry.
  1227. X.IP "\fBx^2  [ @ ]\fP" 18
  1228. XReturn the square of the current entry.
  1229. X.SS Number Manipulation Operators.
  1230. X.LP
  1231. X.IP "\fB<    [ < ]\fP" 18
  1232. XLeft shift n places. This must be followed by a digit
  1233. Xin the range 0 to 9 to indicate the number of places to shift.
  1234. X.IP "\fB>    [ > ]\fP" 18
  1235. XRight shift n places. This must be followed by a digit
  1236. Xin the range 0 to 9 to indicate the number of places to shift.
  1237. X.IP "\fB&32  [ [ ]\fP" 18
  1238. XTruncate the current entry to a 32 bit unsigned integer
  1239. X(logical function).
  1240. X.IP "\fB&16  [ ] ]\fP" 18
  1241. XTruncate the given number to a 16 bit unsigned integer
  1242. X(logical function).
  1243. X.IP "\fBclr  [ Delete ]\fP" 18
  1244. XClear the calculator display.
  1245. X.IP "\fBbsp  [ BackSpace ]\fP" 18
  1246. XRemove the rightmost character of the current entry
  1247. Xand recalculate the the displayed value (note: internal accuracy is
  1248. Xlost with this operation).
  1249. X.IP "\fBINT  [ I ]\fP" 18
  1250. XReturn the integer portion of the current entry.
  1251. X.IP "\fBFRAC [ F ]\fP" 18
  1252. XReturn the fractional portion of the current entry.
  1253. X.IP "\fBACC  [ A ]\fP" 18
  1254. XSet accuracy. This must be followed by a digit in the range 0 to 9 to
  1255. Xindicate how many digits are to be displayed.
  1256. X.IP "\fBCHS  [ C ]\fP" 18
  1257. XChange the arithmetic sign of the current entry.
  1258. X.IP "\fBABS  [ U ]\fP" 18
  1259. XReturn the absolute value of the current entry.
  1260. X.SS Other keys.
  1261. X.LP
  1262. X.IP "\fBMEM  [ M ]\fP" 18
  1263. XToggle the display of the popup register window.
  1264. XValues of the ten memory registers are displayed in the current
  1265. Xbase, to the current accuracy.
  1266. X.IP "\fBFIX / SCI  [ ^n ]\fP" 18
  1267. XToggles the numerical display mode between fixed point and scientific
  1268. Xnotation. This affects the current display and the contents of the
  1269. Xmemory registers.
  1270. X.IP "\fBCON  [ # ]\fP" 18
  1271. XRetrieve and display constant value n. This selection must be followed
  1272. Xby a digit in the range 0 to 9.
  1273. X.br
  1274. XThe ten default constants are:
  1275. X.sp
  1276. X0 - kms per hour / miles per hour.
  1277. X.br
  1278. X1 - square root of 2.
  1279. X.br
  1280. X2 - e.
  1281. X.br
  1282. X3 - pi.
  1283. X.br
  1284. X4 - cms / inches.
  1285. X.br
  1286. X5 - degrees in a radian.
  1287. X.br
  1288. X4 - 2 ^ 20.
  1289. X.br
  1290. X6 - gms / oz.
  1291. X.br
  1292. X8 - kilojoules / British thermals.
  1293. X.br
  1294. X9 - cubic cms / cubic inches.
  1295. X.IP "\fBHYP  [ h ]\fP" 18
  1296. XSet or unset the hyperbolic function indicator. This switch affects the
  1297. Xtype of sine, cosine and tangent trigonometric functions performed.
  1298. X.IP "\fBINV  [ i ]\fP" 18
  1299. XSet or unset the inverse function indicator. This switch affects the
  1300. Xtype of sine, cosine and tangent trigonometric functions performed.
  1301. X.IP "\fBKEYS [ K ]\fP" 18
  1302. XToggle the labels on the calctool buttons between mouse and
  1303. Xkeyboard equivalents.
  1304. X.IP "\fB?    [ ? ]\fP" 18
  1305. XDisplay a help message for a particular button.  First select this key, then
  1306. Xthe key to be described.
  1307. X.IP "\fBQUIT [q or Q]\fP" 18
  1308. XExit (without user verification).
  1309. X.IP "\fBOFF  [ o ]\fP" 18
  1310. XChange \fIcalctool\fP to an icon.
  1311. X.SH FILES
  1312. X.TP
  1313. X/usr/local/lib/calctool.help
  1314. X.TP
  1315. X/usr/local/lib/calctool.ps
  1316. X.TP
  1317. X~/.calctoolrc
  1318. X.SH BUGS
  1319. XHandling of errors generated by the mathematical routines is poorly
  1320. Xdone.
  1321. X.SH AUTHOR
  1322. XRich Burridge,        Domain: richb@sunaus.oz.au
  1323. X.nf
  1324. XPHONE: +61 2 413 2666   Path: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
  1325. X.fi
  1326. X.br
  1327. XOriginal manual page modified by R. P. C. Rodgers, UCSF School of Pharmacy, San
  1328. XFrancisco, CA 94143.
  1329. SHAR_EOF
  1330. chmod 0444 calctool.1 || echo "restore of calctool.1 fails"
  1331. set `wc -c calctool.1`;Sum=$1
  1332. if test "$Sum" != "12952"
  1333. then echo original size 12952, current size $Sum;fi
  1334. echo "x - extracting calctool.ps (Text)"
  1335. sed 's/^X//' << 'SHAR_EOF' > calctool.ps &&
  1336. X
  1337. X%  These are the NeWS dependent graphics routines used by calctool.
  1338. X%  They make use of the tnt toolkit distributed with OpenWindows.
  1339. X%
  1340. X%  Copyright (c) Rich Burridge - Sun Microsystems, Australia.
  1341. X%                                All rights reserved.
  1342. X%
  1343. X%  @(#)calctool.ps 1.5 89/12/21
  1344. X%
  1345. X%  Permission is given to distribute these sources, as long as the
  1346. X%  copyright messages are not removed, and no monies are exchanged.
  1347. X%
  1348. X%  No responsibility is taken for any errors or inaccuracies inherent
  1349. X%  either to the comments or the code of this program, but if
  1350. X%  reported to me then an attempt will be made to fix them.
  1351. X%
  1352. X
  1353. X%  Define a class for the main calctool window. The following events
  1354. X%  are handled:
  1355. X%
  1356. X%  Left mouse button (down and up).
  1357. X%  Middle mouse button (down and up).
  1358. X%  Right mouse button (down and up).
  1359. X%  Keyboard press.
  1360. X%  Window damage.
  1361. X%
  1362. X%  For each of these events, an appropriate tag is sent back to the C code.
  1363. X
  1364. X/KeyClass ClassCanvas []
  1365. Xclassbegin
  1366. X  /PaintCanvas
  1367. X  {
  1368. X    CFRAME_REPAINT typedprint
  1369. X  } def
  1370. X
  1371. X  /MakeInterests
  1372. X  {
  1373. X    /MakeInterests super send
  1374. X    LeftMouseButton   {LEFT_DOWN SendEvent}   /DownTransition self MakeInterest
  1375. X    MiddleMouseButton {MIDDLE_DOWN SendEvent} /DownTransition self MakeInterest
  1376. X    LeftMouseButton   {LEFT_UP SendEvent}     /UpTransition   self MakeInterest
  1377. X    MiddleMouseButton {MIDDLE_UP SendEvent}   /UpTransition   self MakeInterest
  1378. X    {KbdEvent} Canvas /defaultkeys ClassKeysInterest send
  1379. X  } def
  1380. Xclassend def
  1381. X
  1382. X
  1383. X%  Define a class for the memory register window.
  1384. X%  Handle window damage in the same way as the main calctool window.
  1385. X
  1386. X/RegClass ClassCanvas []
  1387. Xclassbegin
  1388. X  /PaintCanvas
  1389. X  {
  1390. X    RFRAME_REPAINT typedprint
  1391. X  } def
  1392. Xclassend def
  1393. X
  1394. X
  1395. X%  Clear the whole of either the main calctool canvas or the memory
  1396. X%  register canvas to a specific color.
  1397. X
  1398. X/PSClearCanvas      % color canvas => -
  1399. X{
  1400. X  dup setcanvas
  1401. X  ColorTable 3 -1 roll get
  1402. X  /fillcanvas 3 -1 roll send
  1403. X} def
  1404. X
  1405. X
  1406. X%  Close the main calctool window and unmap the memory register window.
  1407. X
  1408. X/PSCloseFrame      % - => -
  1409. X{
  1410. X  /flipiconic KFrame send
  1411. X  /unmap RFrame send
  1412. X} def
  1413. X
  1414. X
  1415. X%  Color a rectangular area in the main calctool window.
  1416. X
  1417. X/PSColorArea    % color x width height y => -
  1418. X{
  1419. X  KC setcanvas
  1420. X  KCHeight exch sub exch dup 3 1 roll sub 3 1 roll rectpath
  1421. X  ColorTable exch get setcolor
  1422. X  fill
  1423. X} def
  1424. X
  1425. X
  1426. X%  Draw a line in the main calctool window.
  1427. X
  1428. X/PSDrawLine           % x1 x2 y1 y2 => -
  1429. X{
  1430. X  KCHeight exch sub
  1431. X  exch KCHeight exch sub 3 1 roll
  1432. X  KC setcanvas
  1433. X  newpath
  1434. X    moveto lineto
  1435. X    0 setgray
  1436. X  stroke
  1437. X} def
  1438. X
  1439. X
  1440. X%  Draw (map) the memory register window.
  1441. X
  1442. X/PSDrawRegs
  1443. X{
  1444. X  /map RFrame send
  1445. X} def
  1446. X
  1447. X
  1448. X%  Load the small, normal and bold fonts used by calctool.
  1449. X
  1450. X/PSInitFonts     % - => -
  1451. X{
  1452. X  /SFont /Courier findfont 10 scalefont def
  1453. X  /NFont /Courier-Bold findfont 14 scalefont def
  1454. X  /BFont /Courier-Bold findfont 18 scalefont def
  1455. X} def
  1456. X
  1457. X
  1458. X%  Set up the various tags that are passed back to the C code.
  1459. X%  Note that at present, some of these tags are not used.
  1460. X
  1461. X/PSInitialise   % - => -
  1462. X{
  1463. X  /CFRAME_REPAINT  100 def
  1464. X  /RFRAME_REPAINT  101 def
  1465. X  /ENTER_WINDOW    102 def
  1466. X  /EXIT_WINDOW     103 def
  1467. X  /KEYBOARD        104 def
  1468. X  /LEFT_DOWN       105 def
  1469. X  /LEFT_UP         106 def
  1470. X  /MIDDLE_DOWN     107 def
  1471. X  /MIDDLE_UP       108 def
  1472. X  /RIGHT_DOWN      109 def
  1473. X  /RIGHT_UP        110 def
  1474. X  /TAKE_FROM_SHELF 111 def
  1475. X  /PUT_ON_SHELF    112 def
  1476. X} def
  1477. X
  1478. X
  1479. X%  Test if calctool is running on a color framebuffer.
  1480. X
  1481. X/PSIsColor      % - => iscolorscreen
  1482. X{
  1483. X  /Color? framebuffer /Color get def
  1484. X  Color? {1} {0} ifelse typedprint
  1485. X} def
  1486. X
  1487. X
  1488. X%  Load a red green blue triplet into the appropriate entry in the colortable.
  1489. X
  1490. X/PSLoadColor       % index blue green red => -
  1491. X{
  1492. X  255 div
  1493. X  exch 255 div
  1494. X  3 -1 roll 255 div
  1495. X  rgbcolor
  1496. X  ColorTable 3 1 roll put
  1497. X} def
  1498. X
  1499. X
  1500. X%  Create an array big enough for all the colors used by calctool.
  1501. X
  1502. X/PSMakeColorTable  % size => -
  1503. X{
  1504. X  /ColorTable exch array def
  1505. X} def
  1506. X
  1507. X
  1508. X/KbdEvent
  1509. X{
  1510. X  begin
  1511. X    Action /DownTransition eq
  1512. X      {
  1513. X        KEYBOARD typedprint Name SendEvent
  1514. X      } if
  1515. X  end
  1516. X} def
  1517. X
  1518. X
  1519. X/SendEvent
  1520. X{
  1521. X  KC setcanvas
  1522. X  typedprint
  1523. X  currentcursorlocation KCHeight exch sub exch
  1524. X  typedprint typedprint
  1525. X} def
  1526. X
  1527. X
  1528. X/PaintIcon 
  1529. X{
  1530. X  clippath pathbbox
  1531. X  scale pop pop
  1532. X  0 setgray
  1533. X  false calctoolIcon imagemaskcanvas
  1534. X} def
  1535. X
  1536. X%  Create the main calctool frame and the memory registers property sheet.
  1537. X%  Set the size of these items, and place the open frame and icon at the
  1538. SHAR_EOF
  1539. echo "End of part 1"
  1540. echo "File calctool.ps is continued in part 2"
  1541. echo "2" > s2_seq_.tmp
  1542. exit 0
  1543.  
  1544.