Official patch #6 for calctool v2.4 (Part 1 of 3).
Rich Burridge
richb at sunaus.oz
Fri Feb 2 13:20:55 AEST 1990
**IMPORTANT NOTE** This patch introduces a (hopefully) portable
maths library. Please make sure you read the
details listed below carefully.
This is to try to make calctool portable to all
Unix systems. If you have to make any changes to
get it working on your machine, please let me
know, and I'll adjust the official source code
accordingly.
This patch consists of three parts. As well as patch #6, there are
two new files; mathlib.c and mathlib.h.
---- Cut Here and unpack ----
#!/bin/sh
# shar: Shell Archiver (v1.22)
# Packed Fri Feb 2 13:11:50 EST 1990 by stard!richb
# from directory /home/tmp
#
# This is part 1 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
#
# Run the following text with /bin/sh to create:
# patch.6
# mathlib.h
# mathlib.c
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
exit 1; fi
echo "x - extracting patch.6 (Text)"
sed 's/^X//' << 'SHAR_EOF' > patch.6 &&
XThis is official patch #6 for calctool v2.4; please apply it.
X
X**IMPORTANT NOTE** This patch introduces a (hopefully) portable
X maths library. Please make sure you read the
X details listed below carefully.
X
X This is to try to make calctool portable to all
X Unix systems. If you have to make any changes to
X get it working on your machine, please let me
X know, and I'll adjust the official source code
X accordingly.
X
XIt makes the following changes.
X
X 1/ The Makefile did not include the CHANGES file in the OTHERS
X macro definition.
X
X 2/ If you are not using IEEE floating point format, and you need to
X use some of the routines from the portable maths library which is
X now included with this distribution, then you need to uncomment
X the new NOTIEEE definition in the Makefile.
X
X 3/ From Tom Friedel <tpf at jdyx.atlanta.ga.us>
X In the tty driver, in the drawtext routine, there is a character
X array of five elements. There was an invalid assignment to key[5].
X
X 4/ From Stephen Frede <stephenf at softway.oz>
X The definitions in the Makefile for HELPNAME, NEWSFILE and RCNAME
X do not need extra ...GIVEN definitions.
X
X 5/ Calctool.h defined NEWSNAME, when it should have defined NEWSFILE.
X
X 6/ With the X11 driver, the function XIconifyWindow is new to R4.
X If you are running an X11 release which is not R4, then you need
X to uncomment the new definition in the Makefile called NOT_R4.
X This nullifys the function of the calctool OFF key, but hey, you
X can also you the window manager to iconify calctool (assuming
X your window manager can do that!).
X
X 7/ The factorial function has been adjusted to only work with
X positive integers. I couldn't find a public domain or freely
X distributable lgamma function written in C.
X
X 8/ fillbox in graphics.c no longer needs to be passed a window
X parameter.
X
X 9/ From Stephen Frede <stephenf at softway.oz>
X Not all linkers have the -L option. The CALCLIB definition in the
X Makefile has been adjusted, and moved to the section where
X LIBNAME is defined. By default, you shouldn't have to do anything,
X but if you are on a Sun and want to use the shared library facility,
X then you need to uncomment three definitions.
X
X 10/ From Stephen Frede <stephenf at softway.oz>
X getcwd is not present on all systems. I've replaced it with getwd.
X
X
XIt add the following files:
X
X mathlib.h
X mathlib.c - These are an attempt to provide a portable maths
X library for those systems that don't have all the
X functions that calctool needs.
X
X You should look near the end of mathlib.h for a set
X of definitions, then set appropriately.
X
XUse Larry Walls patch program to apply these changes, then recompile.
X
X------CUT HERE------patch.6------CUT HERE------
X
X------- calctool.c -------
X*** /tmp/da5214 Fri Feb 2 13:01:42 1990
X--- calctool.c Tue Jan 30 12:08:45 1990
X***************
X*** 17,22 ****
X--- 17,25 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X+ #include <math.h>
X #include "patchlevel.h"
X #include "color.h"
X #include "calctool.h"
X***************
X*** 361,372 ****
X }
X
X
X! matherr(x) /* Calctools' math library error-handling routine. */
X! struct exception *x ;
X {
X! SPRINTF(display, "Error in %s", x->name) ;
X set_item(DISPLAYITEM, display) ;
X error = 1 ;
X set_item(OPITEM, "CLR") ;
X- return(1) ;
X }
X--- 364,390 ----
X }
X
X
X! /* Calctools' customised math library error-handling routine. */
X!
X! doerr(funcname, etype, eval)
X! char *funcname, *etype ;
X! int eval ;
X {
X! SPRINTF(display, "%s: %s error", funcname, etype) ;
X set_item(DISPLAYITEM, display) ;
X+ error = eval ;
X+ set_item(OPITEM, "CLR") ;
X+ }
X+
X+
X+ /* Default math library exception handling routine. */
X+
X+ /*ARGSUSED*/
X+ matherr(exc)
X+ struct exception *exc ;
X+ {
X+ STRCPY(display, "Error") ;
X+ set_item(DISPLAYITEM, display) ;
X error = 1 ;
X set_item(OPITEM, "CLR") ;
X }
X
X------- functions.c -------
X*** /tmp/da5217 Fri Feb 2 13:01:43 1990
X--- functions.c Fri Feb 2 12:25:38 1990
X***************
X*** 18,27 ****
X--- 18,34 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X+ #include <math.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X
X+ extern double acos(), acosh(), asin(), asinh(), atan(), atanh() ;
X+ extern double cos(), cosh(), exp(), fabs(), log(), log10(), pow() ;
X+ extern double sin(), sinh(), sqrt(), tan(), tanh() ;
X+
X BOOLEAN ibool() ;
X double setbool() ;
X
X***************
X*** 185,202 ****
X double a ;
X int i ;
X
X! if (val == (int) val)
X {
X i = val ;
X a = 1.0 ;
X while ((i > 0) && (a != HUGE)) a *= (float) i-- ;
X }
X- else
X- {
X- a = gamma(val+1) ;
X- a = exp(a) ;
X- if (signgam) a = -a ;
X- }
X return (a) ;
X }
X
X--- 192,204 ----
X double a ;
X int i ;
X
X! a = val ;
X! if (val == (int) val && val > 0.0) /* Only for positive integers. */
X {
X i = val ;
X a = 1.0 ;
X while ((i > 0) && (a != HUGE)) a *= (float) i-- ;
X }
X return (a) ;
X }
X
X***************
X*** 284,290 ****
X break ;
X case '{' : disp_val = exp(disp_val) ; /* e^x */
X break ;
X! case '}' : disp_val = exp(M_LN10*disp_val) ; /* 10^x */
X break ;
X case 'N' : disp_val = log(disp_val) ; /* ln */
X break ;
X--- 286,292 ----
X break ;
X case '{' : disp_val = exp(disp_val) ; /* e^x */
X break ;
X! case '}' : disp_val = exp(LN10*disp_val) ; /* 10^x */
X break ;
X case 'N' : disp_val = log(disp_val) ; /* ln */
X break ;
X***************
X*** 506,513 ****
X
X if (!inverse)
X {
X! if (ttype == DEG) temp = disp_val * M_PI / 180.0 ;
X! else if (ttype == GRAD) temp = disp_val * M_PI / 200.0 ;
X else temp = disp_val ;
X
X if (!hyperbolic)
X--- 508,515 ----
X
X if (!inverse)
X {
X! if (ttype == DEG) temp = disp_val * PI / 180.0 ;
X! else if (ttype == GRAD) temp = disp_val * PI / 200.0 ;
X else temp = disp_val ;
X
X if (!hyperbolic)
X***************
X*** 553,560 ****
X case CCTRL('t') : disp_val = atanh(disp_val) ; /* atanh */
X }
X
X! tresults[(int) DEG] = disp_val * 180.0 / M_PI ;
X! tresults[(int) GRAD] = disp_val * 200.0 / M_PI ;
X tresults[(int) RAD] = disp_val ;
X }
X
X--- 555,562 ----
X case CCTRL('t') : disp_val = atanh(disp_val) ; /* atanh */
X }
X
X! tresults[(int) DEG] = disp_val * 180.0 / PI ;
X! tresults[(int) GRAD] = disp_val * 200.0 / PI ;
X tresults[(int) RAD] = disp_val ;
X }
X
X
X------- graphics.c -------
X*** /tmp/da5220 Fri Feb 2 13:01:45 1990
X--- graphics.c Tue Jan 30 12:09:19 1990
X***************
X*** 14,19 ****
X--- 14,21 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X***************
X*** 73,80 ****
X drawbox(column*(BWIDTH+BGAP)+BBORDER,
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER, BWIDTH, BHEIGHT) ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+1,
X! DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+1, KEYCANVAS,
X! 42, 50, 1, color) ;
X }
X else
X {
X--- 75,81 ----
X drawbox(column*(BWIDTH+BGAP)+BBORDER,
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER, BWIDTH, BHEIGHT) ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+1,
X! DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+1, 42, 50, 1, color) ;
X }
X else
X {
X***************
X*** 82,96 ****
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+26, 34, 21) ;
X color = (iscolor) ? buttons[n].color : BLACK ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+6,
X! DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+27, KEYCANVAS,
X! 32, 19, 1, color) ;
X }
X but_text(row, column, portion, state) ;
X }
X
X
X! fillbox(x, y, window, width, height, boundry, color)
X! enum can_type window ;
X int x, y, width, height, boundry, color ;
X {
X if (boundry)
X--- 83,95 ----
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+26, 34, 21) ;
X color = (iscolor) ? buttons[n].color : BLACK ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+6,
X! DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+27, 32, 19, 1, color) ;
X }
X but_text(row, column, portion, state) ;
X }
X
X
X! fillbox(x, y, width, height, boundry, color)
X int x, y, width, height, boundry, color ;
X {
X if (boundry)
X***************
X*** 199,205 ****
X color = (portion) ? WHITE : BLACK ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+6,
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+5+(portion*22),
X! KEYCANVAS, 32, 19, portion, color) ;
X but_text(row, column, portion, state) ;
X }
X }
X--- 198,204 ----
X color = (portion) ? WHITE : BLACK ;
X fillbox(column*(BWIDTH+BGAP)+BBORDER+6,
X DISPLAY+row*(BHEIGHT+BGAP)+BBORDER+5+(portion*22),
X! 32, 19, portion, color) ;
X but_text(row, column, portion, state) ;
X }
X }
X
X------- news.c -------
X*** /tmp/da5223 Fri Feb 2 13:01:46 1990
X--- news.c Tue Jan 30 12:47:57 1990
X***************
X*** 14,19 ****
X--- 14,21 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X
X------- sunview.c -------
X*** /tmp/da5226 Fri Feb 2 13:01:47 1990
X--- sunview.c Tue Jan 30 12:30:27 1990
X***************
X*** 14,19 ****
X--- 14,21 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X***************
X*** 27,32 ****
X--- 29,35 ----
X #define NOTIFY_INTERPOSE_DESTROY_FUNC (void) notify_interpose_destroy_func
X #define PW_SETCMSNAME (void) pw_setcmsname
X #define PW_PUTCOLORMAP (void) pw_putcolormap
X+ #define PW_REVERSEVIDEO (void) pw_reversevideo
X #define PW_TTEXT (void) pw_ttext
X #define PW_VECTOR (void) pw_vector
X #define PW_WRITEBACKGROUND (void) pw_writebackground
X***************
X*** 457,463 ****
X
X calc_colorsetup(red, green, blue) ;
X PW_PUTCOLORMAP(cpw, 0, CALC_COLORSIZE, red, green, blue) ;
X! if (inv_video) pw_reversevideo(cpw, 0, CALC_COLORSIZE) ;
X
X if (iscolor)
X {
X--- 460,466 ----
X
X calc_colorsetup(red, green, blue) ;
X PW_PUTCOLORMAP(cpw, 0, CALC_COLORSIZE, red, green, blue) ;
X! if (inv_video) PW_REVERSEVIDEO(cpw, 0, CALC_COLORSIZE) ;
X
X if (iscolor)
X {
X
X------- x11.c -------
X*** /tmp/da5229 Fri Feb 2 13:01:48 1990
X--- x11.c Mon Jan 29 23:10:33 1990
X***************
X*** 14,19 ****
X--- 14,20 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X***************
X*** 91,117 ****
X
X close_frame()
X {
X! Atom a ;
X! XClientMessageEvent ev ;
X!
X! iconic = 1 ;
X! rstate = 0 ;
X!
X! if (dpy->atoms->wm_change_state == None)
X! {
X! a = XInternAtom (dpy, "WM_CHANGE_STATE", False) ;
X! if (a == None) return ;
X! dpy->atoms->wm_change_state = a ;
X! }
X!
X! ev.type = ClientMessage ;
X! ev.window = frame ;
X! ev.message_type = dpy->atoms->wm_change_state ;
X! ev.format = 32 ;
X! ev.data.l[0] = IconicState ;
X! XSendEvent(dpy, RootWindow(dpy, screen), False,
X! SubstructureRedirectMask | SubstructureNotifyMask,
X! (XEvent *) &ev) ;
X }
X
X
X--- 92,100 ----
X
X close_frame()
X {
X! #ifndef NOT_R4
X! XIconifyWindow(dpy, frame, screen) ;
X! #endif /*NOT_R4*/
X }
X
X
X
X------- calctool.h -------
X*** /tmp/da5232 Fri Feb 2 13:01:49 1990
X--- calctool.h Fri Feb 2 12:54:28 1990
X***************
X*** 14,31 ****
X * reported to me then an attempt will be made to fix them.
X */
X
X! #include <stdio.h>
X! #include <strings.h>
X! #include <ctype.h>
X! #include <signal.h>
X! #include <sys/types.h>
X! #include <sys/ioctl.h>
X! #include <sys/time.h>
X! #include <pwd.h>
X! #include <math.h>
X
X- char *getenv(), *sprintf() ;
X-
X #define CLOSE (void) close /* To make lint happy. */
X #define FCLOSE (void) fclose
X #define FFLUSH (void) fflush
X--- 14,21 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X! char *getenv(), *getwd(), *sprintf() ;
X
X #define CLOSE (void) close /* To make lint happy. */
X #define FCLOSE (void) fclose
X #define FFLUSH (void) fflush
X***************
X*** 91,96 ****
X--- 81,102 ----
X
X enum trig_type { DEG, GRAD, RAD } ; /* Trigonometric types. */
X
X+ /* Mathematical constants used by the routines in functions.c
X+ * These should be declared in math.h, but just in case....
X+ */
X+
X+ #ifndef HUGE
X+ #define HUGE 1.701411733192644270e38
X+ #endif /*HUGE*/
X+
X+ #ifndef LN10
X+ #define LN10 2.30258509299404568402
X+ #endif /*LN10*/
X+
X+ #ifndef PI
X+ #define PI 3.14159265358979323846
X+ #endif /*PI*/
X+
X #define BBORDER 10 /* No of pixels in border. */
X #define BCOLS 6 /* No of columns of buttons. */
X #define BGAP 5 /* No of pixels between buttons. */
X***************
X*** 104,112 ****
X #define EQUAL !strcmp /* For character comparisons. */
X #define EXTRA 5 /* Extra useful character definitions. */
X
X! #ifndef HELPGIVEN
X #define HELPNAME "calctool.help"
X! #endif /*HELPGIVEN*/
X
X #define ICONHEIGHT 64 /* Height of calctool icon. */
X #define ICONWIDTH 42 /* Width of calctool icon. */
X--- 110,118 ----
X #define EQUAL !strcmp /* For character comparisons. */
X #define EXTRA 5 /* Extra useful character definitions. */
X
X! #ifndef HELPNAME
X #define HELPNAME "calctool.help"
X! #endif /*HELPNAME*/
X
X #define ICONHEIGHT 64 /* Height of calctool icon. */
X #define ICONWIDTH 42 /* Width of calctool icon. */
X***************
X*** 119,131 ****
X #endif /*MAXLINE*/
X
X #define MAXMENUS 8 /* Maximum number of popup menus. */
X #define MAXREGS 10 /* Maximum number of memory registers. */
X #define MAXVKEYS 7 /* Number of valid keys after an error. */
X #define MIN(x,y) ((x) < (y) ? (x) : (y))
X
X! #ifndef NEWSGIVEN
X! #define NEWSNAME "calctool.ps"
X! #endif /*NEWSGIVEN*/
X
X #define NOBUTTONS BROWS * BCOLS
X
X--- 125,145 ----
X #endif /*MAXLINE*/
X
X #define MAXMENUS 8 /* Maximum number of popup menus. */
X+
X+ #ifndef MAXPATHLEN
X+ #define MAXPATHLEN 1024 /* Longest possible path length. */
X+ #endif /*MAXPATHLEN*/
X+
X #define MAXREGS 10 /* Maximum number of memory registers. */
X #define MAXVKEYS 7 /* Number of valid keys after an error. */
X+
X+ #ifndef MIN
X #define MIN(x,y) ((x) < (y) ? (x) : (y))
X+ #endif /*MIN*/
X
X! #ifndef NEWSFILE
X! #define NEWSFILE "calctool.ps"
X! #endif /*NEWSFILE*/
X
X #define NOBUTTONS BROWS * BCOLS
X
X***************
X*** 133,141 ****
X #define index strchr
X #endif /*NOINDEX*/
X
X! #ifndef RCGIVEN
X #define RCNAME ".calctoolrc"
X! #endif /*RCGIVEN*/
X
X #ifndef NO_4_3SIGNAL
X #define SIGRET void
X--- 147,155 ----
X #define index strchr
X #endif /*NOINDEX*/
X
X! #ifndef RCNAME
X #define RCNAME ".calctoolrc"
X! #endif /*RCNAME*/
X
X #ifndef NO_4_3SIGNAL
X #define SIGRET void
X
X------- Makefile -------
X*** /tmp/da5235 Fri Feb 2 13:01:50 1990
X--- Makefile Fri Feb 2 12:24:19 1990
X***************
X*** 28,35 ****
X # It can also be specified here by uncommenting the following
X # macro definition and setting appropriately.
X #
X! #HELPNAME = -DHELPGIVEN -DHELPNAME=\"$(LIBDIR)/calctool.help\"
X #-----------------------------------------------------------------------
X # Not all machines have the index() string library function. If you
X # don't have this function then you should uncomment the NOINDEX
X # definition below.
X--- 28,44 ----
X # It can also be specified here by uncommenting the following
X # macro definition and setting appropriately.
X #
X! #HELPNAME = -DHELPNAME=\"$(LIBDIR)/calctool.help\"
X #-----------------------------------------------------------------------
X+ # An attempt is now made at using a portable math library. You should
X+ # carefully setup the following three definitions.
X+ #
X+ # One of the things this is not the same on all machines is the
X+ # floating point format. If your machine does *not* use IEEE floating
X+ # point format, then the following definition needs to be uncommented.
X+ #
X+ #NOIEEE = -DIEEE
X+ #-----------------------------------------------------------------------
X # Not all machines have the index() string library function. If you
X # don't have this function then you should uncomment the NOINDEX
X # definition below.
X***************
X*** 47,53 ****
X # should be uncommented and set to the default location for the calctool
X # PostScript file, which is downloaded to the NeWS server.
X #
X! #NEWSFILE = -DNEWSGIVEN -DNEWSFILE=\"$(LIBDIR)/calctool.ps\"
X #-----------------------------------------------------------------------
X # Calctool loads a run control file when it starts. By default
X # this file is called ".calctoolrc", and is taken from the users
X--- 56,62 ----
X # should be uncommented and set to the default location for the calctool
X # PostScript file, which is downloaded to the NeWS server.
X #
X! #NEWSFILE = -DNEWSFILE=\"$(LIBDIR)/calctool.ps\"
X #-----------------------------------------------------------------------
X # Calctool loads a run control file when it starts. By default
X # this file is called ".calctoolrc", and is taken from the users
X***************
X*** 56,62 ****
X # can also be specified here by uncommenting the following macro
X # definition and setting appropriately.
X #
X! #RCNAME = -DRCGIVEN -DRCNAME=\".calctoolrc\"
X #-----------------------------------------------------------------------
X # If you not running under a BSD4.3 derived system, the parameters
X # to the select call are different, and this definition should be
X--- 65,71 ----
X # can also be specified here by uncommenting the following macro
X # definition and setting appropriately.
X #
X! #RCNAME = -DRCNAME=\".calctoolrc\"
X #-----------------------------------------------------------------------
X # If you not running under a BSD4.3 derived system, the parameters
X # to the select call are different, and this definition should be
X***************
X*** 66,77 ****
X #-----------------------------------------------------------------------
X # Note that with SunOS v4.x it is possible to create a shared library
X # for the calctool routines. If you wish to do this, then you should
X! # change LIBNAME below to libcalctool.so.1.1, and uncomment the SHLIB
X! # line.
X #
X LIBNAME = libcalctool.a
X #
X #LIBNAME = libcalctool.so.1.1
X #SHLIB = -pic
X #-----------------------------------------------------------------------
X # If you are not running under a BSD4.3 derived system, then the
X--- 75,89 ----
X #-----------------------------------------------------------------------
X # Note that with SunOS v4.x it is possible to create a shared library
X # for the calctool routines. If you wish to do this, then you should
X! # uncomment the other three definitions below, commented out the initial
X! # two.
X #
X LIBNAME = libcalctool.a
X+ CALCLIB = $(LIBNAME)
X #
X+ # Shared library definitions. Uncomment if required.
X #LIBNAME = libcalctool.so.1.1
X+ #CALCLIB = -L. -lcalctool
X #SHLIB = -pic
X #-----------------------------------------------------------------------
X # If you are not running under a BSD4.3 derived system, then the
X***************
X*** 99,104 ****
X--- 111,122 ----
X #
X #X11INCDIR = -I$(OPENWINHOME)/include
X #X11LIBDIR = -L$(OPENWINHOME)/lib
X+ #
X+ # If you are not running X11R4, then you should uncomment the following
X+ # definition. This is needed to disable the call to XIconifyWindow in
X+ # the routine close_frame. This routines is new in X11R4.
X+ #
X+ #NOT_R4 = -DNOT_R4
X #-------------------------------------------------------------------------
X # If you are compiling the XView version, then the following two lines
X # should be uncommented.
X***************
X*** 118,124 ****
X #
X # Compilation flags and standard macro definitions.
X #
X! CFLAGS = -g $(HELPNAME) $(NEWSFILE) $(NOINDEX) $(RCNAME) \
X $(SELTYPE) $(SHLIB) $(SIGRET) $(SUN4_KEYBOARD) \
X $(TTEXT) $(MGRPARAM) $(MGRINCDIR) $(X11INCDIR) \
X $(XVIEWINCDIR)
X--- 136,142 ----
X #
X # Compilation flags and standard macro definitions.
X #
X! CFLAGS = -g $(HELPNAME) $(NEWSFILE) $(NOIEEE) $(NOINDEX) $(RCNAME) \
X $(SELTYPE) $(SHLIB) $(SIGRET) $(SUN4_KEYBOARD) \
X $(TTEXT) $(MGRPARAM) $(MGRINCDIR) $(X11INCDIR) \
X $(XVIEWINCDIR)
X***************
X*** 130,155 ****
X
X LIBSRCS = graphics.c display.c functions.c get.c
X LIBOBJS = graphics.o display.o functions.o get.o
X! STDSRCS = calctool.c
X! STDOBJS = calctool.o
X OBJS = $(STDOBJS) $(LIBNAME)
X
X GSRCS = mgr.c news.c sunview.c tty.c x11.c xview.c
X! HDRS = calctool.h color.h extern.h
X IMAGES = calctool.icon calctool.color.icon help.cursor
X OTHERS = Makefile README TODO calctool.help calctool.1 \
X! calctool.ps patchlevel.h .calctoolrc
X
X! SFILES1 = $(LIBSRCS) $(STDSRCS)
X! SFILES2 = $(GSRCS)
X! SFILES3 = $(HDRS) $(IMAGES)
X! SFILES4 = $(OTHERS)
X
X- CALCLIB = -L. -lcalctool
X MGRLIBS = $(CALCLIB) $(MGRHOME)/lib/libmgr.a -lm
X! NEWSLIBS = $(CALCLIB) $$NEWSHOME/lib/libcps.a -lm
X SVIEWLIBS = $(CALCLIB) -lsuntool -lsunwindow -lpixrect -lm
X! TTYLIBS = $(CALCLIB) -ltermcap -lm
X X11LIBS = $(CALCLIB) -lX11 -lm
X XVIEWLIBS = $(CALCLIB) -lxview -lolgx -lX11 -lm
X
X--- 148,173 ----
X
X LIBSRCS = graphics.c display.c functions.c get.c
X LIBOBJS = graphics.o display.o functions.o get.o
X! STDSRCS = calctool.c mathlib.c
X! STDOBJS = calctool.o mathlib.o
X OBJS = $(STDOBJS) $(LIBNAME)
X
X GSRCS = mgr.c news.c sunview.c tty.c x11.c xview.c
X! HDRS = calctool.h color.h extern.h mathlib.h
X IMAGES = calctool.icon calctool.color.icon help.cursor
X OTHERS = Makefile README TODO calctool.help calctool.1 \
X! CHANGES calctool.ps patchlevel.h .calctoolrc
X
X! SFILES1 = $(STDSRCS)
X! SFILES2 = $(LIBSRCS)
X! SFILES3 = $(GSRCS)
X! SFILES4 = $(HDRS) $(IMAGES)
X! SFILES5 = $(OTHERS)
X
X MGRLIBS = $(CALCLIB) $(MGRHOME)/lib/libmgr.a -lm
X! NEWSLIBS = $(CALCLIB) $$OPENWINHOME/lib/libcps.a -lm
X SVIEWLIBS = $(CALCLIB) -lsuntool -lsunwindow -lpixrect -lm
X! TTYLIBS = $(CALCLIB) -ltermcap -lm
X X11LIBS = $(CALCLIB) -lX11 -lm
X XVIEWLIBS = $(CALCLIB) -lxview -lolgx -lX11 -lm
X
X***************
X*** 230,235 ****
X--- 248,254 ----
X shar.script $(SFILES2) > archive.2
X shar.script $(SFILES3) > archive.3
X shar.script $(SFILES4) > archive.4
X+ shar.script $(SFILES5) > archive.5
X
X create: SCCS
X -sccs create $(STDSRCS) $(GSRCS) $(HDRS) $(IMAGES) $(OTHERS)
X***************
X*** 236,238 ****
X--- 255,270 ----
X SCCS:
X -mkdir SCCS
X chmod 755 SCCS
X+
X+ calctool.o: calctool.c patchlevel.h color.h calctool.h
X+ display.o: display.c calctool.h color.h extern.h
X+ functions.o: functions.c calctool.h color.h extern.h
X+ get.o: get.c patchlevel.h calctool.h color.h extern.h
X+ graphics.o: graphics.c calctool.h color.h extern.h
X+ mathlib.o: mathlib.c mathlib.h calctool.h
X+ mgr.o: mgr.c calctool.h color.h extern.h
X+ news.o: news.c calctool.h color.h extern.h
X+ sunview.o: sunview.c calctool.h color.h extern.h
X+ tty.o: tty.c calctool.h color.h extern.h
X+ x11.o: x11.c calctool.h color.h extern.h
X+ xview.o: xview.c calctool.h color.h extern.h
X
X------- README -------
X*** /tmp/da5238 Fri Feb 2 13:01:51 1990
X--- README Tue Jan 30 00:07:24 1990
X***************
X*** 39,44 ****
X--- 39,62 ----
X defined by the Makefile macro definition LIBDIR, so you might need root
X permission to successfully do this.
X
X+
X+ Portable maths routines.
X+ ------------------------
X+
X+ It is hoped that your system supplies all the mathematical functions
X+ required by calctool. If not then, it is possible to use the needed
X+ ones from the portable math library routines that comes with these
X+ sources.
X+
X+ In mathlib.h, there is one definition for each routine used by calctool.
X+ These are commented out by default to signify that this system has that
X+ routine in it's maths library. If you are missing any, then uncomment
X+ the appropriate definitions.
X+
X+
X+ Todo.
X+ -----
X+
X There is a TODO file included, which lists the current known bugs, and
X a set of possible enhancements, some relatively trivial, others that
X are fairly major enhancements which would make interesting future
X***************
X*** 46,51 ****
X--- 64,70 ----
X
X
X Acknowledgements.
X+ -----------------
X
X Thanks to Ed Falk at Sun Microsystems (Mountain View) for most of the
X basic arithmetical algorithms used, to Andrew Nicholson for revising the
X***************
X*** 55,65 ****
X
X Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
X Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
X! Mel Melchner, Peter Allott, Skip Gilbrech and Keith McNeill for bug
X! reports and/or bug fixes plus sugggested enhancements.
X
X Suggestions for furthur improvement would be most welcome, plus bugs,
X comments and flames.
X
X! Rich Burridge, DOMAIN: richb at sunaus.oz.au
X! PHONE: +61 2 413 2666 UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
X--- 74,86 ----
X
X Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
X Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
X! Mel Melchner, Peter Allott, Skip Gilbrech, Tom Friedel, Keith McNeill
X! and Stephen Frede for bug reports and/or bug fixes plus sugggested
X! enhancements.
X
X Suggestions for furthur improvement would be most welcome, plus bugs,
X comments and flames.
X
X! Rich Burridge, DOMAIN: richb at Aus.Sun.COM
X! PHONE: +61 2 413 2666 ACSNET: richb at sunaus.sun.oz
X! UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
X
X------- calctool.1 -------
X*** /tmp/da5241 Fri Feb 2 13:01:52 1990
X--- calctool.1 Mon Jan 29 23:55:44 1990
X***************
X*** 259,265 ****
X .IP "\fB1/x [ R ]\fP" 18
X Return the value of 1 divided by the current entry.
X .IP "\fBx! [ ! ]\fP" 18
X! Return the factorial of the current entry.
X .IP "\fBx^2 [ @ ]\fP" 18
X Return the square of the current entry.
X .SS Number Manipulation Operators.
X--- 259,266 ----
X .IP "\fB1/x [ R ]\fP" 18
X Return the value of 1 divided by the current entry.
X .IP "\fBx! [ ! ]\fP" 18
X! Return the factorial of the current entry. Note that this only works
X! for positive integers.
X .IP "\fBx^2 [ @ ]\fP" 18
X Return the square of the current entry.
X .SS Number Manipulation Operators.
X
X------- patchlevel.h -------
X*** /tmp/da5244 Fri Feb 2 13:01:53 1990
X--- patchlevel.h Tue Jan 23 10:00:38 1990
X***************
X*** 14,17 ****
X * reported to me then an attempt will be made to fix them.
X */
X
X! #define PATCHLEVEL 5
X--- 14,17 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X! #define PATCHLEVEL 6
X
X------- mgr.c -------
X*** /tmp/da5247 Fri Feb 2 13:01:53 1990
X--- mgr.c Tue Jan 30 00:21:25 1990
X***************
X*** 14,19 ****
X--- 14,24 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <signal.h>
X+ #include <sys/types.h>
X+ #include <sys/ioctl.h>
X+ #include <sys/time.h>
X #include "dump.h"
X #include "term.h"
X #include "calctool.h"
X
X------- tty.c -------
X*** /tmp/da5250 Fri Feb 2 13:01:54 1990
X--- tty.c Tue Jan 30 12:23:19 1990
X***************
X*** 1,3 ****
X--- 1,4 ----
X+ /*LINTLIBRARY*/
X
X /* %Z%%M% %I% %E%
X *
X***************
X*** 14,19 ****
X--- 15,26 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X+ #include <signal.h>
X+ #include <sys/types.h>
X+ #include <sys/ioctl.h>
X+ #include <sys/time.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X***************
X*** 105,111 ****
X /*ARGSUSED*/
X do_menu(mtype) /* Popup appropriate menu (null routine). */
X enum menu_type mtype ;
X! {}
X
X
X do_move(x, y) /* Move to character position (x, y). */
X--- 112,120 ----
X /*ARGSUSED*/
X do_menu(mtype) /* Popup appropriate menu (null routine). */
X enum menu_type mtype ;
X! {
X! return 0 ; /* To make lint happy. */
X! }
X
X
X do_move(x, y) /* Move to character position (x, y). */
X***************
X*** 234,240 ****
X case 3 : key[0] = ' ' ;
X STRNCPY(&key[1], str, 3) ;
X }
X! key[5] = '\0' ;
X STRCPY(str, key) ;
X if (ty % 3) invert = 1 ;
X }
X--- 243,249 ----
X case 3 : key[0] = ' ' ;
X STRNCPY(&key[1], str, 3) ;
X }
X! key[4] = '\0' ;
X STRCPY(str, key) ;
X if (ty % 3) invert = 1 ;
X }
X
X------- xview.c -------
X*** /tmp/da5253 Fri Feb 2 13:01:55 1990
X--- xview.c Mon Jan 29 23:11:47 1990
X***************
X*** 14,19 ****
X--- 14,20 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X
X------- get.c -------
X*** /tmp/da5256 Fri Feb 2 13:01:56 1990
X--- get.c Fri Feb 2 12:54:34 1990
X***************
X*** 14,19 ****
X--- 14,23 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X+ #include <sys/param.h>
X+ #include <pwd.h>
X #include "patchlevel.h"
X #include "calctool.h"
X #include "color.h"
X***************
X*** 281,286 ****
X--- 285,291 ----
X {
X char *home ; /* Pathname for users home directory. */
X char name[MAXLINE] ; /* Full name of users .calctoolrc file. */
X+ char pathname[MAXPATHLEN] ; /* Current working directory. */
X int n ;
X struct passwd *entry ;
X
X***************
X*** 299,305 ****
X SPRINTF(name, "%s/%s", home, RCNAME) ;
X get_rcfile(name) ; /* Read .calctoolrc from users home directory. */
X
X! SPRINTF(name, "%s/%s", getcwd((char *) NULL, MAXLINE), RCNAME) ;
X get_rcfile(name) ; /* Read .calctoolrc file from current directory. */
X }
X
X--- 304,310 ----
X SPRINTF(name, "%s/%s", home, RCNAME) ;
X get_rcfile(name) ; /* Read .calctoolrc from users home directory. */
X
X! SPRINTF(name, "%s/%s", getwd(pathname), RCNAME) ;
X get_rcfile(name) ; /* Read .calctoolrc file from current directory. */
X }
X
X
X------- display.c -------
X*** /tmp/da5259 Fri Feb 2 13:01:57 1990
X--- display.c Tue Jan 30 12:09:53 1990
X***************
X*** 17,22 ****
X--- 17,25 ----
X * reported to me then an attempt will be made to fix them.
X */
X
X+ #include <stdio.h>
X+ #include <strings.h>
X+ #include <math.h>
X #include "calctool.h"
X #include "color.h"
X #include "extern.h"
X
X------- CHANGES -------
X*** /tmp/da5262 Fri Feb 2 13:01:58 1990
X--- CHANGES Fri Feb 2 13:01:01 1990
X***************
X*** 93,95 ****
X--- 93,152 ----
X
X * CHANGES - documented history of the changes made with each new
X calctool patch.
X+
X+ v2.4 - patchlevel 6. - Posted to comp.sources.bugs (January 1990).
X+
X+ Changes:
X+
X+ * The Makefile did not include the CHANGES file in the OTHERS
X+ macro definition.
X+
X+ * If you are not using IEEE floating point format, and you need to
X+ use some of the routines from the portable maths library which is
X+ now included with this distribution, then you need to uncomment
X+ the new NOTIEEE definition in the Makefile.
X+
X+ * From Tom Friedel <tpf at jdyx.atlanta.ga.us>
X+ In the tty driver, in the drawtext routine, there is a character
X+ array of five elements. There was an invalid assignment to key[5].
X+
X+ * From Stephen Frede <stephenf at softway.oz>
X+ The definitions in the Makefile for HELPNAME, NEWSFILE and RCNAME
X+ do not need extra ...GIVEN definitions.
X+
X+ * Calctool.h defined NEWSNAME, when it should have defined NEWSFILE.
X+
X+ * With the X11 driver, the function XIconifyWindow is new to R4.
X+ If you are running an X11 release which is not R4, then you need
X+ to uncomment the new definition in the Makefile called NOT_R4.
X+ This nullifys the function of the calctool OFF key, but hey, you
X+ can also you the window manager to iconify calctool (assuming
X+ your window manager can do that!).
X+
X+ * The factorial function has been adjusted to only work with
X+ positive integers. I couldn't find a public domain or freely
X+ distributable lgamma function written in C.
X+
X+ * fillbox in graphics.c no longer needs to be passed a window
X+ parameter
X+
X+ * From Stephen Frede <stephenf at softway.oz>
X+ Not all linkers have the -L option. The CALCLIB definition in the
X+ Makefile has been adjusted, and moved to the section where
X+ LIBNAME is defined. By default, you shouldn't have to do anything,
X+ but if you are on a Sun and want to use the shared library facility,
X+ then you need to uncomment three definitions.
X+
X+ * From Stephen Frede <stephenf at softway.oz>
X+ getcwd is not present on all systems. I've replaced it with getwd.
X+
X+
X+ New files:
X+
X+ * mathlib.h
X+ mathlib.c - These are an attempt to provide a portable maths
X+ library for those systems that don't have all the
X+ functions that calctool needs.
X+
X+ You should look near the end of mathlib.h for a set
X+ of definitions, then set appropriately.
SHAR_EOF
chmod 0644 patch.6 || echo "restore of patch.6 fails"
set `wc -c patch.6`;Sum=$1
if test "$Sum" != "35130"
then echo original size 35130, current size $Sum;fi
echo "x - extracting mathlib.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > mathlib.h &&
X
X/* @(#)mathlib.h 1.2 90/02/02
X *
X * Definitions used with the portable math library.
X *
X * This is being done because libm.a doesn't appear to be as portable
X * as originally assumed.
X *
X * These routines are taken from two sources:
X *
X * 1/ Fred Fishs' portable maths library which was posted to the
X * comp.sources.unix newsgroup on April 1987.
X *
X * acos, acosh, asin, asinh, atan, atanh, cos, cosh, dabss,
X * exp, log, log10, mod, poly, sin, sinh, sqrt, tan, tanh.
X *
X * 2/ The BSD4.3 maths library found on uunet in
X * bsd_sources/src/usr.lib/libm.
X *
X * pow, pow_p, scalb, logb, copysign, finite, drem, exp__E,
X * log__L.
X *
X * Customised and condensed by Rich Burridge,
X * Sun Microsystems, Australia.
X *
X * Permission is given to distribute these sources, as long as the
X * copyright messages are not removed, and no monies are exchanged.
X *
X * No responsibility is taken for any errors or inaccuracies inherent
X * either to the comments or the code of this program, but if
X * reported to me then an attempt will be made to fix them.
X */
X
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X/* This file gets included with all of the floating point math
X * library routines when they are compiled. Note that
X * this is the proper place to put machine dependencies
X * whenever possible.
X *
X * It should be pointed out that for simplicity's sake, the
X * environment parameters are defined as floating point constants,
X * rather than octal or hexadecimal initializations of allocated
SHAR_EOF
echo "End of part 1"
echo "File mathlib.h is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0
More information about the Comp.sources.bugs
mailing list