Calctool v2.1 - a Sun calculator. Part 2 of 2.

richb at sunaus.sun.oz.AU richb at sunaus.sun.oz.AU
Mon Feb 22 21:57:43 AEST 1988


This is V2.1 of a desktop calculator for the Sun workstation.
Currently this version works under SunView, but NeWS and X.11 versions
will be coming soon.

Rich Burridge,           JANET richb%sunaus.oz at uk.ac.ucl.cs
ACSnet  richb at sunaus.oz  UUCP {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
PHONE: +61 2 436 4699    ARPAnet rburridge at Sun.COM
Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.

------CUT HERE------CUT HERE------
#! /bin/sh
# this is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh to create the files:
#   calctool.h
#   color.h
#   button.icon
#   calctool.icon
#   help.cursor
#   Makefile
#   README
#   calctool.help
#   patchlevel.h
# This archive created: Fri Feb 19 19:00:00 EST 1988
#
#
export PATH; PATH=/bin:$PATH
#
if [ -f calctool.h ]
then
echo shar: will not over-write existing file calctool.h
else
echo shar: extracting 'calctool.h',     3692 characters
cat > calctool.h <<'Funky_Stuff'

/*  calctool.h
 *
 *  This files contains all the global definitions used by the calctool
 *  calculator program.
 *
 *  Copyright (c) Rich Burridge - February 1988.
 *                Sun Microsystems, Australia - All rights reserved.
 *
 *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
 *
 *  Includes ideas and code from:
 *                Rich Baughman, Consumer Financial Institute, Newton, MA
 *
 *  Version 2.1.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

#include <stdio.h>
#include <strings.h>
#include <ctype.h>
#include <math.h>

char *sprintf() ;

#define  CLOSE          (void) close      /* To make lint happy. */
#define  FCLOSE         (void) fclose
#define  FGETS          (void) fgets
#define  FPRINTF        (void) fprintf
#define  IOCTL          (void) ioctl
#define  READ           (void) read
#define  SPRINTF        (void) sprintf
#define  SSCANF         (void) sscanf
#define  STRCAT         (void) strcat
#define  STRCPY         (void) strcpy
#define  STRNCAT        (void) strncat
#define  STRNCPY        (void) strncpy
#define  WRITE          (void) write

#define  SMALLFONT      "/usr/lib/fonts/fixedwidthfonts/screen.r.7"
#define  NORMALFONT     "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
#define  BIGFONT        "/usr/lib/fonts/fixedwidthfonts/gallant.r.19"

#define  HELPCURSOR     0                /* Cursor types. */
#define  MAINCURSOR     1

#define  BIN            0                /* Base definitions. */
#define  OCT            1
#define  DEC            2
#define  HEX            3

#define  DEG            0                /* Trigonometric types. */
#define  GRAD           1
#define  RAD            2

#define  OP_SET         1                /* Operation text item settings. */
#define  OP_CLEAR       2
#define  OP_NOP         3

#define  BBORDER        10               /* No of pixels in border. */
#define  BCOLS          6                /* No of columns of buttons. */
#define  BGAP           5                /* No of pixels between buttons. */
#define  BHEIGHT        52               /* Number of pixels for height. */
#define  BROWS          6                /* No of rows of buttons. */
#define  BWIDTH         44               /* No of pixels for width. */

#define  CTRL(n)        n - 96           /* Generate control character value. */
#define  DISPLAY        30               /* Calculators numerical display. */

#define  EQUAL          !strcmp          /* For character comparisons. */
#define  EXTRA          4                /* Extra useful character definitions. */
#define  HELPNAME       "calctool.help"
#define  MAX_DIGITS     32               /* Maximum displayable number of digits. */
#define  MAXLINE        80               /* Length of character strings. */
#define  MAXREGS        10               /* Maximum number of memory registers. */
#define  MIN(x,y)       ((x) < (y) ? (x) : (y))
#define  NOBUTTONS      BROWS * BCOLS
#define  THEIGHT        (BROWS*BHEIGHT) + ((BROWS-1) * BGAP) + (2*BBORDER)
#define  TITEMS         NOBUTTONS*2 + EXTRA    /* Total definitions. */
#define  TWIDTH         (BCOLS*BWIDTH) + ((BCOLS-1) * BGAP) + (2*BBORDER)

typedef  unsigned long  BOOLEAN ;

struct button {
         char *str ;          /* Button display string. */
         char value ;         /* Unique button keyboard equivalent. */
         char opdisp ;        /* Display operation code during operation. */
         char color ;         /* Color of button portion. */
         int  (*func)() ;     /* Function to obey on button press. */
} ;
Funky_Stuff
len=`wc -c < calctool.h`
if [ $len !=     3692 ] ; then
echo error: calctool.h was $len bytes long, should have been     3692
fi
fi # end of overwriting check
if [ -f color.h ]
then
echo shar: will not over-write existing file color.h
else
echo shar: extracting 'color.h',     2284 characters
cat > color.h <<'Funky_Stuff'

/*  color.h
 *
 *  Colormap definitions used by the calctool calculator program.
 *
 *  Copyright (c) Rich Burridge - February 1988.
 *               Sun Microsystems, Australia - All rights reserved.
 *
 *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
 *
 *  Includes ideas and code from:
 *                Rich Baughman, Consumer Financial Institute, Newton, MA
 *
 *  Version 2.1.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

#define  CALC_COLOR      "calcolor"
#define  CALC_COLORSIZE  16

#define  WHITE    0
#define  RED      1
#define  ORANGE   2
#define  YELLOW   3
#define  LGREEN   4
#define  BLUE     5
#define  MAUVE    6
#define  GREEN    7
#define  PINK     8
#define  LBLUE    9
#define  GREY     10
#define  LGREY    11
#define  LPURPLE  12
#define  BLACK    13
#define  SPARE14  14
#define  SPARE15  15

#define calc_colorsetup(r,g,b) \
        (r)[WHITE] = 255 ;       (g)[WHITE] = 255 ;       (b)[WHITE] = 255 ; \
        (r)[RED] = 255 ;         (g)[RED] = 50 ;          (b)[RED] = 0 ; \
        (r)[ORANGE] = 255 ;      (g)[ORANGE] = 128 ;      (b)[ORANGE] = 0 ; \
        (r)[YELLOW] = 255 ;      (g)[YELLOW] = 255 ;      (b)[YELLOW] = 0 ; \
        (r)[LGREEN] = 128 ;      (g)[LGREEN] = 255 ;      (b)[LGREEN] = 128 ; \
        (r)[BLUE] = 50 ;         (g)[BLUE] = 128 ;        (b)[BLUE] = 255 ; \
        (r)[MAUVE] = 128 ;       (g)[MAUVE] = 128 ;       (b)[MAUVE] = 255 ; \
        (r)[GREEN] = 0 ;         (g)[GREEN] = 158 ;       (b)[GREEN] = 158 ; \
        (r)[PINK] = 255 ;        (g)[PINK] = 192 ;        (b)[PINK] = 192 ; \
        (r)[LBLUE] = 50 ;        (g)[LBLUE] = 178 ;       (b)[LBLUE] = 255 ; \
        (r)[GREY] = 128 ;        (g)[GREY] = 128 ;        (b)[GREY] = 128 ; \
        (r)[LGREY] = 200 ;       (g)[LGREY] = 200 ;       (b)[LGREY] = 200 ; \
        (r)[LPURPLE] = 225 ;     (g)[LPURPLE] = 225 ;     (b)[LPURPLE] = 255 ; \
        (r)[BLACK] = 0 ;         (g)[BLACK] = 0 ;         (b)[BLACK] = 0 ; \
        (r)[SPARE14] = 0 ;       (g)[SPARE14] = 0 ;       (b)[SPARE14] = 0 ; \
        (r)[SPARE15] = 0 ;       (g)[SPARE15] = 0 ;       (b)[SPARE15] = 0 ;
Funky_Stuff
len=`wc -c < color.h`
if [ $len !=     2284 ] ; then
echo error: color.h was $len bytes long, should have been     2284
fi
fi # end of overwriting check
if [ -f button.icon ]
then
echo shar: will not over-write existing file button.icon
else
echo shar: extracting 'button.icon',     1933 characters
cat > button.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0xFFFF,0xFFFF,0xFFF0,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x87FF,0xFFFF,0xFE10,0x0000,0x8400,0x0000,0x0210,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x85FF,0xFFFF,0xFA10,0x0000,
	0x85FF,0xFFFF,0xFA10,0x0000,0x8400,0x0000,0x0210,0x0000,
	0x87FF,0xFFFF,0xFE10,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0x8000,0x0000,0x0010,0x0000,
	0x8000,0x0000,0x0010,0x0000,0xFFFF,0xFFFF,0xFFF0,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
Funky_Stuff
len=`wc -c < button.icon`
if [ $len !=     1933 ] ; then
echo error: button.icon was $len bytes long, should have been     1933
fi
fi # end of overwriting check
if [ -f calctool.icon ]
then
echo shar: will not over-write existing file calctool.icon
else
echo shar: extracting 'calctool.icon',     1933 characters
cat > calctool.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x1555,0x5555,0x5540,0x0000,0x2AAA,0xAAAA,0xAA80,0x0000,
	0x5555,0x5555,0x5540,0x0000,0xFFFF,0xFFFF,0xFE80,0x0000,
	0x8000,0x0000,0x0340,0x0000,0xBFFF,0xFFFF,0xFA80,0x0000,
	0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
	0xA003,0x0030,0xCB40,0x0000,0xA004,0x8049,0x2A80,0x0000,
	0xA005,0x8059,0x6B40,0x0000,0xA006,0x8069,0xAA80,0x0000,
	0xA004,0x8449,0x2B40,0x0000,0xA003,0x0430,0xCA80,0x0000,
	0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
	0xBFFF,0xFFFF,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
	0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
	0xA050,0x2814,0x0B40,0x0000,0xAF53,0x2994,0x0A80,0x0000,
	0xA154,0xAA55,0x1340,0x0000,0xA253,0x2A54,0xAA80,0x0000,
	0xA254,0xA9D4,0x4B40,0x0000,0xA454,0xA854,0xAA80,0x0000,
	0xA453,0x2995,0x1B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
	0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
	0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
	0xA257,0xA994,0x2B40,0x0000,0xA654,0x2A14,0x4A80,0x0000,
	0xAA57,0x2B94,0x4B40,0x0000,0xAF50,0xAA54,0x8A80,0x0000,
	0xA254,0xAA54,0x8B40,0x0000,0xA253,0x2995,0x0A80,0x0000,
	0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
	0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
	0xA050,0x2814,0x0B40,0x0000,0xA253,0x2994,0x0A80,0x0000,
	0xA654,0xAA54,0x0B40,0x0000,0xA250,0xA895,0xEA80,0x0000,
	0xA253,0x2854,0x0B40,0x0000,0xA254,0x2A54,0x0A80,0x0000,
	0xA757,0xA994,0x0B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
	0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
	0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
	0xA650,0x2814,0x0B40,0x0000,0xA950,0x2814,0x4A80,0x0000,
	0xAB50,0x2BD4,0x4B40,0x0000,0xAD50,0x2815,0xFA80,0x0000,
	0xA951,0x2BD4,0x4B40,0x0000,0xA651,0x2814,0x4A80,0x0000,
	0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
	0x8000,0x0000,0x0300,0x0000,0xFFFF,0xFFFF,0xFE00,0x0000
Funky_Stuff
len=`wc -c < calctool.icon`
if [ $len !=     1933 ] ; then
echo error: calctool.icon was $len bytes long, should have been     1933
fi
fi # end of overwriting check
if [ -f help.cursor ]
then
echo shar: will not over-write existing file help.cursor
else
echo shar: extracting 'help.cursor',      193 characters
cat > help.cursor <<'Funky_Stuff'
/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x03C0,0x07E0,0x0E70,0x0830,0x0030,0x0030,0x0060,
	0x00C0,0x0180,0x0300,0x0300,0x0000,0x0000,0x0300,0x0300
Funky_Stuff
len=`wc -c < help.cursor`
if [ $len !=      193 ] ; then
echo error: help.cursor was $len bytes long, should have been      193
fi
fi # end of overwriting check
if [ -f Makefile ]
then
echo shar: will not over-write existing file Makefile
else
echo shar: extracting 'Makefile',     1300 characters
cat > Makefile <<'Funky_Stuff'
#
#  Makefile for calctool, a calculator program.
#
#  Copyright (c) Rich Burridge - February 1988.
#                Sun Microsystems, Australia - All rights reserved.
#
#  Includes code and ideas from:
#                Rich Baughman, Consumer Financial Institute, Newton, MA
#
#  Version 2.1.
#
#  No responsibility is taken for any errors inherent either in the comments
#  or the code of this program, but if reported to me then an attempt will
#  be made to fix them.
#

BINARIES        = calctool
BINDIR          = .
CFLAGS          = -O
HEADERS         = calctool.h color.h
OBJS            = calctool.o functions.o sunview.o
OTHERS          = Makefile README calctool.help patchlevel.h
SRCS            = calctool.c functions.c sunview.c
IMAGES          = button.icon calctool.icon help.cursor
LIBS            = -lm -lsuntool -lsunwindow -lpixrect

all:            $(BINARIES)

install:        $(BINARIES)
		strip $(BINARIES)
		-mv $(BINARIES) $(BINDIR)

clean:
		rm -f *.o core

lint:
		lint $(SRCS) $(LIBS)

shar:
		shar.sh $(SRCS) > archive.1
		shar.sh $(HEADERS) $(IMAGES) $(OTHERS) > archive.2

calctool:       $(OBJS)
		cc -o calctool $(OBJS) $(LIBS)

calctool.o:     calctool.c $(HEADERS) patchlevel.h
functions.o:    functions.c $(HEADERS)
sunview.o:      sunview.c $(HEADERS) $(IMAGES)
Funky_Stuff
len=`wc -c < Makefile`
if [ $len !=     1300 ] ; then
echo error: Makefile was $len bytes long, should have been     1300
fi
fi # end of overwriting check
if [ -f README ]
then
echo shar: will not over-write existing file README
else
echo shar: extracting 'README',     1018 characters
cat > README <<'Funky_Stuff'

calctool  -  README  -  19th February 1988.

This is V2.1 of a desktop calculator for the Sun workstation.
Currently this version works under SunView, but NeWS and X.11 versions
will be coming soon.

This is a complete rehash from the v1.x series, and now includes
many more mathematical and trigonometrical functions. Memory register
manipulation has been extended, the user interface tidied up and color
is now supported.

See the online help or the manual pages for more details.

Thankyou to everybody who has sent me mail suggesting enhancements.

Thanks to Ed Falk at Sun Microsystems (Mountain View) for some of the
basic algorithms used.

Suggestions for furthur improvement would be most welcome plus bugs,
comments and flames.

    Rich.

Rich Burridge,           JANET richb%sunaus.oz at uk.ac.ucl.cs
ACSnet  richb at sunaus.oz  UUCP {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
PHONE: +61 2 436 4699    ARPAnet rburridge at Sun.COM
Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.
Funky_Stuff
len=`wc -c < README`
if [ $len !=     1018 ] ; then
echo error: README was $len bytes long, should have been     1018
fi
fi # end of overwriting check
if [ -f calctool.help ]
then
echo shar: will not over-write existing file calctool.help
else
echo shar: extracting 'calctool.help',     9284 characters
cat > calctool.help <<'Funky_Stuff'
_calctool.help_
_<   _
Left shift n                ( < ).

This must be followed by a digit
in the range 0 to 9 to indicate
how many places to shift.
_>   _
Right shift n               ( > ).

This must be followed by a digit
in the range 0 to 9 to indicate
how many places to shift.
_BIN _
Change base to binary       ( B ).

The display value is shown in
binary. A maximum of 32 digits
are allowed.
_MEM _
Toggle register window      ( M ).

Display popup window with the
values of the ten memory
registers given in the current
base, to the current accuracy.
_OCT _
Change base to octal        ( O ).

The display value is shown in
octal. A maximum of 15 digits
are allowed.
_D   _
Hex D (decimal 13)          ( d ).

This selection is only valid if
the current base is hexidecimal.
_DEC _
Change base to decimal      ( D ).

The display value is shown in
decimal. This is the default
base. A maximum of 12 digits
are allowed.
_E   _
Hex E (decimal 14)          ( e ).

This selection is only valid if
the current base is hexidecimal.
_HEX _
Change base to hexidecimal  ( H ).
 
The display value is shown in
hexidecimal. A maximum of 12
digits are allowed.
_F   _
Hex F (decimal 15)          ( f ).

This selection is only valid if
the current base is hexidecimal.
_KEYS_
Toggle button labels        ( K ).

Toggle the labels on the calctool
buttons between the mouse and
keyboard equivalents.
_?   _
Calctool Help v2.1.         ( ? ).

All calculations performed as
doubles. The display can be used
with the [Get] and [Put] function
keys with other Sunview windows.
Equivalent keystrokes can be
found by selecting the KEYS
button.

If an error condition occurs, you
must clear the calculator.

>From now on when you select [?]
you will get help on the next
selection you make.
_&32 _
Get 32 bit unsigned int     ( i ).

This is a logical function, that
will truncate the given number to
return a 32 bit unsigned integer.
_STO _
Store memory register n     ( s ).

This must be followed by an
arithmetic operation (addition,
subtraction, multiplication or
division), then a digit in the
range 0 to 9 to indicate which
memory register to store the
current display value in. The
arithmetic operator is optional
in which case the current display
is stored in the memory register.
_&16 _
Get 16 bit unsigned int     ( h ).

This is a logical function, that
will truncate the given number to
return a 16 bit unsigned integer.
_RCL _
Retrieve memory register n  ( r ).

This must be followed by a digit
in the range 0 to 9 to indicate
which memory register to retrieve
the value from.
_PI  _
Value of pi                 ( P ).

Enter the value of pi into the
calculator.
_A   _
Hex A (decimal 10)          ( a ).

This selection is only valid if
the current base is hexidecimal.
_e   _
Value of e                  ( E ).

Enter the value of e into the
calculator.
_B   _
Hex B (decimal 11)          ( b ).

This selection is only valid if
the current base is hexidecimal.
_%   _
Percentage                  ( % ).

This calculation takes the last
number enter and the next number
given, and performs a percentage
calculation on them.
_C   _
Hex C (decimal 12)          ( c ).
 
This selection is only valid if
the current base is hexidecimal.
_clr _
Clear display          ( Delete ).

This will clear the value of the
calculators display.
_bsp _
Erase character     ( BackSpace ).
 
The right most character of the
current calculator display value
is removed, and the value of the
display is recalculated. Note,
internal accuracy is lost with
this operation.
_OR  _
Logical OR                  ( | ).

This operation takes the last
number and the next number
entered, and performs a logical
OR operation on them, treating
both numbers as unsigned long
integers.
_AND _
Logical AND                 ( & ).

This operation takes the last
number and the next number
entered, and performs a logical
AND operation on them, treating
both numbers as unsigned long
integers.
_ASIN_
Arc Sin                     ( } ).

Return the trigonometric Arc Sin
of the current value, in the
current units, degrees, radians
or gradients.
_SIN _
Sin                         ( { ).

Return the trigonometric Sin of
the current value, in the current
units, degrees, radians or
gradients.
_e^x _
e to the x power            ( # ).

Return e raised to the power of
the current display value.
_7   _
Numeric 7                   ( 7 ).

This selection is ignored if
the current base is binary.
_10^x_
10 to the x power            ( $ ).

Return 10 raised to the power of
the current display value.
_8   _
Numeric 8                   ( 8 ).

This selection is ignored if
the current base is octal or
binary.
_y^x _
y to the power of x         ( Y ).

The operation takes the last
number and raises it to the power
of the next number given.
_9   _
Numeric 9                   ( 9 ).

This selection is ignored if
the current base is octal or
binary.
_INT _
Integer portion             ( I ).

Return the integer portion of the
current displayed value.
_X   _
Multiplication    ( * or x or X ).

This operation takes the last
number and the next number
entered, and performs an
arithmetic multiplication on
them.
_XNOR_
Logical XNOR           ( n or N ).

This operation takes the last
number and the next number
entered, and performs a logical
XNOR operation on them, treating
both numbers as unsigned long
integers.
_XOR _
Logical XOR                 ( ^ ).

This operation takes the last
number and the next number
entered, and performs a logical
XOR operation on them, treating
both numbers as unsigned long
integers.
_ACOS_
Arc Cos                     ( ) ).

Return the trigonometric Arc Cos
of the current value, in the
current units, degrees, radians
or gradients.
_COS _
Cos                         ( ( ).

Return the trigonometric Cos of
the current value, in the current
units, degrees, radians or
gradients.
_ln  _
Natural log                 ( N ).

This operation returns the
natural logarithm of the current
displayed value.
_4   _
Numeric 4                   ( 4 ).

This selection is ignored if
the current base is binary.
_log _
Base 10 log                 ( G ).

This operation returns the base
10 logarithm of the current
displayed value.
_5   _
Numeric 5                   ( 5 ).

This selection is ignored if
the current base is binary.
_SQRT_
Square root                 ( S ).

This operation will perform a
square root operation on the
current value of the calculator
display.
_6   _
Numeric 6                   ( 6 ).

This selection is ignored if
the current base is binary.
_FRAC_
Fractional portion          ( F ).

Return the fractional portion of
the current displayed value.
_/   _
Division                    ( / ).

This operation takes the last
number and performs an
arithemetic division by the
next number entered.
_NOT _
Logical NOT                 ( ~ ).

This operation will perform the
logical NOT operation of the
current value of the calculators
display.
_ACC _
Accuracy n                  ( A ).

This must be followed by a digit
in the range 0 to 9 to indicate
how many digits of precision are
to be displayed.
_ATAN
Arc Tan                     ( T ).

Return the trigonometric Arc Tan
of the current value, in the
current units, degrees, radians
or gradients.
_TAN _
Tan                         ( t ).
 
Return the trigonometric Tan of
the current value, in the current
units, degrees, radians or
gradients.
_1/x _
Reciprocal                  ( R ).

The will return the current the
value of 1 divided by the current
display value.
_1   _
Numeric 1                   ( 1 ).
_x!  _
Factorial                   ( ! ).

This will return the factorial of
the current displayed value.
_2   _
Numeric 2                   ( 2 ).

This selection is ignored if
the current base is binary.
_x^2 _
Square                      ( @ ).

This will reurn the square of the
current displayed value.
_3   _
Numeric 3                   ( 3 ).

This selection is ignored if
the current base is binary.
_CHS _
Change sign                 ( C ).

Change the arithmetic sign of the
current displayed value.
_-   _
Subtraction                 ( - ).

This operation takes the last
number and performs an
arithemetic subtraction of the
next number entered.
_QUIT_
Quit calctool          ( q or Q ).

The calctool program is exited,
without user verification.
_OFF _
Turn calctool iconic        ( o ).
_    _
This key is current not used.
It will be implemented in a
future version.
_DEG _
Trig base to degrees       ( ^d ).

Change the current trigonometrical
base to degrees.
_0   _
Numeric 0                   ( 0 ).
_RAD _
Trig base to radians       ( ^r ).

Change the current trigonometrical
base to radians.
_.   _
Numeric point               ( . ).

Selecting this starts the
fractional part of the numeric
entry.
_GRAD_
Trig base to gradients     ( ^g ).

Change the current trigonometrical
base to gradients.
_=   _
Calculate result  ( = or Return ).

The result of the current
calculation is displayed in
the current base.
_ABS _
Absolute value.             ( U ).

Return the absolute value of the
current displayed value.
_+   _
Addition                    ( + ).
 
This operation takes the last
number and the next number
entered, and performs an
arithmetic addition on them.
______
Funky_Stuff
len=`wc -c < calctool.help`
if [ $len !=     9284 ] ; then
echo error: calctool.help was $len bytes long, should have been     9284
fi
fi # end of overwriting check
if [ -f patchlevel.h ]
then
echo shar: will not over-write existing file patchlevel.h
else
echo shar: extracting 'patchlevel.h',      614 characters
cat > patchlevel.h <<'Funky_Stuff'
 
/*  patchlevel.h
 *
 *  This is the current patch level for the calctool calculator program.
 *
 *  Copyright (c) Rich Burridge - February 1988.
 *		Sun Microsystems, Australia - All rights reserved.
 *
 *  Basic algorithms by Ed Falk, Sun Microsystems, Mountain View.
 *
 *  Includes ideas and code from:
 *		Rich Baughman, Consumer Financial Institute, Newton, MA
 *
 *  Version 2.1.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

#define  PATCHLEVEL  0
Funky_Stuff
len=`wc -c < patchlevel.h`
if [ $len !=      614 ] ; then
echo error: patchlevel.h was $len bytes long, should have been      614
fi
fi # end of overwriting check



More information about the Comp.sources.misc mailing list