Official patch #7 for calctool v2.4; please apply it.
Rich Burridge
richb at sunaus.oz
Tue Feb 6 15:54:05 AEST 1990
It makes the following changes.
1/ From Johan Vromans <jv at mh.nl>
There is no need to have a special definition NOT_R4 in the
Makefile for people running the X11 driver on R[23]. The
close_frame routine in x11.c has been rewritten to use the code
supplied by Johan. This code will work with ICCCM compliant
window managers. It also works nicely with OpenWindows, so I've
removed the call to XIconifyWindow and used this code instead.
2/ From Johan Vromans <jv at mh.nl>
The Makefile now uses $(CC) to specify the C compiler of choice.
3/ From Johan Vromans <jv at mh.nl>
With the X11 driver, displaying new values in the memory register
window overwrote the previous contents without first clearing them.
In x11.c, the clear_canvas routine has been rewritten to use
XGetGeometry instead of XGetSizeHints.
4/ From Johan Vromans <jv at mh.nl>
Calctool on a Vax running Ultrix dumps core when you divide by
zero. This is handled on a Sun, by jumping to the matherr routine,
and causing an error. A test has now been added to the do_calculation
routine in functions.c, to check if the divisor is zero, and call
doerr if it is.
5/ From Stephen Frede <stephenf at softway.oz>
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.
Use Larry Walls patch program to apply these changes, then recompile.
------CUT HERE------patch.7------CUT HERE------
------- functions.c -------
*** /tmp/da2003 Tue Feb 6 15:47:20 1990
--- functions.c Tue Feb 6 15:32:16 1990
***************
*** 19,24 ****
--- 19,25 ----
*/
#include <stdio.h>
+ #include <errno.h>
#include <strings.h>
#include <math.h>
#include "calctool.h"
***************
*** 82,88 ****
break ;
case 'x' : result *= disp_val ; /* Multiplication. */
break ;
! case '/' : result /= disp_val ; /* Division. */
break ;
case '%' : result *= disp_val * 0.01 ; /* % */
break ;
--- 83,91 ----
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 ;
------- x11.c -------
*** /tmp/da2006 Tue Feb 6 15:47:22 1990
--- x11.c Tue Feb 6 15:21:28 1990
***************
*** 72,83 ****
enum can_type ctype ;
int color ;
{
! XSizeHints hints ;
! Window window ;
if (ctype == KEYCANVAS) window = frame ;
else if (ctype == REGCANVAS) window = rframe ;
! XGETSIZEHINTS(dpy, window, &hints, XA_WM_NORMAL_HINTS) ;
if (iscolor) gc_val.foreground = palette[color] ;
else
{
--- 72,84 ----
enum can_type ctype ;
int color ;
{
! int x, y ;
! unsigned int width, height, bwidth, depth ;
! Window root, window ;
if (ctype == KEYCANVAS) window = frame ;
else if (ctype == REGCANVAS) window = rframe ;
! XGetGeometry(dpy, window, &root, &x, &y, &width, &height, &bwidth, &depth) ;
if (iscolor) gc_val.foreground = palette[color] ;
else
{
***************
*** 86,100 ****
}
gc_val.function = GXcopy ;
XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
! XFillRectangle(dpy, window, gc, 0, 0, hints.width, hints.height) ;
}
close_frame()
{
! #ifndef NOT_R4
! XIconifyWindow(dpy, frame, screen) ;
! #endif /*NOT_R4*/
}
--- 87,109 ----
}
gc_val.function = GXcopy ;
XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
! XFillRectangle(dpy, window, gc, x, y, width, height) ;
}
close_frame()
{
! XEvent event ;
!
! event.xclient.type = ClientMessage ;
! event.xclient.display = dpy ;
! event.xclient.window = frame ;
! event.xclient.message_type = XInternAtom(dpy, "WM_CHANGE_STATE", False) ;
! event.xclient.format = 32 ;
! event.xclient.data.l[0] = IconicState ;
! XSendEvent(dpy, DefaultRootWindow(dpy), False,
! SubstructureRedirectMask | SubstructureNotifyMask, &event) ;
! XFlush(dpy) ;
}
------- Makefile -------
*** /tmp/da2009 Tue Feb 6 15:47:23 1990
--- Makefile Tue Feb 6 15:36:28 1990
***************
*** 111,122 ****
#
#X11INCDIR = -I$(OPENWINHOME)/include
#X11LIBDIR = -L$(OPENWINHOME)/lib
- #
- # If you are not running X11R4, then you should uncomment the following
- # definition. This is needed to disable the call to XIconifyWindow in
- # the routine close_frame. This routines is new in X11R4.
- #
- #NOT_R4 = -DNOT_R4
#-------------------------------------------------------------------------
# If you are compiling the XView version, then the following two lines
# should be uncommented.
--- 111,116 ----
***************
*** 146,151 ****
--- 140,147 ----
BINARIES = mgr_calctool ps_calctool sv_calctool \
tty_calctool xcalctool xv_calctool
+ CC = cc
+
LIBSRCS = graphics.c display.c functions.c get.c
LIBOBJS = graphics.o display.o functions.o get.o
STDSRCS = calctool.c mathlib.c
***************
*** 193,221 ****
all: $(BINARIES)
mgr: $(OBJS) mgr.o
! cc -o mgr_calctool $(CFLAGS) $(STDOBJS) mgr.o $(MGRLIBS)
-cp mgr_calctool calctool
news: $(OBJS) news.o
! cc -o ps_calctool $(CFLAGS) $(STDOBJS) news.o $(NEWSLIBS)
-cp ps_calctool calctool
sunview: $(OBJS) sunview.o
! cc -o sv_calctool $(CFLAGS) $(STDOBJS) sunview.o $(SVIEWLIBS)
-cp sv_calctool calctool
tty: $(OBJS) tty.o
! cc -o tty_calctool $(CFLAGS) $(STDOBJS) tty.o $(TTYLIBS)
-cp tty_calctool calctool
x11: $(OBJS) x11.o
! cc -o xcalctool $(X11LIBDIR) $(CFLAGS) $(STDOBJS) x11.o \
$(X11LIBS)
-cp xcalctool calctool
xview: $(OBJS) xview.o
! cc -o xv_calctool $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) xview.o \
! $(XVIEWLIBS)
-cp xv_calctool calctool
libcalctool.a: $(LIBOBJS)
--- 189,217 ----
all: $(BINARIES)
mgr: $(OBJS) mgr.o
! $(CC) -o mgr_calctool $(CFLAGS) $(STDOBJS) mgr.o $(MGRLIBS)
-cp mgr_calctool calctool
news: $(OBJS) news.o
! $(CC) -o ps_calctool $(CFLAGS) $(STDOBJS) news.o $(NEWSLIBS)
-cp ps_calctool calctool
sunview: $(OBJS) sunview.o
! $(CC) -o sv_calctool $(CFLAGS) $(STDOBJS) sunview.o $(SVIEWLIBS)
-cp sv_calctool calctool
tty: $(OBJS) tty.o
! $(CC) -o tty_calctool $(CFLAGS) $(STDOBJS) tty.o $(TTYLIBS)
-cp tty_calctool calctool
x11: $(OBJS) x11.o
! $(CC) -o xcalctool $(X11LIBDIR) $(CFLAGS) $(STDOBJS) x11.o \
$(X11LIBS)
-cp xcalctool calctool
xview: $(OBJS) xview.o
! $(CC) -o xv_calctool $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) \
! xview.o $(XVIEWLIBS)
-cp xv_calctool calctool
libcalctool.a: $(LIBOBJS)
------- README -------
*** /tmp/da2012 Tue Feb 6 15:47:24 1990
--- README Tue Feb 6 14:18:26 1990
***************
*** 75,82 ****
Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
Mel Melchner, Peter Allott, Skip Gilbrech, Tom Friedel, Keith McNeill
! and Stephen Frede for bug reports and/or bug fixes plus sugggested
! enhancements.
Suggestions for furthur improvement would be most welcome, plus bugs,
comments and flames.
--- 75,82 ----
Thanks go also to James Buster, David Weaver, Steve Damron, Mike Bender,
Charles Tierney, Trevor Watson, Marla Berg, David Hough, Jeff Donsbach,
Mel Melchner, Peter Allott, Skip Gilbrech, Tom Friedel, Keith McNeill
! Stephen Frede and Johan Vromans for bug reports and/or bug fixes plus
! sugggested enhancements.
Suggestions for furthur improvement would be most welcome, plus bugs,
comments and flames.
------- patchlevel.h -------
*** /tmp/da2015 Tue Feb 6 15:47:25 1990
--- patchlevel.h Tue Feb 6 14:15:11 1990
***************
*** 14,17 ****
* reported to me then an attempt will be made to fix them.
*/
! #define PATCHLEVEL 6
--- 14,17 ----
* reported to me then an attempt will be made to fix them.
*/
! #define PATCHLEVEL 7
------- tty.c -------
*** /tmp/da2018 Tue Feb 6 15:47:25 1990
--- tty.c Tue Feb 6 15:42:03 1990
***************
*** 30,43 ****
char *getenv(), *tgetstr(), *tgoto() ;
int destroy_frame(), outc() ;
- #ifdef NO_4_3SELECT
- int fullmask ; /* Full mask of file descriptors to check on. */
- int readmask ; /* Readmask used in select call. */
- #else
- fd_set fullmask ; /* Full mask of file descriptors to check on. */
- fd_set readmask ; /* Read mask used in select call. */
- #endif /*NO_4_3SELECT*/
-
struct sgttyb in_new, in_old ;
--- 30,35 ----
***************
*** 267,288 ****
for (;;)
{
! readmask = fullmask ;
! #ifdef NO_4_3SELECT
! reply = select(32, &readmask, 0, 0, (struct timeval *) 0) ;
! if (reply == -1) /* do nothing. */
! else if (readmask && (1 << 0))
! #else
! reply = select(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0,
! (struct timeval *) 0) ;
! if (reply == -1) /* do nothing. */ ;
! else if (FD_ISSET(0, &readmask))
! #endif /*NO_4_3SELECT*/
! {
! READ(0, &c, 1) ;
! cur_ch = c ;
! return(KEYBOARD) ;
! }
}
}
--- 259,267 ----
for (;;)
{
! READ(0, &c, 1) ;
! cur_ch = c & 0177 ;
! return(KEYBOARD) ;
}
}
***************
*** 335,347 ****
int i ;
SIGNAL(SIGINT, cleanup) ;
-
- #ifdef NO_4_3SELECT
- fullmask = 1 ; /* Set mask for fd #0. */
- #else
- FD_ZERO(&fullmask) ;
- FD_SET(0, &fullmask) ;
- #endif /*NO_4_3SELECT*/
IOCTL(0, TIOCGETP, &in_old) ; /* Setup standard input. */
in_new = in_old ;
--- 314,319 ----
------- CHANGES -------
*** /tmp/da2021 Tue Feb 6 15:47:26 1990
--- CHANGES Tue Feb 6 15:46:48 1990
***************
*** 150,152 ****
--- 150,185 ----
You should look near the end of mathlib.h for a set
of definitions, then set appropriately.
+
+ v2.4 - patchlevel 7. - Posted to comp.sources.bugs (February 1990).
+
+ Changes:
+
+ * From Johan Vromans <jv at mh.nl>
+ There is no need to have a special definition NOT_R4 in the
+ Makefile for people running the X11 driver on R[23]. The
+ close_frame routine in x11.c has been rewritten to use the code
+ supplied by Johan. This code will work with ICCCM compliant
+ window managers. It also works nicely with OpenWindows, so I've
+ removed the call to XIconifyWindow and used this code instead.
+
+ * From Johan Vromans <jv at mh.nl>
+ The Makefile now uses $(CC) to specify the C compiler of choice.
+
+ * From Johan Vromans <jv at mh.nl>
+ With the X11 driver, displaying new values in the memory register
+ window overwrote the previous contents without first clearing them.
+ In x11.c, the clear_canvas routine has been rewritten to use
+ XGetGeometry instead of XGetSizeHints.
+
+ * From Johan Vromans <jv at mh.nl>
+ Calctool on a Vax running Ultrix dumps core when you divide by
+ zero. This is handled on a Sun, by jumping to the matherr routine,
+ and causing an error. A test has now been added to the do_calculation
+ routine in functions.c, to check if the divisor is zero, and call
+ doerr if it is.
+
+ * From Stephen Frede <stephenf at softway.oz>
+ 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.
More information about the Comp.sources.bugs
mailing list