From e6e2556893c8f489639fb46b1c1ab8049156e362 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Thu, 28 Oct 1999 12:37:17 -0700 Subject: [PATCH] Release calc version 2.11.0t8.6 --- BUGS | 151 ++++++++++++++++++++++++++++++++++++++++++++++-- CHANGES | 5 ++ help/Makefile | 6 +- lib/regress.cal | 2 +- quickhash.c | 108 +++++++++++++++++++--------------- seed.c | 4 +- version.c | 2 +- 7 files changed, 219 insertions(+), 59 deletions(-) diff --git a/BUGS b/BUGS index 904e4e4..e3468e2 100644 --- a/BUGS +++ b/BUGS @@ -79,10 +79,153 @@ Known bugs: At this point, calc will re-prompt if you give it an EOF, or type ^D while using lib/altbind or while ^D is bound to quit. - * When compiled on Solaris with the Solaris cc using -Xc option - (which forces BASEB=16) and without -DFORCE_STDC, calc fails - regression test #8218 because hash(a,s), where a = isqrt(2e1000) - and s = "xyz", returns 1418255679 instead of 2378490456. + * When compiled on some Big Endian machines with BASEB forced to + be 16 (by setting LONGLONG_BITS= 0 in the Makefile), calc fails + a number of regression tests: + + 4230: n = ftell(f) + 4231: isnull(fputs(f,L,"\n",C,"\n",N,"\n")) + 4232: fseek(f, n) + **** Non-true result (0): 4233: fgetstr(f) == LCN + 4234: isnull(fclose(f)) + 4235: a = exp(27, 1e-1000) + 4236: b = sqrt(7 + 5i, 1e-2000) + 4252: fscanf(f, "%*[^|]%*c%n%*[^[]%*c%n", m, n) == 2 + 4253: fseek(f, m) + 4254: fscanf(f, "%3c", x) == 1 + **** Non-true result (0): 4255: x == " Cu" + 4256: fseek(f, n) + 4257: fscanf(f, "%s", y) == 1 + **** Non-true result (0): 4258: y == "Noll" + 4259: isnull(fclose(f)) + 4260: x = rm("junk4200") + 4261: Ending test_fileops + 4600: Beginning test_fileop + 4601: ttest(0,0): passed + 4602: stest(): failed + **** search(f, "and") != 10 failed + 4603: ttest(1,1): failed + **** Failure 2 for i = 0 + 4604: stest(): failed + **** search(f, "and") != 10 failed + 4605: ttest(2,2): failed + **** Failure 2 for i = 0 + 4606: stest(): failed + **** search(f, "and") != 10 failed + 4607: ttest(3,3): failed + **** Failure 2 for i = 0 + 4608: stest(): failed + **** search(f, "and") != 10 failed + 4609: ttest(4,4): failed + **** Failure 2 for i = 0 + 4610: stest(): failed + **** search(f, "and") != 10 failed + 4611: ttest(5,5): failed + **** Failure 2 for i = 0 + 4612: stest(): failed + **** search(f, "and") != 10 failed + 4613: ttest(6,6): failed + **** Failure 2 for i = 0 + 4614: stest(): failed + **** search(f, "and") != 10 failed + 4615: ttest(7,7): failed + **** Failure 2 for i = 0 + 4616: stest(): failed + **** search(f, "and") != 10 failed + 4617: ttest(8,8): failed + **** Failure 2 for i = 0 + 4618: stest(): failed + **** search(f, "and") != 10 failed + 4619: ttest(9,9): failed + **** Failure 1 for file size + 4620: stest(): failed + **** fopen("junk4600", "w") failed + 4621: Ending test_fileop + + 4700: Beginning test_charset + **** errcount:172 > ecnt:150 + 4701: "\a" == char(7) + 4702: "\v" == char(11) + 4703: "\e" == char(27) + 5000: Beginning test_filesearch + 5001: x = rm("-f", "junk5000") + 5002: f = fopen("junk5000", "w") + **** Unable to open "junk5000" for writing + + 5100: Beginning test_newdecl + 5101: test5100(1) + **** errcount:173 > ecnt:172 + 5102: a5100 == 0 + 5103: b5100 == 2 + 5104: test5100(1) + 5927: test unused + 5928: test unused + 5929: test unused + **** errcount:180 > ecnt:177 + 5930: isassoc(loc) == 0 + 5931: isassoc(a) == 1 + 5932: isassoc(ofd) == 0 + 6079: test unused + 6080: iserror(loc) == 0 + 6081: iserror(a) == 0 + **** Non-true result (0): 6082: iserror(ofd) == 0 + **** Non-true result (0): 6083: iserror(cfd) == 0 + 6084: iserror(blk) == 0 + 6085: iserror(nblk) == 0 + 6086: iserror(cfg) == 0 + 6139: test unused + 6140: isfile(loc) == 0 + 6141: isfile(a) == 0 + **** Non-true result (0): 6142: isfile(ofd) == 1 + **** Non-true result (0): 6143: isfile(cfd) == 1 + 6144: isfile(blk) == 0 + 6145: isfile(nblk) == 0 + 6146: isfile(cfg) == 0 + + 6700: Beginning test_blk + 6701: A = blk(20); + **** errcount:181 > ecnt:180 + 6702: size(A) == 20 + 6703: sizeof(A) == 256 + 6704: B = A; + 6822: C == A + 6823: fs = fopen("junk6800", "w+"); + 6824: blkcpy(fs, A); + **** errcount:183 > ecnt:181 + **** Non-true result (0): 6825: size(f) == 5 + 6826: blkcpy(B = blk(), fs); + **** errcount:184 > ecnt:183 + **** Non-true result (0): 6827: B == A + 6828: blkcpy(fs, A, ,100); + **** errcount:185 > ecnt:184 + **** Non-true result (0): 6829: size(f) == 105 + 6830: blkcpy(C = blk(), fs, 2, ,100) + **** errcount:186 > ecnt:185 + **** Non-true result (0): 6831: C == (blk() = {1,2} + 6832: A = blk(); + 6833: blkcpy(A, "blk6800"); + 6834: size(A) == 9 + 6900: Beginning test_name + 6901: x = rm("-f", "junk6900") + 6902: f = fopen("junk6900", "w") + **** errcount:189 > ecnt:186 + **** Non-true result (0): 6903: name(f) == "junk6900" + 6904: fclose(f) + **** errcount:190 > ecnt:189 + 6905: name(f) == null() + 6906: A = blk("blk6900") + 6907: name(A) == "blk6900" + 7002: B = blk(); + 7003: copy("abc yz", A); + 7004: copy("defg", B); + **** errcount:191 > ecnt:190 + 7005: strprintf("%s", A) == "abc yz" + 7006: strprintf("%s", A[2]) == "c yz" + 7007: strprintf("%s", A[7]) == "" + + 9995: freeredc() + 9996: freestatics() + **** 24 error(s) found \/++\/ We are sure some more bugs exist. When you find them, please let us know! See the above for details on how to report and were to diff --git a/CHANGES b/CHANGES index df6f120..62bdf3c 100644 --- a/CHANGES +++ b/CHANGES @@ -129,6 +129,11 @@ Following is the change from calc version 2.11.0t8 to date: print "funcB(size, mass, ...) defined"; } + Fixed the help/custom_cal, help/new_custom, and help/copy files so + that they contain the correct contents instead of the 'usage' file. + + Fixed misc compiler warnings. + Following is the change from calc version 2.11.0t7 to 2.11.0t7.5: diff --git a/help/Makefile b/help/Makefile index 892e1e5..c5cc0ed 100644 --- a/help/Makefile +++ b/help/Makefile @@ -258,7 +258,7 @@ calc: usage custom_cal: ../custom/CUSTOM_CAL rm -f $@ - cp usage $@ + cp ../custom/CUSTOM_CAL $@ chmod 0444 $@ -@if [ -z "${Q}" ]; then \ echo ''; \ @@ -270,7 +270,7 @@ custom_cal: ../custom/CUSTOM_CAL new_custom: ../custom/HOW_TO_ADD rm -f $@ - cp usage $@ + cp ../custom/HOW_TO_ADD $@ chmod 0444 $@ -@if [ -z "${Q}" ]; then \ echo ''; \ @@ -282,7 +282,7 @@ new_custom: ../custom/HOW_TO_ADD copy: blkcpy rm -f $@ - cp usage $@ + cp blkcpy $@ chmod 0444 $@ -@if [ -z "${Q}" ]; then \ echo ''; \ diff --git a/lib/regress.cal b/lib/regress.cal index 54ceb19..c3bd2c5 100644 --- a/lib/regress.cal +++ b/lib/regress.cal @@ -7150,7 +7150,7 @@ define test_somenew() a = isqrt(2e1000); s = "xyz"; print '8217: a = isqrt(2e1000); s = "xyz";'; - vrfy(hash(a,s) == 2378490456, '8218: hash(a,s) == 2378490456'); + vrfy(hash(a,s) == 2708885378, '8218: hash(a,s) == 2708885378'); vrfy(hash("curds n whey") == 2376141927, '8219: hash("curds n whey") == 2376141927'); diff --git a/quickhash.c b/quickhash.c index 1d8fa27..0e635bc 100644 --- a/quickhash.c +++ b/quickhash.c @@ -56,11 +56,6 @@ #include "zrand.h" #include "zrandom.h" -#define ZMOST 2 /* most significant HALFs to hash */ -#define ZLEAST 2 /* least significant HALFs to hash */ -#define ZMIDDLE 4 /* HALFs in the middle to hash */ - - /* * forward declarations */ @@ -71,7 +66,8 @@ static QCKHASH objhash(OBJECT *op, QCKHASH val); static QCKHASH randhash(RAND *r, QCKHASH val); static QCKHASH randomhash(RANDOM *state, QCKHASH val); static QCKHASH config_hash(CONFIG *cfg, QCKHASH val); -static QCKHASH fnv_strhash(char *str, QCKHASH val); +static QCKHASH fnv_strhash(char *ch, QCKHASH val); +static QCKHASH fnv_STRhash(STRING *str, QCKHASH val); static QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val); static QCKHASH fnv_zhash(ZVALUE z, QCKHASH val); static QCKHASH hash_hash(HASH *hash, QCKHASH val); @@ -167,7 +163,7 @@ hashvalue(VALUE *vp, QCKHASH val) case V_COM: return fnv_chash(vp->v_com, val); case V_STR: - return fnv_strhash(vp->v_str->s_str, val); + return fnv_STRhash(vp->v_str, val); case V_NULL: return val; case V_OBJ: @@ -438,7 +434,29 @@ config_hash(CONFIG *cfg, QCKHASH val) /* - * fnv_strhash - Fowler/Noll/Vo 32 bit hash of a string + * fnv_strhash - Fowler/Noll/Vo 32 bit hash of a null-terminated string + * + * given: + * ch the start of the string to hash + * val initial hash value + * + * returns: + * a 32 bit QCKHASH value + */ +static QCKHASH +fnv_strhash(char *ch, QCKHASH val) +{ + /* + * hash each character in the string + */ + while (*ch) { + val = fnv(*ch++, val); + } + return val; +} + +/* + * fnv_STRhash - Fowler/Noll/Vo 32 bit hash of a STRING * * given: * str the string to hash @@ -448,13 +466,19 @@ config_hash(CONFIG *cfg, QCKHASH val) * a 32 bit QCKHASH value */ static QCKHASH -fnv_strhash(char *str, QCKHASH val) +fnv_STRhash(STRING *str, QCKHASH val) { + char *ch; + long n; + + ch = str->s_str; + n = str->s_len; + /* * hash each character in the string */ - while (*str) { - val = fnv(*str++, val); + while (n-- > 0) { + val = fnv(*ch++, val); } return val; } @@ -497,48 +521,36 @@ fnv_fullhash(FULL *v, LEN len, QCKHASH val) static QCKHASH fnv_zhash(ZVALUE z, QCKHASH val) { - int skip; /* HALFs to skip in the middle */ - int i; + LEN n; + HALF *hp; +#if BASEB == 16 + FULL f; +#endif /* - * hash the sign and length + * hash the sign */ - if (zisneg(z)) { - val = fnv(-(z.len), val+V_NUM); - } else { - val = fnv(z.len, val+V_NUM); + val = fnv(z.sign, val + V_NUM); + + n = z.len; + hp = z.v; + +#if BASEB == 16 + while (n > 1) { + f = (FULL) *hp++; + f |= (FULL) *hp++ << BASEB; + val = fnv(f, val); + n -= 2; } - - /* - * if a ZVALUE is short enough, hash it all - */ - if (z.len <= ZMOST+ZLEAST+ZMIDDLE) { - /* hash all HALFs of a short ZVALUE */ - for (i=0; i < z.len; ++i) { - val = fnv(z.v[i], val); - } - - /* - * otherwise hash the ZLEAST significant HALFs followed by - * ZMIDDLE HALFs followed by the ZMOST significant HALFs. - */ - } else { - /* hash the ZLEAST significant HALFs */ - for (i=0; i < ZLEAST; ++i) { - val = fnv(z.v[i], val); - } - - /* hash ZMIDDLE HALFs in the middle */ - skip = (z.len-ZLEAST-ZMOST)/(ZMIDDLE + 1); - for (i=ZLEAST-1+skip; i < ZLEAST-1+skip*(ZMIDDLE+1); i+=skip) { - val = fnv(z.v[i], val); - } - - /* hash the ZMOST significant HALFs */ - for (i=z.len-1-ZMOST; i < z.len; ++i) { - val = fnv(z.v[i], val); - } + if (n) { + val = fnv(*hp, val); } +#else + while (n-- > 0) { + val = fnv(*hp, val); + ++hp; + } +#endif return val; } diff --git a/seed.c b/seed.c index f35faed..02da94a 100644 --- a/seed.c +++ b/seed.c @@ -230,8 +230,8 @@ hash_buf(char *buf, unsigned len) /* convert to hash64 */ /* hval.w32[1] = 0xffff&(val[3]<<16)+val[2]; */ - hval.w32[1] = val[3]<<16 + val[2]; - hval.w32[0] = val[1]<<16 + val[0]; + hval.w32[1] = (val[3]<<16) + val[2]; + hval.w32[0] = (val[1]<<16) + val[0]; #endif /* HAVE_B64 */ diff --git a/version.c b/version.c index fe2d722..eee784a 100644 --- a/version.c +++ b/version.c @@ -12,7 +12,7 @@ #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ #define MAJOR_PATCH 0 /* patch level or 0 if no patch */ -#define MINOR_PATCH "8.5" /* test number or empty string if no patch */ +#define MINOR_PATCH "8.6" /* test number or empty string if no patch */ /* * calc version constants