home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
pc.louisiana.edu/pub/unix/
/
Louisiana_UNIX.tar
/
Louisiana_UNIX
/
sc621.eqs.bugfix
< prev
next >
Wrap
Internet Message Format
|
1994-05-13
|
3KB
Received: from tabasco.ansa.co.uk by armagnac.ucs.usl.edu with SMTP id AA24337
(5.65c/IDA-1.4.4 for <jpd@usl.edu>); Fri, 13 May 1994 10:54:11 -0500
Received: from crippen.ansa.co.uk by tabasco.ansa.co.uk; Fri, 13 May 94 16:53:25 +0100
Received: by crippen.ansa.co.uk; Fri, 13 May 94 16:52:49 BST
Date: Fri, 13 May 94 16:52:49 BST
From: Andrew Watson <ajw@ansa.co.uk>
Message-Id: <9405131552.AA26647@crippen.ansa.co.uk>
To: comp.sources.bugs@newnews.demon.co.uk, James Dugal <jpd@usl.edu>
Subject: SC 6.21 - Null string comparison patch
Status: R
Greetings,
This is a small patch for the excellent sc 6.21 PD spreadsheet. I've been using
sc for increasingly-complex applications over the years, and a month or so ago
I bumped into a small problem with the @eqs string comparison function. While
it's easily worked-around, it's also easily patched.
I'm not sure if SC is still actively maintained. The REAEDME names Jeff Buhrt of
ProsLink, Inc as the maintainer, but I've failed to contact him (although I
haven't tried very hard!). If you're reading this Jeff, I hope you don't mind
me posting a patch without consulting you!
. Regards,
/ \^
/ / \ \ Andrew
/ / \ \
'=========` Andrew Watson Tel: +44 223 323010
/| |\ | < |\ APM Ltd, Poseidon House, Fax: +44 223 359779
/ | | \| _> | \ Castle Park, Internet: ajw@ansa.co.uk
--------------- Cambridge CB3 0RD, UK
------------------------------------------------------------------------------
Software and version:
SC 6.21
Problem description:
A cell's initial string label, and the one that it is given after being
erased (for instance, using the 'x' command) appears to be the null string,
and assigning a null string label to a cell (for instance, using the '>'
command) leaves it in this state too. However, using the @eqs() operator
to compare such a cell to the string "" always yields 0 (false), whereas
comparing the cell to itself or another unlabelled cell yields 1 (true).
Functional description of patch:
Arrange that @eqs(<cell>, "") yields 1 (true) for an unlabelled cell, and
0 (false) otherwise.
Internal description of patch:
The string label of an empty cell is represented by a null pointer, while
the null string generated when the SC parser reads the empty string "" is a
pointer to a zero length string (i.e. a zero byte). The patch catches a
comparison of these two kinds of null string.
Patchfile:
*** interp.c.orig Wed May 11 09:50:29 1994
--- interp.c Wed Apr 20 18:38:20 1994
***************
*** 601,606 ****
--- 601,608 ----
return(v);
}
+ /* Mods by ajw@ansa.co.uk 20/4/94 */
+
double
doeqs(s1, s2)
char *s1, *s2;
***************
*** 609,614 ****
--- 611,628 ----
if (!s1 && !s2)
return((double)1.0);
+
+ /* AJW start */
+ if (!s1 && !strlen(s2))
+ { scxfree(s2);
+ return((double)1.0);
+ }
+
+ if (!s2 && !strlen(s1))
+ { scxfree(s1);
+ return((double)1.0);
+ }
+ /* AJW end */
if (!s1 || !s2)
v = 0.0;