[comp.windows.news] Calctool v2.2. Part 2 of 2.

richb@sunaus.oz (Rich Burridge) (05/04/88)

------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
#	extern.h
#	calctool.icon
#	help.cursor
#	Makefile
#	README
#	calctool.help
#	calctool.1
#	news.ps
#	patchlevel.h
# This archive created: Wed May  4 15:36:19 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',     3687 characters
cat > calctool.h <<'Funky_Stuff'

/*  calctool.h
 *
 *  Contains all the global definitions used by calctool.
 *
 *  Copyright (c) Rich Burridge - May 1988.
 *                Sun Microsystems, Australia - All rights reserved.
 *
 *  Version 2.2.
 *
 *  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  FFLUSH         (void) fflush
#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

enum base_type { BIN, OCT, DEC, HEX } ;   /* Base definitions. */

enum font_type { SFONT, NFONT, BFONT } ;  /* Text font definitions. */

enum can_type { KEYCANVAS, REGCANVAS, PANELCANVAS } ;  /* Canvas types. */

enum but_state { NORMAL, INVERTED } ;     /* Calculator button states. */

enum item_type { BASEITEM, DISPLAYITEM, OPITEM, TTYPEITEM } ;  /* Text items. */

enum trig_type { DEG, GRAD, RAD } ;       /* Trigonometric types. */

enum op_type { OP_SET, OP_CLEAR, OP_NOP } ;  /* Operation item settings. */

#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. */

#ifndef HELPGIVEN
#define  HELPNAME       "calctool.help"
#endif

#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  MAXVALID       6                /* Number of valid keys after an error. */
#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. */
         enum op_type 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 !=     3687 ] ; then
echo error: calctool.h was $len bytes long, should have been     3687
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',     2076 characters
cat > color.h <<'Funky_Stuff'

/*  color.h
 *
 *  Colormap definitions used by calctool.
 *
 *  Copyright (c) Rich Burridge - May 1988.
 *               Sun Microsystems, Australia - All rights reserved.
 *
 *  Version 2.2.
 *
 *  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 !=     2076 ] ; then
echo error: color.h was $len bytes long, should have been     2076
fi
fi # end of overwriting check
if [ -f extern.h ]
then
echo shar: will not over-write existing file extern.h
else
echo shar: extracting 'extern.h',     3395 characters
cat > extern.h <<'Funky_Stuff'

/*  extern.h
 *
 *  Contains the external variable definitions used by calctool.
 *
 *  Copyright (c) Rich Burridge - May 1988.
 *                Sun Microsystems, Australia - All rights reserved.
 *
 *  Version 2.2.
 *
 *  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.
 */

extern char *make_number() ;
extern char base_str[4][4] ;
extern char cur_base_str[] ;       /* Current base value. */
extern char cur_op ;               /* Current arithmetic operation. */
extern char cur_op_str[] ;         /* Current op value. */
extern char cur_ttype_str[] ;      /* Current ttype value. */
extern char current ;              /* Current button or character pressed. */
extern char old_cal_value ;        /* Previous calculation operator. */
extern char display[MAXLINE] ;     /* Current calculator display. */
extern char pstr[] ;               /* Current button text string. */
extern char *selection ;           /* Current [Get] selection. */
extern char ttype_str[3][5] ;

extern double convert_display() ;
extern double disp_val ;           /* Value of the current display. */
extern double last_input ;         /* Previous number input by user. */
extern double mem_vals[] ;         /* Memory register values. */
extern double result ;             /* Current calculator total value. */
extern double tresults[] ;         /* Current trigonometric results. */

extern enum base_type base ;       /* Current base: BIN, OCT, DEC or HEX. */
extern enum trig_type ttype ;      /* Trigonometric type (deg, grad or rad). */

