The Macro Implementation of SNOBOL4 %n snobol4 %v beta2 %c * %l * %b * %d * %f cs.arizona.edu:/snobol4/budne %t beta2.tar.gz %w usr.bin %% # Copyright 1994 Rickard E. Faith, Kevin E. Martin, and Doug L. Hoffman # All rights reserved. # See the BOGUS.LICENSE file for distribution restrictions. if [ ! -d $BUILDDIR ]; then mkdir $BUILDDIR; fi cd $BUILDDIR rm -rf snobol tar zxvf $SRCTARDIR/$TARFILE cd snobol # Patches from budd@cs.bu.edu patch -p1 -s << 'EOF_MARKER' && --- snobol/timing.orig Fri Jun 24 15:08:17 1994 +++ snobol/timing Mon Sep 12 20:38:00 1994 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: timing,v 1.4 94/06/24 15:09:05 budd Exp $ +# $Id: timing,v 1.5 94/06/30 18:12:24 budd Exp $ # perform basic timing tests # results suitable for inclusion in ports.doc @@ -32,6 +32,7 @@ cd $TDIR # NOTE! 2>&1 *BEFORE* >x time ./xsnobol4 genc.sno 2>&1 >x + echo ==== diff diff snobol4.c x cd .. rm -rf $TDIR --- snobol/timing.sno.orig Mon Jun 6 15:44:46 1994 +++ snobol/timing.sno Mon Sep 12 20:38:11 1994 @@ -1,4 +1,4 @@ -* $Id: timing.sno,v 1.3 94/06/06 15:45:22 budd Exp $ +* $Id: timing.sno,v 1.7 94/07/07 17:21:04 budd Exp $ * process "xsnobol genc.sno" and "diff" output! &ANCHOR = 1 @@ -13,12 +13,15 @@ WS = SPAN(SP TAB) NUM = FLOAT | INT +**************************************************************** +* parse snobol's messages + * COMPILING CLOP LINE = INPUT :F(NOCOMP) LINE 'No errors detected in source program' :S(ELOP) LINE 'ERRORS DETECTED IN SOURCE PROGRAM' :S(BADCOMP)F(CLOP) -NOCOMP OUTPUT = "compilation interrupted" :(FATAL) +NOCOMP OUTPUT = "compilation interrupted?" :(FATAL) BADCOMP OUTPUT = "compilation failed" :(FATAL) * EXECUTING @@ -30,6 +33,8 @@ NOEXEC OUTPUT = "execution error" :(FATAL) BADEXEC OUTPUT = "execution failed" :(FATAL) +**************** here at end of normal execution + GETSTAT LINE = INPUT :F(NOSTAT) LINE 'SNOBOL4 statistics' :F(GETSTAT) LINE = INPUT :F(NOSTAT) @@ -39,9 +44,7 @@ LINE = INPUT :F(NOSTAT) LINE WS INT . STMTS WS 'Statements executed' :F(NOSTAT) - A2 = (EXEC * 1000 + STMTS / 2) / STMTS - - OUTPUT = 'Statistics for run of genc.sno' + OUTPUT = OUTPUT = 'SNOBOL4 Compile time:' TAB COMP ' milliseconds' OUTPUT = 'SNOBOL4 Execution time:' TAB EXEC ' milliseconds' OUTPUT = 'Statements executed:' TAB STMTS @@ -62,22 +65,36 @@ * compare A1 vs A2 (calculation fails on HP-PA using gcc?) EQ(A1,A2) :S(GETTIME) + +* check for delta of +/-1 + X = A1 - A2 + EQ(X,1) :S(GETTIME) + EQ(X,-1) :S(GETTIME) + * get ratio, keep our version on the bottom (less likely to be zero) X = 100 * A2 / A1 -* ignore errors of less than 1% - GE(X,99) LT(X,101) :S(GETTIME) +* ignore errors of less than 4% (difference between 49 and 50us) + GE(X,98) LT(X,102) :S(GETTIME) + + OUTPUT = OUTPUT = "SNOBOL's calculated ms/stmt is suspect: " AVG -**************** +**************************************************************** * deal with shell "time" output + GETTIME LINE = INPUT :F(NOTIME) MIN = 0 -* sunos "sh" time - LINE ARB WS NUM . USER WS 'user' :S(GOTTIME) -* csh style time - LINE ARB NUM . USER 'u' :S(GOTTIME) -* hpux +* gnu time '0.00user ....' + LINE NUM . USER 'user' :S(GOTTIME) +* csh style time '0.00u ....' + LINE NUM . USER 'u' :S(GOTTIME) +* hpux, aix 'user 0m0.00s' LINE 'user' ws INT . MIN 'm' NUM . USER :S(GOTTIME) +* aix 'user NN.N' + LINE 'user' ws NUM . USER :S(GOTTIME) +* sunos "sh" time '.... 0.0 user ...' + LINE ARB WS NUM . USER WS 'user' :S(GOTTIME) +* more here??? :(GETTIME) * here with shell runtime @@ -89,8 +106,9 @@ EPSILON = 0.01 GE(FACTOR, 1.0 - EPSILON) LT(FACTOR, 1.0 + EPSILON) :S(TIMEOK) + OUTPUT = OUTPUT = "SNOBOL's timings off by a factor of: " FACTOR - OUTPUT = "see if posix sysconf() available (use posix/mstime.c)" + OUTPUT = " see if posix sysconf() available (use posix/mstime.c)" OUTPUT = "USER:" TAB USER OUTPUT = "TTL:" TAB TTL :(DODIFF) * HZ was 60, should be 100? @@ -99,16 +117,28 @@ TIMEOK OUTPUT = OUTPUT = "SNOBOL4 time measurement checks out" -* XXX use context diff, look for pos(0) "diff" ??? -DODIFF LINE = INPUT :F(NODIFF) +**************************************************************** +* look for start of diff "signal" line + +DODIFF OUTPUT = +DIFFLP LINE = INPUT :F(NODIFF) + IDENT(LINE,'==== diff') :F(DIFFLP) + +* here with first line of diff output + LINE = INPUT :F(NODIFF) IDENT(LINE,'1c1') :F(BADIFF) - OUTPUT = OUTPUT = "genc.sno output checks out" :(END) -BADIFF OUTPUT = 'genc diff failed' :(FATAL) +* here if first line of diff does not check out +BADIFF OUTPUT = 'genc diff failed:' + OUTPUT = LINE +BADLOP OUTPUT = INPUT :S(BADLOP)F(FATAL) + NODIFF OUTPUT = 'no diff found' :(FATAL) -NOSTAT OUTPUT = "could not get stats" :F(FATAL) -NOTIME OUTPUT = "could not get times" +NOSTAT OUTPUT = + OUTPUT = "could not get stats" :F(FATAL) +NOTIME OUTPUT = + OUTPUT = "could not get times" FATAL &CODE = 1 END EOF_MARKER ln -s config/linux.m4 config.m4 make %doc History README TODO TODO.soon doc/design.doc doc/goals.doc %doc doc/load.doc doc/porting.doc doc/porting.ms doc/ports.doc %doc doc/snobol4.0 doc/sqrt.c doc/sqrt.sno * install -m 0755 xsnobol4 /usr/bin/snobol4 * install -m 644 doc/snobol4.1 /usr/man/man1 %% * usr/bin/snobol4 * usr/man/man1/snobol4.1