home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8803 / calctool2.1 / 2 < prev    next >
Encoding:
Text File  |  1990-07-13  |  25.9 KB  |  905 lines

  1. Path: uunet!munnari!basser!richb
  2. From: richb@sunaus.sun.oz.AU
  3. Newsgroups: comp.sources.misc
  4. Subject: Calctool v2.1 - a Sun calculator. Part 2 of 2.
  5. Message-ID: <1193@basser.oz>
  6. Date: 22 Feb 88 11:57:43 GMT
  7. Sender: john@basser.oz
  8. Lines: 894
  9. Approved: john@basser.cs.su.oz.AU
  10.  
  11. This is V2.1 of a desktop calculator for the Sun workstation.
  12. Currently this version works under SunView, but NeWS and X.11 versions
  13. will be coming soon.
  14.  
  15. Rich Burridge,           JANET richb%sunaus.oz@uk.ac.ucl.cs
  16. ACSnet  richb@sunaus.oz  UUCP {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
  17. PHONE: +61 2 436 4699    ARPAnet rburridge@Sun.COM
  18. Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.
  19.  
  20. ------CUT HERE------CUT HERE------
  21. #! /bin/sh
  22. # this is a shell archive, meaning:
  23. # 1. Remove everything above the #! /bin/sh line
  24. # 2. Save the resulting text in a file.
  25. # 3. Execute the file with /bin/sh to create the files:
  26. #   calctool.h
  27. #   color.h
  28. #   button.icon
  29. #   calctool.icon
  30. #   help.cursor
  31. #   Makefile
  32. #   README
  33. #   calctool.help
  34. #   patchlevel.h
  35. # This archive created: Fri Feb 19 19:00:00 EST 1988
  36. #
  37. #
  38. export PATH; PATH=/bin:$PATH
  39. #
  40. if [ -f calctool.h ]
  41. then
  42. echo shar: will not over-write existing file calctool.h
  43. else
  44. echo shar: extracting 'calctool.h',     3692 characters
  45. cat > calctool.h <<'Funky_Stuff'
  46.  
  47. /*  calctool.h
  48.  *
  49.  *  This files contains all the global definitions used by the calctool
  50.  *  calculator program.
  51.  *
  52.  *  Copyright (c) Rich Burridge - February 1988.
  53.  *                Sun Microsystems, Australia - All rights reserved.
  54.  *
  55.  *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
  56.  *
  57.  *  Includes ideas and code from:
  58.  *                Rich Baughman, Consumer Financial Institute, Newton, MA
  59.  *
  60.  *  Version 2.1.
  61.  *
  62.  *  No responsibility is taken for any errors or inaccuracies inherent
  63.  *  either to the comments or the code of this program, but if
  64.  *  reported to me then an attempt will be made to fix them.
  65.  */
  66.  
  67. #include <stdio.h>
  68. #include <strings.h>
  69. #include <ctype.h>
  70. #include <math.h>
  71.  
  72. char *sprintf() ;
  73.  
  74. #define  CLOSE          (void) close      /* To make lint happy. */
  75. #define  FCLOSE         (void) fclose
  76. #define  FGETS          (void) fgets
  77. #define  FPRINTF        (void) fprintf
  78. #define  IOCTL          (void) ioctl
  79. #define  READ           (void) read
  80. #define  SPRINTF        (void) sprintf
  81. #define  SSCANF         (void) sscanf
  82. #define  STRCAT         (void) strcat
  83. #define  STRCPY         (void) strcpy
  84. #define  STRNCAT        (void) strncat
  85. #define  STRNCPY        (void) strncpy
  86. #define  WRITE          (void) write
  87.  
  88. #define  SMALLFONT      "/usr/lib/fonts/fixedwidthfonts/screen.r.7"
  89. #define  NORMALFONT     "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  90. #define  BIGFONT        "/usr/lib/fonts/fixedwidthfonts/gallant.r.19"
  91.  
  92. #define  HELPCURSOR     0                /* Cursor types. */
  93. #define  MAINCURSOR     1
  94.  
  95. #define  BIN            0                /* Base definitions. */
  96. #define  OCT            1
  97. #define  DEC            2
  98. #define  HEX            3
  99.  
  100. #define  DEG            0                /* Trigonometric types. */
  101. #define  GRAD           1
  102. #define  RAD            2
  103.  
  104. #define  OP_SET         1                /* Operation text item settings. */
  105. #define  OP_CLEAR       2
  106. #define  OP_NOP         3
  107.  
  108. #define  BBORDER        10               /* No of pixels in border. */
  109. #define  BCOLS          6                /* No of columns of buttons. */
  110. #define  BGAP           5                /* No of pixels between buttons. */
  111. #define  BHEIGHT        52               /* Number of pixels for height. */
  112. #define  BROWS          6                /* No of rows of buttons. */
  113. #define  BWIDTH         44               /* No of pixels for width. */
  114.  
  115. #define  CTRL(n)        n - 96           /* Generate control character value. */
  116. #define  DISPLAY        30               /* Calculators numerical display. */
  117.  
  118. #define  EQUAL          !strcmp          /* For character comparisons. */
  119. #define  EXTRA          4                /* Extra useful character definitions. */
  120. #define  HELPNAME       "calctool.help"
  121. #define  MAX_DIGITS     32               /* Maximum displayable number of digits. */
  122. #define  MAXLINE        80               /* Length of character strings. */
  123. #define  MAXREGS        10               /* Maximum number of memory registers. */
  124. #define  MIN(x,y)       ((x) < (y) ? (x) : (y))
  125. #define  NOBUTTONS      BROWS * BCOLS
  126. #define  THEIGHT        (BROWS*BHEIGHT) + ((BROWS-1) * BGAP) + (2*BBORDER)
  127. #define  TITEMS         NOBUTTONS*2 + EXTRA    /* Total definitions. */
  128. #define  TWIDTH         (BCOLS*BWIDTH) + ((BCOLS-1) * BGAP) + (2*BBORDER)
  129.  
  130. typedef  unsigned long  BOOLEAN ;
  131.  
  132. struct button {
  133.          char *str ;          /* Button display string. */
  134.          char value ;         /* Unique button keyboard equivalent. */
  135.          char opdisp ;        /* Display operation code during operation. */
  136.          char color ;         /* Color of button portion. */
  137.          int  (*func)() ;     /* Function to obey on button press. */
  138. } ;
  139. Funky_Stuff
  140. len=`wc -c < calctool.h`
  141. if [ $len !=     3692 ] ; then
  142. echo error: calctool.h was $len bytes long, should have been     3692
  143. fi
  144. fi # end of overwriting check
  145. if [ -f color.h ]
  146. then
  147. echo shar: will not over-write existing file color.h
  148. else
  149. echo shar: extracting 'color.h',     2284 characters
  150. cat > color.h <<'Funky_Stuff'
  151.  
  152. /*  color.h
  153.  *
  154.  *  Colormap definitions used by the calctool calculator program.
  155.  *
  156.  *  Copyright (c) Rich Burridge - February 1988.
  157.  *               Sun Microsystems, Australia - All rights reserved.
  158.  *
  159.  *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
  160.  *
  161.  *  Includes ideas and code from:
  162.  *                Rich Baughman, Consumer Financial Institute, Newton, MA
  163.  *
  164.  *  Version 2.1.
  165.  *
  166.  *  No responsibility is taken for any errors or inaccuracies inherent
  167.  *  either to the comments or the code of this program, but if
  168.  *  reported to me then an attempt will be made to fix them.
  169.  */
  170.  
  171. #define  CALC_COLOR      "calcolor"
  172. #define  CALC_COLORSIZE  16
  173.  
  174. #define  WHITE    0
  175. #define  RED      1
  176. #define  ORANGE   2
  177. #define  YELLOW   3
  178. #define  LGREEN   4
  179. #define  BLUE     5
  180. #define  MAUVE    6
  181. #define  GREEN    7
  182. #define  PINK     8
  183. #define  LBLUE    9
  184. #define  GREY     10
  185. #define  LGREY    11
  186. #define  LPURPLE  12
  187. #define  BLACK    13
  188. #define  SPARE14  14
  189. #define  SPARE15  15
  190.  
  191. #define calc_colorsetup(r,g,b) \
  192.         (r)[WHITE] = 255 ;       (g)[WHITE] = 255 ;       (b)[WHITE] = 255 ; \
  193.         (r)[RED] = 255 ;         (g)[RED] = 50 ;          (b)[RED] = 0 ; \
  194.         (r)[ORANGE] = 255 ;      (g)[ORANGE] = 128 ;      (b)[ORANGE] = 0 ; \
  195.         (r)[YELLOW] = 255 ;      (g)[YELLOW] = 255 ;      (b)[YELLOW] = 0 ; \
  196.         (r)[LGREEN] = 128 ;      (g)[LGREEN] = 255 ;      (b)[LGREEN] = 128 ; \
  197.         (r)[BLUE] = 50 ;         (g)[BLUE] = 128 ;        (b)[BLUE] = 255 ; \
  198.         (r)[MAUVE] = 128 ;       (g)[MAUVE] = 128 ;       (b)[MAUVE] = 255 ; \
  199.         (r)[GREEN] = 0 ;         (g)[GREEN] = 158 ;       (b)[GREEN] = 158 ; \
  200.         (r)[PINK] = 255 ;        (g)[PINK] = 192 ;        (b)[PINK] = 192 ; \
  201.         (r)[LBLUE] = 50 ;        (g)[LBLUE] = 178 ;       (b)[LBLUE] = 255 ; \
  202.         (r)[GREY] = 128 ;        (g)[GREY] = 128 ;        (b)[GREY] = 128 ; \
  203.         (r)[LGREY] = 200 ;       (g)[LGREY] = 200 ;       (b)[LGREY] = 200 ; \
  204.         (r)[LPURPLE] = 225 ;     (g)[LPURPLE] = 225 ;     (b)[LPURPLE] = 255 ; \
  205.         (r)[BLACK] = 0 ;         (g)[BLACK] = 0 ;         (b)[BLACK] = 0 ; \
  206.         (r)[SPARE14] = 0 ;       (g)[SPARE14] = 0 ;       (b)[SPARE14] = 0 ; \
  207.         (r)[SPARE15] = 0 ;       (g)[SPARE15] = 0 ;       (b)[SPARE15] = 0 ;
  208. Funky_Stuff
  209. len=`wc -c < color.h`
  210. if [ $len !=     2284 ] ; then
  211. echo error: color.h was $len bytes long, should have been     2284
  212. fi
  213. fi # end of overwriting check
  214. if [ -f button.icon ]
  215. then
  216. echo shar: will not over-write existing file button.icon
  217. else
  218. echo shar: extracting 'button.icon',     1933 characters
  219. cat > button.icon <<'Funky_Stuff'
  220. /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  221.  */
  222.     0xFFFF,0xFFFF,0xFFF0,0x0000,0x8000,0x0000,0x0010,0x0000,
  223.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  224.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  225.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  226.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  227.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  228.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  229.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  230.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  231.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  232.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  233.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  234.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  235.     0x87FF,0xFFFF,0xFE10,0x0000,0x8400,0x0000,0x0210,0x0000,
  236.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  237.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  238.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  239.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  240.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  241.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  242.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  243.     0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
  244.     0x85FF,0xFFFF,0xFA10,0x0000,0x8400,0x0000,0x0210,0x0000,
  245.     0x87FF,0xFFFF,0xFE10,0x0000,0x8000,0x0000,0x0010,0x0000,
  246.     0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
  247.     0x8000,0x0000,0x0010,0x0000,0xFFFF,0xFFFF,0xFFF0,0x0000,
  248.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  249.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  250.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  251.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  252.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  253.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
  254. Funky_Stuff
  255. len=`wc -c < button.icon`
  256. if [ $len !=     1933 ] ; then
  257. echo error: button.icon was $len bytes long, should have been     1933
  258. fi
  259. fi # end of overwriting check
  260. if [ -f calctool.icon ]
  261. then
  262. echo shar: will not over-write existing file calctool.icon
  263. else
  264. echo shar: extracting 'calctool.icon',     1933 characters
  265. cat > calctool.icon <<'Funky_Stuff'
  266. /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  267.  */
  268.     0x1555,0x5555,0x5540,0x0000,0x2AAA,0xAAAA,0xAA80,0x0000,
  269.     0x5555,0x5555,0x5540,0x0000,0xFFFF,0xFFFF,0xFE80,0x0000,
  270.     0x8000,0x0000,0x0340,0x0000,0xBFFF,0xFFFF,0xFA80,0x0000,
  271.     0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
  272.     0xA003,0x0030,0xCB40,0x0000,0xA004,0x8049,0x2A80,0x0000,
  273.     0xA005,0x8059,0x6B40,0x0000,0xA006,0x8069,0xAA80,0x0000,
  274.     0xA004,0x8449,0x2B40,0x0000,0xA003,0x0430,0xCA80,0x0000,
  275.     0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
  276.     0xBFFF,0xFFFF,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
  277.     0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
  278.     0xA050,0x2814,0x0B40,0x0000,0xAF53,0x2994,0x0A80,0x0000,
  279.     0xA154,0xAA55,0x1340,0x0000,0xA253,0x2A54,0xAA80,0x0000,
  280.     0xA254,0xA9D4,0x4B40,0x0000,0xA454,0xA854,0xAA80,0x0000,
  281.     0xA453,0x2995,0x1B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
  282.     0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
  283.     0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
  284.     0xA257,0xA994,0x2B40,0x0000,0xA654,0x2A14,0x4A80,0x0000,
  285.     0xAA57,0x2B94,0x4B40,0x0000,0xAF50,0xAA54,0x8A80,0x0000,
  286.     0xA254,0xAA54,0x8B40,0x0000,0xA253,0x2995,0x0A80,0x0000,
  287.     0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
  288.     0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
  289.     0xA050,0x2814,0x0B40,0x0000,0xA253,0x2994,0x0A80,0x0000,
  290.     0xA654,0xAA54,0x0B40,0x0000,0xA250,0xA895,0xEA80,0x0000,
  291.     0xA253,0x2854,0x0B40,0x0000,0xA254,0x2A54,0x0A80,0x0000,
  292.     0xA757,0xA994,0x0B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
  293.     0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
  294.     0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
  295.     0xA650,0x2814,0x0B40,0x0000,0xA950,0x2814,0x4A80,0x0000,
  296.     0xAB50,0x2BD4,0x4B40,0x0000,0xAD50,0x2815,0xFA80,0x0000,
  297.     0xA951,0x2BD4,0x4B40,0x0000,0xA651,0x2814,0x4A80,0x0000,
  298.     0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
  299.     0x8000,0x0000,0x0300,0x0000,0xFFFF,0xFFFF,0xFE00,0x0000
  300. Funky_Stuff
  301. len=`wc -c < calctool.icon`
  302. if [ $len !=     1933 ] ; then
  303. echo error: calctool.icon was $len bytes long, should have been     1933
  304. fi
  305. fi # end of overwriting check
  306. if [ -f help.cursor ]
  307. then
  308. echo shar: will not over-write existing file help.cursor
  309. else
  310. echo shar: extracting 'help.cursor',      193 characters
  311. cat > help.cursor <<'Funky_Stuff'
  312. /* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  313.  */
  314.     0x0000,0x03C0,0x07E0,0x0E70,0x0830,0x0030,0x0030,0x0060,
  315.     0x00C0,0x0180,0x0300,0x0300,0x0000,0x0000,0x0300,0x0300
  316. Funky_Stuff
  317. len=`wc -c < help.cursor`
  318. if [ $len !=      193 ] ; then
  319. echo error: help.cursor was $len bytes long, should have been      193
  320. fi
  321. fi # end of overwriting check
  322. if [ -f Makefile ]
  323. then
  324. echo shar: will not over-write existing file Makefile
  325. else
  326. echo shar: extracting 'Makefile',     1300 characters
  327. cat > Makefile <<'Funky_Stuff'
  328. #
  329. #  Makefile for calctool, a calculator program.
  330. #
  331. #  Copyright (c) Rich Burridge - February 1988.
  332. #                Sun Microsystems, Australia - All rights reserved.
  333. #
  334. #  Includes code and ideas from:
  335. #                Rich Baughman, Consumer Financial Institute, Newton, MA
  336. #
  337. #  Version 2.1.
  338. #
  339. #  No responsibility is taken for any errors inherent either in the comments
  340. #  or the code of this program, but if reported to me then an attempt will
  341. #  be made to fix them.
  342. #
  343.  
  344. BINARIES        = calctool
  345. BINDIR          = .
  346. CFLAGS          = -O
  347. HEADERS         = calctool.h color.h
  348. OBJS            = calctool.o functions.o sunview.o
  349. OTHERS          = Makefile README calctool.help patchlevel.h
  350. SRCS            = calctool.c functions.c sunview.c
  351. IMAGES          = button.icon calctool.icon help.cursor
  352. LIBS            = -lm -lsuntool -lsunwindow -lpixrect
  353.  
  354. all:            $(BINARIES)
  355.  
  356. install:        $(BINARIES)
  357.         strip $(BINARIES)
  358.         -mv $(BINARIES) $(BINDIR)
  359.  
  360. clean:
  361.         rm -f *.o core
  362.  
  363. lint:
  364.         lint $(SRCS) $(LIBS)
  365.  
  366. shar:
  367.         shar.sh $(SRCS) > archive.1
  368.         shar.sh $(HEADERS) $(IMAGES) $(OTHERS) > archive.2
  369.  
  370. calctool:       $(OBJS)
  371.         cc -o calctool $(OBJS) $(LIBS)
  372.  
  373. calctool.o:     calctool.c $(HEADERS) patchlevel.h
  374. functions.o:    functions.c $(HEADERS)
  375. sunview.o:      sunview.c $(HEADERS) $(IMAGES)
  376. Funky_Stuff
  377. len=`wc -c < Makefile`
  378. if [ $len !=     1300 ] ; then
  379. echo error: Makefile was $len bytes long, should have been     1300
  380. fi
  381. fi # end of overwriting check
  382. if [ -f README ]
  383. then
  384. echo shar: will not over-write existing file README
  385. else
  386. echo shar: extracting 'README',     1018 characters
  387. cat > README <<'Funky_Stuff'
  388.  
  389. calctool  -  README  -  19th February 1988.
  390.  
  391. This is V2.1 of a desktop calculator for the Sun workstation.
  392. Currently this version works under SunView, but NeWS and X.11 versions
  393. will be coming soon.
  394.  
  395. This is a complete rehash from the v1.x series, and now includes
  396. many more mathematical and trigonometrical functions. Memory register
  397. manipulation has been extended, the user interface tidied up and color
  398. is now supported.
  399.  
  400. See the online help or the manual pages for more details.
  401.  
  402. Thankyou to everybody who has sent me mail suggesting enhancements.
  403.  
  404. Thanks to Ed Falk at Sun Microsystems (Mountain View) for some of the
  405. basic algorithms used.
  406.  
  407. Suggestions for furthur improvement would be most welcome plus bugs,
  408. comments and flames.
  409.  
  410.     Rich.
  411.  
  412. Rich Burridge,           JANET richb%sunaus.oz@uk.ac.ucl.cs
  413. ACSnet  richb@sunaus.oz  UUCP {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
  414. PHONE: +61 2 436 4699    ARPAnet rburridge@Sun.COM
  415. Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.
  416. Funky_Stuff
  417. len=`wc -c < README`
  418. if [ $len !=     1018 ] ; then
  419. echo error: README was $len bytes long, should have been     1018
  420. fi
  421. fi # end of overwriting check
  422. if [ -f calctool.help ]
  423. then
  424. echo shar: will not over-write existing file calctool.help
  425. else
  426. echo shar: extracting 'calctool.help',     9284 characters
  427. cat > calctool.help <<'Funky_Stuff'
  428. _calctool.help_
  429. _<   _
  430. Left shift n                ( < ).
  431.  
  432. This must be followed by a digit
  433. in the range 0 to 9 to indicate
  434. how many places to shift.
  435. _>   _
  436. Right shift n               ( > ).
  437.  
  438. This must be followed by a digit
  439. in the range 0 to 9 to indicate
  440. how many places to shift.
  441. _BIN _
  442. Change base to binary       ( B ).
  443.  
  444. The display value is shown in
  445. binary. A maximum of 32 digits
  446. are allowed.
  447. _MEM _
  448. Toggle register window      ( M ).
  449.  
  450. Display popup window with the
  451. values of the ten memory
  452. registers given in the current
  453. base, to the current accuracy.
  454. _OCT _
  455. Change base to octal        ( O ).
  456.  
  457. The display value is shown in
  458. octal. A maximum of 15 digits
  459. are allowed.
  460. _D   _
  461. Hex D (decimal 13)          ( d ).
  462.  
  463. This selection is only valid if
  464. the current base is hexidecimal.
  465. _DEC _
  466. Change base to decimal      ( D ).
  467.  
  468. The display value is shown in
  469. decimal. This is the default
  470. base. A maximum of 12 digits
  471. are allowed.
  472. _E   _
  473. Hex E (decimal 14)          ( e ).
  474.  
  475. This selection is only valid if
  476. the current base is hexidecimal.
  477. _HEX _
  478. Change base to hexidecimal  ( H ).
  479.  
  480. The display value is shown in
  481. hexidecimal. A maximum of 12
  482. digits are allowed.
  483. _F   _
  484. Hex F (decimal 15)          ( f ).
  485.  
  486. This selection is only valid if
  487. the current base is hexidecimal.
  488. _KEYS_
  489. Toggle button labels        ( K ).
  490.  
  491. Toggle the labels on the calctool
  492. buttons between the mouse and
  493. keyboard equivalents.
  494. _?   _
  495. Calctool Help v2.1.         ( ? ).
  496.  
  497. All calculations performed as
  498. doubles. The display can be used
  499. with the [Get] and [Put] function
  500. keys with other Sunview windows.
  501. Equivalent keystrokes can be
  502. found by selecting the KEYS
  503. button.
  504.  
  505. If an error condition occurs, you
  506. must clear the calculator.
  507.  
  508. >From now on when you select [?]
  509. you will get help on the next
  510. selection you make.
  511. _&32 _
  512. Get 32 bit unsigned int     ( i ).
  513.  
  514. This is a logical function, that
  515. will truncate the given number to
  516. return a 32 bit unsigned integer.
  517. _STO _
  518. Store memory register n     ( s ).
  519.  
  520. This must be followed by an
  521. arithmetic operation (addition,
  522. subtraction, multiplication or
  523. division), then a digit in the
  524. range 0 to 9 to indicate which
  525. memory register to store the
  526. current display value in. The
  527. arithmetic operator is optional
  528. in which case the current display
  529. is stored in the memory register.
  530. _&16 _
  531. Get 16 bit unsigned int     ( h ).
  532.  
  533. This is a logical function, that
  534. will truncate the given number to
  535. return a 16 bit unsigned integer.
  536. _RCL _
  537. Retrieve memory register n  ( r ).
  538.  
  539. This must be followed by a digit
  540. in the range 0 to 9 to indicate
  541. which memory register to retrieve
  542. the value from.
  543. _PI  _
  544. Value of pi                 ( P ).
  545.  
  546. Enter the value of pi into the
  547. calculator.
  548. _A   _
  549. Hex A (decimal 10)          ( a ).
  550.  
  551. This selection is only valid if
  552. the current base is hexidecimal.
  553. _e   _
  554. Value of e                  ( E ).
  555.  
  556. Enter the value of e into the
  557. calculator.
  558. _B   _
  559. Hex B (decimal 11)          ( b ).
  560.  
  561. This selection is only valid if
  562. the current base is hexidecimal.
  563. _%   _
  564. Percentage                  ( % ).
  565.  
  566. This calculation takes the last
  567. number enter and the next number
  568. given, and performs a percentage
  569. calculation on them.
  570. _C   _
  571. Hex C (decimal 12)          ( c ).
  572.  
  573. This selection is only valid if
  574. the current base is hexidecimal.
  575. _clr _
  576. Clear display          ( Delete ).
  577.  
  578. This will clear the value of the
  579. calculators display.
  580. _bsp _
  581. Erase character     ( BackSpace ).
  582.  
  583. The right most character of the
  584. current calculator display value
  585. is removed, and the value of the
  586. display is recalculated. Note,
  587. internal accuracy is lost with
  588. this operation.
  589. _OR  _
  590. Logical OR                  ( | ).
  591.  
  592. This operation takes the last
  593. number and the next number
  594. entered, and performs a logical
  595. OR operation on them, treating
  596. both numbers as unsigned long
  597. integers.
  598. _AND _
  599. Logical AND                 ( & ).
  600.  
  601. This operation takes the last
  602. number and the next number
  603. entered, and performs a logical
  604. AND operation on them, treating
  605. both numbers as unsigned long
  606. integers.
  607. _ASIN_
  608. Arc Sin                     ( } ).
  609.  
  610. Return the trigonometric Arc Sin
  611. of the current value, in the
  612. current units, degrees, radians
  613. or gradients.
  614. _SIN _
  615. Sin                         ( { ).
  616.  
  617. Return the trigonometric Sin of
  618. the current value, in the current
  619. units, degrees, radians or
  620. gradients.
  621. _e^x _
  622. e to the x power            ( # ).
  623.  
  624. Return e raised to the power of
  625. the current display value.
  626. _7   _
  627. Numeric 7                   ( 7 ).
  628.  
  629. This selection is ignored if
  630. the current base is binary.
  631. _10^x_
  632. 10 to the x power            ( $ ).
  633.  
  634. Return 10 raised to the power of
  635. the current display value.
  636. _8   _
  637. Numeric 8                   ( 8 ).
  638.  
  639. This selection is ignored if
  640. the current base is octal or
  641. binary.
  642. _y^x _
  643. y to the power of x         ( Y ).
  644.  
  645. The operation takes the last
  646. number and raises it to the power
  647. of the next number given.
  648. _9   _
  649. Numeric 9                   ( 9 ).
  650.  
  651. This selection is ignored if
  652. the current base is octal or
  653. binary.
  654. _INT _
  655. Integer portion             ( I ).
  656.  
  657. Return the integer portion of the
  658. current displayed value.
  659. _X   _
  660. Multiplication    ( * or x or X ).
  661.  
  662. This operation takes the last
  663. number and the next number
  664. entered, and performs an
  665. arithmetic multiplication on
  666. them.
  667. _XNOR_
  668. Logical XNOR           ( n or N ).
  669.  
  670. This operation takes the last
  671. number and the next number
  672. entered, and performs a logical
  673. XNOR operation on them, treating
  674. both numbers as unsigned long
  675. integers.
  676. _XOR _
  677. Logical XOR                 ( ^ ).
  678.  
  679. This operation takes the last
  680. number and the next number
  681. entered, and performs a logical
  682. XOR operation on them, treating
  683. both numbers as unsigned long
  684. integers.
  685. _ACOS_
  686. Arc Cos                     ( ) ).
  687.  
  688. Return the trigonometric Arc Cos
  689. of the current value, in the
  690. current units, degrees, radians
  691. or gradients.
  692. _COS _
  693. Cos                         ( ( ).
  694.  
  695. Return the trigonometric Cos of
  696. the current value, in the current
  697. units, degrees, radians or
  698. gradients.
  699. _ln  _
  700. Natural log                 ( N ).
  701.  
  702. This operation returns the
  703. natural logarithm of the current
  704. displayed value.
  705. _4   _
  706. Numeric 4                   ( 4 ).
  707.  
  708. This selection is ignored if
  709. the current base is binary.
  710. _log _
  711. Base 10 log                 ( G ).
  712.  
  713. This operation returns the base
  714. 10 logarithm of the current
  715. displayed value.
  716. _5   _
  717. Numeric 5                   ( 5 ).
  718.  
  719. This selection is ignored if
  720. the current base is binary.
  721. _SQRT_
  722. Square root                 ( S ).
  723.  
  724. This operation will perform a
  725. square root operation on the
  726. current value of the calculator
  727. display.
  728. _6   _
  729. Numeric 6                   ( 6 ).
  730.  
  731. This selection is ignored if
  732. the current base is binary.
  733. _FRAC_
  734. Fractional portion          ( F ).
  735.  
  736. Return the fractional portion of
  737. the current displayed value.
  738. _/   _
  739. Division                    ( / ).
  740.  
  741. This operation takes the last
  742. number and performs an
  743. arithemetic division by the
  744. next number entered.
  745. _NOT _
  746. Logical NOT                 ( ~ ).
  747.  
  748. This operation will perform the
  749. logical NOT operation of the
  750. current value of the calculators
  751. display.
  752. _ACC _
  753. Accuracy n                  ( A ).
  754.  
  755. This must be followed by a digit
  756. in the range 0 to 9 to indicate
  757. how many digits of precision are
  758. to be displayed.
  759. _ATAN
  760. Arc Tan                     ( T ).
  761.  
  762. Return the trigonometric Arc Tan
  763. of the current value, in the
  764. current units, degrees, radians
  765. or gradients.
  766. _TAN _
  767. Tan                         ( t ).
  768.  
  769. Return the trigonometric Tan of
  770. the current value, in the current
  771. units, degrees, radians or
  772. gradients.
  773. _1/x _
  774. Reciprocal                  ( R ).
  775.  
  776. The will return the current the
  777. value of 1 divided by the current
  778. display value.
  779. _1   _
  780. Numeric 1                   ( 1 ).
  781. _x!  _
  782. Factorial                   ( ! ).
  783.  
  784. This will return the factorial of
  785. the current displayed value.
  786. _2   _
  787. Numeric 2                   ( 2 ).
  788.  
  789. This selection is ignored if
  790. the current base is binary.
  791. _x^2 _
  792. Square                      ( @ ).
  793.  
  794. This will reurn the square of the
  795. current displayed value.
  796. _3   _
  797. Numeric 3                   ( 3 ).
  798.  
  799. This selection is ignored if
  800. the current base is binary.
  801. _CHS _
  802. Change sign                 ( C ).
  803.  
  804. Change the arithmetic sign of the
  805. current displayed value.
  806. _-   _
  807. Subtraction                 ( - ).
  808.  
  809. This operation takes the last
  810. number and performs an
  811. arithemetic subtraction of the
  812. next number entered.
  813. _QUIT_
  814. Quit calctool          ( q or Q ).
  815.  
  816. The calctool program is exited,
  817. without user verification.
  818. _OFF _
  819. Turn calctool iconic        ( o ).
  820. _    _
  821. This key is current not used.
  822. It will be implemented in a
  823. future version.
  824. _DEG _
  825. Trig base to degrees       ( ^d ).
  826.  
  827. Change the current trigonometrical
  828. base to degrees.
  829. _0   _
  830. Numeric 0                   ( 0 ).
  831. _RAD _
  832. Trig base to radians       ( ^r ).
  833.  
  834. Change the current trigonometrical
  835. base to radians.
  836. _.   _
  837. Numeric point               ( . ).
  838.  
  839. Selecting this starts the
  840. fractional part of the numeric
  841. entry.
  842. _GRAD_
  843. Trig base to gradients     ( ^g ).
  844.  
  845. Change the current trigonometrical
  846. base to gradients.
  847. _=   _
  848. Calculate result  ( = or Return ).
  849.  
  850. The result of the current
  851. calculation is displayed in
  852. the current base.
  853. _ABS _
  854. Absolute value.             ( U ).
  855.  
  856. Return the absolute value of the
  857. current displayed value.
  858. _+   _
  859. Addition                    ( + ).
  860.  
  861. This operation takes the last
  862. number and the next number
  863. entered, and performs an
  864. arithmetic addition on them.
  865. ______
  866. Funky_Stuff
  867. len=`wc -c < calctool.help`
  868. if [ $len !=     9284 ] ; then
  869. echo error: calctool.help was $len bytes long, should have been     9284
  870. fi
  871. fi # end of overwriting check
  872. if [ -f patchlevel.h ]
  873. then
  874. echo shar: will not over-write existing file patchlevel.h
  875. else
  876. echo shar: extracting 'patchlevel.h',      614 characters
  877. cat > patchlevel.h <<'Funky_Stuff'
  878.  
  879. /*  patchlevel.h
  880.  *
  881.  *  This is the current patch level for the calctool calculator program.
  882.  *
  883.  *  Copyright (c) Rich Burridge - February 1988.
  884.  *        Sun Microsystems, Australia - All rights reserved.
  885.  *
  886.  *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
  887.  *
  888.  *  Includes ideas and code from:
  889.  *        Rich Baughman, Consumer Financial Institute, Newton, MA
  890.  *
  891.  *  Version 2.1.
  892.  *
  893.  *  No responsibility is taken for any errors or inaccuracies inherent
  894.  *  either to the comments or the code of this program, but if
  895.  *  reported to me then an attempt will be made to fix them.
  896.  */
  897.  
  898. #define  PATCHLEVEL  0
  899. Funky_Stuff
  900. len=`wc -c < patchlevel.h`
  901. if [ $len !=      614 ] ; then
  902. echo error: patchlevel.h was $len bytes long, should have been      614
  903. fi
  904. fi # end of overwriting check
  905.