diff --git a/BUGS b/BUGS index 18b5be4..40ff5c1 100644 --- a/BUGS +++ b/BUGS @@ -114,50 +114,14 @@ Known problems or mis-features: **** 9 error(s) found \/++\/ 9999: Ending regression tests - * On a Dec Alpha, make check for version 2.11.0t1 core dumps: + * On a Dec Alpha, using the Dec Alpha cc (not gcc) make check for + version 2.11.0t5.1 fails in the regression test: - From vandermj@molbio.sbphrd.com Fri Sep 24 06:15:28 1999 - Subject: Re: calc version 2.11.0t1 - Date: Fri, 24 Sep 1999 09:15:02 -0400 + From vandermj@molbio.sbphrd.com Tue Oct 5 04:06:52 1999 + Subject: Re: oops, try calc version 2.10.0t5.1 + Date: Tue, 05 Oct 1999 07:06:30 -0400 - It dies as follows: + Regular cc on Dec alpha, 'make check' dies with: - ... - 1802: a = surd(2,3) - 1803: a == surd(2,3) 1804: surd_value(a) == 2+3i - Segmentation fault - - dbx shows: - signal Segmentation fault at [objcall:155 +0xc,0x1200507b4] index = oap->actions[action]; - (dbx) where - > 0 objcall(action = 14, v1 = 0x1400203d0, v2 = 0x1400203e0, v3 = (nil)) ["obj.c":155, 0x1200507b4] - 1 comparevalue(v1 = 0x1400203d0, v2 = 0x1400203e0) ["value.c":2329, 0x12007f250] - 2 o_eq() ["opcodes.c":2659, 0x12003728c] - 3 calculate(fp = 0x14007fce0) ["opcodes.c":3614, 0x12003942c] - 4 o_usercall(fp = 0x14007fce0, index = 39, argcount = 0) ["opcodes.c":2602, 0x120037080] - 5 calculate(fp = 0x14003bfa0) ["opcodes.c":3622, 0x120039488] - 6 evaluate(nestflag = 14) ["codegen.c":210, 0x120028768] - 7 getcommands(toplevel = 536864560) ["codegen.c":158, 0x1200285bc] - 8 getcommands(toplevel = 536864560) ["codegen.c":122, 0x1200284dc] - 9 main() ["calc.c":279, 0x12001f61c] - - Michel van der List reports that he was using the Dec compiler. - - However On 25-Sep-99 9:18, Ernest Bowen wrote: - - Last night I downloaded 2.11.0t1 and without changing Makefile - or anything else did a make and make check. Absolutely no - reported errors or warnings and the check "passed all tests". - The machine I'm using is a Dec 20 alpha running Digitial - UNIX V4.0B (Rev 564). - - Ernest Bowen was using gcc. - - We definitely want to hunt down this Dec's cc compiler issue. It - could very well be that gcc is letting something slide where as - Dec's cc compiler is compiling it faithfully into core dumping code. - The fault could very well be the calc code and not the compiler. - - Any more information on calc core dumps compiled with Dec's cc compiler - would be most appreciated! + "": line 1706: Calling qfreenum with nozero links!!! diff --git a/CHANGES b/CHANGES index 7fc27d2..b3d7b02 100644 --- a/CHANGES +++ b/CHANGES @@ -145,6 +145,9 @@ Following is the change from calc version 2.11.0t1 to date: freeglobals() at the end of the test suite to free storage consumed during the regression. + Added custom function custom("pzasusb8", n) and lib/pzasusb8.cal based on + Ernest Bowen's diagnostic patch. + Fixed misc compile warnings and notices. diff --git a/custom/Makefile b/custom/Makefile index d8c6f0d..780440c 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -41,13 +41,13 @@ # # Put your custom calc library files here. # -CUSTOM_CALC_FILES= argv.cal halflen.cal +CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal # The custom help files to install # # Put your custom help files here. # -CUSTOM_HELP= argv devnull help sysinfo +CUSTOM_HELP= argv devnull help sysinfo pzasusb8 # Any .h files that are needed by programs that use libcustcalc.a # @@ -63,7 +63,7 @@ CUSTOM_H_SRC= # # Put your custom .c files here. # -CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c +CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c # Any .o files that are needed by program that use libcustcalc.a. # Don't put ${REQUIRED_OBJ} files in this list. @@ -72,7 +72,7 @@ CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c # # Put your custom .o files here. # -CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o +CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o ############################################################################## #-=-=-=-=-=-=- Defaults in case you want to build from this dir -=-=-=-=-=-=-# @@ -590,6 +590,11 @@ c_help.o: ../string.h c_help.o: ../value.h c_help.o: ../zmath.h c_help.o: c_help.c +c_pzasusb8.o: ../custom.h +c_pzasusb8.o: ../have_const.h +c_pzasusb8.o: ../value.h +c_pzasusb8.o: ../zmath.h +c_pzasusb8.o: c_pzasusb8.c c_sysinfo.o: ../alloc.h c_sysinfo.o: ../block.h c_sysinfo.o: ../byteswap.h diff --git a/custom/c_pzasusb8.c b/custom/c_pzasusb8.c new file mode 100644 index 0000000..23647d3 --- /dev/null +++ b/custom/c_pzasusb8.c @@ -0,0 +1,72 @@ +/* + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted. + * + * Ernest Bowen, following Landon Curt Noll + */ + +#if defined(CUSTOM) + +#include + +#include "../have_const.h" +#include "../value.h" +#include "../custom.h" +#include "../zmath.h" + +/* + * c_pzasusb8 - print numereator of real as if its array of HALFs were + * a string of USB8s + * + * given: + * count = 1; + * vals[0] real number; + * + * returns: + * null + */ +/*ARGSUSED*/ +VALUE +c_pzasusb8(char *name, int count, VALUE **vals) +{ + VALUE result; /* what we will return */ + ZVALUE z; /* numerator of the value */ + long octet_cnt; /* number of octets in the numerator */ + long half_cnt; /* number of HALFs in the numerator */ + USB8 *h; /* octet pointer */ + long half_len; /* length of a half in octets */ + long i; + long j; + + /* + * arg check + */ + result.v_type = V_NULL; + if (vals[0]->v_type != V_NUM) { + math_error("Non-real argument for pzasusb8"); + /*NOTREACHED*/ + } + + /* + * look at the numerator + */ + z = vals[0]->v_num->num; + half_len = sizeof(HALF); + octet_cnt = z.len * half_len; + half_cnt = z.len; + + /* + * print the octets + */ + h = (USB8 *) z.v; + for (i=0; i < half_cnt; ++i) { + printf("%d:\t", i); + for (j=0; j < half_len; ++j) { + printf("%02x", (int)(*h++)); + } + putchar('\n'); + } + return result; +} + +#endif /* CUSTOM */ diff --git a/custom/custtbl.c b/custom/custtbl.c index e0e5aa5..bb5c594 100644 --- a/custom/custtbl.c +++ b/custom/custtbl.c @@ -59,6 +59,7 @@ extern VALUE c_argv(char*, int, VALUE**); extern VALUE c_devnull(char*, int, VALUE**); extern VALUE c_help(char*, int, VALUE**); extern VALUE c_sysinfo(char*, int, VALUE**); +extern VALUE c_pzasusb8(char*, int, VALUE**); #endif /* CUSTOM */ @@ -108,6 +109,9 @@ CONST struct custom cust[] = { { "sysinfo", "return a calc #define value", 0, 1, c_sysinfo }, + { "pzasusb8", "print ZCALUE as USB8", + 0, 1, c_pzasusb8 }, + #endif /* CUSTOM */ diff --git a/custom/pzasusb8 b/custom/pzasusb8 new file mode 100644 index 0000000..dc2350a --- /dev/null +++ b/custom/pzasusb8 @@ -0,0 +1,50 @@ +NAME + pzasusb8 - print a number in hex octets + +SYNOPSIS + custom("pzasusb8", arg) + +TYPES + arg real + + return null + +DESCRIPTION + This custom function prints out the numerator of a real value + in octets. Each HALF value is printed in a separate line. + + NOTE: The output will vary depending on the size of a HALF + and the byte order of the system. See: + + custom("sysinfo", "BASEB") + custom("sysinfo", "CALC_BYTE_ORDER") + + foe details. + + This custom function is intented for testing of the general + custom interface. + +EXAMPLE + > custom("pzasusb8", 0x01020304050607080910111213141516); + 0: 13141516 + 1: 09101112 + 2: 05060708 + 3: 01020304 + + > custom("pzasusb8", 10^25) + 0: 4a000000 + 1: 16140148 + 2: 00084595 + + > printf("%x\n", 10^25); + 0x84595161401484a000000 + +LIMITS + calc must be built with ALLOW_CUSTOM= -DCUSTOM + calc must be executed with a -C arg. + +LIBRARY + none + +SEE ALSO + custom diff --git a/custom/pzasusb8.cal b/custom/pzasusb8.cal new file mode 100644 index 0000000..fc8fec9 --- /dev/null +++ b/custom/pzasusb8.cal @@ -0,0 +1,29 @@ +/* + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted. + * + * Ernest Bowen, following Landon Curt Noll + */ + +print "p(n) prints array in which numerator of n is stored as a"; +print "sequence of 2-hex-digits representing unsigned characters."; +print "h(n) printx n in hex notation. This should be the same as"; +print "p(n) except for (1) its leading 0x, (2) possible trailing zeros"; +print "in p(n), and (3) the order of the hex-digit pairs."; +print "The following example show results for n = isqrt(2e100)."; +print ""; + +define p(n) {custom("pzasusb8", n); print;} +define h(n) = printf("%x\n", n); + +n = isqrt(2e100); +print ""; +p(n); +h(n); +print ""; +print "BASEB: ", custom("sysinfo", "BASEB"); +print "CALC_BYTE_ORDER: ", custom("sysinfo", "CALC_BYTE_ORDER"); +print "BIG_ENDIAN: ", custom("sysinfo", "BIG_ENDIAN"); +print "LITTLE_ENDIAN: ", custom("sysinfo", "LITTLE_ENDIAN"); +print "LONG_BITS: ", custom("sysinfo", "LONG_BITS"); +print "LONGLONG_BITS: ", custom("sysinfo", "LONGLONG_BITS"); diff --git a/version.c b/version.c index 472f6eb..95a431a 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 "5.1" /* test number or empty string if no patch */ +#define MINOR_PATCH "5.2" /* test number or empty string if no patch */ /* * calc version constants