From leon@eatworms.swmed.utexas.edu Sat May 16 16:31:13 1992 Received: from cgl.ucsf.EDU by socrates.ucsf.EDU (5.65/GSC4.21) id AA00274; Sat, 16 May 92 16:31:07 -0700 Received: from eatworms.swmed.utexas.edu by cgl.ucsf.EDU (5.65/GSC4.21) id AA05098 for bek@socrates.ucsf.EDU; Sat, 16 May 92 16:31:01 -0700 Received: by eatworms.swmed.utexas.edu (4.1/SMI-4.1) id AA11988; Sat, 16 May 92 18:32:05 CDT Date: Sat, 16 May 92 18:32:05 CDT From: leon@eatworms.swmed.utexas.edu (Leon Avery) Message-Id: <9205162332.AA11988@eatworms.swmed.utexas.edu> To: bek@cgl.ucsf.EDU Subject: another patch Status: RO Bruce, Please apply this patch to eutest the same way as you did the previous two. This doesn't solve the problem with setjmp, but it does provide a way to get around it. If, after applying the patch, you say make "CPPFLAGS=" it will make a version of eutest that doesn't have the -t option, but also doesn't use setjmp, so it ought to work. I still want to try to get the -t option to work, though. Your system obviously HAS setjmp, but for some weird reason it won't let me use it. So if you will let me know your password, I'll have a shot at it. This patch also includes a file called testdata, which you can use to check out eutest if by some miracle you ever get it to compile. Leon *** Makefile Sat May 16 17:34:48 1992 --- Makefile.new Sat May 16 17:53:16 1992 *************** *** 1,5 **** CFLAGS= $(UC) -O ! LINK.c= cc LDLIBS= -lm .KEEP_STATE: ESRC= eutest.c rpick.c pick.c gcf.c lpicks.c dprint.c error.c readline.c \ --- 1,5 ---- CFLAGS= $(UC) -O ! CPPFLAGS= -DTOPT LDLIBS= -lm .KEEP_STATE: ESRC= eutest.c rpick.c pick.c gcf.c lpicks.c dprint.c error.c readline.c \ *************** *** 12,19 **** eutest.ln: $(ESRC) $(LINT) $(LNFLAGS) $(ESRC) > $@ .c: ! $(COMPILE.c) $(OUTPUT_OPTION) $< ! $(LINK.c) -o $@ $(<:.c=.o) pick.o $(LDLIBS) clean: rm $(EOBJ) --- 12,19 ---- eutest.ln: $(ESRC) $(LINT) $(LNFLAGS) $(ESRC) > $@ .c: ! $(CC) $(OUTPUT_OPTION) $< ! $(CC) -o $@ $(<:.c=.o) pick.o $(LDLIBS) clean: rm $(EOBJ) *** eutest.c Sat May 16 14:13:45 1992 --- eutest.c.new Sat May 16 17:57:32 1992 *************** *** 60,71 **** #include #include #include - #include - #include #include "common.h" #include "readline.h" #include "logs.h" #define DEFNP (10000L) /* default npicks */ #define DEFTIM (60) /* default nsecs */ --- 60,74 ---- #include #include #include #include "common.h" #include "readline.h" #include "logs.h" + #ifdef TOPT /* if we want -t option */ + #include + #include + #endif + #define DEFNP (10000L) /* default npicks */ #define DEFTIM (60) /* default nsecs */ *************** *** 103,118 **** double lgpicks(); double lepicks(); double logpick(); ! int setjmp(); ! void longjmp(); ! void sigabort(); unsigned alarm(); char *PROGNAME; int mflag = FALSE; /* Monte Carlo pick generation */ long npicks = DEFNP; /* # picks to generate */ int tflag = FALSE; /* limit time for tests */ int nsecs = DEFTIM; /* time to allow for test */ int cflag = FALSE; /* check picks */ int dflag = FALSE; /* print debug info */ int indent = 0; /* indent for debugging output */ --- 106,125 ---- double lgpicks(); double lepicks(); double logpick(); ! #ifdef TOPT unsigned alarm(); + void sigabort(); + #endif char *PROGNAME; int mflag = FALSE; /* Monte Carlo pick generation */ long npicks = DEFNP; /* # picks to generate */ + #ifdef TOPT int tflag = FALSE; /* limit time for tests */ int nsecs = DEFTIM; /* time to allow for test */ + jmp_buf abort; /* environment save for abort */ + int aborted = FALSE; /* whether test was aborted */ + #endif int cflag = FALSE; /* check picks */ int dflag = FALSE; /* print debug info */ int indent = 0; /* indent for debugging output */ *************** *** 127,134 **** double lesr; double lgsr; POINT *p; /* points being compared */ - jmp_buf abort; /* environment save for abort */ - int aborted = FALSE; /* whether test was aborted */ main(argc, argv) int argc; --- 134,139 ---- *************** *** 198,203 **** --- 203,209 ---- cflag = TRUE; break; + #ifdef TOPT /* * -t: limit time for each test */ *************** *** 220,226 **** while(isdigit(c = *n++)); if ('\0' != c) usage(); break; ! /* * -m: do Monte Carlo pick generation */ --- 226,233 ---- while(isdigit(c = *n++)); if ('\0' != c) usage(); break; ! #endif ! /* * -m: do Monte Carlo pick generation */ *************** *** 412,417 **** --- 419,425 ---- pick = (int *) ealloc(dp1->d_n * sizeof(int)); lsr = esr = gsr = 0; + #ifdef TOPT /* * set up alarm if time limit in effect */ *************** *** 430,435 **** --- 438,444 ---- (EOF == alarm(nsecs)) ) error("unable to set alarm"); } + #endif /* * compare sums of ranks for random picks: Monte Carlo test *************** *** 493,500 **** --- 502,511 ---- ); } quit: + #ifdef TOPT alarm(0); /* turn off alarm */ signal(SIGALRM, SIG_IGN); /* ignore any alarms */ + #endif free(pick); free(p); free(rank); *************** *** 510,515 **** --- 521,527 ---- ); } + #ifdef TOPT /* sigabort -- respond to SIGALRM by aborting test */ void sigabort(sig, code, scp, addr) *************** *** 521,526 **** --- 533,539 ---- signal(SIGALRM, SIG_IGN); /* ignore further alarms */ longjmp(abort, TRUE); /* return true to abort test */ } + #endif /* sr_picks -- compare sums of ranks for picks to sr */ int *************** *** 549,554 **** --- 562,571 ---- /* usage -- complain about usage errors */ usage() { + #ifdef TOPT + error("usage: eutest [-m [n]] [-t [n]] [files]"); + #else error("usage: eutest [-m [n]] [files]"); + #endif } *** testdata Sat May 16 18:17:04 1992 --- testdata.new Sat May 16 18:17:22 1992 *************** *** 0 **** --- 1,3 ---- + I5- 8 10 9 8.5 9 8 9 10 10.5 10 9 9.5 10.5 10 9 9.5 10.5 10.5 9 11 9.5 10.5 + M3- 11 12 12 10 13 12 13 11 12 10 13 10 11.5 15 11 + intact 12 9 11 10 11 8 10 9 9 11 10 12 10 11 11 11 10 10 9.5 10 11 10 9 11 11 10.5 10 10 10 10.5 10 10 10.5 10 10 11 9.5