extern int accuracy ;       /* Number of digits precision (Max 9). */
extern int chxoff[] ;       /* X offset for various length button strings. */
extern int color ;          /* Color used for current raster operation. */
extern int column ;         /* Column number of current key/mouse press. */
extern int disp_length[] ;  /* Display length in characters for each base. */
extern int down ;           /* Indicates if mouse button is down. */
extern int error ;          /* Indicates some kind of display error. */
extern int iscolor ;        /* Set if this is a color screen. */
extern int ishelp ;         /* Set if there is a help file. */
extern int issel ;          /* Set if valid [Get] selection. */
extern int new_input ;      /* New number input since last op. */
extern int pending ;        /* Set for command with on multiple presses. */
extern int pending_op ;     /* Arithmetic operation for pending command. */
extern int pointed ;        /* Whether a decimal point has been given. */
extern int portion ;        /* Button portion on current key/mouse press. */
extern int row ;            /* Row number of current key/mouse press. */
extern int rstate ;         /* Is memory register frame displayed? */
extern int signgam ;
extern int spaces ;         /* Number of spaces in current button string. */
extern int toclear ;        /* Indicates if display should be cleared. */
extern int tstate ;         /* Current button set being displayed. */
extern int x ;              /* X offset for text for button. */
extern int y ;              /* Y offset for text for button. */

extern FILE *hfd ;          /* File descriptor for help information. */

extern struct button buttons[] ;  /* Calculator button values. */
Funky_Stuff
len=`wc -c < extern.h`
if [ $len !=     3395 ] ; then
echo error: extern.h was $len bytes long, should have been     3395
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',     2052 characters
cat > Makefile <<'Funky_Stuff'
#
#  Makefile for calctool, a calculator program.
#
#  Copyright (c) Rich Burridge - May 1988.
#                Sun Microsystems, Australia - All rights reserved.
#
#  Version 2.2.
#
#  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        = sv_calctool ps_calctool
BINDIR          = /usr/local/bin
LIBDIR          = /usr/local/lib
MANDIR          = /usr/man/man$(MANSECT)
MANSECT         = l
CFLAGS          = -g -DHELPGIVEN -DHELPNAME=\"$(LIBDIR)/calctool.help\"
HDRS            = calctool.h color.h extern.h
IMAGES          = calctool.icon help.cursor

PSLIBS          = -lm $$NEWSHOME/lib/libcps.a
PSOBJS          = calctool.o functions.o graphics.o news.o
PSSRCS          = calctool.c functions.c graphics.c news.c

SVLIBS          = -lm -lsuntool -lsunwindow -lpixrect
SVOBJS          = calctool.o functions.o graphics.o sunview.o
SVSRCS          = calctool.c functions.c graphics.c sunview.c

OTHERS          = Makefile README calctool.help calctool.1 news.ps patchlevel.h
SRCS            = calctool.c functions.c graphics.c news.c sunview.c

all:            $(BINARIES)

sunview:        sv_calctool
		cp sv_calctool calctool

news:           ps_calctool
		cp ps_calctool calctool

sv_calctool:    $(SVOBJS)
		cc -o sv_calctool $(CFLAGS) $(SVOBJS) $(SVLIBS)

ps_calctool:    $(PSOBJS)
		cc -o ps_calctool $(CFLAGS) $(PSOBJS) $(PSLIBS)

install:        $(BINARIES)
		install -s -m 751 calctool $(BINDIR)
		install -c -m 644 calctool.help $(LIBDIR)
		install -c -m 644 calctool.1 $(MANDIR)/calctool.$(MANSECT)

clean:;         rm -f *.o calctool core

lint:;          lint $(SVSRCS) $(SVLIBS)
		lint $(PSSRCS) $(PSLIBS)

shar:;          shar.script $(SRCS)  > archive.1
		shar.script $(HDRS) $(IMAGES) $(OTHERS) > archive.2

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

calctool  -  README  -  4th May 1988.

