From: amir@matis.ingr.COM (Amir J Katz)
Subject: unofficial patch to calctool v2.4.12
Reply-To: amir@matis.ingr.com
Organization: SEE Technologies Ltd.
Date: Wed, 6 Jan 1993 18:05:24 GMT

I have recently compiled calctool with gcc 2.2.2 and found a couple of
problems. The first one may be a compiler idiosyncrasy, but the second is a
bug. 
Attached below is a patch to fix both.

For those unfamiliar with calctool, here's a few lines from the README file:

>> This is V2.4 of a simple desktop calculator.
>> This version works under SunView, XView, X11, NeWS, MGR and for
>> dumb tty terminals.
>> 
>> It is almost visually identical to V2.1 which was released in August
>> 1988, but internally most of the code has been reworked to include a
>> level of graphics abstraction, to make porting this code to other
>> window systems a trivial task.
>> 
>> V2.4 includes display in scientific notation, color icons, a correct
>> factorial function and fixes for a few minor bugs. It introduces the
>> new versions for XView, X11, MGR and dumb terminals. New functions
>> include hyperbolic and inverse hyperbolic trigonometrical functions,
>> register exchange, constants and the input of numbers in exponential
>> notation. You can also have a .calctoolrc file in your home directory,
>> which can define upto ten new values for constants, and ten function
>> definitions which are used in conjunction with the FUN key.

Calctool is available via anonymous ftp from ftp.adelaide.edu.au in the
pub/sun/richb directory.

Calctool was written by:

Rich Burridge,          DOMAIN: richb@Aus.Sun.COM
Sun Microsystems.       ACSNET: richb@sunaus.sun.oz
PHONE: +61 2 413 2666   UUCP:   {uunet,mcvax,ukc}!munnari!sunaus.oz!richb

To apply this patch:

1. Rename mathlib.c to mathlib.c.orig
2. Rename x11.c to x11.c.orig
3. Put the stuff below (between the slice'n'dice lines)
   into a file and type
   patch < file
4. Compile and enjoy.

--------------- slice'n'dice ----------------------------
*** mathlib.c.orig	Mon Jan  4 09:37:24 1993
--- mathlib.c	Mon Jan  4 09:38:49 1993
***************
*** 1100,1106 ****
   *      double base ;
   */
  
! #ifdef   NEED_COS || NEED_SIN
  double mod(value, base)
  double value ;
  double base ;
--- 1100,1106 ----
   *      double base ;
   */
  
! #if defined(NEED_COS) || defined(NEED_SIN)
  double mod(value, base)
  double value ;
  double base ;
***************
*** 1141,1147 ****
   *              P(x) = P0 + x(P1 + x(P2 +...x(Pn)))
   */
  
! #ifdef   NEED_ATAN || NEED_COS || NEED_LOG || NEED_SIN
  double
  poly(order, coeffs, x)
  register int order ;
--- 1141,1147 ----
   *              P(x) = P0 + x(P1 + x(P2 +...x(Pn)))
   */
  
! #if   defined(NEED_ATAN) || defined(NEED_COS) || defined(NEED_LOG) || defined(NEED_SIN)
  double
  poly(order, coeffs, x)
  register int order ;
*** x11.c.orig	Mon Jan  4 09:47:38 1993
--- x11.c	Mon Jan  4 14:23:42 1993
***************
*** 296,303 ****
  
    screen = DefaultScreen(dpy) ;
  
!   if (*geometry == '\0')
!     STRCPY(geometry, XGetDefault(dpy, progname, "Geometry")) ;
  
    foregnd = BlackPixel(dpy, screen) ;
    backgnd = WhitePixel(dpy, screen) ;
--- 296,308 ----
  
    screen = DefaultScreen(dpy) ;
  
!   if (*geometry == '\0') {   /* AJK */
!     static char defgeo [] = "100x100+5+5";
!     char       *xdef;
! 
!     xdef = XGetDefault (dpy, progname, "Geometry");
!     STRCPY (geometry, xdef ? xdef : defgeo);
!   }
  
    foregnd = BlackPixel(dpy, screen) ;
    backgnd = WhitePixel(dpy, screen) ;
--------------- slice'n'dice ----------------------------

-- 
/* ----------------------------------------------------------- */
/*  Amir J. Katz             |   amir@matis.ingr.COM           */
/*  System Specialist        |   Voice:  +972 52-584684        */
/*  SEE Technologies Ltd.    |   Fax:    +972 52-543917        */
/* ............ Solaris 2.1 - The Final Frontier ? ........... */
Xref: sparky comp.windows.x:20836 comp.windows.x.motif:8382