mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (06/30/89)
Submitted-by: chuck@melmac.harris-atd.com (Chuck Musciano) Posting-number: Volume 1, Issue 38 Archive-name: calctool/part01 #! /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 (not csh) to create the files: # README # Makefile # calc.b.14.uu # calc.r.7.uu # calc.icon # calctool.man # display.c # globals.c # globals.h # This archive created: Thu Jun 29 21:58:20 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(1133 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else sed 's/^ X//' << \SHAR_EOF > 'README' XCalctool -- A scientific/programmer's calculator for Sun workstations X X Calctool is a windowed calculator suitable for Suns running SunOS X3.0 or higher, utilizing SunWindows and SunTools. The code is relatively Xstraightforward, and requires minimal modification to compile on most any XSun system. X X A glance at the Makefile will show that you should make sure that FONTDIR, XBINDIR, MANDIR, and MANEXT are correct for your site before making calctool. X X Calctool needs the font /usr/lib/fonts/fixedwidthfonts/gallant.r.19, Xso make sure that this font exists. X X The man page should explain most things. Calctool is loosely based upon XTI-type calculators, and uses an "Inverse" key to switch to alternate key Xfunctions. Calctool allows alternate functions to be reached directly by Xselecting keys with the middle mouse button, rather than the left mouse button. XRead the man page for more details. X X Enjoy, and please send any bugs or comments to X X Chuck Musciano X Advanced Technology Department X Harris Corporation X PO Box 37, MS 3A/1912 X Melbourne, FL 32902 X X (305) 727-6131 X ARPA: chuck@trantor.harris-atd.com SHAR_EOF if test 1133 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 1133 characters)' fi fi # end of overwriting check echo shar: extracting "'Makefile'" '(1039 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^ X//' << \SHAR_EOF > 'Makefile' X# where you keep local fonts, if any XFONTDIR = . X X# where you keep local executables XBINDIR = /usr/local/bin X X# man directory for local man pages (usually /usr/man/manl) XMANDIR = /usr/man/manl XMANEXT = l X XOFILES = display.o globals.o memory.o ops.o screen.o XFONTS = $(FONTDIR)/calc.b.14 $(FONTDIR)/calc.r.7 X XWINDOW_LIB = -lsuntool -lsunwindow -lpixrect XMATH = -lm X X.c.o: X cc -O -c -DKEY_FONT=\"$(FONTDIR)/calc.b.14\" -DSTATUS_FONT=\"$(FONTDIR)/calc.r.7\" $*.c X Xcalctool: $(FONTS) $(OFILES) X cc -o calctool $(OFILES) $(WINDOW_LIB) $(MATH) X X$(FONTDIR)/calc.b.14: calc.b.14.uu X uudecode < calc.b.14.uu X mv temp $(FONTDIR)/calc.b.14 X X$(FONTDIR)/calc.r.7: calc.r.7.uu X uudecode < calc.r.7.uu X mv temp $(FONTDIR)/calc.r.7 X Xinstall: calctool X cp calctool $(BINDIR) X cp calctool.man $(MANDIR)/calctool.$(MANEXT) X Xclean: X rm *.o core X X# dependencies X Xdisplay.o: manifest.h globals.h keys.h X Xglobals.o: manifest.h globals.h X Xmemory.o: manifest.h globals.h X Xops.o: manifest.h globals.h keys.h X Xscreen.o: manifest.h globals.h keys.h calc.icon SHAR_EOF if test 1039 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 1039 characters)' fi fi # end of overwriting check echo shar: extracting "'calc.b.14.uu'" '(10805 characters)' if test -f 'calc.b.14.uu' then echo shar: will not over-write existing file "'calc.b.14.uu'" else sed 's/^ X//' << \SHAR_EOF > 'calc.b.14.uu' Xbegin 644 temp XM 1X4B ) !( "0-!0 ) D ) D#04 "0 ) $@ ) T% D "0!L "0- XM!0 ) D D D#04 "0 ) +0 ) T% D "0#8 "0-!0 ) D _ D#04 "0 ) XM 2 ) T% D "0%$ "0-!0 ) D!: D#04 "0 ) 8P ) T% D "0&P "0- XM!0 ) D!U D#04 "0 ) ?@ ) T% D "0(< "0-!0 ) D"0 D#04 "0 ) XM F0 ) T% D "0*( "0-!0 ) D"K D#04 "0 ) M ) T% D "0+T "0- XM!0 ) D#& D#04 "0 ) SP ) T% D "0-@ "0-!0 ) D#A D#04 "0 ) XM Z@ ) T% D "0/, "0-!0 ) D#\ D#04 "0 )!!0 ) T% D "00X "0- XM!0 ) D$7 D#04 "0 )!( ) T% D "02D "0-!0 ) D$R D#04 "0 ) XM!.P ) T% D "040 "0-!0 ) D%- D#04 "0 )!5@ ) T% D "05\ "0- XM!0 ) D%H D#04 "0 )!<0 ) T% D "07H "0-!0 ) D&# D#04 "0 ) XM!C ) T% D "094 "0-!0 ) D&> D#04 "0 )!IP ) T% D "0; "0- XM!0 ) D&Y D#04 "0 )!P@ ) T% D "0<L "0-!0 ) D'4 D#04 "0 ) XM!W0 ) T% D "0>8 "0-!0 ) D'O D#04 "0 )!^ ) T% D "0@$ "0- XM!0 ) D(* D#04 "0 )"$P ) T% D "0AP "0-!0 ) D(E D#04 "0 ) XM"+@ ) T% D "0C< "0-!0 ) D) D#04 "0 )"20 ) T% D "0E( "0- XM!0 ) D); D#04 "0 )"9 ) T% D "0FT "0-!0 ) D)V D#04 "0 ) XM"?P ) T% D "0H@ "0-!0 ) D*1 D#04 "0 )"F@ ) T% D "0J, "0- XM!0 ) D*L D#04 "0 )"M0 ) T% D "0KX "0-!0 ) D+' D#04 "0 ) XM"T ) T% D "0MD "0-!0 ) D+B D#04 "0 )"ZP ) T% D "0O0 "0- XM!0 ) D+] D#04 "0 )#!@ ) T% D "0P\ "0-!0 ) D,8 D#04 "0 ) XM#(0 ) T% D "0RH "0-!0 ) D,S D#04 "0 )#/ ) T% D "0T4 "0- XM!0 ) D-. D#04 "0 )#5P ) T% D "0V "0-!0 ) D-I D#04 "0 ) XM#<@ ) T% D "0WL "0-!0 ) D.$ D#04 "0 )#C0 ) T% D "0Y8 "0- XM!0 ) D.? D#04 "0 )#J ) T% D "0[$ "0-!0 ) D.Z D#04 "0 ) XM#PP ) T% D "0\P "0-!0 ) D/5 D#04 "0 )#W@ ) T% D "0^< "0- XM!0 ) D/P D#04 "0 )#^0 ) T% D "1 ( "0-!0 ) D0+ D#04 "0 ) XM$% ) T% D "1!T "0-!0 ) D0F D#04 "0 )$+P ) T% D "1#@ "0- XM!0 ) D1! D#04 "0 )$2@ ) T% D "1%, "0-!0 ) D1< D#04 "0 ) XM$90 ) T% D "1&X "0-!0 ) D1W D#04 "0 )$@ ) T% D "1(D "0- XM!0 ) D22 D#04 "0 )$FP ) T% D "1*0 "0-!0 ) D2M D#04 "0 ) XM$M@ ) T% D "1+\ "0-!0 ) D3( D#04 "0 )$T0 ) T% D "1-H "0- XM!0 ) D3C D#04 "0 )$[ ) T% D "1/4 "0-!0 ) D3^ D#04 "0 ) XM%!P ) T% D "11 "0-!0 ) D49 D#04 "0 ) XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM #@ XM. X #@ . X #@ . X #@ . X #@ . X #@ . #@ . X #@ . X XM #@ . X #@ . X #@ . X #@ . #@ . X #@ . X #@ . X #@ XM. X #@ . X #@ . #@ . X #@ . X #@ . X #@ . X #@ . X XM #@ . #@ . X #@ . X #@ . X #@ . X #@ . X #@ . XM XM XM #\ 'X _ !^ /P ?@#\ 'X _ !^ /P ?@#\ 'X _ !^ XM /P ?@#^ /X _@#^ /X _@#^ /X _@#^ /X _@#^ /X _@#^ /X _@ X #@ XM. X #@ . X #@ . X #@ . X #@ . X #@ . X #@ . X #@ . X XM #@ . X #@ . X #@ . X #@ . XM XM XM XM XM XM XM XM XM #@ . X #@ . X #@ . X #@ . X #@ . X XM #@ . #@ . X #@ . X #@ . X #@ . X #@ . X #@ . #@ XM. X #@ . X #@ . X #@ . X #@ . X #@ . #@ . X #@ . X XM #@ . X #@ . X #@ . X #@ . #@ . X #@ . X #@ . X #@ XM. X #@ . X #@ . #@ . X #@ . X #@ . X #@ . X #@ . X XM #@ . 'X XM_ !^ /P ?@#\ 'X _ !^ /P ?@#\ 'X _ !^ /P ?@ XM !@ & 8 !@ & 8 !@ XM 8 !@ #8 -@ V #8 XM !L &P ; '^ -@ V /\ ; !L &P XM ( #X :P!K &L . . &L :P!K #X " '8 E@"< XM .P & 8 #< .0!I &X #@ ; !L #@ , ![ -X XMS #< '< P # 8 # XM & P & 8 # , P # , 8 !@ # & XM P !@ # , 8 !@ & 8 !@ , P & P & !: XM 'X / !^ %H & & 8 !@ _P#_ !@ XM& 8 8 !@ " 0 XM " ?P!_ XM 8 !@ # 8 !@ , XM P & 8 # , !@ & P #X 8P!G &< :P!K ', XM<P!C #X P ' \ P # , P # , #\ XM #X 8P!C , !@ , !@ , !A '\ XM #X 8P!C , '@ ' , 8P!C #X ( !@ . XM !X -@!F ,8 _P & 8 '\ 8 !@ 'X P # , XM8P!C #X #X 8P!@ & ?@!C &, 8P!C #X XM '\ 0P!# 8 !@ , P & 8 !@ XM #X 8P!C &, /@!C &, 8P!C #X #X 8P!C XM &, 8P _ , P!C #X !@ & XM 8 !@ !@ & 8 !@ " 0 XM " # 8 # 8 # 8 P !@ # & , XM !_ '\ '\ ?P !@ # & , XM 8 P & P & P & #X 8P!C , !@ , P XM , P !P -@!C &\ :P!K &X 8 S !X XM @ ' < #8 -@ V &, ?P!C &, XM 'P 9@!F &8 ? !F &, 8P!C 'X #X 8P!C XM & 8 !@ & 8P!C #X 'P 9@!C &, 8P!C &, XM8P!F 'P '\ 8 !@ & ?@!@ & 8 !@ '\ XM '\ 8 !@ & ?@!@ & 8 !@ & XM #X 8P!C & 8 !G &, 8P!G #T &, 8P!C XM &, ?P!C &, 8P!C &, 'X & 8 !@ & 8 !@ XM& 8 'X !\ !@ & 8 !@ & 8 9@!F #P XM &, 9@!L '@ ? !L &8 9@!C &, XM & 8 !@ & 8 !@ & 8 !@ '\ ,, PP#G XM .< _P#; -L PP## ,, &, 8P!S ', >P!K &\ XM9P!G &, #X 8P!C &, 8P!C &, 8P!C #X XM 'X 8P!C &, 8P!^ & 8 !@ & XM #X 8P!C &, 8P!C &, 8P!C #X & , < 'X 8P!C XM &, ?@!L &8 9@!C &, #X 8P!C # ' & , XM8P!C #X /\ & 8 !@ & 8 !@ & 8 !@ XM &, 8P!C &, 8P!C &, 8P!C #X XM &, 8P!C #8 -@ V !P ' ( @ ,& R8#) XM@-V 70!W '< -@ B "( &, 8P V #8 ' < #8 XM-@!C &, ,, PP!F &8 / 8 !@ & 8 !@ XM '\ P # 8 # 8 # 8 !@ '\ XM ^ # , P # , P # , P # , ^ # & 8 P XM # & 8 P # & 8 P ^ 8 !@ & 8 !@ & 8 XM!@ & 8 !@ ^ @ ' V &, XM _P#_ XM # , 8 P XM #P 9@ & #X 9@!F #\ & 8 !@ &X <P!C &, XM8P!S &X #X 8P!@ & 8 !C #X XM , P # #L 9P!C &, 8P!G #L XM #X 8P!C '\ 8 !C #X X &P 8 XM !@ ?@ 8 !@ & 8 !@ #L 9P!C &, XM8P!G #L P!C #X & 8 !@ &X <P!C &, 8P!C &, XM P # #P # , P # , P XM 8 !@ !X !@ & 8 !@ & 8 !@!F #P & 8 !@ XM &8 ; !X '@ ; !F &, #P # , P # , P XM# , P +8 VP#; -L VP#; -L XM %X <P!C &, 8P!C &, XM #X 8P!C &, 8P!C #X XM &X <P!C &, 8P!S &X 8 !@ & 8 #L 9P!C &, XM8P!G #L P # , P &X >P!@ & 8 !@ & XM #X 8P!@ #X P!C #X XM !@ & 8 'X & 8 !@ & ; X XM &, 8P!C &, 8P!G #L &, 8P V #8 XM' < @ ,, PP#; -L VP#; 'X XM &8 9@ \ !@ / !F &8 XM &, 8P S #8 %@ < P # !( '@ , XM '\ !@ , !@ , !@ '\ / !@ & 8 !@ & !P !@ XM& 8 !@ & / 8 !@ & 8 !@ & !@ & 8 !@ & 8 XM !X P # , P # ' P # , P # !X XM .P!_ &X #P -@ V #P XM -@ V X &P ; !L &P . &8 9@ \ !@ / !F &8 XM #_ /\ &8 9@ \ !@ / !F &8 XM @ " 8 !@ , P!F &8 / \ !@ & !$ &P XM. X@&R 18 !@ , P!F &8 / \ !@ & #_@/^ XM &, 8P S #8 %@ < P # !( '@ , 8 #@#F .8 !@ & \ XM #@ ; , !@ , !@ 'P XM 0!_ /X 9@!F &8 9@!F &8 P XM' , P # , !X ( !@ , !@ , !@ , @ , !@ , !@ , !@ XM , @ S #, '@ , !X ,P S !@ & 8 /\ _P 8 !@ &( !@ , XM!@ , !@ , !@ $ , !@ , !@ , !@ , @ '\ ?P XM & 8 _P#_ & 8 XM ? #\ < !@ & 8 !@ &0 9@!S #^ 'X # 8 ! 0 # 8 #\ /X 9P S XM !, P # , P ' 'X ? $ 8 P ?@#^ <P!F &0 8 !@ & XM8 !P #\ 'P !\ 'X !P # , P # !, ,P!G /X _ !@ XI # $ # , P ?X!_@ P # , '^ ?X X Xend SHAR_EOF if test 10805 -ne "`wc -c < 'calc.b.14.uu'`" then echo shar: error transmitting "'calc.b.14.uu'" '(should have been 10805 characters)' fi fi # end of overwriting check echo shar: extracting "'calc.r.7.uu'" '(5073 characters)' if test -f 'calc.r.7.uu' then echo shar: will not over-write existing file "'calc.r.7.uu'" else sed 's/^ X//' << \SHAR_EOF > 'calc.r.7.uu' Xbegin 644 temp XM 1X$2 & @ @& @ & 8 " (!@( !@ & ! " 8" 8 !@ 8 @& XM @ & 8 ( (!@( !@ & "@ " 8" 8 !@ P @& @ & 8 . (!@( !@ & XM $ " 8" 8 !@!( @& @ & 8 4 (!@( !@ & %@ " 8" 8 !@!@ @& XM @ & 8 : (!@( !@ & ' " 8" 8 !@!X @& @ & 8 @ (!@( !@ & XM (@ " 8" 8 !@"0 @& @ & 8 F (!@( !@ & * " 8" 8 !@"H @& XM @ & 8 L (!@( !@ & +@ " 8" 8 !@# @& @ & 8 R (!@( !@ & XM - " 8" 8 !@#8 @& @ & 8 X (!@( !@ & .@ " 8" 8 !@#P @& XM @ & 8 ^ (!@( !@ & 0 " 8" 8 !@$( @& @ & 8!$ (!@( !@ & XM 1@ " 8" 8 !@$@ @& @ & 8!* (!@( !@ & 3 " 8" 8 !@$X @& XM @ & 8!0 (!@( !@ & 4@ " 8" 8 !@%0 @& @ & 8!6 (!@( !@ & XM 6 " 8" 8 !@%H @& @ & 8!< (!@( !@ & 7@ " 8" 8 !@& @& XM @ & 8!B (!@( !@ & 9 " 8" 8 !@&8 @& @ & 8!H (!@( !@ & XM :@ " 8" 8 !@&P @& @ & 8!N (!@( !@ & < " 8" 8 !@'( @& XM @ & 8!T (!@( !@ & =@ " 8" 8 !@'@ @& @ & 8!Z (!@( !@ & XM ? " 8" 8 !@'X @& @ & 8" (!@( !@ & @@ " 8" 8 !@(0 @& XM @ & 8"& (!@( !@ & B " 8" 8 !@(H @& @ & 8", (!@( !@ & XM C@ " 8" 8 !@) @& @ & 8"2 (!@( !@ & E " 8" 8 !@)8 @& XM @ & 8"8 (!@( !@ & F@ " 8" 8 !@)P @& @ & 8"> (!@( !@ & XM H " 8" 8 !@*( @& @ & 8"D (!@( !@ & I@ " 8" 8 !@*@ @& XM @ & 8"J (!@( !@ & K " 8" 8 !@*X @& @ & 8"P (!@( !@ & XM L@ " 8" 8 !@+0 @& @ & 8"V (!@( !@ & N " 8" 8 !@+H @& XM @ & 8"\ (!@( !@ & O@ " 8" 8 !@, @& @ & 8#" (!@( !@ & XM Q " 8" 8 !@,8 @& @ & 8#( (!@( !@ & R@ " 8" 8 !@,P @& XM @ & 8#. (!@( !@ & T " 8" 8 !@-( @& @ & 8#4 (!@( !@ & XM U@ " 8" 8 !@-@ @& @ & 8#: (!@( !@ & W " 8" 8 !@-X @& XM @ & 8#@ (!@( !@ & X@ " 8" 8 !@.0 @& @ & 8#F (!@( !@ & XM Z " 8" 8 !@.H @& @ & 8#L (!@( !@ & [@ " 8" 8 !@/ @& XM @ & 8#R (!@( !@ & ] " 8" 8 !@/8 @& @ & 8#X (!@( !@ & XM ^@ " 8" 8 !@/P @& @ & 8#^ (!@( !@ &! " 8" 8 !@0( @& XM @ & 8$$ (!@( !@ &!!@ " 8" 8 !@0@ @& @ & 8$* (!@( !@ & XM!# " 8" 8 !@0X @& @ & 8$0 (!@( !@ & XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM ?$141'P ! 0$%0X$ T2$@T 8)#@D)#@@ 0*$0 XM !\! 0 '" X(!P !\*"@H) 0" 0*$1$ "J5:I5JE6J5?______ XM____P,# P,# P, # P,# P,# SA 6%0X%!0 "A45%0H P"!PD)!@ \ XM0$ \ '@$!'@ 8)"0D)"0 "0D)"0D& 1$1\1"@0 !\!!P$!'P XM X5&Q4. H?"@ !\ 0"'P($ "!4" $"'P0 XM?"! ($" 0"#P ! (! @0/ ? !\ 'P !$*! 0 XM$! 0 ! "@H* *'PH*'PH 0/% X%'@0 'QD"! L3 ,% @5$AT XM ("! ! @0$! (! (! (" @0( 5#AL.%0 0$'P0$ XM ! 0( !X 0$ "! 0("! P2%AH2# ! P$! 0. XM,$@(,$!X P2! (2# ! P4'@0$ >$!P"$@P P0'!(2# '@($! @ XM( ,$@P2$@P P2$@X"# 0$ 0$ " @ " @0 "! @$ @ XM> !X " 0"! @ P2 @P " #A$7%Q . ,$A(>$A( !P2'!(2' XM #!(0$!(, <$A(2$AP !X0'! 0'@ 'A <$! 0 ,$A 6$@P !(2'A( XM2$@ #@0$! 0. . @("$@P !$2%!P2$0 $! 0$! > 1&Q45$1$ !$ XM9%1,1$0 #!(2$A(, <$A(<$! X1$143#@$ '!(2'!02 ,$@@$$@P XM !\$! 0$! $A(2$A(, 1$1$*"@0 !$1%14;$0 $0H$"A$1 1$0X XM$! 0 !X"! @0'@ #@@(" @(#@ 0" @$! ( X" @(" @X ! H1 XM > 0$ @ P"#A(* 0'!(2$AP .$! 0#@ @X2$A( XM. #!(<$ X 8(' @(" X2$@X"' 0%!H2$A( 0 # 0$! ! XM,! 0$& 0$A08%!( P$! 0$! !H5%145 %!H2$A( ,$A(2# XM !0:$AH4$ "A82%@H" 4&A 0$ X0# (< ('@@(" 8 2$A( XM6"@ !$1"@H$ $1$5%0H 1"@0*$0 !(2$@X"' '@($"!X 8 XM("! (" 8 ! 0$! 0$! 8! 0"! 08 (%0( 'Q\?'Q\?'P )$B0D$@D XM "02"0D2) '"(B)R(8 .$1$Y$0( !0Z$0$Z! 0 'P $ % @4 X5H*!@(,"@1*0(:"@0 #X %!0,!!@ X Xend SHAR_EOF if test 5073 -ne "`wc -c < 'calc.r.7.uu'`" then echo shar: error transmitting "'calc.r.7.uu'" '(should have been 5073 characters)' fi fi # end of overwriting check echo shar: extracting "'calc.icon'" '(1485 characters)' if test -f 'calc.icon' then echo shar: will not over-write existing file "'calc.icon'" else sed 's/^ X//' << \SHAR_EOF > 'calc.icon' X/* Format_version=1, Width=48, Height=64, Depth=1, Valid_bits_per_item=16 X */ X 0xBFFF,0xFFFF,0xFFFA,0x6000,0x0000,0x000C, X 0xC000,0x0000,0x0006,0x8000,0x0000,0x0002, X 0x8FFF,0xFFFF,0xFFE2,0x8800,0x0000,0x0022, X 0x884E,0xEAEE,0xEE22,0x8842,0x2A88,0x2A22, X 0x884E,0x6EEE,0x2E22,0x8848,0x222A,0x2A22, X 0x884E,0xE2EE,0x2E22,0x8800,0x0000,0x0022, X 0x8FFF,0xFFFF,0xFFE2,0x8000,0x0000,0x0002, X 0x8000,0x0000,0x0002,0x8000,0x0000,0x0002, X 0x8FFB,0xFEFF,0xBFE2,0x880A,0x0280,0xA022, X 0x89CA,0x729C,0xA8A2,0x884A,0x5294,0xA522, X 0x884A,0x729C,0xA222,0x884A,0x5284,0xA522, X 0x884A,0x729C,0xA8A2,0x880A,0x0280,0xA022, X 0x8FFB,0xFEFF,0xBFE2,0x8000,0x0000,0x0002, X 0x8000,0x0000,0x0002,0x8FFB,0xFEFF,0xBFE2, X 0x880A,0x0280,0xA022,0x894A,0x729C,0xA222, X 0x894A,0x4290,0xA022,0x89CA,0x729C,0xAFA2, X 0x884A,0x1294,0xA022,0x884A,0x729C,0xA222, X 0x880A,0x0280,0xA022,0x8FFB,0xFEFF,0xBFE2, X 0x8000,0x0000,0x0002,0x8000,0x0000,0x0002, X 0x8FFB,0xFEFF,0xBFE2,0x880A,0x0280,0xA022, X 0x888A,0x729C,0xA222,0x888A,0x1284,0xA222, X 0x888A,0x728C,0xAFA2,0x888A,0x4284,0xA222, X 0x888A,0x729C,0xA222,0x880A,0x0280,0xA022, X 0x8FFB,0xFEFF,0xBFE2,0x8000,0x0000,0x0002, X 0x8000,0x0000,0x0002,0x8FFB,0xFEFF,0xBFE2, X 0x880A,0x0280,0xA022,0x89CA,0x7280,0xA022, X 0x890A,0x529C,0xA022,0x890A,0x5280,0xAFA2, X 0x890A,0x529C,0xA022,0x89CA,0x7280,0xA022, X 0x880A,0x0280,0xA022,0x8FFB,0xFEFF,0xBFE2, X 0x8000,0x0000,0x0002,0x8000,0x0000,0x0002, X 0x8000,0x0000,0x0002,0x4000,0x0000,0x0004, X 0xA000,0x0000,0x000A,0x5FFF,0xFFFF,0xFFF4 SHAR_EOF if test 1485 -ne "`wc -c < 'calc.icon'`" then echo shar: error transmitting "'calc.icon'" '(should have been 1485 characters)' fi fi # end of overwriting check echo shar: extracting "'calctool.man'" '(7307 characters)' if test -f 'calctool.man' then echo shar: will not over-write existing file "'calctool.man'" else sed 's/^ X//' << \SHAR_EOF > 'calctool.man' X.TH CALCTOOL 1 "21 November 1986" X.SH NAME Xcalctool \- desktop calculator X.SH SYNOPSIS X\fBcalctool\fP X.SH DESCRIPTION X.LP X\f2Calctool\fP is desktop calculator which runs under \f2suntools\fP(1). XUsers interact with \f2calctool\fP using the mouse and keyboard as Xdescribed below. \f2Calctool\fP honors the standard window command line Xoptions. X.LP X\f2Calctool\fP can be used as a scientific calculator, providing the Xstandard trigonometric and transcendental functions, or it can be used as Xa programmer's calculator, allowing bitwise manipulation of binary, octal, Xand hexadecimal values. All internal values in \f2calctool\fP are maintained Xusing double precision floating point. X.SH "USER INTERFACE" X.sp X.SH "The Display" X.LP X\f2Calctool\fP presents the user with a keyboard and a display area. The Xdisplay area displays the results of calculations, and a status line Xshowing information about the current mode of \f2calctool\fP. The left portion Xof the status line displays the operator stack, allowing the user to track Xpending operations as \f2calctool\fP stacks them. The middle of the display Xline shows the current trigonometric mode, either \*(lqDeg\*(rq, \*(lqRad\*(rq, Xor \*(lqGrad\*(rq. To the right of the trigonometric mode, either \*(lqEE\*(rq Xor \*(lqEng\*(rq will appear when the calculator is in scientific exponential Xor engineering exponential mode. The right portion shows the current display precision, Xindicating the number of decimal digits shown (in scientific mode) or the Xnumber of bits shown (in programmer mode). X.LP XIn scientific or enigneering mode, the value in the display is presented in fixed point notation if it Xis small enough, or is converted to scientific notation if not. In programmer Xmode, the value is presented as a bit string in the appropriate base. The X\f3Fix\fP and \f3EE\fP keys, below, control the precision and format of the display. X.SH "The Keyboard" X.LP XThe various keys on the keyboard are, for the most part, self-explanatory. XKeys are \*(lqpressed\*(rq by clicking the left mouse button on the key. XSome keys also have inverted functions, which are accessed by first Xclicking the \f3Inverse\fP key, and then clicking the desired inverse Xfunction. Clicking the \f3Inverse\fP key causes the inverse functions Xto be displayed. Those keys without inverse functions are grayed out. X.LP XA shortcut method is provided to access inverse functions. Clicking the Xmiddle button on a key accesses its inverse function directly, without Xpressing the \f3Inverse\fP key first. Pressing and holding the middle button Xon a key will preview its inverse function; releasing the middle button Xwill activate the inverse function. X.LP XSeveral keys on the keyboard have special functions associated with them. XThese keys are: X.IP "\f3Sto\fP, \f3Rcl\fP, \f3Exc\fP" XWhen accessed with the left button, these keys access memory 0 of \f2calctool\fP. XIf more memories are desired, they can be accessed by pressing the right Xbutton on the desired key. A menu will pop up, showing the various memories Xcurrently in use. In the case of the \f3Rcl\fP or \f3Exc\fP keys, selecting a memory Xwill cause that memory to be recalled to, or exchanged with, the value in the Xdisplay. The \f3Sto\fP key works in a similar manner, except that an additional Xentry, \*(lqNew Memory\*(rq, is also provided. Selecting \*(lqNew Memory\*(rq Xcauses a new memory to be created, containing the value in the display. Up to X42 memories (0 through 41) can be created in this manner. X.IP "\f3Fix\fP, \f3DRG\fP" XThe \f3Fix\fP key is visible in normal scientific or programmer mode, while the X\f3DRG\fP key is visible in inverted scientific mode. When accessed with the Xleft and middle buttons, these keys cycle through the various display modes. XIn scientific mode, the \f3Fix\fP key cycles through 0 to 12 digits, and floating, Xprecision. This value determines the number of digits which follow the decimal Xpoint in the display. In programmer mode, the \f3Fix\fP key cycles through Xthe available bit widths, which for binary is 4, 8, or 16 bits, and for octal Xand hexadecimal is 8, 16, or 32 bits. The \f3DRG\fP key cycles among the Xdegrees, radians, and grads trigonometric modes, which determines how the Xtrigonometric functions will accept and display their arguments. X.IP XEither of these keys cycles when clicked with the left button, and displays a Xmenu when clicked with the right button. X.IP "\f3Scientific\fP, \f3Binary\fP, \f3Octal\fP, \f3Hexadecimal\fP" XThis large key cycles between the various calculator modes. Clicking with the Xleft button cycles through the four modes, while the right button displays a Xmenu of the various modes. When switching from one mode to another, the Xdisplay is modified to reflect the new mode. The \f2internal value\fP of Xthe display is not changed until that value is used. For example, if the current Xvalue in the display is \*(lq14.5\*(rq, selecting hexadecimal mode will cause the Xdisplay to read \*(lqD\*(rq. However, the internal value is still 14.5. XReturning to scientific mode will restore the display to \*(lq14.5\*(rq. If, Xwhile in hexadecimal mode, 1 was added to the display, (displaying \*(lqE\*(rq), Xreturning to scientific mode would display \*(lq15\*(rq, since hexadecimal mode Xtruncated the display before using it. X.IP \f3EE\fP XThis key places the calculator in exponential mode, which causes all results Xto be displayed in scientific notation. In scientific mode, normal Xscientific notation is used. In engineering mode, the exponent is Xadjusted to a multiple of three. To return to normal display mode, Xclick \f3Inverse\fP \f3EE\fP. This key also allows the user to enter Xexponents when keying in a value. Clicking \f3EE\fP once allows the user to Xenter the exponent value. Clicking again returns the user to entering the Xmantissa. X.IP "\f3Erase\fP, \f3Clear\fP" XThe \f3Erase\fP key erases the currently displayed value and replaces it Xwith zero. The \f3Clear\fP key erases the display, the internal value stack, Xand the internal operator stack. The \f3Clear\fP key can be accessed by Xclicking the \f3Erase\fP key with the middle mouse button. X.SH "Typing Values" X.LP XInstead of clicking keys, the user can type values directly on the keyboard. X\f2Calctool\fP will recognize the digits \*(lq0\*(rq through \*(lq9\*(rq, and \*(lqA\*(rq through \*(lqF\*(rq in Xhexadecimal mode. In scientific mode, the \*(lqE\*(rq key acts like the X\f3EE\fP key Xand the \*(lq.\*(rq key acts like the decimal point key. XThe \*(lq+\*(rq, \*(lq-\*(rq, \*(lq*\*(rq, and \*(lq/\*(rq keys correspond to addition, subtraction, Xmultiplication, and division, and \*(lq(\*(rq, \*(lq)\*(rq, and \*(lq=\*(rq perform the expected function. XIn addition, the \*(lqS\*(rq, \*(lqR\*(rq, and \*(lqG\*(rq keys correspond to the store, recall and Xexchange functions. The \*(lqX\*(rq key is equivalent to \*(lq*\*(rq, and carriage return and newline Xact like the \*(lq=\*(rq key. X.SH AUTHOR X.LP XChuck Musciano X.br XAdvanced Technology Department X.br XHarris Corporation X.br XPO Box 37, MS 3A/1912 X.br XMelbourne, FL 32909 X.br X(305) 727-6131 X.br XARPA: chuck@trantor.harris-atd.com X.SH BUGS X.LP XKeystrokes are ignored when the mouse is positioned in the \f3Scientific\fP Xkey. X.LP XThere is no way to effect the \f3+/-\fP key from the keyboard. SHAR_EOF if test 7307 -ne "`wc -c < 'calctool.man'`" then echo shar: error transmitting "'calctool.man'" '(should have been 7307 characters)' fi fi # end of overwriting check echo shar: extracting "'display.c'" '(19031 characters)' if test -f 'display.c' then echo shar: will not over-write existing file "'display.c'" else sed 's/^ X//' << \SHAR_EOF > 'display.c' X/************************************************************************/ X/* Copyright 1988 by Chuck Musciano and Harris Corporation */ X/* */ X/* Permission to use, copy, modify, and distribute this software */ X/* and its documentation for any purpose and without fee is */ X/* hereby granted, provided that the above copyright notice */ X/* appear in all copies and that both that copyright notice and */ X/* this permission notice appear in supporting documentation, and */ X/* that the name of Chuck Musciano and Harris Corporation not be */ X/* used in advertising or publicity pertaining to distribution */ X/* of the software without specific, written prior permission. */ X/* Chuck Musciano and Harris Corporation make no representations */ X/* about the suitability of this software for any purpose. It is */ X/* provided "as is" without express or implied warranty. */ X/************************************************************************/ X X/************************************************************************/ X/* */ X/* Module: display.c */ X/* */ X/* Function: Manage calculator display */ X/* */ X/* Public Names: update_display resolve stack top and display */ X/* convert_display convert user entry to stack top */ X/* convert_value convert value to string */ X/* fix_proc handle display widths */ X/* do_digit handle digit input */ X/* clear_entry clear any typed digits */ X/* keyboard handle keyboard entries */ X/* */ X/* Change History: 17 Nov 86 Creation */ X/* */ X/************************************************************************/ X X#include <stdio.h> X X#include <suntool/sunview.h> X#include <suntool/panel.h> X#include <suntool/canvas.h> X X#include "manifest.h" X#include "globals.h" X#include "keys.h" X X#define DIGIT_FONT "/usr/lib/fonts/fixedwidthfonts/gallant.r.19" X X#define margin(x) (((curr_mode == SCIENTIFIC? 15 : 16) - strlen(x)) * DIGIT_WIDTH) X X#define MAX_DIGITS ((curr_mode == SCIENTIFIC)? 14 : 16) X#define DIGIT_WIDTH d_font->pf_defaultsize.x X#define DIGIT_HEIGHT d_font->pf_defaultsize.y X#define STATUS_WIDTH s_font->pf_defaultsize.x X#define STATUS_HEIGHT s_font->pf_defaultsize.y X XPUBLIC double atof(); XPUBLIC char *index(); X XPUBLIC Canvas display; XPUBLIC Panel keys; XPUBLIC struct pixfont *key_font; X XPRIVATE Pixwin *pw = NULL; XPRIVATE struct pixfont *d_font = NULL; XPRIVATE struct pixfont *s_font = NULL; XPRIVATE char e_str[5], d_str[18]; XPRIVATE int e_len = 0; XPRIVATE int d_len = 0; XPRIVATE int pw_width; XPRIVATE int pw_height; XPRIVATE char *digit = "0123456789ABCDEF.E-"; X XPRIVATE verify(source, valid) X Xchar *source; Xchar *valid; X X{ register char *s; X X for ( ; *source; source++) { X for (s = valid; *s && *s != *source; s++) X ; X if (*s == '\0') X return(FALSE); X } X return(TRUE); X} X XPRIVATE convert_stacktop() X X{ char buf[60], *p; X X convert_value(v_stack[v_top], buf); X if (curr_mode == SCIENTIFIC && (p = index(buf, 'E')) != NULL) { X strcpy(e_str, p + 1); X if (*e_str == '+') X strcpy(e_str, e_str + 1); X e_len = strlen(e_str); X if (e_len == 2) { X e_str[3] = '\0'; X e_str[2] = e_str[1]; X e_str[1] = e_str[0]; X e_str[0] = '0'; X e_len = 3; X } X else if (e_len == 3 && *e_str == '-') { X e_str[4] = '\0'; X e_str[3] = e_str[2]; X e_str[2] = e_str[1]; X e_str[1] = '0'; X e_len = 4; X } X *p = '\0'; X } X else { X *e_str = '\0'; X e_len = 0; X } X strcpy(d_str, buf); X d_len = strlen(d_str); X} X XPUBLIC update_display() X X{ char buf[60], *p, *op_str(); X int i, w; X static char *tm[] = {"Deg ", "Rad ", "Grad"}; X X if (d_font == NULL) X if ((d_font = pf_open(DIGIT_FONT)) == NULL) { X fprintf(stderr, "calctool: could not open font %s\n", DIGIT_FONT); X exit(1); X } X if (s_font == NULL) X if ((s_font = pf_open(STATUS_FONT)) == NULL) { X fprintf(stderr, "calctool: could not open font %s\n", DIGIT_FONT); X exit(1); X } X if (pw == NULL) { X pw = canvas_pixwin(display); X pw_width = (int) window_get(display, WIN_WIDTH); X pw_height = (int) window_get(display, WIN_HEIGHT); X } X for (i = w = 0; i < o_top && w < 23; w += strlen(op_str(o_stack[i++]))) X pw_text(pw, w * STATUS_WIDTH + 1, 7, PIX_SRC, s_font, op_str(o_stack[i])); X for ( ; w < 23; w++) X pw_text(pw, w * STATUS_WIDTH + 1, 7, PIX_SRC, s_font, " "); X pw_text(pw, 23 * STATUS_WIDTH, 7, PIX_SRC, s_font, (curr_mode == SCIENTIFIC)? tm[trig_mode] : " "); X if (curr_mode == SCIENTIFIC && ee_mode) X pw_text(pw, 28 * STATUS_WIDTH, 7, PIX_SRC, s_font, eng_mode? "Eng " : "EE "); X else X pw_text(pw, 28 * STATUS_WIDTH, 7, PIX_SRC, s_font, " "); X if (curr_mode == SCIENTIFIC) X if (curr_width[0] == -1) X strcpy(buf, " Float"); X else X sprintf(buf, "%2d Digits", curr_width[0]); X else X sprintf(buf, " %2d Bits", curr_width[index_of(curr_base)]); X pw_text(pw, 32 * STATUS_WIDTH, 7, PIX_SRC, s_font, buf); X if (d_len > 0) { X if (e_len > 0) { X pw_text(pw, pw_width - 6 * DIGIT_WIDTH, 26, PIX_SRC, d_font, " e"); X pw_text(pw, pw_width - 4 * DIGIT_WIDTH, 26, PIX_SRC, d_font, e_str); X if (e_len == 3) X pw_text(pw, pw_width - DIGIT_WIDTH, 26, PIX_SRC, d_font, " "); X } X else X pw_text(pw, pw_width - 6 * DIGIT_WIDTH, 26, PIX_SRC, d_font, " "); X pw_rop(pw, 0, pw_height - DIGIT_HEIGHT + 1, margin(d_str), DIGIT_HEIGHT, PIX_SRC | PIX_COLOR(0), NULL, 0, 0); X pw_text(pw, margin(d_str), 26, PIX_SRC, d_font, d_str); X } X else { X convert_value(v_stack[v_top], buf); X if (strcmp(buf, "NaN") == 0) { X strcpy(buf, " Error! "); X pw_text(pw, pw_width - 6 * DIGIT_WIDTH, 26, PIX_SRC, d_font, " "); X } X else if (curr_mode == SCIENTIFIC && (p = index(buf, 'E')) != NULL) { X pw_text(pw, pw_width - 6 * DIGIT_WIDTH, 26, PIX_SRC, d_font, " e"); X *p++ = '\0'; X i = 4; X if (*p == '+') X p++; X if (*p == '-') { X pw_text(pw, pw_width - i-- * DIGIT_WIDTH, 26, PIX_SRC, d_font, "-"); X p++; X } X if (strlen(p) == 2) X pw_text(pw, pw_width - i-- * DIGIT_WIDTH, 26, PIX_SRC, d_font, "0"); X pw_text(pw, pw_width - i * DIGIT_WIDTH, 26, PIX_SRC, d_font, p); X if (i - strlen(p) == 1) X pw_text(pw, pw_width - DIGIT_WIDTH, 26, PIX_SRC, d_font, " "); X } X else X pw_text(pw, pw_width - 6 * DIGIT_WIDTH, 26, PIX_SRC, d_font, " "); X pw_rop(pw, 0, pw_height - DIGIT_HEIGHT + 1, margin(buf), DIGIT_HEIGHT, PIX_SRC|PIX_COLOR(0), NULL, 0, 0); X pw_text(pw, margin(buf), 26, PIX_SRC, d_font, buf); X } X} X XPUBLIC convert_display() X X{ char buf[60], *p; X int i; X X if (d_len > 0 || e_len > 0) X if (curr_mode == SCIENTIFIC) { X strcpy(buf, d_str); X strcat(buf, "E"); X strcat(buf, e_str); X v_stack[v_top] = atof(buf); X } X else { X for (i = 0, p = d_str; *p; p++) X i = i * curr_base + (index(digit, *p) - digit); X v_stack[v_top] = (double) i; X } X edit_ee = FALSE; X clear_entry(); X} X XPUBLIC convert_value(val, s) X Xdouble val; Xchar *s; X X{ unsigned int i; X int start, exp, dp, sign = 1, j, sp; X char *p, *q, buf[60]; X X if (curr_mode == SCIENTIFIC) { X sprintf(s, " %-20.15E", val); X if (!verify(s, " 0123456789eE+-.")) { X strcpy(s, "NaN"); X return; X } X if (s[30] == '-') { X sign = -1; X strcpy(&(s[30]), &(s[31])); X } X start = 30; X sscanf(&(s[start + 18]), "%d", &exp); X s[start + 17] = '\0'; X strcpy(&(s[start + 1]), &(s[start + 2])); /* lose the decimal point */ X exp++; /* and remember it */ X if (s[start + 13] >= '5') /* round up */ X for (i = start + 12; ; i--) { X s[i]++; X if (s[i] == ':') { X s[i] = '0'; X if (i == start) { X s[--start] = '1'; X exp++; X break; X } X } X else X break; X } X s[start + 13] = '\0'; /* retain 13 digits */ X s[start - 1] = s[start]; X s[start--] = '.'; X exp--; X dp = start + 1; X if (ee_mode || exp > 12 || exp < ((curr_width[0] == -1)? -12 : -curr_width[0])) { X if (eng_mode) X for ( ; exp % 3; dp++, exp--) { X s[dp] = s[dp + 1]; X s[dp + 1] = '.'; X } X if (curr_width[0] != -1) { X i = strlen(s + dp + 1); X if (i > curr_width[0]) X s[dp + curr_width[0] + 1] = '\0'; X } X else X for (i = strlen(s) - 1; s[i] == '0'; s[i--] = '\0') X ; X if (s[i = strlen(s) - 1] == '.') X s[i] = '\0'; X sprintf(s + strlen(s), "E%03d", exp); X } X else { X for ( ; exp > 0; dp++, exp--) { X s[dp] = s[dp + 1]; X s[dp + 1] = '.'; X } X for ( ; exp < 0; dp--, exp++) { X s[dp] = s[dp - 1]; X s[dp - 1] = '.'; X s[dp - 2] = '0'; X start = dp - 2; X } X if (curr_width[0] != -1) { X i = strlen(s + dp + 1); X if (i > curr_width[0]) X s[dp + curr_width[0] + 1] = '\0'; X else X for ( ; i < curr_width[0]; i++) X strcat(s, "0"); X if (strlen(s + start) > 14) X s[start + 14] = '\0'; X } X else { X for (i = strlen(s) - 1; s[i] == '0'; s[i--] = '\0'); X if (strlen(s + dp + 1) > 12) X s[dp + 13] = '\0'; X if (s[i = strlen(s) - 1] == '.') X s[i] = '\0'; X } X } X if (sign == -1) X s[--start] = '-'; X strcpy(s, s + start); X } X else { X i = (unsigned int) val; X i &= ((unsigned) 0xffffffff) >> (32 - curr_width[index_of(curr_base)]); X for (p = buf; i; i = i >> index_of(curr_base)) X *p++ = digit[i & (curr_base - 1)]; X *p = '\0'; X if (*buf == '\0') X strcpy(buf, "0"); X for (j = strlen(buf) - 1, p = s; j >= 0; j--, p++) X *p = buf[j]; X *p = '\0'; X } X} X X XPUBLIC fix_proc(item, event) X XPanel_item item; XEvent *event; X X{ static Menu s_menu = NULL; X static Menu b_menu = NULL; X static Menu h_menu = NULL; X static Menu t_menu = NULL; X int i; X X if (event_id(event) >= ASCII_FIRST && event_id(event) <= ASCII_LAST) { X keyboard(event_id(event)); X return; X } X if ((event_id(event) == MS_LEFT && !inverted) || (event_id(event) == MS_MIDDLE && inverted)) X if (curr_mode == SCIENTIFIC) X if (curr_width[0] == 12) X curr_width[0] = -1; X else X curr_width[0]++; X else X switch (curr_base) { X case BINARY : if (curr_width[1] == 16) X curr_width[1] = 4; X else X curr_width[1] *= 2; X break; X case OCTAL : X case HEXADECIMAL : if (curr_width[index_of(curr_base)] == 32) X curr_width[index_of(curr_base)] = 8; X else X curr_width[index_of(curr_base)] *= 2; X break; X } X else if (curr_mode == SCIENTIFIC && ((event_id(event) == MS_LEFT && inverted) || (event_id(event) == MS_MIDDLE && !inverted))) X if (trig_mode == GRAD) X trig_mode = DEG; X else X trig_mode++; X else if (event_id(event) == MS_RIGHT) { X if (inverted) { X if (t_menu == NULL) X t_menu = menu_create(MENU_INITIAL_SELECTION, MENU_DEFAULT, X MENU_ITEM, MENU_STRING, "Degrees", MENU_VALUE, 1, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "Radians", MENU_VALUE, 2, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "Grads", MENU_VALUE, 3, MENU_FONT, key_font, 0, X 0); X menu_set(t_menu, MENU_DEFAULT, trig_mode + 1, 0); X if ((i = (int) menu_show(t_menu, keys, event, 0)) != 0) X trig_mode = i - 1; X } X else if (curr_mode == SCIENTIFIC) { X if (s_menu == NULL) X s_menu = menu_create(MENU_INITIAL_SELECTION, MENU_DEFAULT, X MENU_ITEM, MENU_STRING, " Float", MENU_VALUE, 1, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 0 Digits", MENU_VALUE, 2, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 1 Digit", MENU_VALUE, 3, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 2 Digits", MENU_VALUE, 4, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 3 Digits", MENU_VALUE, 5, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 4 Digits", MENU_VALUE, 6, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 5 Digits", MENU_VALUE, 7, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 6 Digits", MENU_VALUE, 8, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 7 Digits", MENU_VALUE, 9, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 8 Digits", MENU_VALUE, 10, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 9 Digits", MENU_VALUE, 11, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "10 Digits", MENU_VALUE, 12, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "11 Digits", MENU_VALUE, 13, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "12 Digits", MENU_VALUE, 14, MENU_FONT, key_font, 0, X 0); X menu_set(s_menu, MENU_DEFAULT, curr_width[0] + 2, 0); X if ((i = (int) menu_show(s_menu, keys, event, 0)) != 0) X curr_width[0] = i - 2; X } X else if (curr_base == BINARY) { X if (b_menu == NULL) X b_menu = menu_create(MENU_INITIAL_SELECTION, MENU_DEFAULT, X MENU_ITEM, MENU_STRING, " 4 Bits", MENU_VALUE, 4, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, " 8 Bits", MENU_VALUE, 8, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "16 Bits", MENU_VALUE, 16, MENU_FONT, key_font, 0, X 0); X menu_set(b_menu, MENU_DEFAULT_ITEM, menu_find(b_menu, MENU_VALUE, curr_width[1], 0), 0); X if ((i = (int) menu_show(b_menu, keys, event, 0)) != 0) X curr_width[1] = i; X } X else { X if (h_menu == NULL) X h_menu = menu_create(MENU_INITIAL_SELECTION, MENU_DEFAULT, X MENU_ITEM, MENU_STRING, " 8 Bits", MENU_VALUE, 8, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "16 Bits", MENU_VALUE, 16, MENU_FONT, key_font, 0, X MENU_ITEM, MENU_STRING, "32 Bits", MENU_VALUE, 32, MENU_FONT, key_font, 0, X 0); X menu_set(h_menu, MENU_DEFAULT_ITEM, menu_find(h_menu, MENU_VALUE, curr_width[index_of(curr_base)], 0), 0); X if ((i = (int) menu_show(h_menu, keys, event, 0)) != 0) X curr_width[index_of(curr_base)] = i; X } X } X convert_display(); X update_display(); X if (inverted) X invert_proc(); X} X Xdo_digit(op) X Xint op; X X{ char temp[60]; X X if (op <= DIGIT_F) { X if (edit_ee && e_len > 0) { X e_str[e_len - 3] = e_str[e_len - 2]; X e_str[e_len - 2] = e_str[e_len - 1]; X e_str[e_len - 1] = digit[op]; X } X else if (d_len == 1 && d_str[0] == '0') X d_str[0] = digit[op]; X else if (d_len < MAX_DIGITS) { X d_str[d_len] = digit[op]; X d_str[++d_len] = '\0'; X } X } X else if (op == DIGIT_DOT) { X if (e_len == 0 && index(d_str, '.') == 0) { X if (d_len == 0) { X strcpy(d_str, "0."); X d_len = 2; X } X else { X d_str[d_len] = '.'; X d_str[++d_len] = '\0'; X } X } X } X else if (op == DIGIT_CHS) { X if (edit_ee && e_len > 0) X if (e_len == 4) { X strcpy(e_str, e_str + 1); X e_len = 3; X } X else { X e_str[3] = e_str[2]; X e_str[2] = e_str[1]; X e_str[1] = e_str[0]; X e_str[0] = '-'; X e_len = 4; X } X else { X if (d_len == 0) X convert_stacktop(); X if (curr_mode == SCIENTIFIC) { X if (d_len > 0 && strcmp(d_str, "0") != 0) X if (d_str[0] == '-') { X strcpy(d_str, d_str + 1); X d_len -= 1; X } X else { X strcpy(temp, d_str); X d_str[0] = '-'; X strcpy(d_str + 1, temp); X d_len += 1; X } X } X else { X convert_display(); X v_stack[v_top] = -v_stack[v_top]; X convert_stacktop(); X } X } X } X else if (op == DIGIT_EE) { X ee_mode = TRUE; X edit_ee = !edit_ee; X if (d_len == 0) X convert_stacktop(); X if (e_len == 0) { X e_len = 3; X strcpy(e_str, "000"); X } X } X update_display(); X} X XPUBLIC clear_entry() X X{ X e_str[e_len = 0] = d_str[d_len = 0] = '\0'; X edit_ee = FALSE; X} X XPUBLIC keyboard(key) X Xchar key; X X{ double temp; X X switch (key) { X case '0' : X case '1' : X case '2' : X case '3' : X case '4' : X case '5' : X case '6' : X case '7' : X case '8' : X case '9' : if (curr_mode == SCIENTIFIC || (key - '0' + DIGIT_0 < curr_base)) X do_digit(blink(key - '0' + DIGIT_0)); X break; X case 'A' : X case 'B' : X case 'C' : X case 'D' : X case 'F' : if (curr_mode == PROGRAMMER && curr_base == HEXADECIMAL) X do_digit(blink(key - 'A' + DIGIT_A)); X break; X case 'a' : X case 'b' : X case 'c' : X case 'd' : X case 'f' : if (curr_mode == PROGRAMMER && curr_base == HEXADECIMAL) X do_digit(blink(key - 'a' + DIGIT_A)); X break; X case 'e' : X case 'E' : if (curr_mode == PROGRAMMER && curr_base == HEXADECIMAL) X do_digit(blink(DIGIT_E)); X else if (curr_mode == SCIENTIFIC) X do_digit(blink(DIGIT_EE)); X break; X case 'g' : X case 'G' : blink(EXC_OP); X convert_display(); X do_exchange(0); X break; X case 'r' : X case 'R' : blink(RCL_OP); X clear_entry(); X do_recall(0); X break; X case 's' : X case 'S' : blink(STO_OP); X convert_display(); X do_store(0); X break; X case '.' : if (curr_mode == SCIENTIFIC) X do_digit(blink(DIGIT_DOT)); X break; X case '+' : do_binary(blink(ADD_OP)); X break; X case '-' : do_binary(blink(SUB_OP)); X break; X case 'x' : X case 'X' : X case '*' : do_binary(blink(MUL_OP)); X break; X case '/' : do_binary(blink(DIV_OP)); X break; X case '&' : if (curr_mode == PROGRAMMER) X do_binary(blink(AND_OP)); X break; X case '|' : if (curr_mode == PROGRAMMER) X do_binary(blink(OR_OP)); X break; X case '^' : if (curr_mode == PROGRAMMER) X do_binary(blink(XOR_OP)); X break; X case '\n': X case '\r': X case '=' : do_unary(blink(EQUAL_OP)); X break; X case '(' : do_unary(blink(LPAREN_OP)); X break; X case ')' : do_unary(blink(RPAREN_OP)); X break; X } X} X SHAR_EOF if test 19031 -ne "`wc -c < 'display.c'`" then echo shar: error transmitting "'display.c'" '(should have been 19031 characters)' fi fi # end of overwriting check echo shar: extracting "'globals.c'" '(1651 characters)' if test -f 'globals.c' then echo shar: will not over-write existing file "'globals.c'" else sed 's/^ X//' << \SHAR_EOF > 'globals.c' X/************************************************************************/ X/* Copyright 1988 by Chuck Musciano and Harris Corporation */ X/* */ X/* Permission to use, copy, modify, and distribute this software */ X/* and its documentation for any purpose and without fee is */ X/* hereby granted, provided that the above copyright notice */ X/* appear in all copies and that both that copyright notice and */ X/* this permission notice appear in supporting documentation, and */ X/* that the name of Chuck Musciano and Harris Corporation not be */ X/* used in advertising or publicity pertaining to distribution */ X/* of the software without specific, written prior permission. */ X/* Chuck Musciano and Harris Corporation make no representations */ X/* about the suitability of this software for any purpose. It is */ X/* provided "as is" without express or implied warranty. */ X/************************************************************************/ X X/************************************************************************/ X/* */ X/* Module: globals.c */ X/* */ X/* Function: Define global variables */ X/* */ X/* Change History: 14 Nov 86 Creation */ X/* */ X/************************************************************************/ X X#include "manifest.h" X#include "globals.h" X Xint curr_mode = SCIENTIFIC; Xint inverted = FALSE; Xint temp_inverted = FALSE; X Xint curr_base = DECIMAL; Xint ee_mode = FALSE; Xint eng_mode = FALSE; Xint edit_ee = FALSE; Xint trig_mode = DEG; Xint curr_width[5] = {-1, 16, 0, 32, 32}; X Xdouble v_stack[MAX_STACK] = {0.0}; Xint o_stack[MAX_STACK] = {0}; Xint v_top = 0; Xint o_top = 0; SHAR_EOF if test 1651 -ne "`wc -c < 'globals.c'`" then echo shar: error transmitting "'globals.c'" '(should have been 1651 characters)' fi fi # end of overwriting check echo shar: extracting "'globals.h'" '(1581 characters)' if test -f 'globals.h' then echo shar: will not over-write existing file "'globals.h'" else sed 's/^ X//' << \SHAR_EOF > 'globals.h' X/************************************************************************/ X/* Copyright 1988 by Chuck Musciano and Harris Corporation */ X/* */ X/* Permission to use, copy, modify, and distribute this software */ X/* and its documentation for any purpose and without fee is */ X/* hereby granted, provided that the above copyright notice */ X/* appear in all copies and that both that copyright notice and */ X/* this permission notice appear in supporting documentation, and */ X/* that the name of Chuck Musciano and Harris Corporation not be */ X/* used in advertising or publicity pertaining to distribution */ X/* of the software without specific, written prior permission. */ X/* Chuck Musciano and Harris Corporation make no representations */ X/* about the suitability of this software for any purpose. It is */ X/* provided "as is" without express or implied warranty. */ X/************************************************************************/ X X/************************************************************************/ X/* */ X/* Module: globals.h */ X/* */ X/* Function: Define global variables */ X/* */ X/* Change History: 14 Nov 86 Creation */ X/* */ X/************************************************************************/ X XPUBLIC int curr_mode; XPUBLIC int inverted; XPUBLIC int temp_inverted; X XPUBLIC int curr_base; XPUBLIC int ee_mode; XPUBLIC int eng_mode; XPUBLIC int edit_ee; XPUBLIC int trig_mode; XPUBLIC int curr_width[5]; X XPUBLIC double v_stack[MAX_STACK]; XPUBLIC int o_stack[MAX_STACK]; XPUBLIC int v_top; XPUBLIC int o_top; SHAR_EOF if test 1581 -ne "`wc -c < 'globals.h'`" then echo shar: error transmitting "'globals.h'" '(should have been 1581 characters)' fi fi # end of overwriting check # End of shell archive exit 0