This is V2.2.1 of a desktop calculator for the Sun workstation.
This version works under SunView and NeWS.

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@uk.ac.ucl.cs
ACSnet  richb@sunaus.oz  UUCP {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
PHONE: +61 2 436 4699    ARPAnet rburridge@Sun.COM
Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.
Funky_Stuff
len=`wc -c < README`
if [ $len !=      965 ] ; then
echo error: README was $len bytes long, should have been      965
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',     9351 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 valid only 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 valid only 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 valid only 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.2.         ( ? ).

All calculations are in double
precision. The display can be
used with the [Get] and [Put]
function keys with other Sunview
windows. For every mouse
selection, there is an equivalent
keystroke. These 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 the
memory register in which to
store the current display value.
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
the memory register from which
data is to be to retrieved.
_PI  _
Value of pi                 ( P ).

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

This selection is valid only 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 valid only 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 valid only 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 not used currently.
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 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 !=     9351 ] ; then
echo error: calctool.help was $len bytes long, should have been     9351
fi
fi # end of overwriting check
if [ -f calctool.1 ]
then
echo shar: will not over-write existing file calctool.1
else
echo shar: extracting 'calctool.1',     8467 characters
cat > calctool.1 <<'Funky_Stuff'
.\" @(#)calctool.1 2.2 27/04/88 SMI;
.TH CALCTOOL 1L "27 April 1988"
.SH NAME
calctool \- window based calculator for the Sun workstation
.SH SYNOPSIS
.B "calctool
[
.B -h
.I helpfile
]
[
.B -v
]
[
.B -?
]
.SH DESCRIPTION
.I Calctool
is a window based calculator for the Sun. It receives input via the mouse
or the keyboard. Each calculator button has two functions associated with it.
.LP
Internal arithmetic is done with double precision floating point numbers.
Accuracy can be adjusted from zero to nine numeric places, and the base of
operation can be binary,octal,decimal or hexidecimal.  Numbers are initially
displayed to two numeric places, in decimal base.
.LP
The numeric display can be adjusted using the
.I SunView
.I Put
and
.I Get
function keys.  The previous digit entered can be removed and the
whole display cleared.
.LP
There are ten memory registers; numbers can be retrieved or stored in
these locations, and arithmetic can be performed upon register contents.
.LP
In addition to the current numerical value, the display window contains the
current base and the current trigonometrical units. If an operation needing
more than one numerical input is partially complete, the operation
is also displayed in this window as a reminder.
.LP
The calculator has arithmetical, logical and trigonometrical functions.
These are grouped together and color coded on color workstations.
.LP
Online help is provided via a help button.  Select this button, and then
the function you wish to be described.
.SH OPTIONS
.TP
.BI -h " helpfile"
Use an alternate helpfile.
.TP
.B -v
Print the version number of this release of the
.I calctool
program.
.TP
.B -?
Print the usage line for this program. Note that the
.I ?
character should be escaped if running from
.IR csh (1).
.SH CALCULATOR BUTTONS
[Keyboard equivalents appear in brackets]
.SS Numerical Keys [0-9 a-f . = <RETURN>].
.LP
Enter a digit (decimal digits 0-9 or hexidecimal digits A-F) in the display.
The . acts as the decimal point and = is used for completion of numerical
entry (<RETURN> can be also be used from the keyboard to terminate numerical
entry).
.SS Arithmetical Operations [+ - x X * /].
.LP
Perform an arithmetical operation using the preivous entry and the next entry
as operands.  Addition, subtraction, multiplication and division are denoted
by the buttons +, \-, x and / respectively (the keyboard keys * and X are
synonymous with x for multiplication).
.SS Base Changes.
.LP
.IP "\fBBIN  [ B ]\fP" 18
Change display base to binary (maximum: 32 digits).
.IP "\fBOCT  [ O ]\fP" 18
Change display base to octal (maximum: 15 digits). are allowed.
.IP "\fBDEC  [ D ]\fP" 18
Change display base to decimal (default; maximum: 12 digits).
.IP "\fBHEX  [ H ]\fP" 18
Change display base to hexidecimal (maximum: 12 digits).
.SS Trigonometric Unit Changes.
.LP
.IP "\fBDEG  [ ^d ]\fP" 18
Change current trigonometrical base to degrees.
.IP "\fBRAD  [ ^r ]\fP" 18
Change the current trigonometrical base to radians.
.IP "\fBGRAD [ ^g ]\fP" 18
Change the current trigonometrical base to gradients.
.SS Logical Operations.
.LP
.IP "\fBAND  [ & ]\fP" 18
Perform a logical AND operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.IP "\fBNOT  [ ~ ]\fP" 18
Perform the logical NOT operation of the current entry.
.IP "\fBOR   [ | ]\fP" 18
Perform a logical OR operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.IP "\fBXNOR [ n or N ]\fP" 18
Perform a logical XNOR operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.IP "\fBXOR  [ ^ ]\fP" 18
Perform a logical XOR operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.SS Trigonometrical Operators.
.LP
.IP "\fBASIN [ } ]\fP" 18
Return the trigonometric Arc Sin of the current entry, in the
current units (degrees, radians or gradients).
.IP "\fBSIN  [ { ]\fP" 18
Return the trigonometric Sin of the current entry, in the current
units (degrees, radians or gradients).
.IP "\fBACOS [ ) ]\fP" 18
Return the trigonometric Arc Cos of the current entry, in the
current units (degrees, radians or gradients).
.IP "\fBCOS  [ ( ]\fP" 18
Return the trigonometric Cos of the current entry, in the current
units (degrees, radians or gradients).
.IP "\fBATAN [ T ]\fP" 18
Return the trigonometric Arc Tan of the current entry, in the
current units (degrees, radians or gradients).
.IP "\fBTAN  [ t ]\fP" 18
Return the trigonometric Tan of the current entry, in the current
units (degrees, radians or gradients).
.SS Memory Register Operators.
.LP
.IP "\fBRCL  [ r ]\fP" 18
Retrieve memory register n.  This selection must be followed by a digit
in the range 0 to 9 to indicate a memory register.
.IP "\fBSTO  [ s ]\fP" 18
Store memory register n.  This must be followed by a digit in the range
0 to 9 to indicate a memory register.  The register number may be preceded
by an arithmetic operation (addition, subtraction, multiplication or division),
in which case the specifed operation is carred out between the
displayed entry and the value currently in register n, and the result is placed
in register n.
.SS Constants.
.LP
.IP "\fBPI   [ P ]\fP" 18
Enter the value of pi.
.IP "\fBe    [ E ]\fP" 18
Enter the value of e.
.SS Mathematical Operators.
.LP
.IP "\fB%    [ % ]\fP" 18
Perform a percentage calculation using the last entry and the next entry.
.IP "\fBe^x  [ # ]\fP" 18
Return e raised to the power of the current entry.
.IP "\fB10^x [ $ ]\fP" 18
Return 10 raised to the power of the current entry.
.IP "\fBy^x  [ Y ]\fP" 18
Take the last entry and raise it to the power of the next entry.
.IP "\fBln   [ N ]\fP" 18
Return the natural logarithm of the current entry.
.IP "\fBlog  [ G ]\fP" 18
Returns the base 10 logarithm of the current entry.
.IP "\fBSQRT [ S ]\fP" 18
Perform a square root operation on the current entry.
.IP "\fB1/x  [ R ]\fP" 18
Return the value of 1 divided by the current entry.
.IP "\fBx!   [ ! ]\fP" 18
Return the factorial of the current entry.
.IP "\fBx^2  [ @ ]\fP" 18
Return the square of the current entry.
.SS Number Manipulation Operators.
.LP
.IP "\fB<    [ < ]\fP" 18
Left shift n places. This must be followed by a digit
in the range 0 to 9 to indicate the number of places to shift.
.IP "\fB>    [ > ]\fP" 18
Right shift n places. This must be followed by a digit
in the range 0 to 9 to indicate the number of places to shift.
.IP "\fB&32  [ i ]\fP" 18
Truncate the current entry to a 32 bit unsigned integer
(logical function).
.IP "\fB&16  [ h ]\fP" 18
Truncate the given number to a 16 bit unsigned integer
(logical function).
.IP "\fBclr  [ Delete ]\fP" 18
Clear the calculator display.
.IP "\fBbsp  [ BackSpace ]\fP" 18
Remove the rightmost character of the current entry
and recalculate the the displayed value (note: internal accuracy is
lost with this operation).
.IP "\fBINT  [ I ]\fP" 18
Return the integer portion of the current entry.
.IP "\fBFRAC [ F ]\fP" 18
Return the fractional portion of the current entry.
.IP "\fBACC  [ A ]\fP" 18
Set accuracy. This must be followed by a digit in the range 0 to 9 to
indicate how many digits are to be displayed.
.IP "\fBCHS  [ C ]\fP" 18
Change the arithmetic sign of the current entry.
.IP "\fBABS  [ U ]\fP" 18
Return the absolute value of the current entry.
.SS Other keys.
.LP
.IP "\fBMEM  [ M ]\fP" 18
Toggle the display of the popup register window.
Values of the ten memory registers are displayed in the current
base, to the current accuracy.
.IP "\fBKEYS [ K ]\fP" 18
Toggle the labels on the calctool buttons between mouse and
keyboard equivalents.
.IP "\fB?    [ ? ]\fP" 18
Display a help message for a particular button.  First select this key, then
the key to be described.
.IP "\fBQUIT [q or Q]\fP" 18
Exit (without user verification).
.IP "\fBOFF  [ o ]\fP" 18
Change \fIcalctool\fP to an icon.
.SH FILES
.TP
/usr/local/lib/calctool.help
.SH BUGS
Parsing of the online help file is very primative.
.LP
Handling of errors generated by the mathematical routines is poorly
done.
.SH AUTHOR
Rich Burridge, Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W.
2164, AUSTRALIA.  PHONE: +61 2 436 4699
.nf
JANET: richb%sunaus.oz@uk.ac.ucl.cs
ACSnet:  richb@sunaus.oz
UUCP: {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
ARPAnet: rburridge@Sun.COM
.fi
.br
Manual page modified by R. P. C. Rodgers, UCSF School of Pharmacy, San
Francisco, CA 94143.
Funky_Stuff
len=`wc -c < calctool.1`
if [ $len !=     8467 ] ; then
echo error: calctool.1 was $len bytes long, should have been     8467
fi
fi # end of overwriting check
if [ -f news.ps ]
then
echo shar: will not over-write existing file news.ps
else
echo shar: extracting 'news.ps',     8282 characters
cat > news.ps <<'Funky_Stuff'

%  news.ps
%
%  These are the NeWS dependent graphics routines used by calctool.
%
%  Copyright (c) Rich Burridge - May 1988.
%                Sun Microsystems, Australia - All rights reserved.
%
%  Version 2.2.
%
%  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.
%

/edef { exch def } def

/PSClearCanvas      % color canvas => -
{
  2 dict begin
    /Canvas edef
    /Index edef

    gsave
      Canvas setcanvas
      ColorTable Index get
      fillcanvas
    grestore
  end
} def


/PSCloseFrame      % - => -
{
  /flipiconic CFrame send
  /unmap RFrame send
} def


/PSDrawBox           % x y width height => -
{
  /BoxHeight edef
  /BoxWidth edef
  /BoxY edef
  /BoxX edef

  KC setcanvas
  /BoxY KCHeight BoxY sub 5 sub def
  gsave
    newpath
    BoxX BoxY moveto
    BoxX BoxWidth add BoxY lineto
    BoxX BoxWidth add BoxY BoxHeight sub lineto
    BoxX BoxY BoxHeight sub lineto
    closepath
    0 setgray
    stroke
  grestore
} def


/PSDrawRegs
{
  /map RFrame send
} def


/PSFillBox    % x y canvas canvasheight width height boundry color => -
{
  8 dict begin
    /ColorIndex edef
    /BoxBoundry edef
    /BoxHeight edef
    /BoxWidth edef
    /BoxCanvasHeight edef
    /BoxCanvas edef
    /BoxY edef
    /BoxX edef

    BoxCanvas setcanvas
    /BoxY BoxCanvasHeight BoxY sub 5 sub def
    gsave
      BoxBoundry 1 eq
        {
          BoxX BoxY BoxHeight sub 1 sub BoxWidth 1 add BoxHeight 1 add rectpath
          1 setgray fill
          BoxX 1 add BoxY BoxHeight sub
          BoxWidth 1 sub BoxHeight 1 sub rectpath
          ColorTable ColorIndex get setcolor
          fill
        }
        {
          BoxX BoxY BoxHeight sub 1 sub BoxWidth 1 add BoxHeight 1 add rectpath
          ColorTable ColorIndex get setcolor
          fill
        } ifelse
    grestore
  end
} def


/PSInitFonts     % - => -
{
  /SFont /Courier findfont 7 scalefont def
  /NFont /Courier-Bold findfont 14 scalefont def
  /BFont /Courier-Bold findfont 18 scalefont def
} def


/PSInitialise   % - => -
{
  /CFRAME_REPAINT_EVENT 100 def
  /RFRAME_REPAINT_EVENT 101 def
  /LEFT_DOWN_EVENT      102 def
  /LEFT_UP_EVENT        103 def
  /MIDDLE_DOWN_EVENT    104 def
  /MIDDLE_UP_EVENT      105 def
  /KEYBOARD_EVENT       106 def
} def


/PSIsColor      % - => iscolorscreen
{
  /Color? framebuffer /Color get def
  Color? {1} {0} ifelse typedprint
} def


/PSLoadColor       % red green blue index => -
{
  /ColorIndex edef
  /BlueValue edef
  /GreenValue edef
  /RedValue edef

  /CColor RedValue 255 div GreenValue 255 div BlueValue 255 div rgbcolor def
  ColorTable ColorIndex CColor put
} def


/PSMakeColorTable  % size => -
{
  /TableSize edef

  /ColorTable TableSize array def
} def


/PSMakeFrames      % x y width height => -
{
  /CFrameHeight edef
  /CFrameWidth edef
  /CFrameY edef
  /CFrameX edef

  clippath pathbbox /ScreenHeight edef pop pop pop
  /CFrame framebuffer /new DefaultWindow send def
    {
      /PaintClient
        {
          CFRAME_REPAINT_EVENT typedprint
        } def
      /PaintIcon
        {
          gsave
            IconCanvas setcanvas
            clippath pathbbox
            scale pop pop
            0 setgray fill
            1 1 1 setrgbcolor
            false CalctoolIcon imagemaskcanvas
          grestore
        } def
    } CFrame send
  CFrame /BorderLeft 5 put
  CFrame /BorderBottom 5 put
  CFrame /BorderRight 5 put
  CFrame /BorderTop 5 put
  CFrame /ControlSize 0 put
  CFrameX
  ScreenHeight CFrameHeight sub CFrameY sub
  CFrameWidth 10 add CFrameHeight /reshape CFrame send
  /map CFrame send

  /RFrame framebuffer /new DefaultWindow send def
    {
      /PaintClient
        {
          RFRAME_REPAINT_EVENT typedprint
        } def
      /PaintIcon
        {
          gsave
            IconCanvas setcanvas
            1 fillcanvas
            0 strokecanvas
            NFont setfont
            5 40 moveto (Memory) show
            10 20 moveto (Regs.) show
          grestore
        } def
    } RFrame send
  RFrame /BorderLeft 5 put
  RFrame /BorderBottom 5 put
  RFrame /BorderRight 5 put
  RFrame /BorderTop 5 put
  RFrame /ControlSize 0 put
  CFrameX CFrameWidth add 25 add
  ScreenHeight 200 sub CFrameY sub
  CFrameWidth 200 /reshape RFrame send
} def


/PSMakeIcons    % - => -
{
  /CalctoolIcon 42 64 1 { } { <
    1555 5555 5540 2AAA AAAA AA80
    5555 5555 5540 FFFF FFFF FE80
    8000 0000 0340 BFFF FFFF FA80
    A000 0000 0B40 A000 0000 0A80
    A003 0030 CB40 A004 8049 2A80
    A005 8059 6B40 A006 8069 AA80
    A004 8449 2B40 A003 0430 CA80
    A000 0000 0B40 A000 0000 0A80
    BFFF FFFF FB40 8000 0000 0280
    8000 0000 0340 BFDF EFF7 FA80
    A050 2814 0B40 AF53 2994 0A80
    A154 AA55 1340 A253 2A54 AA80
    A254 A9D4 4B40 A454 A854 AA80
    A453 2995 1B40 A050 2814 0A80
    BFDF EFF7 FB40 8000 0000 0280
    BFDF EFF7 FB40 A050 2814 0A80
    A257 A994 2B40 A654 2A14 4A80
    AA57 2B94 4B40 AF50 AA54 8A80
    A254 AA54 8B40 A253 2995 0A80
    A050 2814 0B40 BFDF EFF7 FA80
    8000 0000 0340 BFDF EFF7 FA80
    A050 2814 0B40 A253 2994 0A80
    A654 AA54 0B40 A250 A895 EA80
    A253 2854 0B40 A254 2A54 0A80
    A757 A994 0B40 A050 2814 0A80
    BFDF EFF7 FB40 8000 0000 0280
    BFDF EFF7 FB40 A050 2814 0A80
    A650 2814 0B40 A950 2814 4A80
    AB50 2BD4 4B40 AD50 2815 FA80
    A951 2BD4 4B40 A651 2814 4A80
    A050 2814 0B40 BFDF EFF7 FA80
    8000 0000 0300 FFFF FFFF FE00
    > } buildimage def
} def


/PSMakePanel     % x y width height => -
{
  /PCHeight edef
  /PCWidth edef
  /PCX edef
  /PCY edef

  gsave
    CCanvas setcanvas
    /PC currentcanvas newcanvas def
    PC
      begin
        /Transparent false def
        /Mapped true def
        /Retained true def
      end
    PC
    0 CFrameHeight PCHeight sub translate
    PCX PCY moveto PCWidth PCHeight rect reshapecanvas
    PC setcanvas
    1 fillcanvas
    0 strokecanvas
  grestore
} def


/PSMakeSubCanvas     % x y width height => -
{
  /KCHeight edef
  /KCWidth edef
  /KCY edef
  /KCX edef

  gsave
    CCanvas setcanvas
    /KC currentcanvas newcanvas def
    KC
      begin
        /Transparent false def
        /Mapped true def
        /Retained true def
      end
    KC
    0 0 moveto KCWidth KCHeight rect reshapecanvas
  grestore
} def


/PSMakeSubframes   % panelheight => -
{
  /PCHeight edef

  /CCanvas CFrame /ClientCanvas get def
  /RC RFrame /ClientCanvas get def

  0 0 CFrameWidth PCHeight PSMakePanel
  0 PCHeight 10 sub
  CFrameWidth CFrameHeight PCHeight sub 10 sub PSMakeSubCanvas
  /RCHeight 200 def
  /RCWidth CFrameWidth def

  /SendEvent
    {
      KC setcanvas
      typedprint
      currentcursorlocation KCHeight exch sub exch
      typedprint typedprint
    } def

  /KbdEvent
    {
      begin
        Action /DownTransition eq
          {
            KEYBOARD_EVENT typedprint Name SendEvent
          } if
      end
    } def

  /EventMgrKbdInterest
    {
      [3 1 roll] { MakeEventMgrKbdInterest} append cvx
    } def

  /MakeEventMgrKbdInterest
    {
      addkbdinterests
      { /ClientData 10 dict dup /CallBack 5 index put put } forall
      pop
    } def

  /DownEventInterest {/DownTransition KC eventmgrinterest} def

  /UpEventInterest   {/UpTransition   KC eventmgrinterest} def

  /EventMgr
    [
      LeftMouseButton   {LEFT_DOWN_EVENT   SendEvent} DownEventInterest
      MiddleMouseButton {MIDDLE_DOWN_EVENT SendEvent} DownEventInterest

      LeftMouseButton   {LEFT_UP_EVENT     SendEvent} UpEventInterest
      MiddleMouseButton {MIDDLE_UP_EVENT   SendEvent} UpEventInterest
      { KbdEvent } KC EventMgrKbdInterest
    ] forkeventmgr def
} def


/PSMakeText    % canvas canvasheight font x y color string => -
{
  /TextString edef
  /TextColor edef
  /TextY edef
  /TextX edef
  /TextFont edef
  /TextCanvasHeight edef
  /TextCanvas edef

  /TextFontHeight TextFont fontheight def
  /Y TextCanvasHeight TextY sub 5 sub def
  TextCanvas setcanvas
  TextFont setfont
  ColorTable TextColor get setcolor
  TextX Y moveto TextString show
} def

 
/PSSetCursor   % type => -
{
} def


/PSToggleRegCanvas   % state => -
{
  /RState edef

  RState 1 eq {/map RFrame send} {/unmap RFrame send} ifelse
} def
Funky_Stuff
len=`wc -c < news.ps`
if [ $len !=     8282 ] ; then
echo error: news.ps was $len bytes long, should have been     8282
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',      436 characters
cat > patchlevel.h <<'Funky_Stuff'
 
/*  patchlevel.h
 *
 *  This is the current patch level for this version of calctool.
 *
 *  Copyright (c) Rich Burridge - May 1988.
 *		Sun Microsystems, Australia - All rights reserved.
 *
 *  Version 2.2.
 *
 *  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  1
Funky_Stuff
len=`wc -c < patchlevel.h`
if [ $len !=      436 ] ; then
echo error: patchlevel.h was $len bytes long, should have been      436
fi
fi # end of overwriting check