Official patch #8 for calctool v2.4; please apply it.
Rich Burridge
richb at sunaus.oz
Thu Mar 1 14:33:54 AEST 1990
This is probably the last set of changes to be made to this version of
calctool for a while. I have a few other things I wish to finish.
It makes the following changes:
* From Didier Poirot <dp at chorus.fr>
Two Imakefiles (Imakefile.main and Imakefile.lib) have been provided.
To use these properly, read the comments at the beginning of these
files.
* From Sisira Jayasinghe <spsisira at sdrc.UUCP>
I have included better error detecting routines for addition,
subtraction, multiplication and division supplied by Sisira.
The shar file included below contains the two new Imakefiles and patch #8.
Apply this patch with Larry Walls patch program, then recompile.
------CUT HERE------patch.8------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:
# patch.8
# Imakefile.main
# Imakefile.lib
# This archive created: Thu Mar 1 14:24:42 EST 1990
#
#
export PATH; PATH=/bin:$PATH
#
if [ -f patch.8 ]
then
echo shar: will not over-write existing file patch.8
else
echo shar: extracting 'patch.8', 10002 characters
cat > patch.8 <<'Funky_Stuff'
------- functions.c -------
*** /tmp/da8903 Thu Mar 1 14:22:49 1990
--- functions.c Thu Mar 1 14:18:40 1990
***************
*** 29,34 ****
--- 29,35 ----
extern double acos(), acosh(), asin(), asinh(), atan(), atanh() ;
extern double cos(), cosh(), exp(), fabs(), log(), log10(), pow() ;
extern double sin(), sinh(), sqrt(), tan(), tanh() ;
+ extern double addition(), subtraction(), multiply(), division() ;
BOOLEAN ibool() ;
double setbool() ;
***************
*** 77,91 ****
case CCTRL('t') : /* tan. */
case '?' : result = disp_val ; /* Undefined. */
break ;
! case '+' : result += disp_val ; /* Addition. */
break ;
! case '-' : result -= disp_val ; /* Subtraction. */
break ;
! case 'x' : result *= disp_val ; /* Multiplication. */
break ;
! case '/' : if (disp_val == 0.0) /* Division. */
! doerr("div", "OVERFLOW", ERANGE) ;
! else result /= disp_val ;
break ;
case '%' : result *= disp_val * 0.01 ; /* % */
break ;
--- 78,94 ----
case CCTRL('t') : /* tan. */
case '?' : result = disp_val ; /* Undefined. */
break ;
! case '+' : /* Addition. */
! result = addition(result, disp_val) ;
break ;
! case '-' : /* Subtraction. */
! result = subtraction(result, disp_val) ;
break ;
! case 'x' : /* Multiplication. */
! result = multiply(result, disp_val) ;
break ;
! case '/' : /* Division. */
! result = division(result, disp_val) ;
break ;
case '%' : result *= disp_val * 0.01 ; /* % */
break ;
***************
*** 200,206 ****
{
i = val ;
a = 1.0 ;
! while ((i > 0) && (a != HUGE)) a *= (float) i-- ;
}
return (a) ;
}
--- 203,213 ----
{
i = val ;
a = 1.0 ;
! while ((i > 0) && (a != HUGE))
! {
! a = multiply(a, (float) i) ;
! i-- ;
! }
}
return (a) ;
}
***************
*** 299,309 ****
break ;
case '~' : disp_val = setbool(~ibool(disp_val)) ; /* NOT */
break ;
! case 'R' : disp_val = 1.0 / disp_val ; /* 1/x */
break ;
case '!' : disp_val = do_factorial(disp_val) ; /* x! */
break ;
! case '@' : disp_val *= disp_val ; /* x^2 */
break ;
case 'C' : if (key_exp) /* CHS */
{
--- 306,316 ----
break ;
case '~' : disp_val = setbool(~ibool(disp_val)) ; /* NOT */
break ;
! case 'R' : disp_val = division(1.0, disp_val) ; /* 1/x */
break ;
case '!' : disp_val = do_factorial(disp_val) ; /* x! */
break ;
! case '@' : disp_val = multiply(disp_val, disp_val) ; /* x^2 */
break ;
case 'C' : if (key_exp) /* CHS */
{
------- Makefile -------
*** /tmp/da8906 Thu Mar 1 14:22:50 1990
--- Makefile Thu Mar 1 13:47:54 1990
***************
*** 109,116 ****
# library files are not in a standard place, then the following
# two lines should be uncommented, and set appropriately.
#
! #X11INCDIR = -I$(OPENWINHOME)/include
! #X11LIBDIR = -L$(OPENWINHOME)/lib
#-------------------------------------------------------------------------
# If you are compiling the XView version, then the following two lines
# should be uncommented.
--- 109,116 ----
# library files are not in a standard place, then the following
# two lines should be uncommented, and set appropriately.
#
! X11INCDIR = -I$(OPENWINHOME)/include
! X11LIBDIR = -L$(OPENWINHOME)/lib
#-------------------------------------------------------------------------
# If you are compiling the XView version, then the following two lines
# should be uncommented.
***************
*** 152,158 ****
HDRS = calctool.h color.h extern.h mathlib.h
IMAGES = calctool.icon calctool.color.icon help.cursor
OTHERS = Makefile README TODO calctool.help calctool.1 \
! CHANGES calctool.ps patchlevel.h .calctoolrc
SFILES1 = $(STDSRCS)
SFILES2 = $(LIBSRCS)
--- 152,159 ----
HDRS = calctool.h color.h extern.h mathlib.h
IMAGES = calctool.icon calctool.color.icon help.cursor
OTHERS = Makefile README TODO calctool.help calctool.1 \
! CHANGES calctool.ps patchlevel.h .calctoolrc \
! Imakefile.main Imakefile.lib
SFILES1 = $(STDSRCS)
SFILES2 = $(LIBSRCS)
------- README -------
*** /tmp/da8909 Thu Mar 1 14:22:51 1990
--- README Thu Mar 1 14:17:34 1990
***************
*** 69,76 ****
Thanks to Ed Falk at Sun Microsystems (Mountain View) for most of the
basic arithmetical algorithms used, to Andrew Nicholson for revising the
previous version of the NeWS code, to Sriram Ramachandran for fixing up
! the XView code, and Hala Abdalla for the original implementation of the
! popup menu and function keyboard support.
Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
--- 69,79 ----
Thanks to Ed Falk at Sun Microsystems (Mountain View) for most of the
basic arithmetical algorithms used, to Andrew Nicholson for revising the
previous version of the NeWS code, to Sriram Ramachandran for fixing up
! the XView code, to Hala Abdalla for the original implementation of the
! popup menu and function keyboard support, to Didier Poirot for the
! calctool Imakefiles, and to Sisira Jayasinghe for better error detecting
! addition, subtraction, multiplication and division routines for the
! maths library.
Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
***************
*** 82,86 ****
comments and flames.
Rich Burridge, DOMAIN: richb at Aus.Sun.COM
! PHONE: +61 2 413 2666 ACSNET: richb at sunaus.sun.oz
! UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
--- 85,89 ----
comments and flames.
Rich Burridge, DOMAIN: richb at Aus.Sun.COM
! Sun Microsystems. ACSNET: richb at sunaus.sun.oz
! PHONE: +61 2 413 2666 UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
------- patchlevel.h -------
*** /tmp/da8912 Thu Mar 1 14:22:52 1990
--- patchlevel.h Tue Feb 6 16:44:33 1990
***************
*** 14,17 ****
* reported to me then an attempt will be made to fix them.
*/
! #define PATCHLEVEL 7
--- 14,17 ----
* reported to me then an attempt will be made to fix them.
*/
! #define PATCHLEVEL 8
------- CHANGES -------
*** /tmp/da8915 Thu Mar 1 14:22:52 1990
--- CHANGES Thu Mar 1 14:16:12 1990
***************
*** 183,185 ****
--- 183,199 ----
There is no need for the tty version to use select to determine if
there is input waiting to read. The top bit of the characters read,
is also removed.
+
+
+ v2.4 - patchlevel 8. - Posted to comp.sources.bugs (February 1990).
+
+ Changes:
+
+ * From Didier Poirot <dp at chorus.fr>
+ Two Imakefiles (Imakefile.main and Imakefile.lib) have been provided.
+ To use these properly, read the comments at the beginning of these
+ files.
+
+ * From Sisira Jayasinghe <spsisira at sdrc.UUCP>
+ Have included better error detecting routines for addition,
+ subtraction, multiplication and division supplied by Sisira.
------- mathlib.c -------
*** /tmp/da8918 Thu Mar 1 14:22:54 1990
--- mathlib.c Thu Mar 1 14:20:19 1990
***************
*** 2358,2360 ****
--- 2358,2438 ----
#endif /* defined(vax) || defined(tahoe) */
}
#endif /*NEED_POW*/
+
+
+ /* Error detecting addition, subtraction, multiplication and division routines.
+ *
+ * Routines supplied by Sisira Jayasinghe, Structural Dynamics Research Corp.
+ * 2000 Eastman Dr. Milford, OH 45150 USA <spsisira at sdrc.UUCP>
+ */
+
+ double
+ addition(x, y)
+ double x, y ;
+ {
+ if (y > (HUGE - x)) doerr("add", "OVERFLOW", ERANGE) ;
+ else
+ {
+ x += y ;
+ return(x) ;
+ }
+ return(0.0) ;
+ }
+
+
+ double
+ subtraction(x, y)
+ double x, y ;
+ {
+ if (y > (HUGE - x)) doerr("sub", "OVERFLOW", ERANGE) ;
+ else
+ {
+ x -= y ;
+ return(x) ;
+ }
+ return(0.0) ;
+ }
+
+
+ double
+ multiply(x, y)
+ double x, y ;
+ {
+ double a, b ;
+
+ if (y == 0.0) return(0.0) ;
+ else
+ {
+ a = log(x) ;
+ b = log(y) ;
+ if ((a + b) >= log(HUGE)) doerr("mult", "OVERFLOW", ERANGE) ;
+ else
+ {
+ x *= y ;
+ return(x) ;
+ }
+ }
+ return(0.0) ;
+ }
+
+
+ double
+ division(x, y)
+ double x, y ;
+ {
+ double a, b ;
+
+ if (y == 0.0) doerr("div", "OVERFLOW", ERANGE) ;
+ else
+ {
+ a = log(x) ;
+ b = log(y) ;
+ if ((a - b) >= log(HUGE)) doerr("div", "OVERFLOW", ERANGE) ;
+ else
+ {
+ x /= y ;
+ return(x) ;
+ }
+ }
+ return(0.0) ;
+ }
Funky_Stuff
len=`wc -c < patch.8`
if [ $len != 10002 ] ; then
echo error: patch.8 was $len bytes long, should have been 10002
fi
fi # end of overwriting check
if [ -f Imakefile.main ]
then
echo shar: will not over-write existing file Imakefile.main
else
echo shar: extracting 'Imakefile.main', 2434 characters
cat > Imakefile.main <<'Funky_Stuff'
#
# Imakefile for the main calctool directory.
#
# @(#)Imakefile.main 1.1 90/03/01
#
# Provided by Didier Poirot, Chorus Systemes (dp at chorus.fr).
#
# Note that to use this Imakefile, the current calctool directory
# layout needs to be rearranged as follows:
#
# Files in the main directory:
#
# Imakefile.main (this file), renamed to Imakefile.
#
# calctool.1 mathlib.c Imakefile
# calctool.c mathlib.h Makefile
# calctool.color.icon calctool.help patchlevel.h
# calctool.icon x11.c README
# TODO help.cursor
#
# Files in a new sub-directory called lib:
#
# Imakefile.lib, renamed to Imakefile.
#
# Imakefile color.h functions.c graphics.c
# Makefile display.c get.c calctool.h
# extern.h
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# 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.
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = lib
PROGRAMS = calctool
HELPFILE = -DHELPFILE=\"$(LIBDIR)$(PATHSEP)calctool.help\"
RCNAME = -DRCNAME=\".calctoolrc\"
/*
* #NOIEEE = -DIEEE
* #NOINDEX = -DNOINDEX
* #SUN4_KEYBOARD = -DSUN4_KEYBOARD
* #X11INCDIR = -I$(OPENWINHOME)/include
* #X11LIBDIR = -L$(OPENWINHOME)/lib
*/
DEFINES = $(HELPFILE) $(NOIEEE) $(NOINDEX) $(RCNAME) \
$(SELTYPE) $(SHLIB) $(SIGRET) $(SUN4_KEYBOARD) \
$(TTEXT)
INCLUDES = -I./lib
CALCLIB = -Llib -lCalctool
DEPLIBS1 = lib/libCalctool.a $(DEPXLIB)
LOCAL_LIBRARIES = $(LIBNAME) $(XLIB)
SRCS1 = calctool.c mathlib.c x11.c
OBJS1 = calctool.o mathlib.o x11.o
HDRS = calctool.h color.h extern.h mathlib.h
IMAGES = calctool.icon calctool.color.icon help.cursor
OTHERS = Makefile README TODO calctool.help calctool.1 \
CHANGES calctool.ps patchlevel.h .calctoolrc
MATHLIB = -lm
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
ComplexProgramTarget_1($(PROGRAMS),$(CALCLIB) $(XLIB),$(MATHLIB))
clean::
rm -f *.o *~ *.a $(PROGRAMS) core
InstallNonExec(calctool.help, $(LIBDIR))
Funky_Stuff
len=`wc -c < Imakefile.main`
if [ $len != 2434 ] ; then
echo error: Imakefile.main was $len bytes long, should have been 2434
fi
fi # end of overwriting check
if [ -f Imakefile.lib ]
then
echo shar: will not over-write existing file Imakefile.lib
else
echo shar: extracting 'Imakefile.lib', 3031 characters
cat > Imakefile.lib <<'Funky_Stuff'
#
# Imakefile for the calctool lib directory.
#
# @(#)Imakefile.lib 1.1 90/03/01
#
# Provided by Didier Poirot, Chorus Systemes (dp at chorus.fr).
#
# Note that to use this Imakefile, the current calctool directory
# layout needs to be rearranged as follows:
#
# Files in the main directory:
#
# Imakefile.main, renamed to Imakefile.
#
# calctool.1 mathlib.c Imakefile
# calctool.c mathlib.h Makefile
# calctool.color.icon calctool.help patchlevel.h
# calctool.icon x11.c README
# TODO help.cursor
#
# Files in a new sub-directory called lib:
#
# Imakefile.lib (this file), renamed to Imakefile.
#
# Imakefile color.h functions.c graphics.c
# Makefile display.c get.c calctool.h
# extern.h
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# 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.
#include <Library.tmpl>
#ifdef SunArchitecture
#if SunOSPlatform && OSMajorVersion >= 4
#ifndef SharedLibCalctool
#define SharedLibCalctool YES
#ifndef SharedCalctoolRev
#define SharedCalctoolRev 1.1
#endif /* SharedCalctoolRev */
#endif /* SharedLibCalctool */
SOCALCTOOLREV = SharedCalctoolRev
#else /* SunOSPlatform 4 */
LIBNAME = libCalctool.a
CALCLIB = $(LIBNAME)
SIGRET = -DNO_4.3SIGNAL
TTEXT = -DNO_PR_TTEXT
SELTYPE = -DNO_4.3SELECT
#endif /* SunOSPlatform 4 */
#endif /* SunArch */
INCLUDES = -I.. -I$(TOP)
INSTALLFLAGS = $(INSTINCFLAGS)
LINTLIBS = $(LINTXLIB)
HEADERS = calctool.h color.h extern.h
SRCS = graphics.c display.c functions.c get.c
OBJS = graphics.o display.o functions.o get.o
all::
#if SharedLibCalctool
# if DebugLibCalctool
SharedAndDebuggedLibraryObjectRule()
# else
SharedLibraryObjectRule()
# endif
#else
# if DebugLibCalctool && ProfileLibCalctool
DebuggedAndProfiledLibraryObjectRule()
# else
# if DebugLibCalctool
DebuggedLibraryObjectRule()
# else
# if ProfileLibCalctool
ProfiledLibraryObjectRule()
# else
NormalLibraryObjectRule()
# endif
# endif
# endif
#endif
#if SharedLibCalctool
NormalSharedLibraryTarget(Calctool,$(SOCALCTOOLREV),$(OBJS))
InstallSharedLibrary(Calctool,$(SOCALCTOOLREV),$(USRLIBDIR))
#endif
NormalLibraryTarget(Calctool,$(OBJS))
LintLibraryTarget(Calctool,$(SRCS))
InstallLibrary(Calctool,$(USRLIBDIR))
InstallLintLibrary(Calctool,$(LINTLIBDIR))
#if ProfileLibCalctool
ProfiledLibraryTarget(Calctool,$(OBJS))
InstallLibrary(Calctool_p,$(USRLIBDIR))
#endif
#if DebugLibCalctool
DebuggedLibraryTarget(Calctool,$(OBJS))
#endif
BuildIncludes($(HEADERS),Calctool,..)
MakeDirectories(install,$(INCDIR)/Calctool)
InstallMultiple($(HEADERS),$(INCDIR)/Calctool)
DependTarget()
NormalLintTarget($(SRCS))
Funky_Stuff
len=`wc -c < Imakefile.lib`
if [ $len != 3031 ] ; then
echo error: Imakefile.lib was $len bytes long, should have been 3031
fi
fi # end of overwriting check
More information about the Comp.sources.bugs
mailing list