From 4609e8f8b1403dc6b2fb683756fb65e8fc60afa0 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sun, 2 Dec 2007 01:17:54 -0500 Subject: [PATCH] Pre-0.27 'a' snapshot. (This is a retrospective comment.) --- BUGS.txt | 9 +- MANIFEST.txt | 371 +- Makefile | 175 + Makefile.in | 194 +- NEWS.txt | 81 + README.txt | 267 +- config.ac | 34 - config.cache | 46 + config.in | 57 + config.log | 127 + config.sh | 5639 ++++++++----------------------- config.status | 284 ++ districk.bat | 2 + districk.sh | 2 + doc/Makefile | 40 +- doc/READ.ME | 10 +- doc/{THEORY => THEORY.txt} | 0 doc/{chip.spec => chipspec.txt} | 0 doc/fdl-1-2.txi | 451 +++ doc/fix83.pl | 70 + doc/fixtoc.pl | 17 + doc/gpl-2-0.txi | 389 +++ doc/ick.txi | 3465 +++++++++++++++++++ doc/ickstyle.css | 24 + doc/ickwhile.txt | 73 + doc/t.t | 210 ++ doc/tempnote.txt | 9 + etc/ctrlmfix.bat | 3 +- etc/ctrlmfix.sh | 3 +- etc/intercal.el | 2 + ickspec | 120 +- include/abcess.h | 187 + include/fiddle.h | 23 + include/lose.h | 238 ++ include/syslib.3i | 323 ++ include/syslib.4i | 354 ++ include/syslib.5i | 355 ++ include/syslib.6i | 373 ++ include/syslib.7i | 402 +++ include/syslib.i | 289 ++ include/yuk.h | 127 + install.sh | 119 - makeick.bat | 34 +- makeick.sh | 33 +- pit/CATALOG | 1 + pit/tests/arrtest.doc | 5 +- pit/tests/whileadd.i | 6 + src/abcess.h | 16 +- src/arrgghh.c | 3 - src/configdj.h | 52 + src/configh.in | 52 + src/{coopt.sh => cooptsh.in} | 13 +- src/dekludge.c | 1762 +--------- src/feh.h | 7 + src/feh2.c | 484 ++- src/fiddle.c | 37 + src/fiddle.h | 5 + src/ick-wrap.c | 4 + src/ick.h | 23 +- src/idiotism.oil | 528 +++ src/lexer.l | 35 +- src/lose.c | 1 + src/lose.h | 2 +- src/oil.y | 731 ++++ src/parser.y | 96 +- src/perpet.c | 319 +- src/uncommon.c | 149 + src/uncommon.h | 6 + src/unravel.c | 502 +-- src/yuk.c | 45 +- src/yuk.h | 28 +- 71 files changed, 12676 insertions(+), 7267 deletions(-) create mode 100644 Makefile delete mode 100644 config.ac create mode 100644 config.cache create mode 100644 config.in create mode 100644 config.log create mode 100755 config.status rename doc/{THEORY => THEORY.txt} (100%) rename doc/{chip.spec => chipspec.txt} (100%) create mode 100644 doc/fdl-1-2.txi create mode 100755 doc/fix83.pl create mode 100755 doc/fixtoc.pl create mode 100644 doc/gpl-2-0.txi create mode 100644 doc/ick.txi create mode 100644 doc/ickstyle.css create mode 100644 doc/ickwhile.txt create mode 100644 doc/t.t create mode 100644 doc/tempnote.txt create mode 100644 include/abcess.h create mode 100644 include/fiddle.h create mode 100644 include/lose.h create mode 100644 include/syslib.3i create mode 100644 include/syslib.4i create mode 100644 include/syslib.5i create mode 100644 include/syslib.6i create mode 100644 include/syslib.7i create mode 100644 include/syslib.i create mode 100644 include/yuk.h delete mode 100755 install.sh create mode 100644 pit/tests/whileadd.i create mode 100644 src/configdj.h create mode 100644 src/configh.in rename src/{coopt.sh => cooptsh.in} (88%) mode change 100755 => 100644 create mode 100644 src/idiotism.oil create mode 100644 src/oil.y create mode 100644 src/uncommon.c create mode 100644 src/uncommon.h diff --git a/BUGS.txt b/BUGS.txt index 4aabff4..a31eb4f 100644 --- a/BUGS.txt +++ b/BUGS.txt @@ -47,15 +47,10 @@ AIS = Alex Smith the modified behavior of select's return type depends on this, so there's not much we can do about it as things stand. -4) (AIS) In multithread programs, a thread doing the equivalent of - (10) DO COME FROM (10) will cause the entire program to get stuck in - an infinite loop, because all COMING FROM a statement counts as part - of that statement, and all statements are atomic. - -5) (AIS) Reverse assignments (those with the expression on the left) +4) (AIS) Reverse assignments (those with the expression on the left) are very unlikely to work in bases other than 2. -6) (AIS) Most of the features new in 0.26, and many in 0.25, haven't +5) (AIS) Most of the features new in 0.26, and many in 0.25, haven't been documented. (This is partly because I can't get groff to work.) TO DO diff --git a/MANIFEST.txt b/MANIFEST.txt index 8a3a311..8148bf4 100644 --- a/MANIFEST.txt +++ b/MANIFEST.txt @@ -1,183 +1,188 @@ -.: -BUGS.txt -COPYING.txt -MANIFEST.txt -Makefile.in -NEWS.txt -README.txt -bin -cleanick.bat -cleanick.sh -config.ac -config.sh -districk.bat -districk.sh -doc -etc -ickspec -ickspec.in -include -install.sh -lib -makeick.bat -makeick.sh -pit -src -temp - -./bin: - -./doc: -Makefile -READ.ME -THEORY -chip.spec -intercal.mm - -./etc: -ctrlmfix.bat -ctrlmfix.sh -intercal.el - -./include: - -./lib: - -./pit: -CATALOG -Makefile -beer.doc -beer.i -blinkers -bubble.doc -bubble.i -change.doc -change.i -delta.fft -fft.doc -fft.i -flonck.doc -flonck.i -glider -gun -hail_mary.3i -hail_mary.doc -icat.i -iching.doc -iching1.i -iching2.i -ins.doc -ins.i -lib -life.doc -life.i -life2.doc -life2.i -pass.i -pi.doc -pi.i -pow.i -primes.doc -primes.i -quine.i -random.doc -random.i -random2.i -rot13.doc -rot13.i -rot13b.doc -rot13b.i -sample.i -sort.i -syslib.i -t_tet -tests -tophat.fft -tpk.doc -tpk.i -yapp.doc -yapp.i - -./pit/lib: -1910.doc -floatlib.doc -floatlib.i -lib2.doc -lib2.i -numio.doc -numio.i -plus.i -syslib-orig.i -syslib.3i -syslib.4i -syslib.5i -syslib.6i -syslib.7i -syslib.doc -syslib.i -syslib3-7.doc - -./pit/tests: -ais1.i -ais2.i -arrtest.doc -arrtest.i -compucome.i -count.3i -count.doc -hello.i -iogerunds.doc -iogerunds.i -knuth.i -limits.3i -limits.i -onceagain.i -permute.doc -permute.i -pictest.i -sink.doc -sink.i -test1.i -test16bit.i -test2.i -testarray.i -testcf.i -testi18n.i -testlib2.i -testonce.i -testops.3i -testops.5i -testsplat.i -version.4i -version.doc - -./src: -abcess.h -arrgghh.c -cesspool.c -coopt.sh -dekludge.c -feh.h -feh2.c -fiddle.c -fiddle.h -ick-wrap.c -ick.h -lexer.l -lose.c -lose.h -numerals.c -parser.y -perpet.c -pick1.h -pick2.h -pickwrap.c -sizes.h -unravel.c -yuk.c -yuk.h - -./temp: -lexer.c -parser.c -parser.h +.: +BUGS.txt +COPYING.txt +MANIFEST.txt +Makefile.in +NEWS.txt +README.txt +bin +cleanick.bat +cleanick.sh +config.in +config.sh +districk.bat +districk.sh +doc +etc +ickspec +ickspec.in +include +lib +makeick.bat +makeick.sh +pit +src +temp + +./bin: + +./doc: +Makefile +READ.ME +THEORY +chip.spec +intercal.mm +oil.txt + +./etc: +ctrlmfix.bat +ctrlmfix.sh +intercal.el + +./include: + +./lib: + +./pit: +CATALOG +Makefile +beer.doc +beer.i +blinkers +bubble.doc +bubble.i +change.doc +change.i +delta.fft +fft.doc +fft.i +flonck.doc +flonck.i +glider +gun +hail_mary.3i +hail_mary.doc +icat.i +iching.doc +iching1.i +iching2.i +ins.doc +ins.i +lib +life.doc +life.i +life2.doc +life2.i +pass.i +pi.doc +pi.i +pow.i +primes.doc +primes.i +quine.i +random.doc +random.i +random2.i +rot13.doc +rot13.i +rot13b.doc +rot13b.i +sample.i +sort.i +syslib.i +t_tet +tests +tophat.fft +tpk.doc +tpk.i +yapp.doc +yapp.i + +./pit/lib: +1910.doc +floatlib.doc +floatlib.i +lib2.doc +lib2.i +numio.doc +numio.i +plus.i +syslib-orig.i +syslib.3i +syslib.4i +syslib.5i +syslib.6i +syslib.7i +syslib.doc +syslib.i +syslib3-7.doc + +./pit/tests: +ais1.i +ais2.i +arrtest.doc +arrtest.i +compucome.i +count.3i +count.doc +hello.i +iogerunds.doc +iogerunds.i +knuth.i +limits.3i +limits.i +onceagain.i +permute.doc +permute.i +pictest.i +sink.doc +sink.i +test1.i +test16bit.i +test2.i +testarray.i +testcf.i +testi18n.i +testlib2.i +testonce.i +testops.3i +testops.5i +testsplat.i +version.4i +version.doc +whileadd.i + +./src: +abcess.h +arrgghh.c +cesspool.c +configdj.h +configh.in +cooptsh.in +dekludge.c +feh.h +feh2.c +fiddle.c +fiddle.h +ick-wrap.c +ick.h +idiotism.oil +lexer.l +lose.c +lose.h +numerals.c +oil.y +parser.y +perpet.c +pick1.h +pick2.h +pickwrap.c +sizes.h +unravel.c +yuk.c +yuk.h + +./temp: +lexer.c +oil.c +parser.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ed50649 --- /dev/null +++ b/Makefile @@ -0,0 +1,175 @@ +# Generated automatically from Makefile.in by configure. +# +# Productions for the INTERCAL distribution +# +VERSION=0.27 + +# Common prefix for machine-independent installed files. +prefix = /dev/env/DJDIR +# Common prefix for machine-dependent installed files. +exec_prefix = ${prefix} + +# Directory in which to install binaries. +bindir = ${exec_prefix}/bin +# Directory in which to install libraries. +libdir = ${exec_prefix}/lib +# Directory to install data files. +datadir = ${prefix}/share/ick-0.27 +# Directory to install the include files in. +incdir = ${prefix}/include/ick-0.27 +# Directory to install Info files in. +infodir = ${prefix}/info + +# This can be overridden from the command line +DESTDIR= + +CC = gcc +CFLAGS = -g -O2 -DICKINCLUDEDIR=\"$(incdir)\" -DICKLIBDIR=\"$(datadir)\" -DICKBINDIR=\"$(bindir)\" -DYYDEBUG -O2 -W -Wall -I./src -I./temp +LDFLAGS = +LEX = flex +LEXFLAGS= +YACC = bison -y +YACCFLAGS = + +LOADLIBS = -lfl + +CSOURCES = src/parser.y src/lexer.l src/feh2.c src/dekludge.c src/lose.c src/fiddle.c src/perpet.c src/unravel.c src/uncommon.c +ISOURCES = src/cesspool.c src/arrgghh.c src/ick-wrap.c src/numerals.c +YSOURCES = src/yuk.c +HEADERS = src/ick.h src/lose.h src/sizes.h src/abcess.h src/fiddle.h src/feh.h src/yuk.h src/uncommon.h +BUILD = Makefile.in config.in config.sh src/configh.in ickspec.in ickspec src/cooptsh.in +MISC = etc/intercal.el src/ctrlmfix.sh src/ctrlmfix.bat +DOCS = BUGS.txt COPYING.txt NEWS.txt README.txt +SOURCES = $(CSOURCES) $(ISOURCES) $(YSOURCES) $(HEADERS) $(BUILD) $(MISC) $(DOCS) pit doc + +all: bin/ick.exe lib/libick.a lib/libickmt.a lib/libyuk.a ial + +ial: src/fiddle.h src/abcess.h src/lose.h src/yuk.h src/ick-wrap.c src/pickwrap.c temp/coopt.sh pit/lib/syslib.i COPYING.txt + -cp src/fiddle.h include/fiddle.h + -cp src/abcess.h include/abcess.h + -cp src/lose.h include/lose.h + -cp src/yuk.h include/yuk.h + -cp pit/lib/syslib.i pit/lib/syslib.?i include + -cp src/ick-wrap.c lib/ick-wrap.c + -cp src/pickwrap.c lib/pickwrap.c + -cp temp/coopt.sh lib/coopt.sh + -cp COPYING.txt lib/COPYING.txt + +bin/ick.exe: temp/parser.o temp/lexer.o temp/feh2.o temp/dekludge.o temp/idiotism.o temp/lose.o temp/fiddle.o temp/perpet.o temp/uncommon.o + $(CC) temp/perpet.o temp/parser.o temp/lexer.o temp/feh2.o temp/dekludge.o temp/idiotism.o temp/lose.o temp/fiddle.o temp/uncommon.o $(LDFLAGS) -o bin/ick.exe + +temp/oil.c: src/oil.y temp/config.h + $(YACC) $(YACCFLAGS) src/oil.y + -rm -f temp/oil.c + mv y.tab.c temp/oil.c + +temp/parser.h temp/parser.c: src/parser.y src/ick.h src/sizes.h src/feh.h src/lose.h temp/config.h + $(YACC) -d $(YACCFLAGS) src/parser.y + -rm -f temp/parser.c + mv y.tab.c temp/parser.c + -rm -f temp/parser.h + mv y.tab.h temp/parser.h + +temp/lexer.c: src/lexer.l src/ick.h src/lose.h temp/config.h + $(LEX) $(LEXFLAGS) src/lexer.l + -rm -f temp/lexer.c + mv lexyy.c temp/lexer.c + +bin/lextest: temp/parser.h src/lexer.c src/ick.h temp/lose.o + $(CC) -DMAIN src/lexer.c src/lose.o -lfl -o bin/lextest + +temp/oil.exe: temp/oil.c temp/config.h + $(CC) $(CFLAGS) -o temp/oil.exe temp/oil.c +temp/parser.o: temp/parser.c src/ick.h src/feh.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/parser.o temp/parser.c +temp/lexer.o: temp/lexer.c temp/parser.h src/ick.h src/lose.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/lexer.o temp/lexer.c +temp/feh2.o: src/feh2.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/feh2.o src/feh2.c +temp/idiotism.c: src/idiotism.oil temp/oil.exe + temp/oil.exe < src/idiotism.oil > temp/idiotism.c +temp/idiotism.o: temp/idiotism.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/idiotism.o temp/idiotism.c +temp/dekludge.o: src/dekludge.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/dekludge.o src/dekludge.c +temp/perpet.o: src/perpet.c temp/parser.h src/ick.h src/lose.h src/sizes.h src/uncommon.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/perpet.o src/perpet.c +temp/cesspool.o: src/cesspool.c src/abcess.h src/lose.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/cesspool.o src/cesspool.c +temp/numerals.o: src/numerals.c src/abcess.h src/lose.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/numerals.o src/numerals.c +temp/unravel.o: src/unravel.c src/abcess.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/unravel.o src/unravel.c +temp/lose.o: src/lose.c src/lose.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/lose.o src/lose.c +temp/fiddle.o: src/fiddle.c src/fiddle.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/fiddle.o src/fiddle.c +temp/arrgghh.o: src/arrgghh.c + $(CC) $(CFLAGS) -c -o temp/arrgghh.o src/arrgghh.c +temp/uncommon.o: src/uncommon.c src/uncommon.h + $(CC) $(CFLAGS) -c -o temp/uncommon.o src/uncommon.c +temp/yuk.o: src/yuk.c src/yuk.h src/lose.h src/sizes.h src/abcess.h src/uncommon.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/yuk.o src/yuk.c + +lib/libick.a: temp/cesspool.o temp/numerals.o temp/lose.o temp/fiddle.o temp/arrgghh.o + ar cr lib/libick.a temp/cesspool.o temp/numerals.o temp/lose.o temp/fiddle.o temp/arrgghh.o + ranlib lib/libick.a + +lib/libickmt.a: temp/cesspool.o temp/numerals.o temp/unravel.o temp/lose.o temp/fiddle.o temp/arrgghh.o + ar cr lib/libickmt.a temp/cesspool.o temp/numerals.o temp/unravel.o temp/lose.o temp/fiddle.o temp/arrgghh.o + ranlib lib/libickmt.a + +lib/libyuk.a: temp/yuk.o temp/uncommon.o + ar cr lib/libyuk.a temp/yuk.o temp/uncommon.o + ranlib lib/libyuk.a + +install: all + cp bin/ick.exe $(DESTDIR)$(bindir) + cp lib/libick.a $(DESTDIR)$(libdir) + cp lib/libickmt.a $(DESTDIR)$(libdir) + cp lib/libyuk.a $(DESTDIR)$(libdir) + -mkdir -p $(DESTDIR)$(incdir) + cp src/lose.h src/abcess.h src/fiddle.h src/yuk.h $(DESTDIR)$(incdir) + -mkdir $(DESTDIR)$(datadir) + cp src/ick-wrap.c $(DESTDIR)$(datadir) + cp include/syslib.i include/syslib.?i $(DESTDIR)$(datadir) + cp temp/coopt.sh $(DESTDIR)$(libdir) + cp COPYING.txt $(DESTDIR)$(libdir) + rm -f $(DESTDIR)$(infodir)/ick.info + cp doc/ick.inf $(DESTDIR)$(infodir) + -mv $(DESTDIR)$(infodir)/ick.inf $(DESTDIR)$(infodir)/ick.info +# Note that it's necessary to copy the info file to .inf on an 8.3 system +# and .info otherwise; this is done by copying it to .inf, and then renaming +# to .info; on an 8.3 system, this leaves the extension as .inf because mv +# will signal an (unimportant) error. + +uninstall: + rm -f $(DESTDIR)$(bindir)/ick.exe $(DESTDIR)$(libdir)/libick.a + rm -f $(DESTDIR)$(libdir)/coopt.sh $(DESTDIR)$(libdir)/COPYING.txt + rm -f $(DESTDIR)$(libdir)/libickmt.a $(DESTDIR)$(libdir)/libyuk.a + rm -f ${DESTDIR}${infodir}/ick.inf $(DESTDIR)$(infodir)/ick.info + rm -fr $(DESTDIR)$(incdir) $(DESTDIR)$(datadir) + +TAGS: $(SOURCES) + etags $(SOURCES) + +dist: ick-0.27.tgz + +ick-0.27.tgz: $(SOURCES) + @find $(SOURCES) -type f -print | grep -v RCS | sed s:^:ick-0.27/: >MANIFEST.txt + @(cd ..; ln -s intercal ick-0.27) + (cd ..; tar -czvf intercal/ick-0.27.tgz `cat intercal/MANIFEST.txt`) + @(cd ..; rm ick-0.27) + +clean: + -cp temp/config.h . + -rm -f temp/* bin/* lib/* include/* + mv config.h temp + +distr: + -rm -f temp/*.o temp/parser.h temp/oil.exe temp/idiotism.c + -rm -f bin/* lib/* include/* + +distclean: distr + -rm -f config.status config.cache config.log Makefile + -rm -f temp/config.h temp/coopt.sh diff --git a/Makefile.in b/Makefile.in index 6acd911..3ab8dbc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,51 +13,37 @@ bindir = @bindir@ # Directory in which to install libraries. libdir = @libdir@ # Directory to install data files. -datadir = @datadir@/intercal-@PACKAGE_VERSION@ +datadir = @datadir@/ick-@PACKAGE_VERSION@ # Directory to install the include files in. -incdir = @includedir@/intercal-@PACKAGE_VERSION@ - -# Program to install binaries -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -# Program to install the man page. -INSTALL_DATA = @INSTALL_DATA@ -# Generic install program. -INSTALL = @INSTALL@ +incdir = @includedir@/ick-@PACKAGE_VERSION@ +# Directory to install Info files in. +infodir = @infodir@ # This can be overridden from the command line DESTDIR= -# Location of GNU GPL. This will be automatically copied if not required during install. -# If not using install, change this to any copy of the GNU GPL that exists on your system. -# This is required because the yuk debugger reads commands interactively, and so must be -# able to display a copy of the GPL on demand. This is only possible if yuk can find a copy. -# If you want to delete or move the distribution files, then you will have to move COPYING -# to another directory; otherwise, you can aim this at COPYING. -# It's also possible to aim this at a copy of COPYING from another GPL program. -copyloc = ${DESTDIR}${datadir}/COPYING.txt - CC = @CC@ -CFLAGS = @CFLAGS@ -DICKINCLUDEDIR=\"$(incdir)\" -DICKLIBDIR=\"$(datadir)\" -DICKBINDIR=\"$(bindir)\" -DYYDEBUG -DYUKCOPYLOC=\"$(copyloc)\" -O2 -W -Wall -I./src -I./temp +CFLAGS = @CFLAGS@ -DICKINCLUDEDIR=\"$(incdir)\" -DICKLIBDIR=\"$(datadir)\" -DICKBINDIR=\"$(bindir)\" -DYYDEBUG -O2 -W -Wall -I./src -I./temp LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXFLAGS= YACC = @YACC@ -YACCFLAGS = -d # -t +YACCFLAGS = -LOADLIBS = @LIBS@ @INTLLIBS@ @LEXLIB@ +LOADLIBS = @LIBS@ @LEXLIB@ -CSOURCES = src/parser.y src/lexer.l src/feh2.c src/dekludge.c src/lose.c src/fiddle.c src/perpet.c src/unravel.c +CSOURCES = src/parser.y src/lexer.l src/feh2.c src/dekludge.c src/lose.c src/fiddle.c src/perpet.c src/unravel.c src/uncommon.c ISOURCES = src/cesspool.c src/arrgghh.c src/ick-wrap.c src/numerals.c YSOURCES = src/yuk.c -HEADERS = src/ick.h src/lose.h src/sizes.h src/abcess.h src/fiddle.h src/feh.h src/yuk.h -BUILD = Makefile.in Makefile configure.ac configure config.h.in intercal.spec.in intercal.spec install.sh -MISC = etc/intercal.el src/coopt.sh +HEADERS = src/ick.h src/lose.h src/sizes.h src/abcess.h src/fiddle.h src/feh.h src/yuk.h src/uncommon.h +BUILD = Makefile.in config.in config.sh src/configh.in ickspec.in ickspec src/cooptsh.in +MISC = etc/intercal.el src/ctrlmfix.sh src/ctrlmfix.bat DOCS = BUGS.txt COPYING.txt NEWS.txt README.txt SOURCES = $(CSOURCES) $(ISOURCES) $(YSOURCES) $(HEADERS) $(BUILD) $(MISC) $(DOCS) pit doc -all: bin/ick lib/libick.a lib/libickmt.a lib/libyuk.a ial +all: bin/ick@EXEEXT@ lib/libick.a lib/libickmt.a lib/libyuk.a ial -ial: src/fiddle.h src/abcess.h src/lose.h src/yuk.h src/ick-wrap.c src/pickwrap.c src/coopt.sh pit/lib/syslib.i +ial: src/fiddle.h src/abcess.h src/lose.h src/yuk.h src/ick-wrap.c src/pickwrap.c temp/coopt.sh pit/lib/syslib.i COPYING.txt -cp src/fiddle.h include/fiddle.h -cp src/abcess.h include/abcess.h -cp src/lose.h include/lose.h @@ -65,89 +51,102 @@ ial: src/fiddle.h src/abcess.h src/lose.h src/yuk.h src/ick-wrap.c src/pickwrap. -cp pit/lib/syslib.i pit/lib/syslib.?i include -cp src/ick-wrap.c lib/ick-wrap.c -cp src/pickwrap.c lib/pickwrap.c - -cp src/coopt.sh lib/coopt.sh + -cp temp/coopt.sh lib/coopt.sh + -cp COPYING.txt lib/COPYING.txt -copycopy: COPYING.txt - -mkdir $(DESTDIR)$(datadir) - -if cp $(copyloc) /dev/null ; then : ; else cp COPYING.txt $(copyloc) ; fi +bin/ick@EXEEXT@: temp/parser.@OBJEXT@ temp/lexer.@OBJEXT@ temp/feh2.@OBJEXT@ temp/dekludge.@OBJEXT@ temp/idiotism.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/perpet.@OBJEXT@ temp/uncommon.@OBJEXT@ + $(CC) temp/perpet.@OBJEXT@ temp/parser.@OBJEXT@ temp/lexer.@OBJEXT@ temp/feh2.@OBJEXT@ temp/dekludge.@OBJEXT@ temp/idiotism.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/uncommon.@OBJEXT@ $(LDFLAGS) -o bin/ick@EXEEXT@ -checkcopy: - @echo If the following line fails, change \"copyloc\" in your makefile. - cp $(copyloc) /dev/null +temp/oil.c: src/oil.y temp/config.h + $(YACC) $(YACCFLAGS) src/oil.y + -rm -f temp/oil.c + mv y.tab.c temp/oil.c -bin/ick: temp/parser.o temp/lexer.o temp/feh2.o temp/dekludge.o temp/lose.o temp/fiddle.o temp/perpet.o - $(CC) temp/perpet.o temp/ick.o temp/lexer.o temp/feh2.o temp/dekludge.o temp/lose.o temp/fiddle.o $(LDFLAGS) -o bin/ick - -temp/parser.h temp/parser.c: src/parser.y src/ick.h src/sizes.h src/feh.h src/lose.h +temp/parser.h temp/parser.c: src/parser.y src/ick.h src/sizes.h src/feh.h src/lose.h temp/config.h $(YACC) -d $(YACCFLAGS) src/parser.y - -rm temp/parser.c + -rm -f temp/parser.c mv y.tab.c temp/parser.c - -rm temp/parser.h + -rm -f temp/parser.h mv y.tab.h temp/parser.h -temp/lexer.c: src/lexer.l src/ick.h src/lose.h +temp/lexer.c: src/lexer.l src/ick.h src/lose.h temp/config.h $(LEX) $(LEXFLAGS) src/lexer.l - -rm temp/lexer.c - mv lex.yy.c temp/lexer.c - -# Uncomment the following if using a stock lex -# LEXLIBS = -ll -bin/lextest: temp/parser.h src/lexer.c src/ick.h temp/lose.o - $(CC) -DMAIN src/lexer.c src/lose.o $(LEXLIBS) -o bin/lextest - -temp/parser.o: temp/parser.c src/ick.h src/feh.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/ick.o temp/parser.c -temp/lexer.o: temp/lexer.c temp/parser.h src/ick.h src/lose.h - $(CC) $(CFLAGS) -c -o temp/lexer.o temp/lexer.c -temp/feh2.o: src/feh2.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/feh2.o src/feh2.c -temp/dekludge.o: src/dekludge.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/dekludge.o src/dekludge.c -temp/perpet.o: src/perpet.c temp/parser.h src/ick.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/perpet.o src/perpet.c -temp/cesspool.o: src/cesspool.c src/abcess.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/cesspool.o src/cesspool.c -temp/numerals.o: src/numerals.c src/abcess.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/numerals.o src/numerals.c -temp/unravel.o: src/unravel.c src/abcess.h src/lose.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/unravel.o src/unravel.c -temp/lose.o: src/lose.c src/lose.h - $(CC) $(CFLAGS) -c -o temp/lose.o src/lose.c -temp/fiddle.o: src/fiddle.c src/fiddle.h src/sizes.h - $(CC) $(CFLAGS) -c -o temp/fiddle.o src/fiddle.c -temp/arrgghh.o: src/arrgghh.c - $(CC) $(CFLAGS) -c -o temp/arrgghh.o src/arrgghh.c -temp/yuk.o: checkcopy src/yuk.h src/lose.h src/sizes.h src/abcess.h - $(CC) $(CFLAGS) -c -o temp/yuk.o src/yuk.c - -lib/libick.a: temp/cesspool.o temp/numerals.o temp/lose.o temp/fiddle.o temp/arrgghh.o - ar cr lib/libick.a temp/cesspool.o temp/numerals.o temp/lose.o temp/fiddle.o temp/arrgghh.o - -ranlib lib/libick.a - -lib/libickmt.a: temp/cesspool.o temp/numerals.o temp/unravel.o temp/lose.o temp/fiddle.o temp/arrgghh.o - ar cr lib/libickmt.a temp/cesspool.o temp/numerals.o temp/unravel.o temp/lose.o temp/fiddle.o temp/arrgghh.o - -ranlib libickmt.a - -lib/libyuk.a: temp/yuk.o - ar cr lib/libyuk.a temp/yuk.o - -ranlib lib/libyuk.a - -install: copycopy all - cp bin/ick $(DESTDIR)$(bindir) + -rm -f temp/lexer.c + mv @LEX_OUTPUT_ROOT@.c temp/lexer.c + +bin/lextest: temp/parser.h src/lexer.c src/ick.h temp/lose.@OBJEXT@ + $(CC) -DMAIN src/lexer.c src/lose.@OBJEXT@ @LEXLIB@ -o bin/lextest + +temp/oil@EXEEXT@: temp/oil.c temp/config.h + $(CC) $(CFLAGS) -o temp/oil@EXEEXT@ temp/oil.c +temp/parser.@OBJEXT@: temp/parser.c src/ick.h src/feh.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/parser.@OBJEXT@ temp/parser.c +temp/lexer.@OBJEXT@: temp/lexer.c temp/parser.h src/ick.h src/lose.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/lexer.@OBJEXT@ temp/lexer.c +temp/feh2.@OBJEXT@: src/feh2.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/feh2.@OBJEXT@ src/feh2.c +temp/idiotism.c: src/idiotism.oil temp/oil@EXEEXT@ + temp/oil@EXEEXT@ < src/idiotism.oil > temp/idiotism.c +temp/idiotism.@OBJEXT@: temp/idiotism.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/idiotism.@OBJEXT@ temp/idiotism.c +temp/dekludge.@OBJEXT@: src/dekludge.c src/feh.h temp/parser.h src/ick.h src/fiddle.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/dekludge.@OBJEXT@ src/dekludge.c +temp/perpet.@OBJEXT@: src/perpet.c temp/parser.h src/ick.h src/lose.h src/sizes.h src/uncommon.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/perpet.@OBJEXT@ src/perpet.c +temp/cesspool.@OBJEXT@: src/cesspool.c src/abcess.h src/lose.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/cesspool.@OBJEXT@ src/cesspool.c +temp/numerals.@OBJEXT@: src/numerals.c src/abcess.h src/lose.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/numerals.@OBJEXT@ src/numerals.c +temp/unravel.@OBJEXT@: src/unravel.c src/abcess.h src/lose.h src/sizes.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/unravel.@OBJEXT@ src/unravel.c +temp/lose.@OBJEXT@: src/lose.c src/lose.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/lose.@OBJEXT@ src/lose.c +temp/fiddle.@OBJEXT@: src/fiddle.c src/fiddle.h src/sizes.h + $(CC) $(CFLAGS) -c -o temp/fiddle.@OBJEXT@ src/fiddle.c +temp/arrgghh.@OBJEXT@: src/arrgghh.c + $(CC) $(CFLAGS) -c -o temp/arrgghh.@OBJEXT@ src/arrgghh.c +temp/uncommon.@OBJEXT@: src/uncommon.c src/uncommon.h + $(CC) $(CFLAGS) -c -o temp/uncommon.@OBJEXT@ src/uncommon.c +temp/yuk.@OBJEXT@: src/yuk.c src/yuk.h src/lose.h src/sizes.h src/abcess.h src/uncommon.h temp/config.h + $(CC) $(CFLAGS) -c -o temp/yuk.@OBJEXT@ src/yuk.c + +lib/libick.a: temp/cesspool.@OBJEXT@ temp/numerals.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/arrgghh.@OBJEXT@ + ar cr lib/libick.a temp/cesspool.@OBJEXT@ temp/numerals.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/arrgghh.@OBJEXT@ + @RANLIB@ lib/libick.a + +lib/libickmt.a: temp/cesspool.@OBJEXT@ temp/numerals.@OBJEXT@ temp/unravel.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/arrgghh.@OBJEXT@ + ar cr lib/libickmt.a temp/cesspool.@OBJEXT@ temp/numerals.@OBJEXT@ temp/unravel.@OBJEXT@ temp/lose.@OBJEXT@ temp/fiddle.@OBJEXT@ temp/arrgghh.@OBJEXT@ + @RANLIB@ lib/libickmt.a + +lib/libyuk.a: temp/yuk.@OBJEXT@ temp/uncommon.@OBJEXT@ + ar cr lib/libyuk.a temp/yuk.@OBJEXT@ temp/uncommon.@OBJEXT@ + @RANLIB@ lib/libyuk.a + +install: all + cp bin/ick@EXEEXT@ $(DESTDIR)$(bindir) cp lib/libick.a $(DESTDIR)$(libdir) cp lib/libickmt.a $(DESTDIR)$(libdir) cp lib/libyuk.a $(DESTDIR)$(libdir) -mkdir -p $(DESTDIR)$(incdir) cp src/lose.h src/abcess.h src/fiddle.h src/yuk.h $(DESTDIR)$(incdir) -mkdir $(DESTDIR)$(datadir) - (cp -r pit $(DESTDIR)$(datadir)) cp src/ick-wrap.c $(DESTDIR)$(datadir) - cp etc/coopt.sh $(DESTDIR)$(bindir) + cp include/syslib.i include/syslib.?i $(DESTDIR)$(datadir) + cp temp/coopt.sh $(DESTDIR)$(libdir) + cp COPYING.txt $(DESTDIR)$(libdir) + rm -f $(DESTDIR)$(infodir)/ick.info + cp doc/ick.inf $(DESTDIR)$(infodir) + -mv $(DESTDIR)$(infodir)/ick.inf $(DESTDIR)$(infodir)/ick.info +# Note that it's necessary to copy the info file to .inf on an 8.3 system +# and .info otherwise; this is done by copying it to .inf, and then renaming +# to .info; on an 8.3 system, this leaves the extension as .inf because mv +# will signal an (unimportant) error. uninstall: - rm -f $(DESTDIR)$(bindir)/ick $(DESTDIR)$(libdir)/libick.a - rm -f $(DESTDIR)$(bindir)/coopt.sh + rm -f $(DESTDIR)$(bindir)/ick@EXEEXT@ $(DESTDIR)$(libdir)/libick.a + rm -f $(DESTDIR)$(libdir)/coopt.sh $(DESTDIR)$(libdir)/COPYING.txt rm -f $(DESTDIR)$(libdir)/libickmt.a $(DESTDIR)$(libdir)/libyuk.a + rm -f ${DESTDIR}${infodir}/ick.inf $(DESTDIR)$(infodir)/ick.info rm -fr $(DESTDIR)$(incdir) $(DESTDIR)$(datadir) TAGS: $(SOURCES) @@ -162,7 +161,14 @@ ick-@PACKAGE_VERSION@.tgz: $(SOURCES) @(cd ..; rm ick-@PACKAGE_VERSION@) clean: - rm -f temp/* bin/* lib/* include/* + -cp temp/config.h . + -rm -f temp/* bin/* lib/* include/* + mv config.h temp distr: - rm -f temp/*.o bin/* lib/* include/* + -rm -f temp/*.@OBJEXT@ temp/parser.h temp/oil@EXEEXT@ temp/idiotism.c + -rm -f bin/* lib/* include/* + +distclean: distr + -rm -f config.status config.cache config.log Makefile + -rm -f temp/config.h temp/coopt.sh diff --git a/NEWS.txt b/NEWS.txt index 5fdd276..7a5d2bf 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,5 +1,86 @@ NEW IN THIS RELEASE + Release 0.27 (by Alex Smith) + +1. Joris Huizer pointed out that the manual nowhere says that a GIVE UP line + can't be abstained from by line number. This was probably a mistake in the + INTERCAL-72 manual, but the behaviour specified by the original manual is + now implemented; after all, it wouldn't do to violate the original de facto + standard. (Note that if a GIVE UP line is abstained by line number, there + is then no way to reinstate it; also, if the -X switch for CLC-INTERCAL + compatibility is used, ABSTAINING FROM a GIVE UP line by line number is + also silently ignored.) + +2. Rewrote the optimizer in a language (OIL) invented specifically for the + purpose; the set of optimizer idioms is now in idiotism.oil, and translated + into C and linked with the rest of the compiler at compile time. It + contains many of the same idioms, but some have been generalised or reduced + into smaller parts and some new ones were added. + +3. Joris Huizer submitted a patch to fix a memory allocation bug which + occasionally caused memory corruption when a program had a number of + commands that was 1 less than a multiple of 256. + +4. Completely redid the autoconfiguration. The install should now progress + with less user interaction than before. As a bonus, if you have a range of + GNU utilities including make, sed, tr, and bash (and possibly others), + it's now possible to compile using 'sh config.sh' followed by 'make' under + DJGPP. (To be specific, some settings that previously sometimes had to be + set by the user, such as whether lex provided yylineno and yyrestart, are + now either detected by config.sh or no longer relevant. Other settings that + were not previously detected, such as what extension executables have, are + now detected so that config.sh works on DJGPP as well, now. Note that if + config.in is translated to config.sh on a non-DJGPP system, it might cause + the resulting shell script to fail on DJGPP; this is an upstream problem.) + The autoconfigurer now also adapts coopt.sh so that -F works on DJGPP too, + sort of (or else detects that it won't work and disables it). + +5. Improved the action of 'make install', so that it actually installs + everything in the right place. It works under DJGPP, now, too, as long as + you have the programs installed that allow config.sh and make to work. + +6. Fixed a bug involving COME FROM in multithreaded programs; now, if a line + COMEs FROM itself (either because this is written explicitly or because it + is a computed COME FROM computing to its own line number), the loop this + creates doesn't block all the other threads in the program. + +7. Added support for statement WHILE statement, with similar semantics to CLC- + INTERCAL. (The second statement is repeated for as long as the first + statement is executing; NEXTing to the statement nexts to the first + statement and doesn't set off the loop, and COMING or NEXTING FROM the + first statement leaves the loop running until the NEXT FROM returns.) With + the current implementation, strange things happen if the same WHILE is + simultaneously run by multiple threads, although I decided to work out + exactly what the rules were anyway and document them, so those strange + things are now official. + +8. Fixed some weird bugs in the multithreader that could cause segfaults in + several situations involving backtracking; it's kind of surprising that + they didn't turn up sooner. + +9. Prevented a segfault in some situations where a syntax error was the + target of a noncomputed COME FROM or NEXT FROM. + +10. CALCULATING now includes array dimensioning. (There previously was no + gerund for this situation; the original manual doesn't say what to do but + implies that this is a special case of calculate.) + +11. Made operand overloading interact more sensibly with multithreading. + Previously, overloading information was shared between all threads, but the + stashes for operand overloading were separate in each thread. Now, the + overloading is not shared between threads, except when they are woven by a + WHILE statement. + +12. There's no longer a need to set or modify copyloc in the makefile by hand; + COPYING.txt is now found the same way as syslib and the skeleton. It's also + now copied out of the distribution to the same place as the other data + files when installing, preventing the need to keep the original + installation directory around. + +13. The compiler now actually looks for a temporary directory to place a file + in when creating a temporary file; this was meant to be fixed in 1.26, but + the fix didn't actually work. + Release 1.26 (by Alex Smith) [a bugfix of 0.26] 1. Fixed an optimizer bug (thanks to Joris Huizer for pointing it out), diff --git a/README.txt b/README.txt index 9450f46..49b284b 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,6 @@ - Release Notes for C-INTERCAL + Release Notes for C-INTERCAL - DISCREDITS + DISCREDITS This package is an implementation of the language INTERCAL designed by Don Woods and James Lyon, who have since spent more than twenty years trying to @@ -9,9 +9,9 @@ live it down. This implementation was created by Eric S. Raymond during a fit of lunacy from which he has since mostly recovered. It has been considerably hacked upon and improved by Steve Swales, Michael Ernst, Louis -Howell, Brian Raiter, and others. For detailed credits see NEWS. +Howell, Brian Raiter, Alex Smith, and others. For detailed credits see NEWS. - FILES + FILES The compiler itself is in the src directory. Setting a symbol in the makefile will allow you to install it and its libraries and support files in a directory @@ -20,72 +20,93 @@ contains various examples of INTERCAL source code, writhing in agony. The files included are: -README.txt -- this file -BUGS.txt -- current bug and to-do list -NEWS.txt -- info on features and fixes new in this release -COPYING.txt -- copyright and licence information -MANIFEST.txt -- a list of all files in the distribution - -etc/intercal.el -- elisp for editing INTERCAL code under GNU Emacs - -doc/READ.ME -- historical notes on the docs -doc/intercal.mm -- the manual in groffable form -doc/THEORY -- some notes on the internals of the INTERCAL compiler - -src/lexer.l -- the lexical analyzer specification (in LEX) -src/parser.y -- the grammar specification (in YACC) -src/ick.h -- compilation types and defines -src/perpet.c -- main routine for compiler -src/feh2.c -- INTERCAL-to-C code generator -src/feh2.h -- interface to INTERCAL-to-C code generator -src/dekludge.c -- INTERCAL parse tree optimizer -src/fiddle.c -- the INTERCAL operators -src/lose.[ch] -- INTERCAL compile- and run-time error handling -src/ick-wrap.c -- the driver for generated C-from-INTERCAL code -src/pickwrap.c -- the driver for generated PIC C-from-INTERCAL code -src/arrgghh.c -- option argument parsing for generated programs -src/abcess.h -- interface to functions linked with programs -src/cesspool.c -- the INTERCAL runtime support code -src/numerals.c -- numerals table for INTERCAL input -src/sizes.h -- variables defining the numeric base -src/unravel.c -- multithreading functions -src/yuk.[ch] -- INTERCAL debugger and profiler (POSIX only) -src/pick1.h -- template for compiler-dependent PIC C headers -src/pick2.h -- runtime support for compiled PIC-INTERCAL +README.txt -- this file +BUGS.txt -- current bug and to-do list +NEWS.txt -- info on features and fixes new in this release +COPYING.txt -- copyright and licence information +MANIFEST.txt -- a list of all files in the distribution + +etc/intercal.el -- elisp for editing INTERCAL code under GNU Emacs + +doc/READ.ME -- historical notes on the docs +doc/ick.txi -- the Revamped Manual sources, a newer manual +doc/gpl-2-0.txi -- the GNU GPL version 2.0 in Texinfo form +doc/fdl-1-2.txi -- the GNU FDL version 1.2 in Texinfo form +doc/html/*.htm -- the Revamped Manual as an HTML website +doc/ick.htm -- the Revamped Manual as one HTML file +doc/ick.txt -- the Revamped Manual in plain text form +doc/ick.inf -- the Revamped Manual in Info +doc/fix83.pl -- script to fixup the HTML output for 8.3 systems +doc/intercal.mm -- the old manual in groffable form +doc/Makefile -- makefile to build old and new manuals +doc/THEORY.txt -- some notes on the internals of the INTERCAL compiler +doc/chipspec.txt -- plans for an INTERCAL-based microprocessor + +src/abcess.h -- interface to functions linked with programs +src/arrgghh.c -- option argument parsing for generated programs +src/cesspool.c -- the INTERCAL runtime support code +src/configdj.h -- config.h substitute for DJGPP without config.sh src/coopt.sh -- script to help out the -F optimizer (POSIX only) -src/ick.bat -- wrapper around the compiler (DJGPP only) - -temp/parser.[ch] -- Prebuilt parser (for DJGPP systems without bison) -temp/lexer.c -- Prebuilt lexer (for DJGPP systems without flex) - -Makefile.in -- makefile input for the INTERCAL compiler (POSIX) -makeick.bat -- script to compile under DJGPP -districk.bat -- script to remove files not distributed (DJGPP) -cleanick.bat -- script to remove all non-source files (DJGPP) -ctrlmfix.bat -- script to remove ^Ms that may have got in by mistake -makeick.sh --\ -districk.sh --|the same as above, but in sh format -cleanick.sh --|(use .bat under command.com/cmd, and .sh under bash) -ctrlmfix.sh --/ - -config.sh -- GNU Autoconf script that generates a makefile - from Makefile.in -ickspec.in -- Input to config.sh -config.ac -- Source from which config.sh was generated -install.sh -- Helper file for 'make install' - -bin/* -- Directory that holds binaries after the build -include/* -- Directory that holds header files after the build -lib/* -- Directory that holds library files after the build - -pit/* -- sample INTERCAL code; see pit/CATALOG - - HOW TO GET STARTED +src/dekludge.c -- INTERCAL optimizer wrapper and utility functions +src/feh.h -- interface to INTERCAL-to-C code generator +src/feh2.c -- INTERCAL-to-C code generator +src/fiddle.[ch] -- the INTERCAL operators +src/ick-wrap.c -- the driver for generated C-from-INTERCAL code +src/ick.h -- compilation types and defines +src/idiotism.oil -- list of INTERCAL idioms to optimize +src/lexer.l -- the lexical analyzer specification (in LEX) +src/lose.[ch] -- INTERCAL compile- and run-time error handling +src/numerals.c -- numerals table for INTERCAL input +src/oil.y -- compiler to translate idiotism.oil into C +src/parser.y -- the grammar specification (in YACC) +src/perpet.c -- main routine for compiler +src/pick1.h -- template for compiler-dependent PIC C headers +src/pick2.h -- runtime support for compiled PIC-INTERCAL +src/pickwrap.c -- the driver for generated PIC C-from-INTERCAL code +src/sizes.h -- variables defining the numeric base +src/uncommon.[ch] -- code common to the compiler and debugger +src/unravel.c -- multithreading functions +src/yuk.[ch] -- INTERCAL debugger and profiler + +temp/parser.[ch] -- Prebuilt parser (for DJGPP systems without bison) +temp/lexer.c -- Prebuilt lexer (for DJGPP systems without flex) +temp/oil.c -- Prebuilt OIL compiler (again, for bisonless systems) + +makeick.bat -- script to compile under DJGPP +districk.bat -- script to remove files not distributed (DJGPP) +cleanick.bat -- script to remove all non-source files (DJGPP) +etc/ctrlmfix.bat -- script to remove ^Ms that may have got in by mistake +makeick.sh --\ +districk.sh --|the same as above, but in sh format +cleanick.sh --|(use .bat under command.com/cmd, and .sh under bash) +etc/ctrlmfix.sh --/ + +config.sh -- GNU Autoconf script that generates a makefile + from Makefile.in +ickspec.in -- Input to config.sh +config.in -- Source from which config.sh was generated +configh.in -- Source from which temp/config.h is generated +Makefile.in -- makefile input for the INTERCAL compiler + +bin/* -- Directory that holds binaries after the build +include/* -- Directory that holds header files after the build +lib/* -- Directory that holds library files after the build + +pit/* -- sample INTERCAL code; see pit/CATALOG + + HOW TO GET STARTED + +First, note that there is a much fuller manual than this README file +available. For full information about C-INTERCAL, including extensive +installation and usage instructions, see that one; point a web browser at +doc/html/index.htm, or run `info -f doc/ick.inf', or failing that read the +plain text version at doc/ick.txt. After C-INTERCAL is installed, the manual is +also available with just `info ick'. You want a man page? Man pages are for wimps. To compile an INTERCAL program `foo.i' to executable code, just do - ick foo.i + ick foo.i There's a -c option that leaves the generated `foo.c' in place for inspection (suppressing compilation to machine code), a -d option that enables verbose @@ -104,7 +125,8 @@ will cause it to dump core on E778. Other than that, yer on yer own. -t has been mentioned above as a compatibility option; -X is also permitted, and causes the program to treat the ambiguous characters ? and @ as having the meanings that they have in CLC-INTERCAL rather than their traditional -C-INTERCAL meanings. +C-INTERCAL meanings, and also uses the CLC-INTERCAL meaning for some commands +(such as an ABSTAIN aiming at a GIVE UP command's line label). Another switch affects C-INTERCAL's runtime behavior. The `-C' option forces output in "clockface" mode, for superstitious users who believe writing "IV" @@ -128,7 +150,7 @@ extent the INTERCAL philosophy, the fact that a 'unbutcher' command has been posted clearly indicates the need for it. Anyway... if you don't like it, don't use it... the default is -wimpmode (i.e. NOT wimp mode)." - SPREADING THE BLAME + SPREADING THE BLAME There is an INTERCAL Resource Page at http://www.catb.org/intercal @@ -146,67 +168,70 @@ who to contact.) There is, in addition, an occasionally active USENET newsgroup devoted to the language: alt.lang.intercal. - NOTES ON THE POSIX BUILD + NOTES ON THE POSIX BUILD The configure script in this distribution is called 'config.sh', to be kind to people trying to build under DOS, and also just because we like being -different. - -At the top of ick.h are two defines that you may need to remove if you are -using lex instead of flex. - -Many lexes export a yylineno variable, an undocumented feature that is not in -flex (by default). If your build fails because of redecleration of yylineno, -comment out the define of YYLINENO_BY_HAND. +different. (You can build and install C-INTERCAL using the familiar routine of +config.sh, then make, then make install.) -Some lexes also supply a yyrestart function to begin parsing a second file, -while others automatically restart after seeing an EOF. (This is the case with -flex.) If your build fails at link time because yyrestart is not defined, -comment out the define of USE_YYRESTART. - -I have also come across lexes whose default limits for various things aren't -high enough to handle INTERCAL's various lexing conundrums. In this case, pay +I have come across lexes whose default limits for various things aren't high +enough to handle INTERCAL's various lexing conundrums. In this case, pay attention to the error messages they give you, and alter the source file -src/lexer.l accordingly. +src/lexer.l accordingly. (Note that previously you might also have had to +change some defines at the top of ick.h to allow for features of your version +of lex; this is no longer required, as one of the defines is now detected by +config.sh and the source files were refactored to make the other moot.) If you are using gcc in an non-ANSI environment, such as SunOS, it is strongly recommended that you add "-Wno-unused -Wimplicit" to the gcc command in the makefile. If you are in an ANSI environment and are using the current versions -of gcc, flex, and bison, C-INTERCAL should build with no warnings. - -As the debugger is interactive, it needs to be able to find the GNU GPL. The -Makefile attempts to copy the GPL to /dev/null to prove it exists. If this -fails, you will have to point the Makefile to a copy of the GPL yourself. You -can always copy the one included with this distribution somewhere safe and use -that (what the Makefile will try to do by default, but I suspect it always -fails). +of gcc, flex, and bison, C-INTERCAL should build with no warnings (except some +from rm saying it can't find files, which is not a problem; if installing for +a second or subsequent time, you may also get a harmless warning from mkdir +explaining that the directory it's trying to make already exists, and you can +ignore that too). If you get an error about 'gettimeofday()', or if you have a more accurate timing function available, there's a whole section about profiling in yuk.h that you can change to affect the accuracy of the timings. (Option 0 is pure ANSI C, which can be used as a fallback to allow the debugging library to -compile if you have nothing better.) +compile if you have nothing better.) Note that the configure script now tries +to detect what timing functions you have available; it's pretty good at +finding ANSI and POSIX functions, but at the moment I only have one +nonstandard one there (gethrtime, which was on one proprietary UNIX system I +tested on); feel free to add code to call other proprietary functions in much +the same way if they're more accurate than gettimeofday() or POSIX +alternatives on some system. - NOTES ON THE DJGPP BUILD + NOTES ON THE DJGPP BUILD This distribution needs prebuilding; you can use the makeick.bat or makeick.sh file provided to compile the program if you can't compile using the usual -POSIX methods via config.sh and make. Once the implementation has been built, -you can install it by adding the \bin subdirectory to your PATH environment -variable (at either end). The temporary output from bison and flex is included -in the distribution (for those people who don't have bison and flex, makeick -will give error messages, but succeed anyway using the prebuilt versions). The -districk.bat file will remove all generated files that weren't in the -distribution, and the cleanick.bat file will remove all files that aren't -needed for a build (including the temporary bison/flex output). Note that -makeick.bat and makeick.sh produce DJGPP-specific output; and if you're +POSIX methods via config.sh and make. (Unlike previous releases of C-INTERCAL, +the configure/make process can work under DJGPP; invoke config.sh as 'sh +config.sh' (without the sparks), and run make as normal. However, this +requires that you've installed quite a few utilities in addition to just gcc, +including at least bash, sed, tr and make, but possibly other things I +missed.) Once the implementation has been built, you can install it by adding +the \bin subdirectory to your PATH environment variable (at either end), or by +using 'make install' (again without the sparks) if you got config.sh and make +to work (which will copy the INTERCAL compiler into your main DJGPP +installation direcrtories). The temporary output from bison and flex is +included in the distribution (for those people who don't have bison and flex, +makeick will give error messages, but succeed anyway using the prebuilt +versions). The districk.bat file will remove all generated files that weren't +in the distribution, and the cleanick.bat file will remove all files that +aren't needed for a build (including the temporary bison/flex output). Note +that makeick.bat and makeick.sh produce DJGPP-specific output; and if you're running DJGPP under bash under Windows XP, you may need to either set your default command interpreter for batch files to cmd rather than command.com (by setting your SHELL environment variable, or use some better workaround that I -don't know about. (command.com seems to have problems with the PATH environment -variable under Windows XP when running under bash.) Also try to make sure that -you use the .sh versions of the makeick.* scripts when running under bash or a -similar ported shell, and the .bat versions when running under a DOS shell. +don't know about. (command.com seems to have problems with the PATH +environment variable under Windows XP when running under bash.) Also try to +make sure that you use the .sh versions of the makeick.* scripts when running +under bash or a similar ported shell, and the .bat versions when running under +a DOS shell. Some distributions of DJGPP have a bug where they complain that they can't find 'm4.exe' (or maybe my PATH is still wrong...). You can solve this problem by @@ -215,18 +240,16 @@ copying m4.exe into the \temp subdirectory before running makeick.bat. (P.S. It was my PATH that was wrong. Still, if you made the same mistake as me, you may want to try the same fix.) -Some features (for instance, -F) are unavailable at the moment under DJGPP -(they are documented, but have no effect). Note also that the profiler is -pretty much useless under DOS; this is a problem inherent in DOS, in that it -doesn't provide timings to any decent resolution (it was worse than 50ms last I -checked, and the DJGPP documentation agrees with me on this; INTERCAL may be -traditionally considered to be slow, but it isn't that slow, especially with -the optimiser enabled). - -Note that for copyright reasons, the compilation needs to know a location of -the GNU GPL on your system. There is one provided as COPYING.txt. You will -need to edit makeick.sh or makeick.bat to change the location given, if the -default (/DJGPP/COPYING) is incorrect. +Some features (for instance, -F) are sometimes unavailable under DJGPP (they +are documented, but have no effect); note that if you do compile a program +under DJGPP using -F, the resulting program may not run if invoked using a +command interpreter other than bash (because -F sometimes produces a shell +script with a .exe extension, rather than a DOS-format executable file). Note +also that the profiler is pretty much useless under DOS; this is a problem +inherent in DOS, in that it doesn't provide timings to any decent resolution +(it was worse than 50ms last I checked, and the DJGPP documentation agrees +with me on this; INTERCAL may be traditionally considered to be slow, but it +isn't that slow, especially with the optimiser enabled). You can get a copy of DJGPP at . @@ -235,7 +258,7 @@ please run etc/ctrlmfix.bat (or sh) from the main installation directory before releasing it; this will remove any trailing control-M characters that may have got into the files by mistake. - NOTES ON COMPILING PIC-INTERCAL + NOTES ON COMPILING PIC-INTERCAL PIC C compilers tend to differ substantially in the way they handle various language constructs. As a result, this compiler will only compile to C (not to @@ -245,14 +268,14 @@ your compiler can find them, and pick1.h will need to be modified to contain compiler-specific data (like the names of data types and the syntax for specifying the device type, fuses, and various commands). - LICENSING + LICENSING C-INTERCAL is now distributed under the General Public License, except for the C skeleton file which is explicitly *not* GPLed in order to avoid the (possibly mythical) "license virus" effect. See the file COPYING.txt for details on the General Public License. - APOCALYPSE + APOCALYPSE INTERCAL is fully Y2K-compliant. Indeed, it is Y2K-obsequious, and loves nothing better than to be punished by relays of leather-clad and spike-heeled diff --git a/config.ac b/config.ac deleted file mode 100644 index 0571ecc..0000000 --- a/config.ac +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.57) -AC_INIT(intercal, 1.26, esr@thyrsus.com) -AC_CONFIG_SRCDIR([src/lose.h]) - -# Checks for programs. -AC_PROG_YACC -AC_PROG_CC -AC_PROG_LEX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([memory.h stddef.h stdlib.h string.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_MALLOC -AC_FUNC_REALLOC -AC_TYPE_SIGNAL -AC_CHECK_FUNCS([memset strrchr strtol strtoul]) - -AC_MSG_NOTICE(Version is $PACKAGE_VERSION) -AC_OUTPUT(Makefile ickspec) diff --git a/config.cache b/config.cache new file mode 100644 index 0000000..c6e97c5 --- /dev/null +++ b/config.cache @@ -0,0 +1,46 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_c_const=${ac_cv_c_const=yes} +ac_cv_cygwin=${ac_cv_cygwin=no} +ac_cv_exeext=${ac_cv_exeext=.exe} +ac_cv_func_gethrtime=${ac_cv_func_gethrtime=no} +ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday=yes} +ac_cv_func_strdup=${ac_cv_func_strdup=yes} +ac_cv_func_strtol=${ac_cv_func_strtol=yes} +ac_cv_func_strtoul=${ac_cv_func_strtoul=yes} +ac_cv_header_stdc=${ac_cv_header_stdc=yes} +ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h=yes} +ac_cv_header_time=${ac_cv_header_time=yes} +ac_cv_header_unistd_h=${ac_cv_header_unistd_h=yes} +ac_cv_lib_fl_yywrap=${ac_cv_lib_fl_yywrap=yes} +ac_cv_mingw32=${ac_cv_mingw32=no} +ac_cv_objext=${ac_cv_objext=o} +ac_cv_prog_CC=${ac_cv_prog_CC=gcc} +ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'} +ac_cv_prog_LEX=${ac_cv_prog_LEX=flex} +ac_cv_prog_LN_S=${ac_cv_prog_LN_S='cp -p'} +ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib} +ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes} +ac_cv_prog_gcc=${ac_cv_prog_gcc=yes} +ac_cv_prog_lex_root=${ac_cv_prog_lex_root=lexyy} +ac_cv_prog_lex_yytext_pointer=${ac_cv_prog_lex_yytext_pointer=yes} +ac_cv_sizeof__Bool=${ac_cv_sizeof__Bool=1} +ac_cv_sizeof_long_long_int=${ac_cv_sizeof_long_long_int=8} +ac_cv_sys_interpreter=${ac_cv_sys_interpreter=yes} +ac_cv_type_signal=${ac_cv_type_signal=void} +lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=12288} diff --git a/config.in b/config.in new file mode 100644 index 0000000..7f69726 --- /dev/null +++ b/config.in @@ -0,0 +1,57 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/abcess.h) +AC_CONFIG_HEADER(temp/config.h:src/configh.in) + +dnl Information about this version of INTERCAL. +PACKAGE_VERSION=0.27 + +dnl Checks for programs. +AC_PROG_YACC +AC_PROG_CC +AC_PROG_LEX +AC_PROG_RANLIB + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(sys/time.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +dnl This Autoconf input is compatible with pre-C99 Autoconf, so to +dnl check for long long AC_CHECK_SIZEOF is used to test for a nonzero result, +dnl likewise for _Bool. +AC_C_CONST +AC_CHECK_SIZEOF(long long int,0) +AC_CHECK_SIZEOF(_Bool,0) +AC_HEADER_TIME +AC_EXEEXT +AC_OBJEXT +AC_DECL_YYTEXT +AC_SYS_INTERPRETER + +AC_MSG_CHECKING(whether yyrestart() is needed) +# Write a lex program that will cause an error if yyrestart exists. +echo '%% +%% +float yyrestart(int, ...);' | $LEX +AC_TRY_COMPILE( +#include "${LEX_OUTPUT_ROOT}.c" +, exit(0);, +AC_MSG_RESULT(no), +AC_DEFINE(NEED_YYRESTART) +AC_MSG_RESULT(yes)) +rm -f ${LEX_OUTPUT_ROOT}.c + +if test "$interpval" != "no"; then +AC_DEFINE([HAVE_SYS_INTERPRETER]) +fi +AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT") + +dnl Checks for library functions. +AC_TYPE_SIGNAL +AC_CHECK_FUNCS(gettimeofday gethrtime strdup strtol strtoul) + +AC_SUBST(PACKAGE_VERSION) + +AC_OUTPUT(Makefile temp/coopt.sh:src/cooptsh.in) diff --git a/config.log b/config.log new file mode 100644 index 0000000..a9c190f --- /dev/null +++ b/config.log @@ -0,0 +1,127 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +configure:534: checking for bison +configure:572: checking for gcc +configure:700: checking whether the C compiler (gcc ) works +configure:716: gcc -o conftest conftest.c 1>&5 +configure:742: checking whether the C compiler (gcc ) is a cross-compiler +configure:747: checking whether we are using GNU C +configure:756: gcc -E conftest.c +configure:775: checking whether gcc accepts -g +configure:809: checking for flex +configure:848: checking for yywrap in -lfl +configure:867: gcc -o conftest -g -O2 conftest.c -lfl 1>&5 +configure:892: checking for ranlib +configure:927: checking how to run the C preprocessor +configure:948: gcc -E conftest.c >/dev/null 2>conftest.out +configure:1007: checking for ANSI C header files +configure:1020: gcc -E conftest.c >/dev/null 2>conftest.out +configure:1087: gcc -o conftest -g -O2 conftest.c 1>&5 +configure: In function 'main': +configure:1082: warning: incompatible implicit declaration of built-in function 'exit' +configure:1114: checking for sys/time.h +configure:1124: gcc -E conftest.c >/dev/null 2>conftest.out +configure:1114: checking for unistd.h +configure:1124: gcc -E conftest.c >/dev/null 2>conftest.out +configure:1152: checking for working const +configure:1206: gcc -c -g -O2 conftest.c 1>&5 +configure:1227: checking size of long long int +configure:1246: gcc -o conftest -g -O2 conftest.c 1>&5 +configure: In function 'main': +configure:1240: warning: incompatible implicit declaration of built-in function 'exit' +configure:1266: checking size of _Bool +configure:1285: gcc -o conftest -g -O2 conftest.c 1>&5 +configure: In function 'main': +configure:1279: warning: incompatible implicit declaration of built-in function 'exit' +configure:1305: checking whether time.h and sys/time.h may both be included +configure:1319: gcc -c -g -O2 conftest.c 1>&5 +configure:1340: checking for Cygwin environment +configure:1356: gcc -c -g -O2 conftest.c 1>&5 +configure: In function 'main': +configure:1352: error: '__CYGWIN32__' undeclared (first use in this function) +configure:1352: error: (Each undeclared identifier is reported only once +configure:1352: error: for each function it appears in.) +configure: failed program was: +#line 1345 "configure" +#include "confdefs.h" + +int main() { + +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__; +; return 0; } +configure:1373: checking for mingw32 environment +configure:1385: gcc -c -g -O2 conftest.c 1>&5 +configure: In function 'main': +configure:1381: error: '__MINGW32__' undeclared (first use in this function) +configure:1381: error: (Each undeclared identifier is reported only once +configure:1381: error: for each function it appears in.) +configure: failed program was: +#line 1378 "configure" +#include "confdefs.h" + +int main() { +return __MINGW32__; +; return 0; } +configure:1404: checking for executable suffix +configure:1414: gcc -o conftest -g -O2 conftest.c 1>&5 +configure:1435: checking for object suffix +configure:1441: gcc -c -g -O2 conftest.c 1>&5 +configure:1459: checking lex output file root +configure:1480: checking whether yytext is a pointer +configure:1499: gcc -o conftest.exe -g -O2 conftest.c -lfl 1>&5 +configure:1523: checking whether #! works in shell scripts +configure:1545: checking whether yyrestart() is needed +configure:1559: gcc -c -g -O2 conftest.c 1>&5 +In file included from configure:1552: +:3: error: conflicting types for 'yyrestart' +lexyy.c:1064: error: previous definition of 'yyrestart' was here +configure: failed program was: +#line 1551 "configure" +#include "confdefs.h" +#include "lexyy.c" + +int main() { +exit(0); +; return 0; } +configure:1587: checking return type of signal handlers +configure:1609: gcc -c -g -O2 conftest.c 1>&5 +configure:1630: checking for gettimeofday +configure:1658: gcc -o conftest.exe -g -O2 conftest.c 1>&5 +configure:1630: checking for gethrtime +configure:1658: gcc -o conftest.exe -g -O2 conftest.c 1>&5 +c:\djgpp\tmp/ccgmBLT8.o: In function `main': +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/configure:1652: undefined reference to `_gethrtime' +collect2: ld returned 1 exit status +configure: failed program was: +#line 1635 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethrtime(); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethrtime(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethrtime) || defined (__stub___gethrtime) +choke me +#else +gethrtime(); +#endif + +; return 0; } +configure:1630: checking for strdup +configure:1658: gcc -o conftest.exe -g -O2 conftest.c 1>&5 +configure:1630: checking for strtol +configure:1658: gcc -o conftest.exe -g -O2 conftest.c 1>&5 +configure:1630: checking for strtoul +configure:1658: gcc -o conftest.exe -g -O2 conftest.c 1>&5 diff --git a/config.sh b/config.sh index 2657829..04ebb4c 100755 --- a/config.sh +++ b/config.sh @@ -1,326 +1,26 @@ #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for intercal 1.26. -# -# Report bugs to . +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# +# Defaults: +ac_help= ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='intercal' -PACKAGE_TARNAME='intercal' -PACKAGE_VERSION='1.26' -PACKAGE_STRING='intercal 1.26' -PACKAGE_BUGREPORT='esr@thyrsus.com' - -ac_unique_file="src/lose.h" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS YACC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LEX LEXLIB LEX_OUTPUT_ROOT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE CPP EGREP LIBOBJS LTLIBOBJS' -ac_subst_files='' +# Any additions from configure.in: # Initialize some variables set by options. -ac_init_help= -ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -cache_file=/dev/null +build=NONE +cache_file=./config.cache exec_prefix=NONE +host=NONE no_create= +nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -329,15 +29,10 @@ program_transform_name=s,x,x, silent= site= srcdir= +target=NONE verbose= x_includes=NONE x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -351,9 +46,17 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + ac_prev= for ac_option do + # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -361,59 +64,59 @@ do continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; + bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; + ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; + build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; + cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir=$ac_optarg ;; + datadir="$ac_optarg" ;; -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; *) ac_optarg=yes ;; esac - eval "enable_$ac_feature='$ac_optarg'" ;; + eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -422,47 +125,95 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; + exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; -host | --host | --hos | --ho) - ac_prev=host_alias ;; + ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; + host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; + includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; + infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; + libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; + libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -471,19 +222,19 @@ do -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; + localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; + mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) + | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -497,26 +248,26 @@ do -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; + oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; + prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; + program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; + program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -533,7 +284,7 @@ do | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; + program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -543,7 +294,7 @@ do ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; + sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -554,57 +305,58 @@ do | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; + sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site=$ac_optarg ;; + site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; + srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; + sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; + ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; + target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + case "$ac_option" in + *=*) ;; *) ac_optarg=yes ;; esac - eval "with_$ac_package='$ac_optarg'" ;; + eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. @@ -615,110 +367,99 @@ do ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; + x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; + x_libraries="$ac_optarg" ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi -test "$silent" = yes && exec 6>/dev/null +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/abcess.h # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -728,427 +469,13 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures intercal 1.26 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of intercal 1.26:";; - esac - cat <<\_ACEOF - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -intercal configure 1.26 -generated by GNU Autoconf 2.57 - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by intercal $as_me 1.26, which was -generated by GNU Autoconf 2.57. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core core.* *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -1159,793 +486,308 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 + echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi + echo "loading cache $cache_file" + . $cache_file else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + echo "creating cache $cache_file" + > $cache_file fi ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi +PACKAGE_VERSION=0.27 -# Checks for programs. for ac_prog in 'bison -y' byacc do - # Extract the first word of "$ac_prog", so it can be a program name with args. +# Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:534: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" fi -done -done - + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" fi fi -YACC=$ac_cv_prog_YACC +YACC="$ac_cv_prog_YACC" if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 + echo "$ac_t""$YACC" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$ac_t""no" 1>&6 fi - test -n "$YACC" && break +test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:572: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" fi -done -done - + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" fi fi -CC=$ac_cv_prog_CC +CC="$ac_cv_prog_CC" if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + echo "$ac_t""$CC" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:607: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# != 0; then + if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" fi fi fi fi -CC=$ac_cv_prog_CC +CC="$ac_cv_prog_CC" if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + echo "$ac_t""$CC" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$ac_t""no" 1>&6 fi -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:663: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" fi -done -done - + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" fi fi -CC=$ac_cv_prog_CC +CC="$ac_cv_prog_CC" if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + echo "$ac_t""$CC" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$ac_t""no" 1>&6 fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + ;; + esac fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:700: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 711 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi + ac_cv_prog_cc_cross=yes fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:742: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:747: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + ac_cv_prog_gcc=no fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 -ac_compiler_gnu=no +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:775: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no + ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest* + fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS + CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -1959,926 +801,247 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:809: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" fi -done -done - + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + ac_cv_prog_LEX="flex" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi -LEX=$ac_cv_prog_LEX +LEX="$ac_cv_prog_LEX" if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 + echo "$ac_t""$LEX" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$ac_t""no" 1>&6 fi - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - if test -z "$LEXLIB" then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fl_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +echo "configure:848: checking for yywrap in -l$ac_lib" >&5 +ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$ac_lib $LIBS" +cat > conftest.$ac_ext <&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi - -fi - -fi - -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" -cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -cat >>confdefs.h <<\_ACEOF -#define YYTEXT_POINTER 1 -_ACEOF - + builtin and then its argument prototype would still apply. */ +char yywrap(); + +int main() { +yywrap() +; return 0; } +EOF +if { (eval echo configure:867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" fi -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LEXLIB="-l$ac_lib" else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - + echo "$ac_t""no" 1>&6 fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6 fi -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:892: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - eval ac_cv_prog_make_${ac_make}_set=no + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_test_flag="-f" + if ! test -z "$COMSPEC$ComSpec"; then + ac_test_flag="-x" + IFS="${PATH_SEPARATOR-;}" + fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_test_flag $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi -rm -f conftest.make fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" + echo "$ac_t""no" 1>&6 fi -# Checks for libraries. -# Checks for header files. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:927: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then : else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then : else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes +rm -f conftest* fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break +rm -f conftest* fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +rm -f conftest* + ac_cv_prog_CPP="$CPP" fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + CPP="$ac_cv_prog_CPP" else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi + ac_cv_prog_CPP="$CPP" fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - +echo "$ac_t""$CPP" 1>&6 -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1007: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + cat > conftest.$ac_ext < #include #include #include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +cat > conftest.$ac_ext < - -_ACEOF +EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then + egrep "memchr" >/dev/null 2>&1; then : else + rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2887,20 +1050,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +cat > conftest.$ac_ext < - -_ACEOF +EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then + egrep "free" >/dev/null 2>&1; then : else + rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2909,1032 +1068,532 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then +if test "$cross_compiling" = yes; then : else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + cat > conftest.$ac_ext < -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then : else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -fr conftest* fi + fi fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 -_ACEOF +EOF fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h +for ac_hdr in sys/time.h unistd.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1114: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest* fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 fi - done +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1152: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} - - - - -for ac_header in memory.h stddef.h stdlib.h string.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes +; return 0; } +EOF +if { (eval echo configure:1206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" +rm -f conftest* fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF fi -done - - -# Checks for typedefs, structures, and compiler characteristics. -echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 -if test "${ac_cv_header_stdbool_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo $ac_n "checking size of long long int""... $ac_c" 1>&6 +echo "configure:1227: checking size of long long int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#ifndef bool -# error bool is not defined -#endif -#ifndef false -# error false is not defined -#endif -#if false -# error false is not 0 -#endif -#ifndef true -# error true is not defined -#endif -#if true != 1 -# error true is not 1 -#endif -#ifndef __bool_true_false_are_defined -# error __bool_true_false_are_defined is not defined -#endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) -0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) -0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - -int -main () -{ - return !a + !b + !c + !d + !e + !f + !g + !h + !i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdbool_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdbool_h=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 -echo "$as_me:$LINENO: checking for _Bool" >&5 -echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 -if test "${ac_cv_type__Bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + ac_cv_sizeof_long_long_int=0 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () + cat > conftest.$ac_ext < +main() { -if ((_Bool *) 0) - return 0; -if (sizeof (_Bool)) - return 0; - ; - return 0; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long long int)); + exit(0); } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type__Bool=yes +EOF +if { (eval echo configure:1246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_long_int=`cat conftestval` else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type__Bool=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_long_int=0 fi -echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -echo "${ECHO_T}$ac_cv_type__Bool" >&6 -if test $ac_cv_type__Bool = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF - - +rm -fr conftest* fi -if test $ac_cv_header_stdbool_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDBOOL_H 1 -_ACEOF - fi +echo "$ac_t""$ac_cv_sizeof_long_long_int" 1>&6 +cat >> confdefs.h <&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes +echo $ac_n "checking size of _Bool""... $ac_c" 1>&6 +echo "configure:1266: checking size of _Bool" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof__Bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + ac_cv_sizeof__Bool=0 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () + cat > conftest.$ac_ext < +main() { -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(_Bool)); + exit(0); } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes +EOF +if { (eval echo configure:1285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof__Bool=`cat conftestval` else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof__Bool=0 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -fr conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF - -fi - -# Checks for library functions. - -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +echo "$ac_t""$ac_cv_sizeof__Bool" 1>&6 +cat >> confdefs.h <&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1305: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - eval "$as_ac_Header=$ac_header_preproc" + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - +rm -f conftest* fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF -done +fi -echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1340: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif + cat > conftest.$ac_ext <&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +int main() { -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__; +; return 0; } +EOF +if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no fi +rm -f conftest* +rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 -if test $ac_cv_func_malloc_0_nonnull = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1373: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi - LIBOBJS="$LIBOBJS malloc.$ac_objext" +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc -_ACEOF +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1404: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi fi +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:1435: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:1441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo $ac_n "checking lex output file root""... $ac_c" 1>&6 +echo "configure:1459: checking lex output file root" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no + { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + +echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 +echo "configure:1480: checking whether yytext is a pointer" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS="$LIBS" +LIBS="$LIBS $LEXLIB" +cat > conftest.$ac_ext <&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +; return 0; } +EOF +if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_prog_lex_yytext_pointer=yes else - eval "$as_ac_Header=$ac_header_preproc" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +rm -f conftest* +LIBS="$ac_save_LIBS" +rm -f "${LEX_OUTPUT_ROOT}.c" fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi +echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + cat >> confdefs.h <<\EOF +#define YYTEXT_POINTER 1 +EOF -done +fi -echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 -echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 -if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_realloc_0_nonnull=no +# Pull the hash mark out of the macro call to avoid m4 problems. +ac_msg="whether #! works in shell scripts" +echo $ac_n "checking $ac_msg""... $ac_c" 1>&6 +echo "configure:1523: checking $ac_msg" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_interpreter'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif - -int -main () -{ -exit (realloc (0, 0) ? 0 : 1); - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_realloc_0_nonnull=yes + echo '#! /bin/cat +exit 69 +' > conftest +chmod u+x conftest +(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) +if test $? -ne 69; then + ac_cv_sys_interpreter=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_realloc_0_nonnull=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_interpreter=no fi +rm -f conftest fi -echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 -if test $ac_cv_func_realloc_0_nonnull = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 1 -_ACEOF +echo "$ac_t""$ac_cv_sys_interpreter" 1>&6 +interpval="$ac_cv_sys_interpreter" -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 0 -_ACEOF - LIBOBJS="$LIBOBJS realloc.$ac_objext" +echo $ac_n "checking whether yyrestart() is needed""... $ac_c" 1>&6 +echo "configure:1545: checking whether yyrestart() is needed" >&5 +# Write a lex program that will cause an error if yyrestart exists. +echo '%% +%% +float yyrestart(int, ...);' | $LEX +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""no" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define NEED_YYRESTART 1 +EOF + +echo "$ac_t""yes" 1>&6 +fi +rm -f conftest* +rm -f ${LEX_OUTPUT_ROOT}.c -cat >>confdefs.h <<\_ACEOF -#define realloc rpl_realloc -_ACEOF +if test "$interpval" != "no"; then +cat >> confdefs.h <<\EOF +#define HAVE_SYS_INTERPRETER 1 +EOF fi +cat >> confdefs.h <&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1587: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + cat > conftest.$ac_ext < #include #ifdef signal -# undef signal +#undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -3942,1021 +1601,439 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -int -main () -{ +int main() { int i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +; return 0; } +EOF +if { (eval echo configure:1609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* ac_cv_type_signal=void else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_signal=int + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6 -cat >>confdefs.h <<_ACEOF +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1630: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $ac_func(); below. */ +#include /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} +$ac_func(); #endif -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" +; return 0; } +EOF +if { (eval echo configure:1658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest* fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 fi done -{ echo "$as_me:$LINENO: Version is $PACKAGE_VERSION" >&5 -echo "$as_me: Version is $PACKAGE_VERSION" >&6;} - ac_config_files="$ac_config_files Makefile ickspec" -cat >confcache <<\_ACEOF + + +trap '' 1 2 15 +cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. # -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - +EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file + echo "updating cache $cache_file" + cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 +DEFS=-DHAVE_CONFIG_H +# Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# # Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' +# configure, is in ./config.log if it exists. -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac done -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi +ac_given_srcdir=$srcdir -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi +trap 'rm -fr `echo "Makefile temp/coopt.sh:src/cooptsh.in temp/config.h:src/configh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@YACC@%$YACC%g +s%@CC@%$CC%g +s%@LEX@%$LEX%g +s%@LEXLIB@%$LEXLIB%g +s%@RANLIB@%$RANLIB%g +s%@CPP@%$CPP%g +s%@EXEEXT@%$EXEEXT%g +s%@OBJEXT@%$OBJEXT%g +s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +s%@PACKAGE_VERSION@%$PACKAGE_VERSION%g -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else - PATH_SEPARATOR=: + sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file else - as_ln_s='ln -s' + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by intercal $as_me 1.26, which was -generated by GNU Autoconf 2.57. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi +EOF -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -intercal config.status 1.26 -configured by $0, generated by GNU Autoconf 2.57, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; +CONFIG_FILES=\${CONFIG_FILES-"Makefile temp/coopt.sh:src/cooptsh.in"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; esac - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - *) ac_config_targets="$ac_config_targets $1" ;; + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "ickspec" ) CONFIG_FILES="$CONFIG_FILES ickspec" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. # - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@YACC@,$YACC,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@LN_S@,$LN_S,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; esac - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h else - cat $tmp/out - rm -f $tmp/out + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file fi +fi; done -done -_ACEOF +EOF +cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\_ACEOF +EOF +cat >> $CONFIG_STATUS <<\EOF -{ (exit 0); exit 0; } -_ACEOF +exit 0 +EOF chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/config.status b/config.status new file mode 100755 index 0000000..5c8efdd --- /dev/null +++ b/config.status @@ -0,0 +1,284 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host : +# +# config.sh +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} config.sh --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} config.sh --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. + +trap 'rm -fr Makefile temp/coopt.sh temp/config.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@SHELL@%/dev/env/DJDIR/bin/sh.exe%g +s%@CFLAGS@%-g -O2%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@FFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/dev/env/DJDIR%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@YACC@%bison -y%g +s%@CC@%gcc%g +s%@LEX@%flex%g +s%@LEXLIB@%-lfl%g +s%@RANLIB@%ranlib%g +s%@CPP@%gcc -E%g +s%@EXEEXT@%.exe%g +s%@OBJEXT@%o%g +s%@LEX_OUTPUT_ROOT@%lexyy%g +s%@PACKAGE_VERSION@%0.27%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile temp/coopt.sh:src/cooptsh.in"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="temp/config.h:src/configh.in" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 diff --git a/districk.bat b/districk.bat index 87103a2..787cab1 100755 --- a/districk.bat +++ b/districk.bat @@ -3,7 +3,9 @@ rem This batch file removes all files that weren't in the distribution. ren temp\parser.c parser.tmp ren temp\parser.h parserh.tmp ren temp\lexer.c lexer.tmp +ren temp\oil.c oil.tmp call cleanick ren temp\parser.tmp parser.c ren temp\parserh.tmp parser.h ren temp\lexer.tmp lexer.c +ren temp\oil.tmp oil.c \ No newline at end of file diff --git a/districk.sh b/districk.sh index 7df8992..f302375 100755 --- a/districk.sh +++ b/districk.sh @@ -5,7 +5,9 @@ mv temp/parser.c temp/parser.tmp mv temp/parser.h temp/parserh.tmp mv temp/lexer.c temp/lexer.tmp +mv temp/oil.c temp/oil.tmp sh cleanick.sh mv temp/parser.tmp temp/parser.c mv temp/parserh.tmp temp/parser.h mv temp/lexer.tmp temp/lexer.c +mv temp/oil.tmp temp/oil.c \ No newline at end of file diff --git a/doc/Makefile b/doc/Makefile index 6621a54..bb7e830 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,9 +2,14 @@ # Makefile for the Intercal documentation # +# Making the original manual: # To see the Revised Manual, generate intercal.txt or intercal.ps # To see the original INTERCAL-72 manual, generate original.txt or original.ps. +# Making the Revamped Manual: +# generate ick.inf, ickhtml (will be placed into a directory), +# ick.htm (all in one file), or ick.txt. + # We make two passes in order to resolve SETR/GETNH references. # The sed hackery strips the trailing dots from level 1 section references. @@ -12,7 +17,11 @@ x.txt: x.mm groff -dc=y -Tascii -p -t -mm x.mm >x.txt -all: intercal.ps intercal.txt original.ps original.txt +all: allorig allnew + +allorig: intercal.ps intercal.txt original.ps original.txt + +allnew: ick.inf ickhtml ick.htm ick.txt intercal.ps: intercal.mm groff -dc=y -Tps -p -t -mm intercal.mm >/dev/null @@ -43,5 +52,32 @@ original.txt: intercal.mm rm intercal.refs.qrf clean: - rm -f *.ps *.txt *.refs* + rm -f *.ps *.txt *.refs* ick.info ick.txt + rm -rf html + +ick.inf: ick.txi gpl-2-0.txi fdl-1-2.txi + -makeinfo --force -o ick.inf ick.txi + +# The --css-include is skipped here because it seems to cause makeinfo +# to leak open file space, and it fails with an EMFILE error. Instead, +# fix83.pl (which changes filenames to 8.3 format, among other things) +# is used to add the styling. +ickhtml: ick.txi ickstyle.css gpl-2-0.txi fdl-1-2.txi + rm -rf html + -makeinfo --force --html -o html ick.txi + ls -1 html | perl -w fix83.pl | sh + perl -i.tmp -w fix83.pl html/*.htm + rm html/*.tmp + +# fixtoc.pl is used here to reformat the TOC to look good under the +# multiple-part system (which makeinfo doesn't really know about). +ick.htm: ick.txi ickstyle.css gpl-2-0.txi fdl-1-2.txi + -makeinfo --force --html --no-split --no-header --css-include=ickstyle.css -D notsplit -o ick.htm ick.txi + -perl -i.tmp -w fixtoc.pl ick.htm + rm ick*.tmp + chmod u+w ick.htm +# For some reason, ick.htm comes out of this readonly sometimes, which +# is why the chmod seems to be needed. No idea why, though. +ick.txt: ick.txi gpl-2-0.txi fdl-1-2.txi + -makeinfo --force --plaintext -D notsplit -o ick.txt ick.txi diff --git a/doc/READ.ME b/doc/READ.ME index 2fc871c..0a53649 100644 --- a/doc/READ.ME +++ b/doc/READ.ME @@ -14,6 +14,10 @@ THEORY chip.spec: Christian Brunschen's spec sheet for the INTERCAL chip. +ick.txi: + Master for the Revamped reference manual, a newer manual + independent of the old one. + Note 1: The TeX version we formerly distributed has been dropped. The combination of groff and pic does an effective job of rendering the illustrations and is easier to maintain. @@ -33,4 +37,8 @@ of Princeton compiler options has all marks above each description, rather than to its left. The aim of these changes was to reduce to one the number of manual masters that -need to be maintained. +need to be maintained for the original manual, which can both produce the +original INTERCAL-72 manual and the revised version that existed up to about +version 0.18. The revised version proved to be unportable and impractical; it's +still worth a read, but for up-to-date information available in a range of +formats it's worth reading the Revamped manual instead. \ No newline at end of file diff --git a/doc/THEORY b/doc/THEORY.txt similarity index 100% rename from doc/THEORY rename to doc/THEORY.txt diff --git a/doc/chip.spec b/doc/chipspec.txt similarity index 100% rename from doc/chip.spec rename to doc/chipspec.txt diff --git a/doc/fdl-1-2.txi b/doc/fdl-1-2.txi new file mode 100644 index 0000000..7b93651 --- /dev/null +++ b/doc/fdl-1-2.txi @@ -0,0 +1,451 @@ +@c The GNU Free Documentation License. +@center Version 1.2, November 2002 + +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@heading ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with@dots{}Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/doc/fix83.pl b/doc/fix83.pl new file mode 100755 index 0000000..fdf774f --- /dev/null +++ b/doc/fix83.pl @@ -0,0 +1,70 @@ +#!/bin/perl + +# Change .html to .htm and change all URLs appropriately in the file +# being edited; also fix a bug in makeinfo that sometimes causes +# incorrect anchors to be used in the META REFRESH commands. +# +# This script assumes the output from makeinfo is reasonably correct, so it +# needs to be run on a system that supports filenames longer than 8.3; it +# converts these long filenames into 8.3 form. + +my @base32str=qw{0 1 2 3 4 5 6 7 8 9 a b c d e f + g h i j k l m n o p q r s t u v}; + +# Hash a string into 8 5-bit segments, base32 encoded +# The algorithm isn't designed to be secure or anything like that, but simply +# to avoid collisions in what filenames are mapped to. I don't know how well +# it succeeds at this. Note that this can't map to "index" unless the input +# is "index", in which case it always does; this is a special case. The +# hashing is case-insensitive to reduce errors on DOS. +sub hash8x5($) +{ + my $low32sf=0; + my $high32sf=0; + my $str=shift; + $str=lc $str; + defined($str) or die; + return "index" if $str eq "index"; + while($str ne '') + { + $low32sf ^= !!($low32sf & (1<<19)); + $low32sf &= (1<<19)-1; + $low32sf <<= 1; + $low32sf ^= ord $str; + $low32sf *= 41; + $high32sf ^= !!($high32sf & (511<<11)); + $high32sf &= (1<<11)-1; + $high32sf <<= 9; + $high32sf ^= ord $str; + $high32sf *= 43; + $str = substr $str, 1; + } + $str = $base32str[$low32sf & 31]; $low32sf >>= 5; + $str .= $base32str[$low32sf & 31]; $low32sf >>= 5; + $str .= $base32str[$low32sf & 31]; $low32sf >>= 5; + $str .= $base32str[$low32sf & 31]; + $str .= $base32str[$high32sf & 31]; $high32sf >>= 5; + $str .= $base32str[$high32sf & 31]; $high32sf >>= 5; + $str .= $base32str[$high32sf & 31]; $high32sf >>= 5; + $str .= $base32str[$high32sf & 31]; + return $str; +} + +$/=undef; #read the whole file at a time + +open CSSFILE, "; +close CSSFILE; + +while(<>) +{ + /^]*?).html([\"\#])/$1 . hash8x5($2) . ".htm" . $3/ge; + }; + s/(\-\-><\/style>)/$css$1/; + s/(href=\")([^\">]*?).html([\"\#])/$1 . hash8x5($2) . ".htm" . $3/ge; + s=^(.*?)\.html$="mv html/".$1.".html html/".hash8x5($1).".htm"=gemi; + print; +} diff --git a/doc/fixtoc.pl b/doc/fixtoc.pl new file mode 100755 index 0000000..51ef879 --- /dev/null +++ b/doc/fixtoc.pl @@ -0,0 +1,17 @@ +#!/bin/perl -w + +# Deindent and delink part headings in the TOC, and remove the initial +# H2 entry. + +my $f=1; +my $g=1; + +while(<>) +{ + $f and /
    / and do{$f=0; next;}; + /^
  • ]*>C-INTERCAL / and next; + s%^
  • ]*>(PART .*?)%($g?($g=0,''):"
")."

$1

    "%e; + last if $_ eq "\n"; + print; +} +while(<>) {print;} diff --git a/doc/gpl-2-0.txi b/doc/gpl-2-0.txi new file mode 100644 index 0000000..8391c38 --- /dev/null +++ b/doc/gpl-2-0.txi @@ -0,0 +1,389 @@ +@c The GNU General Public License. +@center Version 2, June 1991 + +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. + +@display +Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@heading Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software---to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + +@heading TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +@enumerate 0 +@item +This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The ``Program'', below, +refers to any such program or work, and a ``work based on the Program'' +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term ``modification''.) Each licensee is addressed as ``you''. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +@item +You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +@item +You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +@enumerate a +@item +You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +@item +You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +@item +If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) +@end enumerate + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +@item +You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +@enumerate a +@item +Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +@item +Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +@item +Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) +@end enumerate + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +@item +You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +@item +Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +@item +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +@item +If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +@item +The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and ``any +later version'', you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +@item +If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +@iftex +@heading NO WARRANTY +@end iftex +@ifinfo +@center NO WARRANTY + +@end ifinfo + +@item +BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +@item +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. +@end enumerate + +@iftex +@heading END OF TERMS AND CONDITIONS +@end iftex +@ifinfo +@center END OF TERMS AND CONDITIONS + +@end ifinfo + +@page +@heading Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the ``copyright'' line and a pointer to where the full notice is found. + +@smallexample +@var{one line to give the program's name and a brief idea of what it does.} +Copyright (C) @var{yyyy} @var{name of author} + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +@end smallexample + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +@smallexample +Gnomovision version 69, Copyright (C) @var{year} @var{name of author} +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. +@end smallexample + +The hypothetical commands @samp{show w} and @samp{show c} should show +the appropriate parts of the General Public License. Of course, the +commands you use may be called something other than @samp{show w} and +@samp{show c}; they could even be mouse-clicks or menu items---whatever +suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a ``copyright disclaimer'' for the program, if +necessary. Here is a sample; alter the names: + +@example +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +@var{signature of Ty Coon}, 1 April 1989 +Ty Coon, President of Vice +@end example + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/doc/ick.txi b/doc/ick.txi new file mode 100644 index 0000000..f37544e --- /dev/null +++ b/doc/ick.txi @@ -0,0 +1,3465 @@ +\input texinfo @c -*- texinfo -*- +@c %**start of header +@setfilename ick.info +@set VERSION 0.27 +@set VERSIONDASH 0-27 +@settitle C-INTERCAL @value{VERSION} Revamped Instruction Manual +@paragraphindent 0 +@documentlanguage en +@documentencoding ISO-8859-1 + +@c Command line option index. +@defcodeindex op +@c Error index +@defindex er +@c Commands and language features are in the predefined fnindex. +@c Things generally are in the predefined cpindex. + +@c Combining indices. +@syncodeindex fn cp +@syncodeindex op cp +@synindex er cp + +@c Adding to the main documentation tree. +@dircategory INTERCAL compilers +@direntry +* C-INTERCAL: (ick). The C-INTERCAL language and compiler. +* ick: (ick) Invoking ick. Invoking the C-INTERCAL compiler. +@end direntry + +@c Some macros to ease writing and updating. (The VERSION is set above because +@c it's needed to set the title.) +@macro cic{} +@abbr{C-INTERCAL} +@end macro +@macro clcic{} +@abbr{CLC-INTERCAL} +@end macro +@macro icst{} +@abbr{INTERCAL-72} +@end macro +@macro ical{} +@acronym{INTERCAL} +@end macro + +@c Part headings for unsplit output +@macro partheading{arg} +@html +

    \arg\

    +@end html +@c +@end macro + +@c 'Portability' boxes +@macro portability{st,c,clc} +@multitable @columnfractions .25 .25 .25 +@headitem @icst{} @tab @cic{} @tab @clcic{} +@item \st\ @tab \c\ @tab \clc\ +@end multitable +@c +@end macro + +@c Generating items and anchors together is also helpful. +@macro ianchor{arg} +@item \arg\ +@anchor{\arg\} +@c +@end macro +@macro ianchorc{arg} +@item \arg\ +@anchor{\arg\+} +@c +@end macro +@macro ieanchor{arg} +@item \arg\ +@anchor{\arg\} +@erindex \arg\ +@c +@end macro +@macro ianchorpm{arg} +@item +\arg\ +@itemx -\arg\ +@anchor{+\arg\} +@anchor{-\arg\} +@c +@end macro + +@c Some fixes for HTML. +@ifhtml +@c Examples are styled in CSS; don't do it with hardcoded whitespace! +@exampleindent 0 +@end ifhtml +@c %**end of header + +@copying +This manual is for @cic{} version @value{VERSION}. It does not replace +the old groff manual, nor is it designed to be read in conjunction with +it; instead, it serves a different purpose, of providing information +useful to users of @cic{} (unlike the other manual, it is not derived +from the original @icst{} manual). + +Copyright @copyright{} 2007 Alex Smith. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'', with no +Front-Cover Texts, and with no Back-Cover Texts. A copy of the license +is included in the section entitled ``GNU Free Documentation License.'' + +As a special exception, you may create a Modified Version of this +document (with the definition of ``Modified Version'' given in the GNU +Free Documentation License) in which the Invariant Section ``GNU General +Public License'' has been deleted entirely, as long as all of that +license is complied with apart from the requirement to preserve that +Invariant Section. (This means that that section must be either +entirely preserved or entirely deleted in any copies or Modified +Versions of this document.) +@end quotation +@end copying + +@titlepage +@ifset notsplit +@title C-INTERCAL Revamped Instruction Manual +@subtitle (this version distributed with version @value{VERSION} of C-INTERCAL) + +@page +@vskip 0pt plus 1filll +@insertcopying + +@end ifset +@end titlepage + +@ifset notsplit +@contents +@end ifset + +@ifnottex +@node Top +@top C-INTERCAL @value{VERSION} + +@insertcopying + +@menu + +The @cic{} compiler +* Installation:: How to install @cic{} @value{VERSION} +* Invoking ick:: Options to give to the compiler ick +* Errors and Warnings:: Error messages, and what to do about them +* The yuk debugger:: How to use the runtime debugger + +Basic @ical{} features +* Syntax:: Holding statements together +* Expressions:: Operators, operands, and grouping +* Statements:: What an @ical{} statement can do + +@ical{} dialects and extensions +* TriINTERCAL:: @ical{} in non-binary bases +* Multithreading and Backtracking:: Running @ical{} programs in parallel +* Operand Overloading:: Where one expression stands for another +* PIC-INTERCAL:: @ical{} on embedded systems +* Differences to Other Compilers:: @cic{} vs. @clcic{} + +Appendices and indices +* Optimizer Idiom Language:: The syntax to specify optimizer idioms +* Copying:: License information for the code and manual +* Main Index:: An index of all the pages in this manual + +@end menu +@end ifnottex +@ifset notsplit +@partheading PART I: THE @cic{} COMPILER +@end ifset +@node Installation +@chapter Installation +@cindex installation +@cindex @command{ick}, installing + +The @cic{} distribution is distributed in source code form; this means +that before using it, you first have to compile it. Don't worry: if you +have the right software, it's not at all difficult. Most Linux-based +and UNIX-based computers are likely to have the software needed already; +the software needed to compile source-distributed packages is also +readily available for free for other operating systems. The following +instructions will help you install the distribution in a method +appropriate for your system. + +@menu +* Obtaining:: How to get a @cic{} distribution to install +* Unpacking:: What to do with the distribution file +* Simple Installation:: Normally you can just do things the easy way +* DOS/Windows Install:: For users of DOS or of Microsoft Windows +* Not Installing:: You can use the software without installing it +* Uninstalling:: If you don't want to use the software +* Reporting Bugs:: If it doesn't work or you know how to fix it +* Distributing:: How to make your own @cic{} distribution +@end menu + +@node Obtaining +@section Obtaining +@cindex obtaining C-INTERCAL +@cindex C-INTERCAL, obtaining a copy + +@cic{} distributions have been stored in many different places over +time; it can sometimes be hard to make sure that you are finding the +most recent version. In order to make sure that you have the most +recent version, the easiest way is to look at the +@uref{news:alt.lang.intercal,,alt.lang.intercal newsgroup}; all releases +of the @cic{} compiler ought to be announced there. (If you are +interested in what other @ical{} compilers are available, it may also be +worth looking there.) If you don't have access to a newsreader, your +newsreader doesn't cover that newsgroup, or the distance between +releases has been too large for your news server to keep the message, +it's likely that you can find the announcement in an archive on the +World Wide Web; at the time of writing (2007), the archives of the +newsgroup are stored by @uref{http://groups.google.com,Google Groups}, +and a search for @samp{alt.lang.intercal} there should tell you where to +find a copy. + +If you're looking for the latest version, note that the number after the +dot represents the major version number; you want to maximise this in +favour of the number before the dot, which is the bugfix level within a +major version. (Major versions are released as version 0.whatever; if a +new version comes out that fixes bugs but adds no new features, nowadays +its number will be of the form 1.whatever, with the same major number. +This has not always been the case, though.) + +@node Unpacking +@section Unpacking +@cindex C-INTERCAL, unzipping +@cindex C-INTERCAL, unpacking +@cindex unzipping C-INTERCAL +@cindex unpacking C-INTERCAL +@cindex ick-@value{VERSIONDASH}.tgz + +The distribution is likely to be a single file with extension +@samp{.tgz}; this refers to a gzipped tar file. Most computer systems +can extract files in this format (nowadays even many computers running +Windows have the appropriate software). + +It doesn't matter where you extract the distribution file to: it's best +if you don't put it anywhere special. If you aren't an administrator, +you should extract the file to somewhere in your home directory (Linux +or UNIX-like systems) or to your My Documents directory (recent versions +of Windows; if you're using an older version, then you @emph{are} an +administrator, or at least have the same privileges, and can extract it +anywhere). Some commands that you might use to extract it: + +@table @asis + +@item Generic UNIX/Linux + +@example +gunzip ick-@value{VERSIONDASH}.tgz +tar xvf ick-@value{VERSIONDASH}.tar +@end example + +On most UNIX-based and Linux-based systems, @command{tar} will be +available to unpack the installation files once they've been +uncompressed with @command{gunzip}. @command{gunzip} is also likely to +be available; if it isn't, you will need to download a copy from the +Internet. + +@item Using GNU tar + +@example +tar xzvf ick-@value{VERSIONDASH}.tgz +@end example + +If you are using the GNU version of @command{tar} (which is very likely +on Linux), you can combine the two steps into one as shown here. + +@item Using DJGPP + +@example +djtar -x ick-@value{VERSIONDASH}.tgz +@end example + +On a DOS or Windows system, you will have to install DJGPP anyway to be +able to compile the distribution (@pxref{DOS/Windows Install}), and once +you've done that you will be able to use DJGPP's decompressing and +unpacking utility to extract the files needed to install the +distribution. (You will need to type this at the command line; on +Windows 95 and later, try choosing Run...@: from the start menu then +typing @command{cmd} (or @command{command} if that fails) in the dialog +box that opens to get a command prompt, which you can exit by typing +@command{exit}. After typing any command at a command line, press +@key{RET} to tell the shell to execute that command.) + +@item On Windows + +If you're running a Windows system, you could always try double-clicking +on the ick-@value{VERSIONDASH}.tgz file. It's quite possible that +you'll have a program installed that's capable of decompressing and +unpacking it. Unfortunately, I can't guess what program that might be, +so I can't give you any instructions for using it. + +@end table + +Whatever method you use, you should end up with a directory created +called @file{ick-@value{VERSION}}; this is your main installation +directory where all the processing done by the installation will be +carried out. You will need to have that directory as the current +directory during install (at the command prompt in all the operating +systems I know, you can set the current directory by typing @command{cd +ick-@value{VERSION}}). + +@node Simple Installation +@section Simple Installation +@cindex installation, simple +@cindex simple installation +@findex config.sh +@findex make +@findex make install +@cindex compiling, @command{ick} itself +@cindex installation, via autoconf and make +@cindex configuring + +There are scripts included in the distribution to automate the process +of installing, in various ways. The simplest method of installing is to +use the following routine: + +@enumerate + +@item +Configure @cic{}, by typing @command{sh config.sh} + +@item +Compile the source code, with the command @command{make} + +@item +Install the executables and libraries, using @command{make install} + +@end enumerate + +On all systems, it's worth just trying this to see if it works. This +requires a lot of software on your computer to work, but all of it is +standard on Linux and UNIX systems. The first command is a shell-script +which will analyse your system and set settings accordingly; it will +explain what it's doing and what settings it detected, and create +several files in the installation directory to record its results. +(This is a configure script produced by the DJGPP version of GNU +autoconf; its autoconf source code is available in the file +@file{config.in}.) The second command actually compiles the source code +to produce binaries; this takes the longest of any of the steps. You +will see all the commands that it's running as it runs them. (The most +time-consuming one is the compilation of @file{idiotism.c}, by the way; +be prepared for this to take longer than the other compilations.) The +third command will copy the files it's compiled to appropriate shared +locations on your system so that anyone on the system can just use +@command{ick}. + +There may be various factors that prevent this simple installation +method working. On a system not based on UNIX or Linux, you may find +that you don't have some of the software required to run this (for +instance, you may be missing the shell @command{sh}, and don't have the +shell @command{bash} which can emulate it, and so can't run @command{sh +config.sh} that depends on one of those shells being available) and so +this method won't work for you. In such cases, one solution may be to +install all the software required; the GNU project has a version of all +the commands required, for instance, and there may be ports available +for your operating system. However, the only software absolutely +required is a C compiler (@cic{} was designed to work with @command{gcc} +and has only been tested in combination with that compiler, but in +theory it should be possible to adapt it to work with other compilers) +and the associated software needed to compile C files to object files +and executables, combine object files into libraries, etc. + +Another possiblity that might stop this process working is if your +version of the relevant software is incompatible with the GNU versions +that were used for testing. For instance, I have come across +proprietary versions of @command{lex} that need directives in the source +file to say in advance how much memory the lexer-generator needs to +allocate. In such cases, pay attention to the error messages you're +getting; normally they will suggest trivial modifications to the source +files that will cause the compilation to work again. + +If you're trying to do something unusual, you probably want to set some +of the settings yourself rather than letting the compilation process +guess everything. In this case, use @command{sh config.sh --help} to +view the options that you can set on @command{config.sh}; there's a wide +range of settings that you can set available there, and one of them may +be what you want. For the special case of a non-administrator user who +wants to test the @cic{} compiler without having admin rights, or +equivalently any user who wants to test the compiler without installing +it, see @ref{Not Installing}. + +@node DOS/Windows Install +@section DOS/Windows Install +@cindex installation, on DOS or Windows +@cindex DOS +@cindex Windows +@cindex DJGPP +@findex makeick.sh +@findex makeick.bat + +On DOS and Windows, it's possible to install @cic{} by using the C +compiler and utilities provided by DJGPP. (Possibly other environments +also work, but DJGPP is the only C compilation system on which recent +versions of @cic{} have been tested.) If you don't have a copy of DJGPP, +or you're not sure whether you have the most recent version, visit +@uref{http://www.delorie.com/djgpp}. I think it's possible to compile +@cic{} to binaries from only the files in the distribution and the C +compilation parts of DJGPP, but this relies on some prebuilt files +enclosed in the distribution, and I haven't actually tested this, so I +might be wrong. At the other extreme, if you download and install not +only the DJGPP C compiler but also all the DJGPP ports of the GNU +utilities required to run @command{config.sh} and @command{make}, you +can use the simple installation method; see @ref{Simple Installation}. +(This is actually somewhat recommended; doing this will not only allow +you to change source code, recompile, and be guaranteed to have your +changes to the source code affect the executables, and allow you to +install @cic{} without having to fiddle around with the @samp{PATH} +environment variable, but also you may then be able to install other +programs distributed in source form without further hassle.) + +Assuming that you decide not to download all the utilites required to +carry out a simple install, follow the following instructions to compile +and install the @cic{} compiler: + +@enumerate + +@item +If you haven't already installed DJGPP, do that now, following the +instructions given there. + +@item +Open a command prompt if you aren't at one already, unpack the +distribution if you haven't already, and change directory to the main +installation directory (@pxref{Unpacking}). + +@item +Run one of two commands included in the distribution especially for +installing @cic{} under DJGPP. Which one you run depends on the shell +you're using: if you're running under one of the DOS/Windows shells +(@command{cmd.exe} or @command{command.com}), type +@command{makeick.bat}, and if you're running under a port of a UNIX or +Linux shell (such as @command{bash}), type @command{makeick.sh}. + +@item +The distribution should now have been compiled, but it still needs to be +installed. To do this, you will need to edit your @samp{PATH} +environment variable. Under DOS and earlier versions of Windows, you +can do this by editing @file{C:\autoexec.bat}; look for the last command +that sets the @samp{PATH} environment variable (i.@:e.@: that starts +with @samp{set PATH=}), and add another semicolon and the @file{bin} +subdirectory of your main installation directory to it (for instance, if +your installation directory is +@file{C:\stuff\intercal\ick-@value{VERSION}}, you want to add +@samp{;C:\stuff\intercal\ick-@value{VERSION}\bin} to the end of that +line). Under later versions of Windows, this won't work (I'm not sure +exactly where the cutoff is, but I know the other method doesn't work on +Windows XP); instead, go via the Start menu to Settings, Control Panel, +System, Advanced, Environment Variables, and edit either your own or the +system-wide PATH setting (depending on whether you want to install for +yourself or for everyone) to end with the @file{bin} subdirectory of the +main installation directory, the same way as for older versions of +Windows. + +@end enumerate + +To test that the @samp{PATH} setting is set correctly, try changing to +an unrelated directory (for instance, by typing @command{cd \} at a +command prompt), and typing @command{ick -@@}; if you get a usage +message for @command{ick}, then you've set the @samp{PATH} setting +correctly. Note that if things go wrong during compilation, other than +errors about inability to find @command{flex} or @command{bison} (the +compilation process can succeed despite either of these errors), it's +likely that you've messed up your DJGPP installation (maybe by setting +the @samp{PATH} or @samp{DJDIR} environment variables incorrectly for +it). + +@node Not Installing +@section Not Installing +@cindex @command{ick}, using without installation +@cindex @command{ick}, not installating +@cindex trying out @command{ick} +@cindex not installing +@cindex non-root installation +@cindex installation, non-root +@cindex live CD/USB stick +@cindex making a live CD/USB stick + +You don't have to install @cic{} to be able to use it; you can instead +stop any of the other install techniques just after compiling the source +code, before the installation step. (This may be useful if you just +want to try out @cic{}, or if you aren't a root/admin user and therefore +don't have the permissions to install things.) When @cic{} hasn't been +installed, @command{ick} won't be able to find the files it looks for in +the places that they ought to have been installed, so it will look in a +variety of places they might be instead (the installation directory, if +it can figure out where it is; the same directory as the binary; the +current directory). In order for this to work, just don't move any of +the files that were compiled anywhere else. + +Of course, if you haven't installed the compiler, just typing +@command{ick} is unlikely to work, because your computer won't know what +you mean. Instead, you should give a pathname (absolute or relative) to +where @command{ick} is, so that your computer can find it. With any +luck, your computer will communicate the pathname you used to +@command{ick} itself, and if that happens @command{ick} will use it to +figure out where the main installation directory is, and find the files +it needs that way. If you suspect that errors you are getting are due +to inability to find files (such as E127 (@pxref{E127}) or E999 +(@pxref{E999})), try giving the @option{-u} (@pxref{-u}) option to +@command{ick} to see where it's looking. + +You can make a `live' CD or USB-stick version of @cic{} using similar +methods; configure (if possible) and compile it, but instead of +installing it, copy the entire @file{@value{VERSION}} directory to the +CD or USB stick. @ical{} can then be run from there by explicitly giving +a pathname to @file{bin/ick} or @file{bin/ick.exe} + +@node Uninstalling +@section Uninstalling +@cindex uninstalling +@cindex @command{ick}, uninstalling + +It may happen that you decide to uninstall @cic{} after installing it; +this may be useful if you want to test the installation system, or +change the location you install programs, or for some reason you don't +want it on your computer. It's worth uninstalling just before you +install a new version of @cic{} because this will save some disk space; +you cannot install two versions of @cic{} at once (but see @ref{Not +Installing} for information on how you can use @cic{} without installing +it). + +If you installed @cic{} using @command{make install}, you can uninstall +it by using @command{make uninstall} from the installation directory, +assuming that it still exists. If you can't use that method for some +reason, you can uninstall it by deleting the files @file{ick.exe} where +your computer installs binaries, @file{libick.a}, @file{libickmt.a}, +@file{libyuk.a}, @file{COPYING.txt}, and @file{coopt.sh} where your +computer installs libraries, and the subdirectories +@file{ick-@value{VERSION}} in the places where your computer installs +data files and include files, and their contents. + +If you installed @cic{} by changing your @samp{PATH} environment +variable, you can uninstall by changing it back. + +You can go further than uninstalling. Running @command{make distr}, +@command{districk.sh}, or @command{districk.bat} will delete any files +created by compilation; @command{make distclean} will delete those +files, and also any files created by configuring. The distribution +contains prebuilt versions of the parser, lexical analyser and OIL +compiler; doing @command{make clean} (or @command{cleanick.sh} or +@command{cleanick.bat}) will do the same thing as @command{make distr} +and also delete those prebuilt versions. + +@node Reporting Bugs +@section Reporting Bugs +@cindex bugs, reporting +@cindex reporting bugs +@cindex patches, submitting +@cindex submitting patches + +If you can't get @cic{} to install at all, or something goes wrong when +you're using it, reporting a bug is probably a good idea. (This is +still important even if you figure out how to fix it, and the +information isn't in the manual, because the fix can be added to the +source code if possible, or at least to the manual, to benefit future +users.) For general help, you may want to post to the +@uref{news:alt.lang.intercal,,alt.lang.intercal} news group; to report +a bug or submit a patch, email the person who released the most recent +@cic{} version (which you can determine by looking at that newsgroup). + +If you do find a bug (either the compiler not behaving in the way you'd +expect, or if you find a way to cause E778 (@pxref{E778}) without +modifying the source code), it helps a lot if you can submit a bug +report explaining what causes it. If you're not sure, say that; it +helps if you give examples of input, command line options, etc.@: that +cause the bug. There are several debug options (@pxref{Debug Options}) +that you can use to help pin down a bug if you're interested in trying +to solve the problem yourself; looking at the output C code can also +help pin down a bug if the compiler gets that far. + +Information that should be given in a bug report is what you expect to +happen, what actually happens, what input and command line options you +gave to the compiler, what operating system you're using, any ideas you +might have as to what the problem is, and any appropriate debug traces +(for instance, @option{-H} (@pxref{-H+,,-H}) output if you think the bug +is in the optimizer). Core dumps aren't portable between systems, so +don't send those; however, if you're getting an internal error and can +dump core with @option{-U} (@pxref{-U+,,-U}), it helps if you can load a +debugger (such as @command{gdb}) on the core dump, use the debugger to +produce a backtrace, and send that backtrace. + +If you figure out how to solve the bug yourself, and want to submit the +patches to help other users (this also carries the advantage that your +patches will then be maintained along with the rest of the distribution, +and that you won't have to reapply them every time you upgrade to a +newer version of @cic{}), you must first agree to license your code +under the same license as the code that surrounds it (normally, that's +the GNU General Public License, but if you submit a patch to a file with +a different license, like this manual (yes, documentation patches are +useful too), you must agree to that license). You will be credited for +the patch in the source code unless you specifically ask not to be or +you don't give your name (in both these cases, you must license the code +to the public domain so that it can be incorporated without the +attribution requirement). Preferably, patches should be submitted in +the format created by the command @command{diff -u}; this command is +likely to be available on UNIX and Linux systems and versions are also +available for DOS and Windows (including a DJGPP port of the GNU +version). If you can't manage that, just submit your new code with +enough lines of old code around it to show where it's meant to go, and a +description of approximately where in the file it was. Patches should +be submitted by email to the person who most recently released a version +of @cic{}. + +If you have a suggestion for a new feature, it makes sense to first +discuss it on the @uref{news:alt.lang.intercal,,alt.lang.intercal} news +group; other @ical{} compiler maintainers may also want to implement +that feature. If you have developed code to implement that feature in +@cic{}, you can submit it the same way that you would submit a patch for +a bug. + +@node Distributing +@section Distributing +@cindex C-INTERCAL, distributing +@cindex distributing C-INTERCAL +@cindex releasing C-INTERCAL + +Due to the licensing conditions of @cic{}, you are allowed to release +your own version or distribution if you want to. In such cases, it's +recommended that you follow the following guidelines: + +@enumerate + +@item +Make sure the new version is based on the most recent existing version. +Looking at the @uref{news:alt.lang.intercal,,alt.lang.intercal} +newsgroup will normally let you know what version is most recent. + +@item +Increment the version number; if you add any new features, increment the +major version number (after the decimal point) and drop the minor +version number (before the decimal point) to 0, and otherwise increment +the minor version number. You have to update the version number in the +following files: @file{config.in}, @file{config.sh}, and +@file{ick.info}. You also have to rename the installation directory to +reflect the new version number. + +@item +Add an entry to the @file{NEWS.txt} file explaining what's new in the +version that you're releasing, following the same format as the other +entries. + +@item +Update the @file{README.txt} with a description of any new files you may +have added. + +@item +Remove any autosave or backup files that may be littering the +installation directory or its subdirectories. + +@item +Run @command{make distclean}, or @command{districk.sh} or +@command{districk.bat} if you didn't manage to configure; this will +remove all files that shouldn't be in the distribution. + +@item +Update the @file{MANIFEST.txt} file that lists all files in the +distribution; on a Linux or UNIX system, you can do this by typing +@command{ls -R1 > MANIFEST.txt} in the main installation directory. + +@item +If creating the distribution under DJGPP, run @command{etc/ctrlmfix.bat} +or @command{etc/ctrlmfix.sh}, even if you managed to configure; this +will sort out portability problems with newlines. + +@item +Create a gzipped tar file containing the installation directory. Its +filename should be @samp{ick-}, followed by the version number with the +dot replaced by a dash, followed by @samp{.tgz}; this form of filename +is friendly to DOS. + +@item +Place the new version somewhere on the Internet, and announce the +location and the fact that a new version has been released on +@uref{news:alt.lang.intercal,,alt.lang.intercal}. + +@end enumerate + +@node Invoking ick +@chapter Invoking ick +@cindex command line options +@cindex options, to @command{ick} +@cindex @command{ick}, command line options +@cindex @command{ick}, invoking +@cindex @command{ick}, options +@cindex compiling, @ical{} source code + +All operations on @ical{} source code available in @cic{} are currently +carried out by the compiler @command{ick}. + +The syntax is + +@example +ick -options @var{inputfile} +@end example + +@noindent +(Options can be given preceded by separate hyphens, or all in a row +after one hyphen, or a mixture; they're all single characters.) By +default, this compiles one @ical{} program given as the input file +directly to an executable without doing anything fancy; usually you will +want to give options, which are described below. + +@menu +* Language-affecting Options:: Options that specify language dialect +* Debug Options:: Debug your code or ick itself +* Output Options:: Specifying output format and location +* Optimizer Options:: Yes, you can optimize @ical{}! +* Other Options:: Options not covered in other sections +* Options to Generated Programs:: Generated executables allow options too +* Environment Variables:: What environment variables affect ick +@end menu + +@node Language-affecting Options +@section Language-affecting Options +@cindex options, language-affecting +@cindex language-affecting options +@cindex options, dialect +@cindex dialect options + +The following command-line options to @command{ick} affect what dialect +of the @ical{} language is compiled by the compiler; you may need to set +one or more of these options if your input is not the default @cic{} but +instead some other language like @icst{} or @clcic{}, or just because +you like certainty or like being different with respect to your output. +Note that there is no command-line option corresponding to +@abbr{TriINTERCAL} (or the base 4-7 versions); instead, the numeric base +to use is determined by looking at the filename extension (@samp{.i} for +base 2, the default, or @samp{.3i} to @samp{.7i} for the base 3-7 +versions.) + +@table @option +@ianchor -b +@opindex -b +@cindex random bug +@cindex E774, disabling +If this option is @emph{not} given, there is a small chance that a +random bug appears in the compiler, which causes the programs it creates +to manifest a bug that causes error E774 (@pxref{E774}). Giving the +option means that this bug will not happen. (You may wonder why this +bug was preserved; it is in fact a bug that was carefully preserved +since the days of @icst{}, in this case, but the option to turn it off +is available as a workaround. (There are no plans to fix this or any of +the other carefully preserved bugs any time soon, because that would +kind of defeat the point of having preserved them.) Interestingly, the +@icst{} compiler documentation mentions a similar command-line option +that is a workaround for the same bug. + +@ianchor -m +@opindex -m +@cindex multithreading, enabling +@cindex backtracking, enabling +This option needs to be given to allow any multithreading or +backtracking commands or identifiers to be used. (Unlike with other +language features, this is not autodetected because it's legal to have a +program with multiple COME FROM (@pxref{COME FROM}) commands aiming at +the same line even when it isn't multithreaded, in which case the +commands cause error E555 (@pxref{E555}) when that line is encountered +(with the usual caveats about both commands having to be active at the +time).) Attempts to use non-COME FROM multithreading or backtracking +commands without this option produce error E405 (@pxref{E405}). + +@ianchor -t +@opindex -t +@cindex INTERCAL-72 compatibility mode +@cindex compatibility, INTERCAL-72 +This option tells the compiler to treat the source code as @icst{}; as a +result, any language constructs that are used but weren't available in +1972 will trigger error E111 (@pxref{E111}). + +@ianchor -v +@opindex -v +@cindex constants, assigning to +@cindex assigning to constants +It is possible to write @ical{} code sufficiently tortuous that it ends +up assigning to a constant. Generally speaking, this isn't what you +wanted to do, so the compiler will kindly cause an error (E277; +@pxref{E277}) that stops the insanity at that point, but at the cost of +a significant amount of performance you can give this option to tell the +compiler to simply change the constant and keep on going anyway. (Note +that unlike @clcic{}, this only changes uses of the constant preceded by +@code{#} in your program, not things like line numbers; you want +@uref{http://esolangs.org/wiki/Forte,Forte} for that.) + +@ianchorc -C +@opindex -C +@cindex clockface mode +When this option is given, the generated programs will write the number +4 as @samp{IIII} rather than @samp{IV}, in case you're writing a clock +program. + +@ianchorc -P +@opindex -P +@cindex PIC-INTERCAL, command line option +@cindex E256, avoiding +@cindex E652, avoiding +This tells the compiler to treat the input as @abbr{PIC-INTERCAL} +(@pxref{PIC-INTERCAL}) rather than ordinary @cic{} input, and generate +PIC output code accordingly. There are a lot of options that are +incompatible with this, as well as many language features, due to the +limited memory available on a PIC. If you get error E256 +(@pxref{E256}), you have this option given when it shouldn't be; +likewise, if you get error E652 (@pxref{E652}), you should be using this +option but aren't. (A few simple programs are +@cic{}/@abbr{PIC-INTERCAL} polyglots, but such programs are incapable of +doing input or output, meaning that they aren't particularly useful.) + +@ianchorc -X +@opindex -X +@cindex CLC-INTERCAL compatibility mode +@cindex compatibility, CLC-INTERCAL +The @cic{} and @clcic{} compilers use different notation for various +things, sometimes to the extent where the same notation is legal in both +cases but has a different meaning. As this is the @cic{} compiler, it +rather guessably uses its own notation by default; however, the @clcic{} +notation can be used as the default instead using this option. (In most +situations where there isn't an ambiguity about what something means, +you can use the `wrong' syntax freely.) This option also causes some +constructs with subtly different meanings in these two @ical{} +implementations to take on the @clcic{} meaning. (OK, one construct at +present, the abstention of a GIVE UP (@pxref{GIVE UP}) command by line +number, which is possible as long as this switch isn't given; reading +through the @icst{} manual, there are a lot of things that imply that +this probably wasn't intended to be possible, but as far as I can tell +that manual doesn't actually @emph{say} anywhere that this particular +case is disallowed, even though it rules out all other similar cases. +However, I intend to add to this list at some point.) + +@end table + +@node Debug Options +@section Debug Options +@cindex options, debug +@cindex debug options + +Sometimes things will go wrong with your program, or with the way +@command{ick} was installed. There may even be unknown bugs in +@command{ick} itself (if you find one of these, please report it). The +following options are used to debug the whole system on various levels. + +@table @option + +@ianchor -d +@opindex -d +@cindex debugging, parser +@cindex parser, debugging +@cindex debugging, lexical analyser +@cindex lexical analyser, debugging + +If you think that something has gone wrong with the parser, or you want +to see how your program is being parsed, you can give this option on the +command line. All the debug output produced by the parser and lexical +analyser will be output on standard error. + +@ianchor -g +@opindex -g +@cindex debugging, C code +@cindex C code, debugging +@cindex C code, leaving in place + +This option allows debugging of the final executable at the C code +level. Any C code generated will be left in place, and the @option{-g} +option will be given to the C compiler that's used to compile the code, +so all the information needed for a C debugger to be used on the +executable will be present there. + +@item -h +@itemx -H +@itemx -hH +@anchor{-h} +@anchor{-H+} +@anchor{-hH} +@opindex -h +@opindex -H +@opindex -hH +@cindex optimizer, debugging +@cindex debugging, optimizer +@cindex OIL, debugging +@cindex debugging, OIL + +These options allow debugging of the optimiser, or produce output +helpful for understanding how your program has been summarised. +@option{-h} produces a summary of what optimiser rules were used, the +initial expression and what it was optimised to; @option{-H} produces a +more expanded view that shows each intermediate step of optimisation, +and @option{-hH} shows the same output as @option{-H}, but written +completely using C syntax (the other options output in a strange mix of +@ical{} and C). + +@ianchor -l +@opindex -l +@cindex warnings, enabling + +This option turns on generation of warnings (@pxref{Warnings}). To make +sure that they aren't actually useful, or are only marginally useful, +the warning generator is far too sensitive, and there is no way to +decide which warnings are given and which ones aren't; you either get +all of them or none. + +@ianchor -p +@opindex -p +@cindex profiling +@cindex yuk, profiling + +This option causes the program to run immediately after being compiled, +and profiles the resulting program to identify performance bottlenecks, +etc. The usefulness of this depends on the resolution of the timers on +the computer and operating system; DOS, in particular, is really bad +with timer resolution. The output will be saved in a file called +@file{yuk.out} when the program finishes running. It's legal to turn on +both the profiler and the interactive debugger at the same time, but if +you do this the profiler will also identify bottlenecks in the person +typing in commands to step through the program! The profiler will, in +fact, identify all the timings that particular commands in the program +take; so @code{WRITE IN} instructions will often show up as taking a +long time due to their need to wait for input. + +@ianchor -u +@opindex -u +@cindex skeleton file, directory problems +@cindex system library, directory problems +@cindex syslib, directory problems +@cindex directory problems +@cindex E999, debugging +@cindex E127, debugging + +When you are getting problems with finding files -- for instance, the +compiler can't find the skeleton file (@pxref{E999}) or the system +library (@pxref{E127}) -- this option will let you know, on standard +error, where the compiler is looking for files. This may hopefully help +you pin down where the file-finding problems are coming from, and also +offers the option of simply placing copies of the files where the +compiler is looking as a last resort. + +@ianchor -y +@opindex -y +@cindex yuk, command line option + +This is the main debugging option: it loads yuk, an interactive @ical{} +debugger with ability to step through the program, set breakpoints, view +and modify variables, etc. @xref{yuk}. + +@ianchorc -U +@opindex -U +@cindex internal errors, debugging +@cindex debugging, internal errors +@cindex internal errors, dumping core +@cindex dumping core on error +@cindex E778, debugging + +The internal error E778 (@pxref{E778}) should never happen. However, +there are all sorts of potential problems that may come up, and if part +of the code detects something impossible, or more usually when the +operating system detects things have got too insane and segfaults, +normally this error will just be generated and that's that. (I most +often get this when I've been writing a new section of code and have +made a mistake; hopefully, all or at least most of these errors are +fixed before release, though.) If you want more information as to what's +going on, you can give the @option{-U} option, which will cause the +compiler to raise an abort signal when an internal error happens. This +can generally be caught by a debugger that's being run on @command{ick} +itself at the time; on many systems, it will also cause a core dump. + +@end table + +@node Output Options +@section Output Options +@cindex output options +@cindex options, output + +These options allow you to control how far to compile (all the way to an +executable, or only to C, etc.@:), and where the output will be created. +Note that the output options may change depending on the other options +selected; for instance, many of the debug options will prevent the code +being compiled all the way to an executable. + +@table @option + +@ianchor -c +@opindex -c +@cindex code generation, stopping at C code +@cindex C, stopping after C is generated +@cindex output, C only + +By default, the original @ical{} code will be compiled all the way to an +executable, and the intermediate C and object files produced will be +deleted. Giving this option causes the compiler to stop when it has +finished producing the C file, leaving the C file there as the final +output of the compiler. (Its filename is the same as the source file, +but with @samp{.c} as its extension/suffix rather than the source file's +extension.) Without this option, an executable will be produced with the +extension changed to whatever's appropriate for the system you are on +(or omitted entirely if that's appropriate for the system). + +This option also places verbose comments in the output C file. + +@ianchor -o +@opindex -o +@cindex output, to standard output +@cindex standard output + +This option causes the compiler to progress no further than producing +the C output file, but instead of writing it to a file writes it +directly to standard output. This might occasionally be useful when +using @command{ick} as part of a pipe; it can also be useful to see how +far the compiler gets with compiling code before an error happens, when +you're trying to track down an error. + +@end table + +@node Optimizer Options +@section Optimizer Options +@cindex optimizer options +@cindex options, optimizer +@cindex optimization + +There are various command line options that can be used to tell +@command{ick} whether and in what ways to optimize code. + +@table @option + +@ianchor -f +@opindex -f +@cindex flow optimization +@cindex optimization, flow +@cindex optimization, control flow + +This option requests the compiler to attempt to analyse the flow of the +program and optimize accordingly; for instance, it will detect which +commands can't possibly be @code{ABSTAINED} from and refrain from +generating code to check the abstention status of those commands. + +@ianchorc -F +@opindex -F +@cindex optimization, extreme +@cindex extreme optimization + +This option tells the compiler to optimize the output for speed. This +is done to crazy extremes; the compiler may take several hours/days +analysing the program in some cases and still not come up with an +improvement. It turns on all the other optimizer options. Note that +not all systems accept this option, because it sometimes outputs a shell +script disguised as an executable rather than an actual executable. + +@ianchorc -O +@opindex -O +@cindex optimization, idioms +@cindex idiom optimization +@cindex optimization, OIL +@cindex OIL, optimizing code + +This option tells the compiler to apply optimizer idioms to the +expressions in the code given, when appropriate. The list of idioms is +stored in the file @file{src/idiotism.oil}; note that it is compiled +into the compiler, though, so you will have to rebuild and reinstall the +compiler if you change it. For more information about changing the list +of idioms, see @ref{Optimizer Idiom Language}. + +@end table + +@node Other Options +@section Other Options +@cindex other options +@cindex options, other + +Some options just can't be classified. + +@table @option + +@ianchor -@@ +@opindex -@@ +@cindex options, help +@cindex help with options +@cindex usage instructions, printing + +If this option is given, the compiler doesn't run at all, but instead +prints a set of instructions for using it, explaining which options are +available on the system you're on and which options conflict with which +other options. + +@end table + +@node Options to Generated Programs +@section Options to Generated Programs +@cindex generated programs, options +@cindex options, to generated programs + +Once the compiler runs and produces an output executable, that +executable itself will accept a range of options that control the way it +runs. None of these options have to be used; a default value will be +assumed if they aren't. + +@table @option + +@ianchorpm help +@opindex +help +@opindex -help + +Whether @samp{+} or @samp{-} is given at the start of this option, it +will cause the program to print out what options are available and what +state they are in. It will then cause the program to exit via an +internal error. + +@ianchorpm wimpmode +@opindex +wimpmode +@opindex -wimpmode +@cindex wimpmode +@cindex Roman numerals, disabling +@cindex Arabic numberals, enabling +@cindex input, in Arabic numerals +@cindex output, in Arabic numerals + +If the @samp{+} version of this is given (rather than the default +@samp{-}), then the program will print a message explaining that you are +a wimp (the mode itself is known as wimpmode), and for the rest of +execution will input in Arabic numerals (@samp{123} rather than +@samp{ONE TWO THREE}) and likewise will output in Arabic numerals rather +than Roman numerals (such as @samp{CXXIII}). True @ical{} programmers +should rarely have to use this mode. + +@ianchorpm traditional +@opindex +traditional +@opindex -traditional + +This option does not actually appear to do anything. + +@ianchorpm printflow +@opindex +printflow +@opindex -printflow +@cindex flow, printing +@cindex debugging, flow +@cindex debugging, multithreaded programs +@cindex multithreading, debugging +@cindex backtracking, debugging + +The usual debugging methods don't work with multithreaded or +backtracking programs. This option exists to give at least a slim +chance of working out what is going on with them. It causes the program +to print the line number of the command it thinks it may be executing +next (i.e.@: the line number that would be printed if that line had an +error) immediately after executing each command, and also an internal +identifier for the thread that that command was in. It also prints a +trace of what parts of the multithreader are being activated; so for +instance, it will tell you when a thread is being forked into multiple +threads or when a choicepoint has been deleted. + +@ianchorpm mystery +@opindex +mystery +@opindex -mystery + +This option is occasionally capable of doing something, but is +deliberately undocumented. Normally changing it will have no effect, +but changing it is not recommended. + +@end table + +@node Environment Variables +@section Environment Variables +@cindex environment variables + +Various environment variables can be set to affect the operation of +@command{ick}. + +@multitable @columnfractions .3 .7 +@headitem Variable @tab Meaning +@item ICKINCLUDEDIR@*ICKLIBDIR@*ICKBINDIR +@tab +These three environment variables suggest locations in which +@command{ick} should look to find various files that it needs: the +skeleton file, system library, C header files and libraries that it +needs, constant-output optimiser, and the GNU General Public License +(which the debugger needs to be able to display on demand for legal +reasons). +@item CC +@tab +The name of a C compiler to use (defaults to gcc, which is the only +compiler with which @cic{} has been tested recently). This option has +no effect on DJGPP, where gcc is always used. +@item ICKTEMP@*TMPDIR@*TEMP@*TMP +@tab +On DJGPP, @command{ick} creates temporary files to pass options to gcc +as a method of getting around the limit on the length of a command line +that can sometimes affect DOS programs. These four environment +variables are tried (in this order) to determine a location for the +temporary file; if none of them are set, the current directory is used. +@end multitable + +@node Errors and Warnings +@chapter Errors and Warnings +@cindex ick, errors and warnings +@cindex errors and warnings + +Things may go wrong, either during the compilation or the execution of +your program. Note that some things that would be compile-time errors +in many other languages -- such as syntax errors -- are in fact run-time +errors in @ical{}. + +Errors and warnings appear as an error code starting with @samp{ICL}, +followed by a three digit number, followed by @samp{I} for an error or +@samp{W} for a warning. However, they will be notated here as +@samp{E000}, etc.@:, to save space and because consistency was never a +strong point of @ical{}. This is followed by a text description of the +error, and a hint as to the location of the error. This is not the line +on which the error occurred, but rather the line on which the next +command to be executed is. To add to the fun, the calculation of the +next command to be executed is done at compile-time rather than runtime, +so it may be completely wrong due to things like abstention on +@code{COME FROM}s or computed @code{COME FROM}s. The moral of this +story is that, if you really want to know where the error is, use a +debugger. Note also that if the error happens at compile-time, there is +no guarantee that the line number given makes any sense at all. Some +errors don't give next line numbers, mostly those for which it doesn't +make logical sense, such as E633 (@pxref{E633}). After this is a +suggestion to correct (or reconsider) the source code and to resubnit +it. (This typo has been carefully preserved for over a decade.) + +@menu +* Errors:: Error messages that might be produced +* Warnings:: Warnings produced by the @option{-l} option +@end menu + +@node Errors +@section Errors +@cindex errors +@cindex ick, errors + +This is a list of the error messages that might be produced during the +compilation or execution of an @ical{} program. + +@table @asis + +@ieanchor E000 +@cindex syntax error + +This is an unusual error; it's what's printed when a syntax error is +encounted at runtime, in a situation in which it would be executed. (An +@code{ABSTAIN}ed syntax error, for instance, would not be executed; this +is one of the mechanisms available for writing comments.) The text of +the error message is simply the statement that couldn't be decoded. + +@ieanchor E017 +@cindex syntax error, serious +@quotation +DO YOU EXPECT ME TO FIGURE THIS OUT? +@end quotation + +It sometimes happens that a syntax error manages to get the parser so +confused that it can't figure out what to do next; that causes this +error, which happens at compile time. + +@ieanchor E079 +@cindex politesse +@cindex @code{PLEASE}, proportion required +@quotation +PROGRAMMER IS INSUFFICIENTLY POLITE +@end quotation + +The balance between various statement identifiers is important. If less +than approximately one fifth of the statement identifiers used are the +polite versions containing @code{PLEASE}, that causes this error at +compile time. + +@ieanchor E099 +@quotation +PROGRAMMER IS OVERLY POLITE +@end quotation + +Of course, the same problem can happen in the other direction; this +error is caused at compile time if over about one third of the statement +identifiers are the polite form. + +@ieanchor E111 +@quotation +COMMUNIST PLOT DETECTED, COMPILER IS SUICIDING +@end quotation + +This error happens when you give the @option{-t} option (@pxref{-t}) but +you use a language construct that wasn't available in @icst{}. If this +happens, then either there's a mistake in the program that prevents it +being @icst{} or you shouldn't be compiling it as @icst{} in the first +place. + +@ieanchor E123 +@cindex black lagoon +@cindex @code{NEXT}, stack overflow +@cindex stack overflow +@quotation +PROGRAM HAS DISAPPEARED INTO THE BLACK LAGOON +@end quotation + +There is a hard limit of 80 @command{NEXT}s at a time; this is to +discourage excessive use of @command{NEXTING} for things like recursion. +(Recursive programs are entirely legal; you simply have to figure out +how to do it with computed @command{COME FROM} instead. (For the +record, it is possible. (Using lots of nested brackets when talking +about recursion is great (yay!@:).))) Another problem with writing the +source code that can cause this error is a failure to properly +@command{FORGET} the entry on the @command{NEXT} stack created when +trying to simulate a goto. + +@ieanchor E127 +@cindex system library, errors +@cindex syslib, errors +@quotation +SAYING 'ABRACADABRA' WITHOUT A MAGIC WAND WON'T DO YOU ANY GOOD +@end quotation +Your program asked to include the system library (by specifying a line +number from 1000 to 1999 inclusive without including a line with that +number), but due to installation problems the copmiler couldn't find the +system library to include. You could try using the @option{-u} +(@pxref{-u}) option to see where the compiler's looking; that may give +you an idea of where you need to copy the system library so that the +compilation will work. This error happens at compile time and doesn't +give a next command line number. + +@ieanchor E129 +@cindex @code{NEXT}, nonexistent target +@quotation +PROGRAM HAS GOTTEN LOST +@end quotation + +This error happens at compile time when the compiler can't figure out +where a @command{NEXT} command is actually aiming (normally due to a +typo in either the line label given or the line label on the line aimed +for). The logic behind this error means that the next line to be +executed is unknown (after all, that's the whole point of the error) and +is therefore not given. + +@ieanchor E139 +@cindex @code{ABSTAIN}, nonexistent target +@cindex @code{REINTSTATE}, nonexistent target +@quotation +I WASN'T PLANNING TO GO THERE ANYWAY +@end quotation + +This error happens at compile time when an @code{ABSTAIN} or +@code{REINSTATE} references a non-existent target line. This generally +happens for much the same reasons as E129 (@pxref{E129}). + +@ieanchor E182 +@cindex line label, duplicate +@cindex duplicate line label +@quotation +YOU MUST LIKE THIS LABEL A LOT! +@end quotation + +At present, it's impossible to have more than one line with the same +line number. That would make @code{NEXT} act too much like @code{COME +FROM} in reverse to be interesting. This error happens at compile time. + +@ieanchor E197 +@cindex line label, illegal value +@cindex illegal line label value +@cindex invalid line label value +@quotation +SO@! 65535 LABELS AREN'T ENOUGH FOR YOU? +@end quotation + +Legal values for line labels are 1 to 65535 (with values from 1000 to +1999 reserved if you want to use the system library). This error comes +up if you use nonpositive or twospot values for a line label. + +@ieanchor E200 +@cindex variable, illegal number +@cindex illegal variable number +@cindex invalid variable number +@quotation +NOTHING VENTURED, NOTHING GAINED +@end quotation + +You used a variable that isn't actually in your program. Failing that +(which would be quite impressive and is probably impossible, at least in +the present version of @cic{}), you specified an illegal number for a +variable (legal numbers are positive and onespot). This error happens +at compile time, at least for illegal variable numbers. + +@ieanchor E222 +@cindex out of memory, during @code{STASH} +@quotation +BUMMER, DUDE! +@end quotation + +In @ical{}, you're allowed to @code{STASH} as much as you like; this +makes the language Turing-complete and allows for unlimited recursion +when combined with computed @code{COME FROM} in the right way. +Unfortunately, real computers aren't so idealised; if you manage to +write a program so memory-intensive that the computer runs out of memory +to store stashes, it causes this error at runtime. To fix this error, +you either have to simplify the program or upgrade your computer's +memory, and even then that will only help to some extent. + +@ieanchor E240 +@cindex array, invalid dimension +@cindex invalid array dimension +@cindex illegal array dimension +@quotation +ERROR HANDLER PRINTED SNIDE REMARK +@end quotation + +Arrays have to be large enough to hold at least one element; you tried +to dimension an array which isn't large enough to hold any data. This +error happens at run time. + +@ieanchor E241 +@cindex array, wrong dimension +@cindex wrong array dimension +@cindex array, out of bounds +@cindex out of bounds +@quotation +VARIABLES MAY NOT BE STORED IN WEST HYPERSPACE +@end quotation + +This error happens at run time when the subscripts given to an array are +inconsistent with the way the array was dimensioned, either because +there were the wrong number of subscripts or because a subscript was too +large to fit in the array. + +@ieanchor E256 +@cindex PIC-INTERCAL, unsupported command +@quotation +THAT'S TOO HARD FOR MY TINY BRAIN +@end quotation + +Some commands simply aren't available in @abbr{PIC-INTERCAL}. I mean, +@acronym{PIC}s generally have less than a kilobyte of memory; you're not +going to be able to use some of the more confusing language features +with that sort of resource limitation. The solution is to replace the +affected command, or to not give the @option{-P} option +(@pxref{-P+,,-P}) if you didn't mean to compile as @abbr{PIC-INTERCAL} +in the first place. + +@ieanchor E275 +@cindex overflow, over onespot +@cindex overflow, over 16 bits +@cindex onespot overflow +@cindex 16 bit overflow +@quotation +DON'T BYTE OFF MORE THAN YOU CAN CHEW +@end quotation + +This error happens when there is an attempt to store a twospot value in +a onespot variable. The actual size of the value is what matters when +counting its spots; so you can store the output of a mingle in a onespot +variable if it happens to be less than or equal to 65535, for instance. +(This is not necessarily the case in versions of @ical{} other than +@cic{}, though, so you have to be careful with portability when doing +this.) + +@ieanchor E277 +@cindex reverse assignment, impossible +@cindex reverse assignment, error +@cindex operand overloading, impossible +@cindex impossible reverse assignment +@quotation +YOU CAN ONLY DISTORT THE LAWS OF MATHEMATICS SO FAR +@end quotation + +Reverse assignments are not always mathematically possible. Also, +sometimes they require changing the value of a constant; this is only +legal if you specifically specified that it was legal by using the +@option{-v} option. In the case of an impossible reverse assignment +(including a situation in which operand overloading causes a reverse +assignment to happen), this error happens at runtime. + +@ieanchor E281 +@cindex spark, nesting limit +@cindex ears, nesting limit +@cindex rabbit-ears, nesting limit +@cindex nesting limit +@findex SENESTMAX +@quotation +THAT MUCH QUOTATION AMOUNTS TO PLAGIARISM +@end quotation + +There is a limit of 256 on the number of nested spark/ears groups +allowed. If you somehow manage to exceed that limit, that will cause +this error. Try breaking the expression up into smaller expressions. +(The limit is trivial to increase by changing @code{SENESTMAX} in +@file{ick.h}; if you ever actually come across a program that hits the +limit but wasn't designed to, just email the maintainer to request a +higher limit.) + +@ieanchor E333 +@cindex variables, limit +@quotation +YOU CAN'T HAVE EVERYTHING, WHERE WOULD YOU PUT IT? +@end quotation + +Your program references so many variables that the compiler couldn't +cope. This error is unlikely to ever happen; if it does, try reducing +the number of variables you use by combining some into arrays. This is +a compile-time error. + +@ieanchor E404 +@cindex @code{GO BACK}, no choicepoint +@cindex @code{GO AHEAD}, no choicepoint +@quotation +I'M ALL OUT OF CHOICES! +@end quotation + +Your program asked that a choicepoint be backtracked to or removed, but +there aren't any choicepoints at the moment. This runtime error usually +indicates a logic mistake in your program. In backtracking programs +translated from other backtracking languages, this indicates that the +program has failed. + +@ieanchor E405 +@cindex multithreading, not enabled +@cindex backtracking, not enabled +@cindex @code{WHILE}, not enabled +@cindex @code{MAYBE}, not enabled +@cindex @code{GO AHEAD}, not enabled +@cindex @code{GO BACK}, not enabled +@quotation +PROGRAM REJECTED FOR MENTAL HEALTH REASONS +@end quotation + +Your program used a construct that only makes sense when multithreading +or backtracking (@code{WHILE}, @code{MAYBE}, @code{GO BACK}, or @code{GO +AHEAD}), but you didn't specify the @option{-m} option (@pxref{-m}). If +you meant to write a multithreaded or backtracking program, just give +that option; if you didn't, be careful what words you use in comments! +This error happens at compile-time. + +@ieanchor E436 +@cindex @code{RETRIEVE}, without stashing +@cindex stash failure +@quotation +THROW STICK BEFORE RETRIEVING! +@end quotation + +In order to @code{RETRIEVE} a variable, it has to be @code{STASH}ed +first; if it isn't, then this error happens at runtime. + +@ieanchor E444 +@cindex @code{COME FROM}, no target +@cindex @code{NEXT FROM}, no target +@quotation +IT CAME FROM BEYOND SPACE +@end quotation + +A @code{COME FROM} aiming at a line label --- as opposed to a computed +@code{COME FROM}, which is allowed to be pointing at a nonexistent line +--- must point to a valid line label. The same applies to @code{NEXT +FROM}. This error happens at compile time if a nonexistent line label is +found in one of these contexts. + +@ieanchor E533 +@cindex overflow, over twospot +@cindex overflow, over 32 bits +@cindex twospot overflow +@cindex 32 bit overflow +@quotation +YOU WANT MAYBE WE SHOULD IMPLEMENT 64-BIT VARIABLES? +@end quotation + +This error is like E275 (@pxref{E275}), but applies when an attempt is +made at runtime to store a threespot value (or even a fourspot or +morespot value) in a twospot variable, or a threespot or greater value +is produced as an intermediate during a calculation (for instance by a +mingle operation). No values above twospot are allowed at any point +during an @ical{} program; if you want to process higher numbers, you +have to figure out a different way of storing them. + +@ieanchor E555 +@cindex @code{COME FROM}, ambiguity +@quotation +FLOW DIAGRAM IS EXCESSIVELY CONNECTED +@end quotation + +Aiming two @code{COME FROM}s at the same line only makes sense in a +multithreaded program. In a non-multithread program, doing that will +cause this error at compile time (if neither @code{COME FROM} is +computed) or at run time (if the command that has just finished running +is simultaneously the target of two or more @code{COME FROM}s). This +either indicates an error in your program or that you've forgotten to +use the @option{-m} option (@pxref{-m}) if you are actually trying to +split the program into two threads. + +@ieanchor E562 +@cindex input, EOF +@cindex EOF +@cindex end of file +@quotation +I DO NOT COMPUTE +@end quotation + +The program asked for input, but for some reason it wasn't available. +(This is a runtime error, obviously.) The error may happen because the +input is being piped in from a command or file which has reached +end-of-file, or because the user typed @kbd{@key{CTRL}-@key{D}} +(UNIX/Linux) or @kbd{@key{CTRL}-@key{Z}} (DOS/Windows) while the program +was trying to @code{WRITE IN} some data. + +@ieanchor E579 +@cindex input, invalid +@quotation +WHAT BASE AND/OR LANGUAGE INCLUDES @var{string}? +@end quotation + +When reading spelt-out-digit input, the input didn't seem to be a valid +digit in English, Sanskrit, Basque, Tagalog, Classical Nahuatl, +Georgian, Kwakiutl, Volap@"uk, or Latin. This seems to have languages +covered pretty well; what on earth were you using, or did you just make +a spelling mistake? + +@ieanchor E621 +@cindex @code{RESUME}, by 0 +@quotation +ERROR TYPE 621 ENCOUNTERED +@end quotation + +The compiler encountered error E621 (@pxref{E621}). This happens at +runtime when the program requests that no entries are removed from the +@code{NEXT} stack (which is possible), but that the last entry removed +should be jumped to (which given the circumstances isn't, because no +entries were removed.) + +@ieanchor E632 +@quotation +THE NEXT STACK RUPTURES. ALL DIE. OH, THE EMBARRASSMENT! +@end quotation + +When an attempt is made to @code{RESUME} past the end of the @code{NEXT} +stack, the program ends; however, this cause the program to end in a +manner other than via @code{GIVE UP} or @code{DON'T TRY AGAIN}, so an +error message must be printed, and this is that error message. + +@ieanchor E633 +@quotation +PROGRAM FELL OFF THE EDGE +@end quotation + +You can't just let execution run off the end of the program. At least, +that is, if it doesn't end with @code{TRY AGAIN}. An attempt to do that +causes this error at runtime. Note that if your program references the +system library, then it counts as being appended to your program and so +the program will run into the first line of the system library rather +than cause this error. As it happens, the first line of the system +library is a syntax error, so doing this will cause E000 (@pxref{E000}) +with the error text @samp{PLEASE KNOCK BEFORE ENTERING}. There isn't a +next statement to be executed with E633, so the next statement won't be +given in the error message. + +@ieanchor E652 +@cindex @code{PIN}, in a non-PIC program +@quotation +HOW DARE YOU INSULT ME! +@end quotation + +The @code{PIN} command doesn't make much sense for anything bigger than +a @acronym{PIC}; using it in a non-@acronym{PIC} program causes this +error at compile-time. Try using the normal input and output mechanisms +instead. This error may also be a clue that you are trying to compile a +@abbr{PIC-INTERCAL} program without giving the @option{-P} option +(@pxref{-P+,,-P}). + +@ieanchor E666 +@cindex out of memory, during compile +@quotation +COMPILER HAS INDIGESTION +@end quotation + +There isn't a limit on the length of an input program other than your +computer's memory; if your computer does run out of memory during +compilation, it causes this error. + +@ieanchor E774 +@cindex random bug, error message +@quotation +RANDOM COMPILER BUG +@end quotation + +No compiler is perfect; sometimes errors just happen at random. In this +case, the random error is E774. If you don't like the idea that your +program may be shot down by a random compiler bug, or you are doing +something important, you can use the @option{-b} option (@pxref{-b}) to +prevent this bug happening. (You may wonder why this bug is in there at +all if it's so easily prevented. The answer is that such a bug was +present in the original @icst{} compiler, which also had an option to +turn the bug off. It's also a reward for people who actually read the +manual.) + +@ieanchor E777 +@cindex directory problems, source file +@cindex no source file +@quotation +A SOURCE IS A SOURCE, OF COURSE, OF COURSE +@end quotation + +You specified a file to compile on the command line, but the compiler +couldn't find or couldn't open it. This is almost certainly because you +made a typo specifying the file. + +@ieanchor E778 +@cindex internal errors +@quotation +UNEXPLANED COMPILER BUG +@end quotation + +This should never come up, either at compile time or at run time. It +could come up at either when an internal check by the compiler or the +runtime libraries realises that something has gone badly wrong; mistakes +happen, and in such cases the mistake will have been detected. (If this +happens at compile time you can use the @option{-U} option +(@pxref{-U+,,-U}) to cause the compiler to send an abort signal -- which +normally causes a core dump -- when the error happens, to help debug +what's causing it.) More often, this error comes up when the operating +system has noticed something impossible, like an attempt to free +allocated memory twice or to write to a null pointer, and tells the +compiler an error has occured, in which case the same response of +putting up this error happens. The point is that in all cases this +error indicates a bug in the compiler (even if it happens at run time); +in such cases, it would be very helpful if you figure out what caused it +and send a bug report (@pxref{Reporting Bugs}). + +@ieanchor E810 +@cindex yuk, input overflow +@quotation +ARE ONE-CHARACTER COMMANDS TOO SHORT FOR YOU? +@end quotation + +This is a debug-time error caused when you give too much input to the +debugger when all it wanted was to know what you wanted to do next. + +@ieanchor E811 +@cindex yuk, breakpoint overflow +@cindex yuk, too many breakpoints +@cindex breakpoints, too many +@quotation +PROGRAM IS TOO BADLY BROKEN TO RUN +@end quotation + +There's a limit to how many breakpoints you can have in a program; +you've broken the limit and therefore broken the debugger. This is a +debug-time error. + +@ieanchor E888 +@quotation +I HAVE NO FILE AND I MUST SCREAM +@end quotation + +The output file couldn't be written, maybe because the disk is full or +because there's already a read-only file with the same name. This is a +compile-time error. + +@ieanchor E991 +@cindex out of memory, multithreading +@cindex out of memory, backtracking +@cindex multithreading, out of memory +@cindex backtracking, out of memory +@quotation +YOU HAVE TOO MUCH ROPE TO HANG YOURSELF +@end quotation + +There is no limit on the number of threads or choicepoints that you can +have in a multithreaded or backtracking program (in a program that isn't +multithreaded or backtracking, these are obviously limited to 1 and 0 +respectively). However, your computer may not be able to cope; if it +runs out of memory in the multithreader, it will cause this error at +runtime. + +@ieanchor E993 +@cindex @code{TRY AGAIN}, not last +@quotation +I GAVE UP LONG AGO +@end quotation + +@code{TRY AGAIN} has to be the last command in a program, if it's there +at all; you can't even follow it by comments, not even if you know in +advance that they won't be @code{REINSTATE}d. This error happens at +compile time if a command is found after a @code{TRY AGAIN}. + +@ieanchor E995 +@quotation +DO YOU REALLY EXPECT ME TO HAVE IMPLEMENTED THAT? +@end quotation + +Some parts of the code haven't been written yet. There ought to be no +way to cause those to actually run; however, if you do somehow find a +way to cause them to run, they will cause this error at compile time. + +@ieanchor E997 +@cindex whirlpool, in base 2 +@cindex sharkfin, in base 2 +@cindex TriINTERCAL, operators in base 2 +@quotation +ILLEGAL POSSESSION OF A CONTROLLED UNARY OPERATOR +@end quotation + +Some operators (such as whirlpool (@code{@@}) and sharkfin (@code{^})) +only make sense in @abbr{TriINTERCAL} programs, and some have a minimum +base in which they make sense. This error happens at compile-time if +you try to use an operator that conflicts with the base you're in (such +as using @abbr{TriINTERCAL} operators in an @ical{} program in the +default base 2). + +@ieanchor E999 +@cindex skeleton file, errors +@quotation +NO SKELETON IN MY CLOSET, WOE IS ME! +@end quotation + +The skeleton file @file{ick-wrap.c} or @file{pickwrap.c} is needed to be +able to compile @ical{} to C. If the compiler can't find it, it will +give this error message. This indicates a problem with the way the +compiler has been installed; try using the @option{-u} option +(@pxref{-u}) to find out where it's looking (you may be able to place a +copy of the skeleton file in one of those places.) + +@end table + +@node Warnings +@section Warnings +@cindex warnings +@cindex ick, warnings + +This is a list of the warnings stored in the warning database. Warnings +only come up when the @option{-l} (@pxref{-l}) is given; even then, some +of the warnings are not currently implemented and therefore will never +come up. + +@table @asis + +@ieanchor W016 +@quotation +DON'T TYPE THAT SO HASTILY +@end quotation + +The positional precedence rules for unary operators are somewhat +complicated, and it's easy to make a mistake. This warning is meant to +detect such mistakes, but is not currently implemented. + +@ieanchor W018 +@quotation +THAT WAS MEANT TO BE A JOKE +@end quotation + +If an @ical{} expression has been translated from another language such +as C, the optimiser is generally capable of translating it back into +something similar to the original, at least in base 2. When after +optimisation there are still @ical{} operators left in an expression, +then this warning is produced. (Therefore, it's likely to come up quite +a lot if optimisation isn't used@!) The system library produces some of +these warnings (you can tell if a warning has come up in the system +library because you'll get a line number after the end of your program). + +@ieanchor W112 +@cindex warnings, non-INTERCAL-72 +@cindex non-INTERCAL-72 warning +@quotation +THAT RELIES ON THE NEW WORLD ORDER +@end quotation + +This warning comes up whenever the compiler recognises that you've added +some code that didn't exist in @icst{}. This allows you to check +whether your code is valid @icst{} (although @option{-t} (@pxref{-t}) is +more useful for that); it also warns you that code might not be portable +(because @icst{} is implemented by most @ical{} compilers, but more +recent language features may not be). + +@ieanchor W128 +@quotation +SYSLIB IS OPTIMIZED FOR OBUSCATION +@end quotation + +There is an idiom used in the system library that does a right-shift by +selecting alternate bits from a twospot number and then mingling them +the other way round. A rightshift can much more easily be done with a +single rightshift, so this is a silly way to do it, and this warning +warns that this idiom was used. However, the present optimizer is +incapable of recognising whether this problem exists or not, so the +warning is not currently implemented. + +@ieanchor W276 +@cindex onespot, overflow warning +@cindex overflow, warning +@quotation +YOU CAN'T EXPECT ME TO CHECK BACK THAT FAR +@end quotation + +It's an error to assign a twospot value (a value over 65535) to a +onespot variable, or to use it as an argument to a mingle. If the +optimizer can't guarantee at compile time that there won't be an +overflow, it issues this warning. (Note that this doesn't necessarily +mean there's a problem --- for instance, the system library generates +some of these warnings --- only that the optimiser couldn't work out for +sure that there wasn't a problem.) + +@ieanchor W239 +@quotation +WARNING HANDLER PRINTED SNIDE REMARK +@end quotation + +Your code looks like it's trying to assign 0 to an array, giving it no +dimension; this is an error. This warning is produced at compile time +if it looks like a line in your code will cause this error, but it isn't +necessarily an error because that line of code might never be executed. + +@ieanchor W278 +@quotation +FROM A CONTRADICTION, ANYTHING FOLLOWS +@end quotation + +It's sometimes impossible to reverse an assignment (a reverse assignment +can happen if the @option{-v} option (@pxref{-v}) is used and an +expression is placed on the left of an assignment), or in operand +overloading; if the compiler detects that a reversal failure is +inevitable, it will cause this warning. Note that this doesn't always +cause an error, because the relevant code might never be executed. + +@ieanchor W534 +@cindex unary operators, portability +@cindex portability, unary operators +@quotation +KEEP LOOKING AT THE TOP BIT +@end quotation + +@cic{} uses a slightly different typing mechanism to some other @ical{} +compilers; types are calculated at compile time rather than run time. +This only makes a difference in some cases involving unary operators. +It's impossible to detect at compile time for certain whether such a +case has come up or not, but if the compiler or optimizer thinks that +such a case might have come up, it will issue this warning. + +@ieanchor W622 +@quotation +WARNING TYPE 622 ENCOUNTERED +@end quotation + +Your code looks like it's trying to resume by 0; this is an error. This +warning is produced at compile time if it looks like a line in your code +will cause this error, but it isn't necessarily an error because that +line of code might never be executed. + +@end table + +@node The yuk debugger +@chapter The yuk debugger +@cindex yuk +@cindex debugging, yuk +@cindex debugging, runtime +@cindex runtime debugger +@anchor{yuk} + +The @cic{} distribution contains a runtime debugger called `yuk'. +Unlike most other debuggers, it is stored as object code rather than as +an executable, and it is compiled into the code rather than operating on +it. To debug code, add @option{-y} (@pxref{-y}) to the command line of +@command{ick} when invoking it; that tells it to compile the debugger +into the code and then execute the resulting combination. (The +resulting hybrid debugger/input executable is deleted afterwards; this +is to prevent it being run by mistake, and to prevent spreading the +debugger's licence onto the code it was compiled with.) + +yuk can also be used as a profiler using the @option{-p} option +(@pxref{-p}); this produces a file @file{yuk.out} containing information +on how much time was spent running each command in your program, and +does not prompt for debugger commands. + +Note that some command line arguments are incompatible with the +debugger, such as @option{-m} and @option{-f}. In particular, this +means that multithreaded programs and programs that use backtracking +cannot be debugged using this method; the @option{+printflow} option +(@pxref{+printflow}) to a compiled program may or may not be useful for +debugging multithreaded programs. + +When the debugger starts, it will print a copyright message and a +message on how to access online help; then you can enter commands to +run/debug the program. The debugger will show a command prompt, +@samp{yuk007 }, to let you know you can input a command. + +@cindex yuk, commands +Here are the commands available. Commands are single characters +followed by newlines, or followed by a line number (in decimal) and a +newline or a variable name (a @code{.}, @code{,}, @code{:} or @code{;} +followed by a number in decimal; note that some commands only allow +onespot and twospot variables as arguments). + +@multitable @columnfractions .15 .85 +@headitem Command @tab Description +@item a@var{LINE} +@tab +All non-abstained commands on line @var{LINE} become abstained from +once. +@item b@var{LINE} +@tab +A breakpoint is set on line @var{LINE}. The breakpoint causes execution +with @samp{c} to stop when it is reached. +@item c +@tab +The program is run until it ends (which also ends the debugger) or a +breakpoint is reached. +@item d@var{LINE} +@tab +Any breakpoint that may be on line @var{LINE} is removed. +@item e@var{LINE} +@tab +An explanation of the main expression in each command on line @var{LINE} +is printed to the screen. The explanation is in the same format as the +format produced by @option{-h} (@pxref{-h}) and shows what the optimiser +optimised the expression to (or the original expression if the optimiser +wasn't used). +@item f@var{LINE} +@tab +Removes the effect of the @samp{m} command on line @var{LINE}. +@item g@var{LINE} +@tab +Causes the current command to be the first command on @var{LINE} (if not +on that line already) or the next command on @var{LINE}, as if that line +was @code{NEXT}ed to and then that @code{NEXT} stack item was forgotten. +@item h +@tab +Lists 10 lines either side of the current line; if there aren't 10 lines +to one or the other side of the current line, instead more lines will be +shown on the other side to compensate, if available. +@item i@var{VAR} +@tab +Causes variable @var{VAR} to become @code{IGNORE}d, making it read-only. +@item j@var{VAR} +@tab +Causes variable @var{VAR} to become @code{REMEMBER}ed, making it no +longer read-only. +@item k +@tab +Continues executing commands until the @command{NEXT} stack is the same +size or smaller than it was before. In other words, if the current +command is not a @command{NEXT} and doesn't have a @command{NEXT FROM} +aiming at it, one command is executed; but if a @command{NEXT} does +happen, execution will continue until that @command{NEXT} returns or is +forgotten. A breakpoint or the end of the program also end this. +@item l@var{LINE} +@tab +Lists 10 lines of source code either side of line @var{LINE}, the same +way as with @samp{h}, but using a line stated in the command rather than +the current line. +@item m@var{LINE} +@tab +Produces a message onscreen every time a command on line @var{LINE} is +executed, but without interrupting the program. +@item n +@tab +Show the @command{NEXT} stack on the screen. +@item o +@tab +Continue executing commands until the @command{NEXT} stack is smaller +than it was before. If you are using @command{NEXT}s like procedures, +then this effectively means that the procedure will run until it +returns. A breakpoint or the end of the program also end this. +@item p +@tab +Displays the value of all onespot and twospot variables. +@item q +@tab +Aborts the current program and exits the debugger. +@item r@var{LINE} +@tab +Reinstates once all abstained commands on line @var{LINE}. +@item s +@tab +Executes one command. +@item t +@tab +Continues execution until the end of the program or a breakpoint: each +command that executes is displayed while this command is running. +@item u@var{LINE} +@tab +Continues execution of the program until just before a command on line +@var{LINE} is run (or a breakpoint or the end of the program). +@item v@var{VAR} +@tab +Adds a `view' on variable @var{VAR} (which must be onespot or twospot), +causing its value to be displayed on the screen whenever a command is +printed on screen (for instance, because the command has just been +stepped past, or due to the @samp{m} or @samp{t} commands). +@item w +@tab +Displays the current line and current command onscreen. +@item x@var{VAR} +@tab +Removes any view and any action that may be associated with it on +variable @var{VAR} (which must be onespot or twospot). +@item y@var{VAR} +@tab +Adds a view on variable @var{VAR}; also causes a break, as if a +breakpoint was reached, whenever the value of that variable changes. +@item z@var{VAR} +@tab +Adds a view on variable @var{VAR}; also causes a break, as if a +breakpoint was reached, whenever that variable's value becomes 0. +@item @var{VAR} +@tab +A onespot or twospot variable written by itself prints out the value of +that variable. +@item <@var{VAR} +@tab +@command{WRITEs IN} a new value for variable @var{VAR}. Note that input +must be in the normal @samp{ONE TWO THREE} format; input in any other +format will cause error E579 (@pxref{E579}) and as that is a fatal +error, the debugger and program it's debugging will end. +@item * +@tab +Displays the license conditions under which @command{ick} is +distributed. +@item ? +@tab +Displays a summary of what each command does. (@samp{@@} does the same +thing.) +@end multitable + +While the code is executing (for instance, during a @samp{c}, @samp{k}, +@samp{o}, @samp{t} or @samp{u} command), it's possible to interrupt it +with @kbd{@key{CTRL}-@key{C}} (on UNIX/Linux) or +@kbd{@key{CTRL}-@key{BREAK}} (on Windows/DOS); this will cause the +current command to finish running and the debugger prompt to come back +up. + +@ifset notsplit +@partheading PART II: THE @ical{} LANGUAGE +@end ifset +@node Syntax +@chapter Syntax +@cindex syntax, INTERCAL +@cindex INTERCAL, syntax + +@ical{} programs consist of a list of statements. Execution of a +program starts with its first statement; generally speaking each +statement runs after the previous statement, although many situations +can change this. + +Whitespace is generally insignificant in @ical{} programs; it cannot be +added in the middle of a keyword (unless the keyword contains whitespace +itself) or inside a decimal number, but it can be added more or less +anywhere else, and it can be removed from anywhere in the program as +well. + +An @ical{} statement consists of an optional line label, a statement +identifier, an optional execution chance, the statement itself +(@pxref{Statements}), and optionally @code{ONCE} or @code{AGAIN}. + +@menu +* Line Labels:: Allowing lines to be referred to +* Statement Identifiers:: Marking the start of a statement +* Execution Chance:: Statements that might not execute +* ONCE and AGAIN:: Self-abstaining and self-reinstating statements +@end menu + +@node Line Labels +@section Line Labels +@cindex line label +@cindex line number + +@portability{yes, all versions, all versions} + +The first part of an @ical{} statement is a line label that specifies +what its line number is. This is optional; it's allowed to have a +statement without a line number, although that prevents other commands +referring to it by number. Line numbers must be constants, and unique +within the program. However, they do not have to be in order; unlike +some other languages with line numbers, a line with a higher number can +come earlier in the program than a line with a lower number, and the +numbers don't affect the order in which commands are executed. + +A line label is a integer expressed in decimal within a wax/wane pair +(@code{(} and @code{)}). For instance, this is a valid line label: + +@example +(1000) +@end example + +Note that line numbers from 1000 to 1999 are used by the system library, +so using them within your own programs may produce unexpected errors if +the system library is included. Apart from this, line numbers from 1 to +65535 are allowed. + +It has become reasonably customary for people writing @ical{} libraries +to pick a range of 1000 line numbers (for instance, 3000 to 3999) and +stick to that range for all line numbers used in the program (apart from +when calling the system library), so if you want to write an @ical{} +library, it may be a good idea to look at the existing libraries (in the +@file{pit/lib} directory in the @cic{} distribution) and choose a range +of numbers that nobody else has used. If you aren't writing a library, +it may be a good idea to avoid such number ranges (that is, use only +line numbers below 1000 or very high numbers that are unlikely to be +used by libraries in the future), so that you can easily add libraries +to your program without renumbering in the future. + +@node Statement Identifiers +@section Statement Identifiers +@cindex statement identifier +@findex DO +@findex PLEASE +@findex NOT +@findex N'T + +@portability{yes, all versions, all versions} + +After the line label (if a statement has one) comes the statement +identifier, which marks where the statement starts. Either the label or +the statement identifier, whichever one comes first, marks where the +preceding statement finishes. + +@anchor{DO}@anchor{PLEASE} +The main statement identifier is @code{DO}. It also has two synonyms, +@code{PLEASE} and @code{PLEASE DO}; these synonyms are the 'polite' +forms of statement identifiers. Although the three identifiers have the +same meaning, using either polite or non-polite identifiers too much can +cause an error; the correct proportion is approximately 3 non-polite +identifiers for every polite identifier used. None of these identifiers +actually does anything else apart from marking where the statement +starts; they leave the statements in the default `reinstated' state. + +@anchor{NOT}@anchor{N'T} +Adding @code{NOT} or @code{N'T} to the end of any of these identifiers, +to create a statement identifier such as @code{DO NOT} or @code{PLEASE +DON'T}, also creates a valid statement identifier. These differ in +meanings from the previous set of identifiers, though; they cause the +statement they precede to not be executed by default; that is, the +command will be skipped during execution (this is known as the +`abstained' state). This applies even if the command in question is in +fact a syntax error, thus causing this to be a useful method of writing +comments. One common idiom is to write code like this: + +@example +PLEASE NOTE: This is a comment. +@end example + +The statement identifier (@code{PLEASE NOT}) is the only part of this +statement that is valid @ical{}; however, because the statement +identifier is in the negated form that contains @code{NOT}, the syntax +error won't be executed, and therefore this is a valid statement. (In +@ical{}, syntax errors happen at runtime, so a program containing a +statement like @code{DOUBT THIS WILL WORK} will still compile, and will +not end due to the syntax error unless that statement is actually +executed. @xref{E000}.) + +The @code{ABSTAIN} and @code{REINSTATE} statements can override the +@code{NOT} or otherwise on a statement identifier; @xref{ABSTAIN}. + +In backtracking programs, @code{MAYBE} is also a valid statement +identifier; @xref{MAYBE}. It comes before the other keywords in the +statement identifier, and an implicit @code{DO} is added if there wasn't +one already in the statement identifier (so @code{MAYBE}, @code{MAYBE +DO}, @code{MAYBE DON'T}, @code{MAYBE PLEASE}, and so on are all valid +statement identifiers). + +@node Execution Chance +@section Execution Chance +@cindex execution chance +@cindex double-oh-seven +@findex % + +@portability{yes, all versions, all versions} + +It's possible to specify that a command should be run only a certain +proportion of the time, at random. This is a rarely used feature of +@ical{}, although it is the only way to introduce randomness into a +program. (The @cic{} compiler approximates this with pseudorandomness.) +An execution chance specification comes immediately after the statement +identifier, but before the rest of the statement, and consists of a +double-oh-seven (@code{%}) followed by an integer from 1 to 99 +inclusive, written in decimal; this gives the percentage chance of the +statement running. The execution chance only acts to prevent a +statement running when it otherwise would have run; it cannot cause a +statement that would otherwise not have run to run. For instance, the +statement @code{DO %40 WRITE OUT #1} has a 40% chance of writing out +@samp{I}, but the statement @code{DON'T %40 WRITE OUT #1} has no chance +of writing out @code{I} or anything else, because the @code{N'T} +prevents it running and the double-oh-seven cannot override that. + +@node ONCE and AGAIN +@section ONCE and AGAIN +@cindex ABSTAIN, self-abstaining +@cindex REINSTATE, self-reinstating +@cindex self-abstaining +@cindex self-reinstating +@findex ONCE +@findex AGAIN +@anchor{ONCE}@anchor{AGAIN} + +@portability{no, version 0.25+, no} + +The last part of a statement is an optional @code{ONCE} or @code{AGAIN}. +@code{ONCE} specifies that the statement is self-abstaining or +self-reinstating (this will be explained below); @code{AGAIN} specifies +that the statement should behave like it has already self-reinstated or +self-abstained. Whether the behaviour is self-abstention or +self-reinstatement depends on whether the statement was initially +abstained or not; a @code{ONCE} on an initially reinstated statement or +@code{AGAIN} on an initially abstained statement indicates a +self-abstention, and a @code{ONCE} on an initially abstained statement +or @code{AGAIN} on an initially reinstated statement indicates a +self-reinstatement. + +The first time a self-abstaining statement is encountered, it is +executed as normal, but the statement is then abstained from and +therefore will not run in future. Likewise, the first time +self-reinstating statement is encountered, it is not executed (as is +normal for an abstained statement), but then becomes reinstated and will +run in future. In each of these cases, the @code{ONCE} effectively +changes to an @code{AGAIN}; the @code{ONCE} only happens once, as might +be expected. + +@code{REINSTATING} a currently abstained self-abstaining statement or +@code{ABSTAINING} (that is, with the @code{ABSTAIN} or @code{REINSTATE} +commands) a currently reinstated self-reinstating statement causes the +@code{AGAIN} on the statement to change back into a @code{ONCE}, so the +statement will again self-abstain or self-reinstate. Likewise, +@code{REINSTATING} a currently abstained self-reinstating statement or +@code{ABSTAINING} a currently reinstated self-abstaining statement +causes its @code{ONCE} to turn into an @code{AGAIN}. + +Historical note: @code{ONCE} was devised by Malcom Ryan as a method of +allowing synchronisation between threads in a multithreaded program +(@code{ONCE} is atomic with the statement it modifies, that is, there is +no chance that threads will change between the statement and the +@code{ONCE}). @code{AGAIN} was added to Malcom Ryan's Threaded Intercal +standard on the suggestion of Kyle Dean, as a method of adding extra +flexibility (and to allow the @code{ONCE}s to happen multiple times, +which is needed to implement some multithreaded algorithms). + +@node Expressions +@chapter Expressions +@cindex expressions + +Many @ical{} statements take expressions as arguments. Expressions are +made up out of operands and operators between them. Note that there is +no operator precedence in @ical{}; different compilers resolve +ambiguities different ways, and some versions of some compilers +(including the original @icst{} compiler) will cause error messages on +compiling or executing an ambiguous expression, so it's safest to fully +group each expression. + +@menu +* Constants and Variables:: The basic operands that make up expressions +* Grouping Rules:: How to specify grouping in expressions +* Operators:: Joining operands into more complex expressions +@end menu + +@node Constants and Variables +@section Constants and Variables +@cindex constant +@cindex variable +@cindex mesh +@cindex onespot +@cindex twospot +@cindex tail +@cindex hybrid +@findex # +@findex . +@findex : +@findex , +@findex ; + +@portability{yes, all versions, all versions} + +The basic operands in @ical{} are constants and variables. These +together make up what in other languages are known as `lvalues', that +is, operands to which values can be assigned. (Constants can also be +lvalues in @ical{}, but by default @cic{} turns this off because it +carries an efficiency penalty and can be confusing; this can be turned +on with the @option{-v} option (@pxref{-v}).) + +Constants can have any integer value from 0 to 65535 inclusive; higher +values (up to 4294967295) can be generated in programs, but cannot be +specified literally as constants. (The usual way to work around this +limitation is to interleave two constants together; @xref{Mingle}.) A +constant is written as a mesh (@code{#}) followed by a number in +decimal. At the start of the program, all constants have the same value +as the number that identifies them; for instance, @code{#100} has 100 as +its value, and it's strongly advised not to change the value of a +constant during the execution of a program. + +There are four types of variable: 16-bit and 32-bit unsigned integers, +and arrays of 16-bit and 32-bit unsigned integers. These are +represented with a spot, twospot, tail, and hybrid (@code{.}, @code{:}, +@code{,}, and @code{;}) respectively. For this reason, integers within +the range 0 to 65535 inclusive are known as `onespot numbers', and +integers within the range 0 to 4294967295 inclusive are known as +`twospot numbers'; variables with those ranges are known as onespot and +twospot variables. + +Variables are represented with a character representing their data type, +followed by an integer from 1 to 65535 inclusive, written in decimal. +Non-array variables don't need to be declared before they are used; they +automatically exist in any program that uses them. For instance, +@code{.1} and @code{.001} are the same variable, onespot number 1. +Array variables need to be dimensioned before they are used, by +assigning dimensions to them; @xref{Calculate}. + +@node Grouping Rules +@section Grouping Rules +@cindex grouping rules +@cindex positional precedence +@cindex spark +@cindex rabbit-ears +@cindex ears +@findex ' +@findex " + +Because there are no operator precedences in @ical{}, there are various +solutions to specifying what precedences actually are. + +@table @asis + +@item The portable solution + +All known versions of @ical{} accept the @icst{} grouping rules. These +state that it's possible to specify that an operator takes precedence by +grouping it inside sparks (@code{'}) or rabbit-ears (@code{"}), the same +way as wax/wane pairs (parentheses) are used in other programming +languages. @icst{} and earlier @cic{} versions demanded that +expressions were grouped fully like this, and this practice is still +recommended because it leads to portable programs and is easier to +understand. Whether sparks or rabbit-ears (often called just `ears' for +short) are used normally doesn't matter, and programmers can use one or +the other for clarity or for aesthetic appeal. (One common technique is +to use just sparks at the outermost level of grouping, just ears at the +next level, just sparks at the next level, and so on; but expressions +like @code{''#1~#2'~"#3~#4"'~#5} are completely unambiguous, at least to +the compiler.) + +There are, however, some complicated situations involving arrays +subscripting where it is necessary to use sparks and ears at alternate +levels, if you want to write a portable program. This limitation is in +@cic{} to simplify the parsing process; @icst{} has the same limitation, +probably for the same reason. Compare these two statements: + +@example +DO .1 <- ,3SUB",2SUB.1".2 +DO .1 <- ,3SUB",2SUB.1".2~.3"".4 +@end example + +The problem is that in the first statement, the ears close a group, and +in the second statement, the ears open a group, and it's impossible to +tell the difference without unlimited lookahead in the expression. +Therefore, in similar situations (to be precise, in situations where a +group is opened inside an array subscript), it's necessary to use the +other grouping character to the one that opened the current group if you +want a portable program. + +One final comment about sparks and rabbit-ears; if the next character in +the program is a spot, as often happens because onespot variables are +common choices for operands, a spark and the following spot can be +combined into a wow (@code{!}). Unfortunately, none of the character +sets that @cic{} accepts as input (UTF-8, Latin-1, and ASCII-7) contain +the rabbit character, although the Hollerith input format that @clcic{} +can use does. + +@item Positional precedences: @clcic{} rules + +The precedence rules used by @clcic{} for grouping when full grouping +isn't used are simple to explain: the largest part of the input that +looks like an expression is taken to be that expression. The main +practical upshot of this is that binary operators right-associate; that +is, @code{.1~.2~.3} is equivalent to @code{.1~'.2~.3'}. @cic{} versions +0.26 and later also right-associate binary operators so as to produce +the same results as @clcic{} rules in this situation, but as nobody has +yet tried to work out what the other implications of @clcic{} rules are +they are not emulated in @cic{}, except possibly by chance + +@ianchor Prefix and infix unary operators +@cindex unary operator, prefix +@cindex unary operator, infix + +In @icst{} and versions of @cic{} before 0.26, unary operators were +always in the `infix' position. (If you're confused about how you can +have an infix unary operator: they go one character inside a group that +they apply to, or one character after the start of a constant or +variable representation; so for instance, to portably apply the unary +operator @code{&} to the variable @code{:1}, write @code{:&1}, and to +portably apply it to the expression @code{'.1~.2'}, write +@code{'&.1~.2'}.) @clcic{}, and versions of @cic{} from 0.26 onwards, +allow the `prefix' position of a unary operator, which is just before +whatever it applies to (as in @code{&:1}). This leads to ambiguities as +to whether an operator is prefix or infix. The portable solution is, of +course, to use only infix operators and fully group everything, but when +writing for recent versions of @cic{}, it's possible to rely on its +grouping rule, which is: unary operators are interpreted as infix where +possible, but at most one infix operator is allowed to apply to each +variable, constant, or group, and infix operators can't apply to +anything else. So for instance, the @cic{} @code{'&&&.1~.2'} is +equivalent to the portable @code{'&"&.&1"~.2'} (or the more readable +version of this, @code{"&'"&.&1"~.2'"}, which is also portable). If +these rules are counter-intuitive to you, remember that this is @ical{} +we're talking about; note also that this rule is unique to @cic{}, at +least at the time of writing, and in particular @clcic{} is likely to +interpret this expression differently. + +@end table + +@node Operators +@section Operators +@cindex operator + +Operators are used to operate on operands, to produce more complicated +expressions that actually calculate something rather than just fetch +information from memory. There are two types of operators, unary and +binary operators, which operate on one and two arguments respectively. +Binary operators are always written between their two operands; to +portably write a unary operator, it should be in the `infix' position, +one character after the start of its operand; see @ref{Prefix and infix +unary operators} for the full details of how to write unary operators +portably, and how else you can use them if you aren't aiming for +portability. This section only describes @icst{} operators; many +@ical{} extensions add their own operators. + +@menu +* Mingle:: Interleaving bits in two operands +* Select:: Selecting from one operand according to another +* Unary Binary Logic:: Binary logic on adjacent bits of an operand +@end menu + +@node Mingle +@subsection Mingle +@cindex mingle +@cindex interleave +@findex $ + +@portability {yes, all versions, all versions} + +Mingle, or interleave, is one of the two binary operators in @icst{}. +However, different @ical{} compilers represent it in different ways, so +it is impossible to write a mingle in a program completely portably. + +The original @icst{} compiler (the Princeton compiler) used the 'change' +(cent) character for a mingle, represented as @code{c}, backspace, +@code{/}. (By the way, this is still the most portable way to write a +mingle; both @cic{} and @clcic{} accept it, at least if a lowercase +@code{c} is used; @clcic{} also accepts a capital @code{C} before the +backspace and @code{/}, and allows @code{|} rather than @code{/}.) The +Atari compiler, another @icst{} compiler, used a 'big money' character +(@code{$}) as the mingle character. @cic{} originally also used the +@code{$} character for mingle, and this character is the one most +commonly seen in existing @cic{} programs, and most often used when +giving examples of @ical{} on Usenet, because it exists in the ASCII-7 +character set, and because it doesnt contain control characters. From +version 0.18 of @cic{} onwards, various other units of currency (change, +quid, and zlotnik if Latin-1 is used as the input, and euro if Latin-9 +is used as the input) are accepted; from version 0.20 onwards, in +addition to the Latin-1 characters, all the currency symbols in Unicode +are accepted if UTF-8 is used as the input format. @cic{} has always +used the change character (either the Latin-1 version or the version +that contains a backspace) for mingle. In this manual, mingle will be +represented as @code{$}, but it's important to bear in mind that this +character is not the most portable choice. + +The mingle operator should be applied to two operands or expressions. +To be portable, the operands must both be onespot expressions, that is +expressions which have a 16-bit result; @cic{} relaxes this rule +slightly and only requires that the result be in the onespot range. +(This is because the data type of a select operator's value is meant to +be determined at runtime; @cic{} determines all data types at compile +time, so has to guess a 32-bit result for a select with a 32-bit type as +its right operand even when the result might actually turn out to be of +a 16-bit type, and so this behaviour prevents an error when a select +operation returns a value with a 16-bit data type and is used as an +argument to amingle.) The result is a 32-bit value (that is, it is of a +32-bit data type, even if its value fits into the onespot range), which +consists of bits alternated from the two arguments; to be precise, its +most significant bit is the most significant bit of its first argument, +its second most significant bit is the most significant bit of its +second argument, its third most significant bit is the second most +significant bit of its first argument, and so on until its least +significant bit, which is the least significant bit of its second +argument. + +One of the most common uses of interleaving is to create a constant with +a value greater than 65535; for instance, 65536 is @code{#256$#0}. It +is also commonly used in expressions that need to produce 32-bit +results; except in some simple cases, this is usually coded by +calculating separately the odd-numbered and even-numbered bits of the +result, and mingling them together at the end. It is also used in +expressions that need to left-shift values or perform similar +value-increasing operations, as none of the other operators can easily +do this; and mingle results are commonly used as the argument to unary +binary logic operators, because this causes them to behave more like the +binary logic operators found in some other languages. + +@node Select +@subsection Select + +@portablity{yes, all versions, all versions} + +The select operator is one of the two binary operators in @icst{}; +unlike mingle, every known implementation of @ical{} ever has used the +sqiggle character (@code{~}) as the representation of the select +operator, meaning that writing it portably is easy. + +The select operator takes two arguments, which can be of either datatype +(that is, 16- or 32-bit). It returns a value made by selecting certain +bits of its first operand indicated by the second operand, and +right-justifying them. What it does is ignores all the bits of the +first operand where the second operand has a 0 as the corresponding bit, +that is, deletes them from a copy of the operand's value; the bits that +are left are squashed together towards the least-significant end of the +number, and the result is filled with 0s to make it up to 16 or 32 +bits. (In @icst{} the minimum multiple of 16 bits possible that the +result fits into is chosen, although if :1 has the value 131061 (in hex, +1FFFF) the expression @code{#21~:1} produces a 32-bit result because 17 +bits were selected, even though many of the leading bits were zeros; in +@cic{} the data type of the result is the same as of the right operand +of the select, so that it can be determined at run time, and so using a +unary binary logic operator on the result of select when the right +operand has a 32-bit type is nonportable and not recommended.) As an +example, @code{#21~:1} produces 21 as its result if :1 has the value +131061, 10 as its result if :1 has the value 30 (1E in hex; the +least significant bit of 21 is removed because it corresponds to a 0 in +:1), and 7 as its result if :1 has the value 21 (because three bits in +21 are set, and those three bits from 21 are therefore selected by 21). + +Select is used for right-shifts, to select every second bit from a +number (either to produce what will eventually become an argument to +mingle, or to interpret the result of a unary binary logic operator, or +occasionally both), to test if a number is zero or not (by selecting it +from itself and selecting 1 from the result), in some cases as a limited +version of bitwise-and (that only works if the right operand is 1 less +than a power of 2), and for many other purposes. + +@node Unary Binary Logic +@subsection Unary Binary Logic +@cindex unary binary logic +@cindex and +@cindex or +@cindex xor +@cindex exor +@cindex exclusive or +@findex ? +@findex & +@findex V +@cindex what +@cindex ampersand +@cindex book + +@portability{yes, all versions, all versions} + +There are three unary operators in @icst{}, each of which carries out a +binary logic operation on adjacent bits of the number. The operators are +and, or, and exclusive or; and and or are represented by an ampersand +(@code{&}) and book (@code{V}) respectively, and exclusive or has the +same notational problems as mingle. It was represented by a bookworm, +written @code{V}, backspace, @code{-}, in the Princeton @icst{} +implementation, and this is still the most portable way to write it +(@cic{} and @clcic{} accept it). The Atari implementation of @icst{} +wrote it with a what (@code{?}), and this is the representation +originally used by @cic{} (and still accepted), the one most commonly +used on Usenet, and the one used in this manual (although again, it's +worth pointing out that this isn't portable). @clcic{} approximates a +bookworm with the yen character, which being a currency character is one +of the possible representations for mingle in @cic{}; therefore, @cic{} +will only execute a @clcic{} program which contains yen-represented +exclusive ors if the @clcic{} compatibility option @code{-X} is used +(@pxref{-X+,,-X}). (In the same way, @clcic{} has a @cic{} +compatibility option to allow the use of @code{?} for exclusive-or.) + +The operators take each pair of consecutive bits in their arguments +(that is, the least significant with the second least significant, the +second least significant with the third least significant, the third +least significant with the fourth least significant, and so on, with the +pair consisting of the most significant and least significant being used +to calculate the most significant bit of the result), and perform an +appropriate logic operation on them; and sets a bit of the result if and +only if both bits in the pair were set, or sets each bit corresponding to +each pair where either bit was set, and exclusive or sets if and only if +the bits in the pair had different values (that is, one was set, but not +both). So for instance, @code{#&26} is 16 (26 is 1A in hexadecimal or +11010 in binary); @code{#V26} is 31 (11111 in binary), and @code{#?26} +is 23 (10111 in binary). + +The most commonly seen use for these operators is to carry out bitwise +ands, ors, and exclusive ors between two different 16-bit expressions, +by mingling them together, applying a unary binary logic operator, and +selecting every second bit of the result; such code often results due to +people thinking in terms of some other language when writing @ical{}, +but is still often useful. (Historically, the first idiom added to the +optimizer, apart from constant folding, was the mingle/unary/select +sequence.) There are more imaginative uses; one impressive example is +the exclusive or in the test for greater-than from the original @icst{} +system library: + +@example +DO :5 <- "'?":1~'#65535$#0'"$":2~'#65535$#0'"' + ~'#0$#65535'"$"'?":1~'#0$#65535'"$":2~'#0$ + #65535'"'~'#0$#65535'" +DO .5 <- '?"'&"':2~:5'~'"'?"'?":5~:5"~"#65535~ + #65535"'~'#65535$#0'"$#32768'~'#0$#65535'" + $"'?":5~:5"~"#65535$#65535"'~'#0$#65535'"' + "$"':5~:5'~#1"'~#1"$#2'~#3 +@end example + +The first statement works out the value of :1 bitwise exclusive or :2; +the second statement then works out whether the most significant set bit +in :5 (that is, the most significant bit that differs between :1 and :2) +corresponds to a set bit in :2 or not. In case that's a bit too +confusing to read, here's the corresponding optimizer idiom (in OIL): + +@example +((_1~:2)~((?(:2~:2))^#2147483648))->(_1>(:2^_1)) +@end example + +(Here, the ^ refers to a bitwise exclusive or, an operation found in OIL +but not in @ical{}, which is why the @ical{} version is so much longer.) +The @ical{} version also has some extra code to check for equality and +to produce 1 or 2 as the output rather than 0 or 1. + +@node Statements +@chapter Statements + +@ifset notsplit +@partheading PART III: @ical{} DIALECTS AND EXTENSIONS +@end ifset +@node TriINTERCAL +@chapter TriINTERCAL + +@c first available in 0.7 + +@node Multithreading and Backtracking +@chapter Multithreading and Backtracking + +@node Operand Overloading +@chapter Operand Overloading + +@node PIC-INTERCAL +@chapter PIC-INTERCAL + +@node Differences to Other Compilers +@chapter Differences to Other Compilers + +@ifset notsplit +@partheading PART IV: APPENDICES AND INDICES +@end ifset +@node Optimizer Idiom Language +@appendix Optimizer Idiom Language +@cindex Optimizer Idiom Language +@cindex OIL + +One file in the @cic{} distribution (@file{src/idiotism.oil}) is written +in Optimizer Idiom Language, a programming language designed especially +for expressing optimizer idioms for @ical{} in an easily editable form +(well, at least it's easier than the unmaintainable set of idioms +hard-coded in C that were used in previous versions of the @ical{} +compiler). + +@menu +* Basics: OIL Basics. The basics of how an OIL program works. +* Syntax: OIL Syntax. How to write comments, idioms, and groups. +* Expressions: OIL Expressions. Expressions are the basis of idioms. +* Patterns: OIL Patterns. Filling in the left hand side of an idiom. +* Replacements: OIL Replacements. Syntax for the right hand side. +* Loops: OIL Loops. Simplifying and shortening programs. +* Tips: OIL Tips. Some tips about using OIL. +* Example: OIL Example. An example of how OIL can work. +@end menu + +@node OIL Basics +@appendixsec OIL Basics +@cindex OIL, basics +@cindex @file{src/idiotism.oil} +@cindex @file{idiotism.oil} +@cindex OIL, execution + +The structure of an @acronym{OIL} file consists of a sequence of idioms. +An optimizer idiom looks for a certain pattern in an expression (which +could be an @ical{} expression, or an expression that has already been +partly optimized and therefore contains some non-@ical{} operators), and +replaces it with a replacement that's `simpler' in some sense (in the +case of @cic{}, `simpler' is interpreted to mean `compiles into a faster +or smaller executable when run through a C compiler'). When an +@acronym{OIL} program acts on an input @ical{} file, it keeps on +matching idioms to simplify expressions, until none of the idioms act +any more (and if a situation occurs where idioms can keep matching +indefinitely, the compiler goes into an infinite loop; so don't allow +that to happen); at present, the idioms are tried from left to right, +from the leaves of an expression to its root, and from the start of the +OIL file to the end; but don't rely on that, because it's subject to +change (and gets confusing when you think about what happens when the +program actually does a replacement). Anyway, the point is that if an +idiom can match an expression, and another idiom doesn't change it +first, then the idiom will be matched against that part of the +expression eventually, and the program won't end until there are no +idioms that match the optimized expression. + +At present, the only place that @acronym{OIL} is used in the @cic{} +compiler is when the @option{-O} option (@pxref{-O+,,-O}) is used in +base 2. (Syntax is planned to extend @acronym{OIL} to higher bases, and +some of this is documented and even implemented, but there's no way to +use it.) The idioms are read from the file @file{src/idiotism.oil} +during the compilation of the @cic{} from sources; you can change the +idioms, but you will then have to recompile the distribution (and if you +are using the @command{config.sh} method, also reinstall, but that will +be pretty fast.) + +@node OIL Syntax +@appendixsec OIL Syntax +@cindex OIL, syntax +@cindex syntax, of OIL + +An @acronym{OIL} file is encoded as an @acronym{ASCII} text file using +no codepoints outside the range 0-127; using 10 for newline (as on a +UNIX or Linux system) is always acceptable, but using 13 then 10 (as is +common on Windows or DOS) for newline is acceptable only if your C +compiler recognizes that as a newline. I have no idea what happens if +you use just 13 on an Apple computer on which that is the common newline +convention. + +@cindex OIL, comments +@cindex comments, OIL +Comments can be given anywhere in the file by writing lines starting +with semicolons (known as hybrids to @ical{} programmers). It's also +possible to write a semicolon after part of a line to comment out the +rest of the line. Inside braced C expressions, comments can be given +anywhere whitespace would be allowed by placing them between @code{/*} +and @code{*/} (in such cases, the comments will be copied verbatim to +the C temporary files used when building the @cic{} compiler, where your +C compiler will ignore them). Whitespace is ignored nearly everywhere; +the only places it isn't ignored are in the middle of a decimal +constant, inside square brackets, immediately after one of the +characters @samp{.:#_@}}, and anywhere that C doesn't allow it in quoted +C code. (This means that you can even place it inside operators like && +if you like, as long as they're part of OIL code and not C code, +although doing this is not recommended.) If you use whitespace in a +situation where it isn't ignored, that's almost certainly an error. + +@cindex OIL, idiom groups +Idioms are grouped into groups of idioms by placing an identifier in +square brackets before the group; this follows the rules for C +identifiers, except that there's a maximum length of 30 characters. +This identifier is the `name' of the group, which has no effect except +on optimizer debug output; for that matter, the only effect a group has +is that all idioms in the group look the same in optimizer debug output, +because they have the same name. It's recommended that idioms only have +the same name if they are the same idiom, possibly written in several +ways. For example, a shift by 0 has no effect and may as well be +removed from the output; the way to express this in OIL is: + +@example +[nullshift] +(_1 >> #0)->(_1) +(_1 << #0)->(_1) +@end example + +Here, nullshift is the name of the group of idioms, and two idioms are +given; one which removes a null rightshift, and one which removes a null +leftshift. + +@cindex OIL, idioms +@cindex idiom +As the example above shows, the syntax of an idiom itself is + +@example +(pattern)->(replacement) +@end example + +The parentheses here are actually part of the pattern and/or +replacement, and as such sparks (apostrophes) or rabbit-ears (double +quotes) can be used instead; they're shown in the syntax because the +outer layer of parenthesising is always required. Both the pattern and +replacement are @acronym{OIL} expressions, although they both have their +own special syntax elements as well. + +@node OIL Expressions +@appendixsec OIL Expressions +@cindex expressions, OIL +@cindex OIL, expressions + +An @acronym{OIL} expression is built around subexpressions connected by +infix binary operators and/or preceded by prefix unary operators, the +same way as in C or @ical{} (although unary operators must be entirely +before their argument; the one character later position is not allowed.) +As in @ical{}, there is no operator precedence; expressions must be very +fully bracketed to show unambiguously what the precedences must be, and +then more so; for instance, bracketing marks must be placed around the +argument of a unary operator in most circumstances. Bracketing of +expressions can be done with parentheses, sparks (apostrophes) or +rabbit-ears (double-quotes). + +The following unary and binary operators are allowed in OIL expressions: + +@cindex OIL, operators +@cindex operators, OIL +@multitable {@code{@@2..@@5}} {@ical{} unary generalised whirlpool} +@item @code{$} @tab INTERCAL mingle +@item @code{~} @tab INTERCAL select +@item @code{&} @tab INTERCAL unary AND +@item @code{V} @tab INTERCAL unary OR +@item @code{?} @tab INTERCAL unary XOR +@item @code{^} @tab INTERCAL unary sharkfin +@item @code{@@} @tab INTERCAL unary whirlpool +@item @code{@@2..@@5} @tab INTERCAL unary generalised whirlpool +@item @code{&} @tab C binary bitwise AND +@item @code{|} @tab C binary bitwise OR +@item @code{^} @tab C binary bitwise XOR +@item @code{+} @tab C addition +@item @code{-} @tab C subtraction +@item @code{*} @tab C multiplication +@item @code{/} @tab C integer division +@item @code{%} @tab C modulus +@item @code{>} @tab C greater than +@item @code{<} @tab C less than +@item @code{~} @tab C unary bitwise complement +@item @code{!=} @tab C not equals operator +@item @code{==} @tab C equals operator +@item @code{&&} @tab C logical AND +@item @code{||} @tab C logical OR +@item @code{>>} @tab C bitwise rightshift +@item @code{<<} @tab C bitwise leftshift +@item @code{!} @tab C unary logical NOT +@end multitable + +(Note that in some cases two operators are expressed the same way, but +that this doesn't matter because one is unary and the other is binary so +that there can't be any ambiguity, only confusion.) + +It hasn't yet been explained what operands these operators have to +operate on; the syntax for those depends on whether it's a pattern or +replacement that the expression is representing. + +@node OIL Patterns +@appendixsec OIL Patterns +@cindex patterns +@cindex OIL, patterns + +Patterns are simply @acronym{OIL} expressions; the expressions match +either original @ical{} input or expressions produced by earlier idioms. +Each operator must match the same operator in the (possibly +partially-optimised) input; the operands themselves are pattern +templates specifying what operands in the input they can match. + +One special simple form of match is possible: @code{#@var{NUMBER}}, +where @var{NUMBER} is in decimal, matches a constant with that value. +(Unlike in @ical{}, this constant is not limited to being a onespot +value; it is, however, limited to being at most twospot, as are all +operands and intermediate values in @acronym{OIL}.) + +Otherwise, an operand consists of the following parts, written in order: + +@cindex operands, OIL, in patterns +@cindex patterns, operands +@enumerate + +@item +A character to specify the data type of what's being matched. Usually, +this will be @code{_} to specify that any data type can be matched. In +a few cases, you may want to use @code{.} or @code{:} to specify that +you only want to match a onespot or twospot value respectively (that is, +16- or 32-bit). You can also use @code{#}; this specifies a value that +can be any width, but must be known to be a constant with a known value +at optimize time (either because it was hardcoded as a constant +originally or because a constant was produced there by the optimizer, +for instance via a constant folding optimization). + +@item +Optionally, an expression in braces (@code{@{} and @code{@}}). This +expression is written in C, not @acronym{OIL} (as are all expressions in +braces), and puts an extra condition on whether the pattern matches. +The exact meaning of this will be explained later. + +@item +A reference number, which must be one decimal digit long. A reference +number of 0 causes the operand to be discarded immediately after +matching; normally, you will want to specify a positive reference +number. Two operands with the same reference number must be exactly the +same for the pattern to match (for instance, both references to the same +variable, or identical subexpressions). The reference number also +allows the operand to be referenced by C expressions on other operands +and by replacements. Reference numbers must be unique within the idiom +(unless two or reference numbers are deliberately the same so that the +operands they reference have to be identical to produce a match), and +they are scoped only as far as the containing idiom; they don't carry +from one idiom to another. + +@end enumerate + +Note that syntax like @code{#2} is ambiguous given what comes so far; +the first interpretation is the one that is taken in practice, and if +the second interpretation is wanted the operand should be expressed as +@code{#@{1@}2}, using a no-op braced expression to tell them apart. +This particular no-op is recommended because it's detected and optimized +by the @code{OIL} compiler. + +Braced expressions, which must be written purely in C, add extra +conditions; they must return nonzero to allow a possible match or zero +to prevent one. They can reference the following variables and +functions: + +@cindex functions, OIL in C +@cindex OIL, functions in C +@cindex C, within OIL +@anchor{C functions in OIL} +@table @code + +@item c +@itemx c@var{NUMBER} +@findex c +@findex c1--c9 + +This accesses a calculation made automatically by the compiled +@acronym{OIL} program to identify which bits of the operand can possibly +be set, and which ones cannot be. @code{c} by itself refers to the +operand to which the braced expression is attached; if a number is +given, it refers to another node (the number is interpreted as a +reference numer). The actual value of @code{c} is a 32-bit unsigned +integer, each bit of which is true, or 1, if there is any chance that +the corresponding bit of the operand might be 1, and false, or 0, if +it's known for certain that the corresponding bit of the operand is 0. + +For instance: + +@example +_@{!(c&4294901760LU)@}1 +@end example + +The constant given here is FFFF0000 when expressed in hexadecimal; the +point is that the expression matches any operand that is known to have a +value no greater than 65535. Unless the operand is the argument to a +unary AND, this check generally makes more point than explicitly +specifying @code{.} rather than @code{_}, because it will identify both +16- and 32-bit values as long as they're small enough to fit into a +onespot variable. This code could, for instance, be used to check that +an argument to a mingle must be small enough before optimising it (this +is important because an optimisation shouldn't optimise an error -- in +this case, an overflowing mingle -- into a non-error). + +@item x +@itemx x@var{NUMBER} +@findex x +@findex x1--x9 + +@code{x} is like @code{c}, and refers to operands in the same way, +except that it can only refer to an operand marked with @code{#}. It +holds the value of that constant (a 32-bit unsigned integer), which will +be known to the optimizer at optimize time. One common use of this is +to detect whether a constant happens to be a power of 2, although there +are many other possibilities that may be useful. + +@item r +@findex r + +When inside a loop, @code{r} is the value of the loop counter. (It's +almost certainly a mistake if you have a loop but don't reference the +loop counter at least once, and usually at least twice, within the +loop.) @xref{OIL Loops}. + +@item and16 +@itemx and32 +@itemx or16 +@itemx or32 +@itemx xor16 +@itemx xor32 +@itemx iselect +@itemx mingle +@findex and16 +@findex and32 +@findex or16 +@findex or32 +@findex xor16 +@findex xor32 +@findex iselect +@findex mingle + +These are all functions with one argument (apart from iselect and +mingle, which each take two arguments); they exist so that @ical{} +operators can be used by C expressions. They all take unsigned longs as +input and output, even if they are onespot operators. Note that it's +entirely possible for these to cause a compile-time error if used on +invalid arguments (such as mingling with an operand over 65535), or to +silently truncate an invalid argument down to the right number of bits; +both of these should be avoided if possible, so the optimiser should +check first to make sure that it doesn't use any of these functions on +invalid arguments. + +@item xselx +@findex xselx + +This function returns its argument selected with itself; so +@code{xselx(c)} is shorthand for @code{iselect(c,c)}. When the argument +is very complicated, this can save a lot of space in the original +@acronym{OIL} program. + +@item setbitcount +@findex setbitcount + +This function simply returns the number of bits with value 1 in its +argument. This is sometimes useful with respect to various +select-related optimisations, and can be a useful alternative to having +to take logarithms in various situations. + +@item smudgeright +@itemx smudgeleft +@findex smudgeright +@findex smudgeleft + +The @code{smudgeright} function returns its argument but with all the +bits less significant than the most significant bit with value 1 set to +1; likewise, @code{smudgeleft} returns its argument with all the bits +more significant than the least significant bit with value 1 set to 1. + +@end table + +Note that all @acronym{OIL} character is done internally using unsigned +32-bit numbers, and C expressions you write should do the same. The +practical upshot of this is that you should write @code{LU} after any +constant you write in C code; if you don't do this, you are reasonably +likely to get compiler warnings, and the resulting program may not work +reliably, although the @acronym{OIL} compiler itself will not complain. + +Here's a more complicated example of an optimizer operand: + +@example +#@{!(x&2863311530LU)&&iselect(x,1431655765LU)== + xselx(iselect(x,1431655765LU))@}3 +@end example + +It helps to understand this if you know that 2863311530 in hexadecimal +is AAAAAAAA and 1431655765 is hexadecimal is 55555555. (It's worth +putting a comment with some frequently-used decimal constants in an +@acronym{OIL} input file to help explain what these numbers mean and +make the code more maintainable.) The operand matches any constant +integer which has no bits in common with AAAAAAAA, and for which if any +bit in common with 55555555 is set, all less significant bits in common +with that number are also set. + +@node OIL Replacements +@appendixsec OIL Replacements +@cindex OIL, replacements +@cindex replacements + +Replacements have much the same syntax as patterns. The expressions are +parsed in much the same way; however, one peculiarity of replacements is +that bitwidths must be specified. @ical{} has a typecaster that figures +out whether each expression is 16 bits or 32 bits wide, but it runs +before the optimizer, and as the optimizer can produce expressions whose +bitwidths don't obey @ical{}'s rules, this information needs to be +inserted somehow in a replacement. In @cic{}, it usually doesn't matter +what the bitwidth is, and in cases where it doesn't matter the normal +operators (@code{$}, @code{~}, and so on) can be used. (Note that the +bit width of the entire replacement is always set to the same bit width +as the bit width of the expression matched by the pattern; so you don't +have to worry about the effect on unary logical operators that might be +operating on the expression being optimized. This is an exception to +the normal bitwidth rules for a replacement.) In cases where it does +matter (due to @cic{}'s lenient interpretation of bitwidth on mingle +inputs, the only place it matters is in the input to @ical{} unary +logical operators), both the bidwidth of the operator and the argument +on which it operates must be explicitly given, and given as the same +value; to set the bitwidth of an operator's result, simply write the +bitwidth (16 or 32 for onespot and twospot respectively) immediately +after the operator; for instance, @code{!=32} will generate a not-equals +operation with a 32-bit bitwidth. If an operator's width is set to 16, +and during the course of execution of the optimized program, a value +that doesn't fit into 16 bits is encountered, that's undefined behaviour +and anything might happen (most likely, though, the program will just +act as though its width had been set to 32 bits instead); this error +condition is not detected. + +@cindex operands, OIL, in replacements +@cindex replacements, operands +Replacement operands are simpler than pattern operands, because there +are only a few forms they can take. + +@table @code +@item _@var{NUMBER} +@itemx .@var{NUMBER} +@itemx :@var{NUMBER} + +This tells the optimiser to copy the operand or expression with +reference number @var{NUMBER} to this point in the replacement used for +the expression matched by the pattern. The three forms are identical; +the last two are provided for aesthetic reasons (it can look better and +be clearer to match @code{.1} in the pattern with @code{.1} in the +replacement, for instance). You cannot use @code{#@var{NUMBER}} here to +copy in a constant from the left-hand side, though, nor +@code{#@{1@}@var{NUMBER}}, because the first means something else and +the second is undefined behaviour (that is, no behaviour for the second +case has been specifically implemented in the compiler and therefore its +behaviour is unpredictable and subject to change in future versions); +use @code{_@var{NUMBER}} to copy over a constant with an unknown at +optimizer compile time (but known at optimize time) value from the left +hand side, as you can do with any other operand being copied. + +@item #@var{NUMBER} + +Insert a constant with the literal value @var{NUMBER} here. + +@item #@{@var{EXPRESSION}@}0 + +Calculate the value of @var{EXPRESSION} (a C expression, which can +reference the same variables and functions as a C expression in a +pattern can; @xref{C functions in OIL}. + +@end table + +As an example, here's an idiom that moves C bitwise AND operations +inside leftshifts. (This is useful because if the optimizer has +generated a large sequence of mixed ANDs and bitshifts, moving all the +ANDs to one end allows them to be clumped together and optimized down to +one AND.) + +@example +((_1 << #@{1@}2) & #@{1@}3)->((_1 & #@{x3>>x2@}0) << _2) +@end example + +@node OIL Loops +@appendixsec OIL Loops +@cindex loops, OIL +@cindex OIL, loops + +When writing idioms, sometimes instead of using very complicated +expressions to try to match multiple situations at once it's easier to +have a separate idiom for each possible situation; for instance, it's +easier to write idioms for right-shift by 1, right-shift by 2, +right-shift by 3, etc.@:, rather than a general idiom to rightshift by any +amount. When the idioms follow a pattern, as they will do in basically +every case of this sort, it's possible to automatically generate them +using a loop. For instance, idioms to optimize a one-bit rightshift +and a two-bit rightshift are: + +@example +(_1~#@{xselx(x)<<1==x&&x@}2)->((_1&_2)>>#1) +(_1~#@{xselx(x)<<2==x&&x@}2)->((_1&_2)>>#2) +@end example + +Adding a loop to automatically generate the idioms, and placing a name +for the group of idioms at the start, produces the following code: + +@example +[rshift] +<#1-#31 +(_1~#@{xselx(x)<((_1&_2)>>#@{r@}0) +> +@end example + +That's 31 different idioms, generated with a loop. As the above example +shows, a loop starts with @code{<#@var{NUMBER}-#@var{NUMBER}} and ends +with @code{>}; a different idiom is generated for each possible value of +the loop counter @code{r} in the range given by the opening line of the +loop. Loops must be placed around idioms, but inside a group of +idioms. Note the use of @code{#@{r@}0} to generate a constant whose +value is equal to the value of the loop counter. + +@node OIL Tips +@appendixsec OIL Tips +@cindex tips, OIL +@cindex OIL, tips + +Here are some tips for the best use of @acronym{OIL}: + +@itemize + +@item +Not all idioms that you might want to write can be expressed in +@acronym{OIL}, although most can. (See the @file{idiotism.oil} file +provided with the distribution for an example of where @acronym{OIL} +gets stuck; it's due to tricky bitwidth problems.) There are some +reasonably obvious ways to fix this deficiency, but if you don't +understand why a language which has no obvious problems but several +subtle deficiencies is appropriate for @ical{}, you don't really get +what @ical{} is about. + +@item +@findex MAXTOFREE +The @acronym{OIL} compiler has a few deficiencies, such as error +messages that don't give you much of an idea of what you did wrong (to +compensate for this, it does give a reasonably accurate line and +character number where the error happened), limits on things like how +deep expressions can be nested and how many idioms are allowed (if you +hit the first, you should really break it up into smaller idioms if +possible, and if you hit the second, increase @code{MAXTOFREE} in oil.y; +this isn't a limit on the number of idioms but on the number of strings +that are allocated internally to process the idioms), and lack of error +checking (invalid @acronym{OIL} may produce errors in the @acronym{OIL} +compiler, or cause the output C code to contain errors or warnings, or +may even appear to work). + +@item +When you have symmetrical operators in an idiom (like C binary logical +operators), you need to write the idiom both ways round (in the same +group of idioms, preferably), or write another idiom to standardise the +format first; the first method can get very tedious when there are many +symmetrical operators in an idiom, and the second is prone to optimizer +loops and subtle errors (both methods have been used in the provided +@file{idiotism.oil} file.) + +@item +Idioms should preferably be as general as possible, broken down into +many separate idioms rather than all as one big idiom, and match the +smallest part of the expression being optimized that is necessary for +the idiom to be correct in all cirucmstances; all of these help to +improve the performance of the optimizer in terms of what it can +optimize. + +@item +If a program's optimizing incorrectly, or you just want to see how the +optimizer deals with a particular program, it's possible to debug the +optimizer by giving the @option{-h}, @option{-H}, or @option{-hH} +(@pxref{-h}) switch to the @cic{} compiler, which will cause debug +information to be output on stderr. @option{-h} will show the initial +and final expressions for each expression that was given as input to the +optimizer, as well as a list of all optimizations used, in a language +that's a sort of mix of C, @ical{}, and @acronym{OIL}; @option{-H} will +do the same, and also show the intermediate stages in the optimization. +@option{-hH} is like @option{-H}, but produces its output entirely in C, +so that the various intermediate stages can be tried with a C compiler, +or for people who are fed up of reading @ical{}. @option{-H} can be a +useful learning resource for people who want to understand how a +particular @ical{} expression works. + +@item +Make sure that the optimizer doesn't change a statement from a run-time +error into something that silently succeeds@! Checking which bits can +and can't be 1 is one good way to avoid this, especially with mingles. +(At present, there are some idioms that can turn run-time errors into +compile-time errors, such as with the expression +@code{''#65535$#65535'$#0'}; this could be avoided, but for the time +being it isn't.) + +@item +You can help@! If you find an idiom that the optimizer isn't optimizing +correctly, feel free to add it, or multiple idioms that come to the same +thing, to @file{idiotism.oil}. In such a case, it would help other +users if you would submit your new optimizer idiom to the project +(@pxref{Reporting Bugs}); this will help other users and future releases +of @ical{}, and also has a chance of allowing other users to check your +new idioms to see if they cause problems or could be written better. + +@end itemize + +@node OIL Example +@appendixsec OIL Example +@cindex OIL, example +@cindex examples, OIL + +To finish off this appendix, here's an example of the power of +@acronym{OIL}; this is the optimization of an idiom from the @icst{} +system library, as shown with @option{-H}; this should give a good idea +of how @acronym{OIL} programs work. (All the relevant idioms are in +@file{idiotism.oil} as of the time of writing.) Note how the expression +is reduced one small step at a time; the smallness of the steps makes +the optimizer more general, because if the original expression had been +slightly different, the optimizer wouldn't have come to the same result +but could have optimized it quite a bit of the way, up to the point +where the optimizations were no longer valid; in an older version of +@ical{}, this idiom was simply hardcoded as a special case and so slight +variations of it weren't optimized at all. If you look at the idioms +themselves, it'll also be apparent how @code{c} (the record of which +bits of an expression can be 1 and which bits can't be) is important +information in being able to apply an optimization more aggressively. + +@smallexample +.3 <- ((((((((.3 $ 0x0) ~ (0x7fff $ 0x1)) $ 0x0) ~ (0x7fff $ 0x1)) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[minglefold] +.3 <- ((((((((.3 $ 0x0) ~ 0x2aaaaaab) $ 0x0) ~ (0x7fff $ 0x1)) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[lshift16] +.3 <- ((((((((((.3 >> 0x0) & 0x7fff) << 0x1) | 0x0) $ 0x0) ~ (0x7fff $ 0x1)) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[noopor] +.3 <- (((((((((.3 >> 0x0) & 0x7fff) << 0x1) $ 0x0) ~ (0x7fff $ 0x1)) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[minglefold] +.3 <- (((((((((.3 >> 0x0) & 0x7fff) << 0x1) $ 0x0) ~ 0x2aaaaaab) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[lshift16] +.3 <- (((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) | 0x0) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[noopor] +.3 <- ((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) $ 0x0) ~ (0x3fff $ 0x3)) $ 0x0) ~ (0xfff $ 0xf)) +[minglefold] +.3 <- ((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) $ 0x0) ~ 0xaaaaaaf) $ 0x0) ~ (0xfff $ 0xf)) +[lshift16] +.3 <- ((((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) | 0x0) $ 0x0) ~ (0xfff $ 0xf)) +[noopor] +.3 <- (((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) $ 0x0) ~ (0xfff $ 0xf)) +[minglefold] +.3 <- (((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) $ 0x0) ~ 0xaaaaff) +[lshift16] +.3 <- (((((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) | 0x0) +[noopor] +.3 <- ((((((((((((.3 >> 0x0) & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[nullshift] +.3 <- (((((((((((.3 & 0x7fff) << 0x1) >> 0x0) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[combinelrshift] +.3 <- ((((((((((.3 & 0x7fff) << 0x1) & 0x7fff) << 0x1) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[andintolshift] +.3 <- ((((((((((.3 & 0x7fff) & 0x3fff) << 0x1) << 0x1) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[combinellshift] +.3 <- (((((((((.3 & 0x7fff) & 0x3fff) << 0x2) >> 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[combinelrshift] +.3 <- ((((((((.3 & 0x7fff) & 0x3fff) << 0x1) & 0x1fff) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[andintolshift] +.3 <- ((((((((.3 & 0x7fff) & 0x3fff) & 0xfff) << 0x1) << 0x3) >> 0x3) & 0x1ff) << 0x7) +[combinellshift] +.3 <- (((((((.3 & 0x7fff) & 0x3fff) & 0xfff) << 0x4) >> 0x3) & 0x1ff) << 0x7) +[combinelrshift] +.3 <- ((((((.3 & 0x7fff) & 0x3fff) & 0xfff) << 0x1) & 0x1ff) << 0x7) +[andintolshift] +.3 <- ((((((.3 & 0x7fff) & 0x3fff) & 0xfff) & 0xff) << 0x1) << 0x7) +[combinellshift] +.3 <- (((((.3 & 0x7fff) & 0x3fff) & 0xfff) & 0xff) << 0x8) +[combineand] +.3 <- ((((.3 & 0x3fff) & 0xfff) & 0xff) << 0x8) +[combineand] +.3 <- (((.3 & 0xfff) & 0xff) << 0x8) +[combineand] +.3 <- ((.3 & 0xff) << 0x8) +@end smallexample + +@node Copying +@appendix Copying +@cindex copyright +@cindex copying conditions + +The majority of the files in the @cic{} distribution are licensed under +the GNU General Public License, but with some exceptions. The files +@file{ick-wrap.c} and @file{pickwrap.c} are licensed under a license +that allows them to be used for any purpose and redistributed at will, +and are explicitly not GPL'd. This means that C source code generated +by the compiler has the same copyright conditions as the original +@ical{} source. (Note that the libraries @file{libick.a} and +@file{libickmt.a} are GPL, though, so you cannot redistribute an +executable produced by @command{ick} or by linking a C file to either of +those libraries unless the original @ical{} source was GPL.) Also, this +manual, and the files that are the source code for creating it, are +licensed under the GNU Free Documentation License rather than the GPL, +and the licenses themselves (@file{fdl-1-2.txi}, @file{gpl-2-0.txi}, and +@file{COPYING.txt}) are licensed under a license that allows verbatim +redistribution but not creation of derivative works. + +@menu +* GNU General Public License:: License for copying source and binaries. +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@node GNU General Public License +@appendixsec GNU General Public License +@cindex GPL +@cindex GNU General Public License +@cindex General Public License + +@include gpl-2-0.txi + +@node GNU Free Documentation License +@appendixsec GNU Free Documentation License +@cindex GFDL +@cindex FDL +@cindex GNU Free Documentation License +@cindex Free Documentation License + +@include fdl-1-2.txi + +@node Main Index +@unnumbered Index + +This is the index of everything in this manual. (Note that in some +versions of the manual this is called @samp{Main Index} to prevent it +transforming into a page called @file{index.html} in the HTML version of +the manual. The complications that that caused were really odd.) + +@printindex cp + +@bye diff --git a/doc/ickstyle.css b/doc/ickstyle.css new file mode 100644 index 0000000..7768fd5 --- /dev/null +++ b/doc/ickstyle.css @@ -0,0 +1,24 @@ + +/* Custom styles for the C-INTERCAL manual. These are partly for a + small amount of beautification, but mostly to work around the + ugliness of the default stylesheet on at least one compiler. This + stylesheet is public domain from this comment onwards. */ + + body {text-align:justify; font-family:serif;} + pre {margin:0.5em 3em 0.5em 3em; + background-color:#F8F8F8; + border:1px solid #CCCCCC;} + pre.smallexample {font-size:75%;} + p {margin:0.5em 0em 0.5em 0em;} + li {margin:0.5em 0em 0.5em 0em;} + ul.menu li {margin:0em 0em 0em 0em;} + ul.index-cp li {margin:0em 0em 0em 0em;} + div.contents ul li {margin:0em 0em 0em 0em;} + blockquote {margin:0.5em 3em 0.5em 3em;} + dt {margin:0em 0em 0em 0em; font-weight:bold;} + dd {margin:0.5em 0em 1em 3em;} + code {background-color:#F8F8F8;} + tt {background-color:#F8F8F8;} + samp {background-color:#F8F8F8;} + table {border:1px solid #666666; background-color:#CCCCCC;} + td {border:1px solid #666666; background-color:#FFFFFF;} diff --git a/doc/ickwhile.txt b/doc/ickwhile.txt new file mode 100644 index 0000000..6edb665 --- /dev/null +++ b/doc/ickwhile.txt @@ -0,0 +1,73 @@ +A WHILE command starts two threads (the original thread that ran that +command and a new one), one of which runs the command to the left and +one of which runs the command to the right. Any line number applies to +the left-hand command, not the WHILE as a whole, which is a +metalanguage construct. NEXTING FROM, ABSTAINING FROM or similar +behaviour with respect to the WHILE itself is impossible, although +it's certainly possible to abstain from either of its operands or next +from the left operands (and abstaining from the left operand has much +the same effect as abstaining from the WHILE itself; the right-hand +thread deliberately takes a bit of time to get started so that this +behaviour happens). The right-command thread starts just before the +left command is run (so NEXTing, etc., directly to the left command +will not start that loop in the first place); if that command finishes +(which may be almost immediately for something like CALCULATE, or take +a long time for something like NEXT), that thread loops and reruns +that command as long as the left command has not finished; COMING FROM +that command, or a NEXT/NEXT FROM from/aiming at that command, doesn't +count as finishing that command until it is RESUMEd back to (if +possible; if it's come from, that command can never end and the right- +hand loop will continue forever). A WHILE command itself exists across +all threads of a multithreaded program in a way; for each left-hand +command that ends (in any thread), the next time a right-hand command +ends it will cause the thread it's looping in to end, regardless of +whether that thread corresponds to the thread in which the left-hand +command ended. (As well as a right-hand command ending, there's also +the possibility that it never got started; there is a delay before the +right-hand command runs during which a left-hand command ending can +prevent the right-hand thread starting in the first place; this counts +as the same sort of event as terminating a right-hand loop, and can +substitute for it anywhere a right-hand command ending is mentioned.) +There is one exception, in that if two or more left-hand commands end +in a space of time in which no right-hand commands for that WHILE +ends, they together only cause one right-hand command to end. [This +particular behaviour is one of my main concessions to the way the +compiler actually behaves, as opposed to the way it 'ought' to behave +in some sense; it would be more orthogonal and logical to end the same +number of right-hand threads as left-hand threads in this situation, +but as this INTERCAL I'm going with the counterintuitive version of +the behaviour documented here.] + + +The two threads produced by a WHILE (the original thread and a new +copy of it) have more in common than ordinary INTERCAL threads created +by COME FROM; ordinary threads share only ABSTAIN/REINSTATE +information, whereas the WHILE-produced threads count as 'woven' +threads which also share variables and stashes. (They still have +separate instruction pointers, separate IP stacks, such as the NEXT +stack, and separate choicepoint lists. Overloading information in my +current working version of C-INTERCAL (and in the released version +1.26) is shared between all threads, but this is a bug which I intend +to fix before the next release, and weaving ought to also share +overloading information.) Being woven is a relationship between two or +more threads, rather than an attribute of a thread. + + +Ordinary multithreading cannot create woven threads. When threads are +created by multiple COME FROMs from an original thread, which was +woven with at least one other thread, one of the resulting threads (an +implementation can choose to always select the same one, or to +randomize, or use any other means of selection as long as it always +chooses exactly one; I hope to cause this to say 'a random thread' in +the future, to make programming with woven threads more interesting, +but I haven't figured out how to implement that yet) counts as the +'original' thread and remains woven; the rest are 'new' threads which +initially start out with the same data as the original, but are not +woven with anything. Backtracking in a thread causes it to unweave +with any threads it may be woven with at the time (so the data in the +thread that backtracks is set back to the data it, and the threads it +was woven with at the time, had at the time of the MAYBE, but the +other threads continue with the same data as before). The only way to +cause three or more threads to become woven is with a new WHILE inside +one of the threads that is already woven, which causes all the new +threads to be woven together (the weaving relationship is transitive). diff --git a/doc/t.t b/doc/t.t new file mode 100644 index 0000000..a9641f5 --- /dev/null +++ b/doc/t.t @@ -0,0 +1,210 @@ +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2925: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2818: Cross reference to nonexistent node `C functions in OIL' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2413: Cross reference to nonexistent node `-O+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2254: Cross reference to nonexistent node `MAYBE' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2251: Cross reference to nonexistent node `ABSTAIN' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2248: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2112: Cross reference to nonexistent node `E579' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2014: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1978: Cross reference to nonexistent node `+printflow' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1970: Cross reference to nonexistent node `-p' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1962: Cross reference to nonexistent node `-y' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1919: Cross reference to nonexistent node `-v' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1870: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1832: Cross reference to nonexistent node `-l' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1821: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1719: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1690: Cross reference to nonexistent node `-b' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1669: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1653: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1626: Cross reference to nonexistent node `E621' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1590: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1570: Cross reference to nonexistent node `E275' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1533: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1442: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1351: Cross reference to nonexistent node `E129' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1324: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1290: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1226: Cross reference to nonexistent node `E633' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:964: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:954: Cross reference to nonexistent node `yuk' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:942: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:941: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:834: Cross reference to nonexistent node `GIVE UP' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:816: Cross reference to nonexistent node `E652' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:815: Cross reference to nonexistent node `E256' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:791: Cross reference to nonexistent node `E277' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:782: Cross reference to nonexistent node `E111' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:774: Cross reference to nonexistent node `E405' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:771: Cross reference to nonexistent node `E555' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:769: Cross reference to nonexistent node `COME FROM' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:752: Cross reference to nonexistent node `E774' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:592: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:589: Cross reference to nonexistent node `-H+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:576: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:512: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +make.exe: [ick.inf] Error 1 (ignored) +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +makeinfo: could not open --css-file: ickstyle.css +ick.txi:3064: @include `gpl-2-0.txi': Too many open files (EMFILE). +makeinfo: could not open --css-file: ickstyle.css +ick.txi:3072: @include `fdl-1-2.txi': Too many open files (EMFILE). +makeinfo: could not open --css-file: ickstyle.css +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2925: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2818: Cross reference to nonexistent node `C functions in OIL' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2413: Cross reference to nonexistent node `-O+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2254: Cross reference to nonexistent node `MAYBE' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2251: Cross reference to nonexistent node `ABSTAIN' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2248: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2112: Cross reference to nonexistent node `E579' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2014: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1978: Cross reference to nonexistent node `+printflow' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1970: Cross reference to nonexistent node `-p' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1962: Cross reference to nonexistent node `-y' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1919: Cross reference to nonexistent node `-v' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1870: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1832: Cross reference to nonexistent node `-l' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1821: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1719: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1690: Cross reference to nonexistent node `-b' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1669: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1653: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1626: Cross reference to nonexistent node `E621' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1590: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1570: Cross reference to nonexistent node `E275' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1533: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1442: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1351: Cross reference to nonexistent node `E129' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1324: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1290: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1226: Cross reference to nonexistent node `E633' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:964: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:954: Cross reference to nonexistent node `yuk' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:942: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:941: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:834: Cross reference to nonexistent node `GIVE UP' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:816: Cross reference to nonexistent node `E652' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:815: Cross reference to nonexistent node `E256' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:791: Cross reference to nonexistent node `E277' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:782: Cross reference to nonexistent node `E111' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:774: Cross reference to nonexistent node `E405' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:771: Cross reference to nonexistent node `E555' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:769: Cross reference to nonexistent node `COME FROM' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:752: Cross reference to nonexistent node `E774' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:592: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:589: Cross reference to nonexistent node `-H+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:576: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:512: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +make.exe: [ickhtml] Error 1 (ignored) +ick.txi:155: warning: undefined flag: . +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2925: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2818: Cross reference to nonexistent node `C functions in OIL' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2413: Cross reference to nonexistent node `-O+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2254: Cross reference to nonexistent node `MAYBE' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2251: Cross reference to nonexistent node `ABSTAIN' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2248: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2112: Cross reference to nonexistent node `E579' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2014: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1978: Cross reference to nonexistent node `+printflow' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1970: Cross reference to nonexistent node `-p' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1962: Cross reference to nonexistent node `-y' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1919: Cross reference to nonexistent node `-v' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1870: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1832: Cross reference to nonexistent node `-l' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1821: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1719: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1690: Cross reference to nonexistent node `-b' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1669: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1653: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1626: Cross reference to nonexistent node `E621' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1590: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1570: Cross reference to nonexistent node `E275' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1533: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1442: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1351: Cross reference to nonexistent node `E129' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1324: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1290: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1226: Cross reference to nonexistent node `E633' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:964: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:954: Cross reference to nonexistent node `yuk' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:942: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:941: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:834: Cross reference to nonexistent node `GIVE UP' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:816: Cross reference to nonexistent node `E652' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:815: Cross reference to nonexistent node `E256' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:791: Cross reference to nonexistent node `E277' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:782: Cross reference to nonexistent node `E111' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:774: Cross reference to nonexistent node `E405' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:771: Cross reference to nonexistent node `E555' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:769: Cross reference to nonexistent node `COME FROM' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:752: Cross reference to nonexistent node `E774' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:592: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:589: Cross reference to nonexistent node `-H+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:576: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:512: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +make.exe: [ick.htm] Error 1 (ignored) +ick.txi:155: warning: undefined flag: . +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2925: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2818: Cross reference to nonexistent node `C functions in OIL' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2413: Cross reference to nonexistent node `-O+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2254: Cross reference to nonexistent node `MAYBE' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2251: Cross reference to nonexistent node `ABSTAIN' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2248: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2112: Cross reference to nonexistent node `E579' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:2014: Cross reference to nonexistent node `-h' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1978: Cross reference to nonexistent node `+printflow' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1970: Cross reference to nonexistent node `-p' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1962: Cross reference to nonexistent node `-y' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1919: Cross reference to nonexistent node `-v' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1870: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1832: Cross reference to nonexistent node `-l' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1821: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1719: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1690: Cross reference to nonexistent node `-b' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1669: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1653: Cross reference to nonexistent node `E000' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1626: Cross reference to nonexistent node `E621' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1590: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1570: Cross reference to nonexistent node `E275' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1533: Cross reference to nonexistent node `-m' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1442: Cross reference to nonexistent node `-P+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1351: Cross reference to nonexistent node `E129' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1324: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1290: Cross reference to nonexistent node `-t' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:1226: Cross reference to nonexistent node `E633' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:964: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:954: Cross reference to nonexistent node `yuk' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:942: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:941: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:834: Cross reference to nonexistent node `GIVE UP' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:816: Cross reference to nonexistent node `E652' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:815: Cross reference to nonexistent node `E256' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:791: Cross reference to nonexistent node `E277' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:782: Cross reference to nonexistent node `E111' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:774: Cross reference to nonexistent node `E405' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:771: Cross reference to nonexistent node `E555' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:769: Cross reference to nonexistent node `COME FROM' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:752: Cross reference to nonexistent node `E774' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:592: Cross reference to nonexistent node `-U+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:589: Cross reference to nonexistent node `-H+' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:576: Cross reference to nonexistent node `E778' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `-u' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:513: Cross reference to nonexistent node `E999' (perhaps incorrect sectioning?). +c:/Documents and Settings/Alex/My Documents/esoteric/intercal/ick-0.27/doc//ick.txi:512: Cross reference to nonexistent node `E127' (perhaps incorrect sectioning?). +make.exe: [ick.txt] Error 1 (ignored) diff --git a/doc/tempnote.txt b/doc/tempnote.txt new file mode 100644 index 0000000..10d237b --- /dev/null +++ b/doc/tempnote.txt @@ -0,0 +1,9 @@ +$ flonck +EIGHT FIVE ZERO ZERO ZERO ZERO ZERO ZERO TWO +SEVEN SEVEN ONE ZERO ZERO ZERO ZERO ZERO ONE +THREE +SIX + ____ +dclvCCCLIV +THREE ZERO +$ diff --git a/etc/ctrlmfix.bat b/etc/ctrlmfix.bat index 5483fb3..9bda031 100755 --- a/etc/ctrlmfix.bat +++ b/etc/ctrlmfix.bat @@ -5,12 +5,13 @@ rem Likewise, it adds trailing ^Ms to .bat files so they run under DOS shells. dtou *.* +dtou ickspec dtou etc\intercal.el dtou src\*.c dtou src\*.h dtou src\*.l dtou src\*.y -dtou src\*.sh +dtou src\*.in dtou pit\*.doc dtou pit\*.i dtou pit\tests\*.doc diff --git a/etc/ctrlmfix.sh b/etc/ctrlmfix.sh index f04222d..6dd58f0 100755 --- a/etc/ctrlmfix.sh +++ b/etc/ctrlmfix.sh @@ -5,12 +5,13 @@ dtou *.* +dtou ickspec dtou etc/intercal.el dtou src/*.c dtou src/*.h dtou src/*.l dtou src/*.y -dtou src/*.sh +dtou src/*.in dtou pit/*.doc dtou pit/*.i dtou pit/tests/*.doc diff --git a/etc/intercal.el b/etc/intercal.el index 7c3c93d..d0239bc 100644 --- a/etc/intercal.el +++ b/etc/intercal.el @@ -91,6 +91,7 @@ (define-abbrev intercal-mode-abbrev-table "wr" "" 'intercal-wr-abbrev) (define-abbrev intercal-mode-abbrev-table "co" "" 'intercal-co-abbrev) (define-abbrev intercal-mode-abbrev-table "do" "" 'intercal-do-abbrev) + (define-abbrev intercal-mode-abbrev-table "wh" "" 'intercal-wh-abbrev) ;AIS (define-abbrev intercal-mode-abbrev-table "goa" "" 'intercal-goa-abbrev) ;AIS (define-abbrev intercal-mode-abbrev-table "gob" "" 'intercal-gob-abbrev) ;AIS (define-abbrev intercal-mode-abbrev-table "ma" "MAYBE" nil) ;AIS @@ -121,6 +122,7 @@ (make-intercal-abbrev intercal-co-abbrev "COMING FROM" "COME FROM") (make-intercal-abbrev intercal-tr-abbrev "TRYING AGAIN" "TRY AGAIN") ;AIS (make-intercal-abbrev intercal-cal-abbrev "CALCULATING" "cal") ;AIS +(make-intercal-abbrev intercal-wh-abbrev "WHILING" "WHILE") ;AIS (make-intercal-abbrev intercal-goa-abbrev "GOING AHEAD" "GO AHEAD") ;AIS (make-intercal-abbrev intercal-gob-abbrev "GOING BACK" "GO BACK") ;AIS diff --git a/ickspec b/ickspec index f2b4d59..74ee151 100644 --- a/ickspec +++ b/ickspec @@ -1,60 +1,60 @@ -Name: intercal -Version: 1.26 -Release: 1 -URL: http://www.catb.org/~esr/intercal/ -Source: ick-1.26.tgz -License: GPL -Group: Development/Languages -Summary: the language that kills the weak and drives mad the strong -BuildRoot: %{_tmppath}/%{name}-root - -%description -An implementation of the language INTERCAL, legendary for -its perversity and horribleness (this version adds COME FROM -for extra flavor). Comes with language manual and examples -including possibly the entire extant body of INTERCAL code. -Now supports i18n and l14n (to Ancient Roman locale only) -Now with fix patch by Donald Knuth. - -%prep -%setup -q - -%build -configure --prefix=/usr -make - -%clean -[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" - -%install -[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" -mkdir -p "$RPM_BUILD_ROOT"%{_bindir} -cp ick coopt.sh "$RPM_BUILD_ROOT"%{_bindir} -mkdir -p "$RPM_BUILD_ROOT"%{_libdir} -cp libick.a "$RPM_BUILD_ROOT"%{_libdir} -cp libickmt.a "$RPM_BUILD_ROOT"%{_libdir} -cp libyuk.a "$RPM_BUILD_ROOT"%{_libdir} -mkdir -p "$RPM_BUILD_ROOT"%{_includedir}/intercal-1.26 -cp lose.h abcess.h fiddle.h yuk.h "$RPM_BUILD_ROOT"%{_includedir}/intercal-1.26 - -%files -%doc README BUGS NEWS -%{_bindir}/ick -%{_libdir}/libick.a -%{_libdir}/libickmt.a -%{_libdir}/libyuk.a -%{_includedir}/intercal-1.26/lose.h -%{_includedir}/intercal-1.26/abcess.h -%{_includedir}/intercal-1.26/fiddle.h -%{_includedir}/intercal-1.26/yuk.h - -%changelog -* Wed Dec 31 2003 Eric S. Raymond 0.24-1 -- Non-root users can now build RPMs. - -# The following sets edit modes for GNU EMACS -# Local Variables: -# mode:rpm-spec -# End: - - +Name: intercal +Version: @PACKAGE_VERSION@ +Release: 1 +URL: http://www.catb.org/~esr/intercal/ +Source: intercal-@PACKAGE_VERSION@.tar.gz +License: GPL +Group: Development/Languages +Summary: the language that kills the weak and drives mad the strong +BuildRoot: %{_tmppath}/%{name}-root + +%description +An implementation of the language INTERCAL, legendary for +its perversity and horribleness (this version adds COME FROM +for extra flavor). Comes with language manual and examples +including possibly the entire extant body of INTERCAL code. +Now supports i18n and l14n (to Ancient Roman locale only) +Now with fix patch by Donald Knuth. + +%prep +%setup -q + +%build +configure --prefix=/usr +make + +%clean +[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" + +%install +[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" +mkdir -p "$RPM_BUILD_ROOT"%{_bindir} +cp ick coopt.sh "$RPM_BUILD_ROOT"%{_bindir} +mkdir -p "$RPM_BUILD_ROOT"%{_libdir} +cp libick.a "$RPM_BUILD_ROOT"%{_libdir} +cp libickmt.a "$RPM_BUILD_ROOT"%{_libdir} +cp libyuk.a "$RPM_BUILD_ROOT"%{_libdir} +mkdir -p "$RPM_BUILD_ROOT"%{_includedir}/intercal-@PACKAGE_VERSION@ +cp lose.h abcess.h fiddle.h yuk.h "$RPM_BUILD_ROOT"%{_includedir}/intercal-@PACKAGE_VERSION@ + +%files +%doc README BUGS NEWS +%{_bindir}/ick +%{_libdir}/libick.a +%{_libdir}/libickmt.a +%{_libdir}/libyuk.a +%{_includedir}/intercal-@PACKAGE_VERSION@/lose.h +%{_includedir}/intercal-@PACKAGE_VERSION@/abcess.h +%{_includedir}/intercal-@PACKAGE_VERSION@/fiddle.h +%{_includedir}/intercal-@PACKAGE_VERSION@/yuk.h + +%changelog +* Wed Dec 31 2003 Eric S. Raymond 0.24-1 +- Non-root users can now build RPMs. + +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:rpm-spec +# End: + + diff --git a/include/abcess.h b/include/abcess.h new file mode 100644 index 0000000..e677d46 --- /dev/null +++ b/include/abcess.h @@ -0,0 +1,187 @@ +/* abcess.h -- functions used by compiled INTERCAL programs */ + +/* AIS note: This header file now serves two purposes. For non-multithread + programs, it serves as headers to the degenerated code and many support + functions. For multithread programs, this header file adds extra functions + only when compiling the degenerated code and unravel.c, and holds its + previous contents during other files. */ + +typedef int bool; +#define TRUE 1 +#define FALSE 0 + +#define ONESPOT 0 +#define TWOSPOT 1 +#define TAIL 2 +#define HYBRID 3 + +#define MAXNEXT 80 /* AIS: Moved from cesspool.c */ + +/* the following two types must both promote to unsigned int in expressions */ + +typedef unsigned short type16; +typedef unsigned int type32; + +typedef struct array_t +{ + unsigned int rank; + unsigned int *dims; + union + { + type16 *tail; + type32 *hybrid; + } data; +} array; + + +/* AIS: For operand overloading, a more complicated data type is needed. */ +typedef struct overop_t +{ + type32 (*get)(type32); + void (*set)(type32, void(*)()); +} overop; + +/* AIS: Moved from cesspool.c */ +typedef struct stashbox_t /* this is a save-stack element */ +{ + unsigned int type; /* variable type */ + unsigned int index; /* variable's index within the type */ + union /* the data itself */ + { + type16 onespot; + type32 twospot; + array *a; + } save; + struct stashbox_t *next; /* pointer to next-older stashbox */ + overop overloadinfo; /* AIS: overloading info is stashed too, in a + non-overloaded program (ignored otherwise) */ +} stashbox; + +/* AIS: files to take input and output from */ +extern FILE* cesspoolin; +extern FILE* cesspoolout; + +/* defined in cesspool.c */ +extern void pushnext(int n); +extern unsigned int popnext(int n); +extern unsigned int resume(unsigned int n); +extern unsigned int pin(void); +extern void clockface(bool mode); +extern void pout(unsigned int val); +extern void binin(unsigned int type, array *a, bool forget); +extern void binout(unsigned int type, array *a); +extern unsigned int assign(char *dest, unsigned int type, bool forget, + unsigned int value); + +/* AIS: yuk and unravel need these */ +extern int* next; +extern int nextindex; +extern stashbox* first; + +/* AIS: Implement the +mystery command line option. */ +extern unsigned long mysteryc; +extern int mystery; +#define MYSTERYLINE if(mystery && mysteryc++ > 4000000000LU) exit(42); + +/* AIS: Handle multiple COME FROMs aiming at the same line */ +extern int multicome0(int errlineno, jmp_buf pc); + +#ifdef _POSIX_SOURCE +extern char *aref(unsigned int type, ...); +extern void resize(unsigned int type, ...); +#else +extern char *aref(); +extern void resize(); +#endif + +extern void stashinit(void); +/* AIS: Added mentions of oo. This is set to 0 in a non-overloaded program. */ +extern void stash(unsigned int type, unsigned int index, void *from, overop* oo); +extern void retrieve(void *to, int type, unsigned int index, bool forget, + overop* oo); +extern unsigned int roll(unsigned int n); + +/* defined in arrgghh.c */ +extern void parseargs(int argc, char **argv); + +/* AIS: Multithreading types and defines */ +#if MULTITHREAD != 0 +typedef struct tag_ickthread ickthread; +struct tag_ickthread +{ + void* varforget[10]; /* holds all four variable types, and forgetting data */ + int* nextstack; + int nextpointer; + jmp_buf pc; /* program counter */ + stashbox* sb; /* holds all stash data */ + ickthread* next; + ickthread* choicepoint; /* the top choicepoint available. Used as a next + pointer in the choicepoint stack. */ + int stale; /* if this is a choicepoint, whether it's a stale choicepoint. */ + int refcount; /* when Threaded INTERCAL and Backtracking INTERCAL are + combined, reference-counting on choicepoints is needed + so that backtracking past multithreading is possible. + This also allows for garbage-collection of choicepoints. + (Luckily, choicepoints cannot refer to themselves, so this + mechanism works.) This only applies to ickthreads that are + acting as choicepoints, not those acting as threads. */ + int ccfc; /* number of comefroms currently active */ + unsigned skipto; /* compucome line number */ + jmp_buf cjb; /* keeps track of compucomes */ + ickthread* dsi; /* which thread's varforget and sb to use */ + ickthread* usesthis; /* for garbage collection purposes */ +}; +extern ickthread* ickmt_cur; /* current thread */ +extern ickthread* ickmt_prev; /* previous thread: an optimisation to make + thread switching O(1), not O(n), with + respect to the number of threads */ +extern int weaving; /* whether to weave newly created threads */ +#define NEXTTHREAD if(printflow) printf("[%d:%lx]",lineno,(unsigned long)\ + ickmt_cur); \ + if(setjmp(cjb) == 0) \ + nextthread(cjb, lineno, 3); + +extern void nextthread(jmp_buf pc, int errlineno, int flags); +extern void killthread(void); +extern void ickmtinit(void); +extern int multicome1(int errlineno, jmp_buf pc); +extern void choicepoint(void); +extern void choiceahead(void); +extern void choiceback(void); + +/* from ick-wrap.c, declare as extern so they can be accessed by cesspool.c, + unravel.c */ +extern int onespotcount; +extern int twospotcount; +extern int tailcount; +extern int hybridcount; + +extern int oldabstain; +extern int gonebackto; +extern int ccfc; +extern unsigned skipto; +extern jmp_buf btjb; +extern jmp_buf cjb; + +#define MULTICOME multicome1 +#else +#define MULTICOME multicome0 +#endif /* MULTITHREAD */ + +/* AIS: Used by the debugger, multithread code */ +#if (MULTITHREAD != 0) || (YUKDEBUG != 0) +extern type16* onespots; +extern bool* oneforget; +extern type32* twospots; +extern bool* twoforget; +extern array* tails; +extern bool* tailforget; +extern array* hybrids; +extern bool* hyforget; +#if (MULTITHREAD != 0) +extern overop* oo_onespots; +extern overop* oo_twospots; +#endif +#endif + +/* abcess.h ends here */ diff --git a/include/fiddle.h b/include/fiddle.h new file mode 100644 index 0000000..a5289bd --- /dev/null +++ b/include/fiddle.h @@ -0,0 +1,23 @@ +/* fiddle.h -- functions implementing intercal's operators */ + +extern unsigned int mingle(register unsigned int r, register unsigned int s); +extern unsigned int iselect(register unsigned int r, register unsigned int s); +extern unsigned int and16(unsigned int n), or16(unsigned int n), + xor16(unsigned int n), fin16(unsigned int n); +extern unsigned int whirl16(unsigned int p, unsigned int n); +extern unsigned int and32(unsigned int n), or32(unsigned int n), + xor32(unsigned int n), fin32(unsigned int n); +extern unsigned int whirl32(unsigned int p, unsigned int n); +/* AIS: Reversed operators */ +extern unsigned int rev_and16(unsigned int n), rev_or16(unsigned int n), + rev_xor16(unsigned int n), rev_fin16(unsigned int n); +extern unsigned int rev_whirl16(unsigned int p, unsigned int n); +extern unsigned int rev_and32(unsigned int n), rev_or32(unsigned int n), + rev_xor32(unsigned int n), rev_fin32(unsigned int n); +extern unsigned int rev_whirl32(unsigned int p, unsigned int n); +/* AIS: Optimizer helper operators */ +extern unsigned int xselx(unsigned int x); +extern unsigned int setbitcount(unsigned int x); +extern unsigned int smudgeleft(unsigned int x); +extern unsigned int smudgeright(unsigned int x); +/* fiddle.h ends here */ diff --git a/include/lose.h b/include/lose.h new file mode 100644 index 0000000..4549ece --- /dev/null +++ b/include/lose.h @@ -0,0 +1,238 @@ +/* lose.h --- error message strings */ + +/* + * Note: these error message texts, with one exception, are direct from + * the Princeton compiler (INTERCAL-72) sources (transmitted by Don Woods). + * The one exception is E632, which in INTERCAL-72 had the error message + * PROGRAM ATTEMPTED TO EXIT WITHOUT ERROR MESSAGE + * ESR's "THE NEXT STACK HAS RUPTURED!..." has been retained on the grounds + * that it is more obscure and much funnier. For context, find a copy of + * Joe Haldeman's SF short story "A !Tangled Web", first published in + * Analog magazine in September 1981 and later anthologized in the author's + * "Infinite Dreams" (Ace 1985). + */ +/* An undecodable statement has been encountered in the course of execution. */ +#define E000 "000 %s\n\ + ON THE WAY TO %d\n" +/* An expression contains a syntax error. */ +#define E017 "017 DO YOU EXPECT ME TO FIGURE THIS OUT?\n\ + ON THE WAY TO %d\n" +/* Improper use has been made of statement identifiers. */ +#define E079 "079 PROGRAMMER IS INSUFFICIENTLY POLITE\n\ + ON THE WAY TO %d\n" +/* Improper use has been made of statement identifiers. */ +#define E099 "099 PROGRAMMER IS OVERLY POLITE\n\ + ON THE WAY TO %d\n" +/* Program has attempted 80 levels of NEXTing */ +#define E123 "123 PROGRAM HAS DISAPPEARED INTO THE BLACK LAGOON\n\ + ON THE WAY TO %d\n" +/* Program has attempted to transfer to a non-existent line label */ +#define E129 "129 PROGRAM HAS GOTTEN LOST\n\ + ON THE WAY TO WHO KNOWS WHERE\n" +/* An ABSTAIN or REINSTATE statement references a non-existent line label */ +#define E139 "139 I WASN'T PLANNING TO GO THERE ANYWAY\n\ + ON THE WAY TO %d\n" +/* A line label has been multiply defined. */ +#define E182 "182 YOU MUST LIKE THIS LABEL A LOT!\n\ + ON THE WAY TO %d\n" +/* An invalid line label has been encountered. */ +#define E197 "197 SO! 65535 LABELS AREN'T ENOUGH FOR YOU?\n\ + ON THE WAY TO %d\n" +/* An expression involves an unidentified variable. */ +#define E200 "200 NOTHING VENTURED, NOTHING GAINED\n\ + ON THE WAY TO %d\n" +/* An attempt has been made to give an array a dimension of zero. */ +#define E240 "240 ERROR HANDLER PRINTED SNIDE REMARK\n\ + ON THE WAY TO %d\n" +/* Invalid dimensioning information was supplied + * in defining or using an array. */ +#define E241 "241 VARIABLES MAY NOT BE STORED IN WEST HYPERSPACE\n\ + ON THE WAY TO %d\n" +/* A 32-bit value has been assigned to a 16-bit variable. */ +#define E275 "275 DON'T BYTE OFF MORE THAN YOU CAN CHEW\n\ + ON THE WAY TO %d\n" +/* A retrieval has been attempted for an unSTASHed value. */ +#define E436 "436 THROW STICK BEFORE RETRIEVING!\n\ + ON THE WAY TO %d\n" +/* A WRITE IN statement or interleave ($) operation + * has produced value requiring over 32 bits to represent. */ +#define E533 "533 YOU WANT MAYBE WE SHOULD IMPLEMENT 64-BIT VARIABLES?\n\ + ON THE WAY TO %d\n" +/* Insufficient data. (raised by reading past EOF) */ +#define E562 "562 I DO NOT COMPUTE\n\ + ON THE WAY TO %d\n" +/* Input data is invalid. */ +#define E579 "579 WHAT BASE AND/OR LANGUAGE INCLUDES %s?\n\ + ON THE WAY TO %d\n" +/* The expression of a RESUME statement evaluated to #0. */ +#define E621 "621 ERROR TYPE 621 ENCOUNTERED\n\ + ON THE WAY TO %d\n" +/* Program execution terminated via a RESUME statement instead of GIVE UP. */ +#define E632 "632 THE NEXT STACK RUPTURES. ALL DIE. OH, THE EMBARRASSMENT!\n\ + ON THE WAY TO %d\n" +/* Execution has passed beyond the last statement of the program. */ +#define E633 "633 PROGRAM FELL OFF THE EDGE\n\ + ON THE WAY TO THE NEW WORLD\n" +/* A compiler error has occurred (see section 8.1). */ +#define E774 "774 RANDOM COMPILER BUG\n\ + ON THE WAY TO %d\n" +/* An unexplainable compiler error has occurred (see J. Lyon or D. Woods). */ +#define E778 "778 UNEXPLAINED COMPILER BUG\n\ + ON THE WAY TO %d\n" + +/* + * These errors are unique to C-INTERCAL. + */ +/* You tried to use a C-INTERCAL extension with the `traditional' flag on */ +#define E111 "111 COMMUNIST PLOT DETECTED, COMPILER IS SUICIDING\n\ + ON THE WAY TO %d\n" +/* Cannot find the magically included system library */ +#define E127 "127 SAYING 'ABRACADABRA' WITHOUT A MAGIC WAND WON'T DO YOU ANY GOOD\n\ + ON THE WAY TO THE CLOSET\n" +/* Out of stash space */ +#define E222 "222 BUMMER, DUDE!\n\ + ON THE WAY TO %d\n" +/* (AIS) Can't reverse an expression in an assignment. This is the + same error number as in CLC-INTERCAL, but the message is different. */ +#define E277 "277 YOU CAN ONLY DISTORT THE LAWS OF MATHEMATICS SO FAR\n\ + ON THE WAY TO %d\n" +/* (AIS) The spark/ears nesting is too deep. */ +#define E281 "281 THAT MUCH QUOTATION AMOUNTS TO PLAGIARISM\n\ + ON THE WAY TO %d\n" +/* Too many variables. */ +#define E333 "333 YOU CAN'T HAVE EVERYTHING, WHERE WOULD YOU PUT IT?\n\ + ON THE WAY TO %d\n" +/* (AIS, from the suggestion by Malcom Ryan) + GO BACK or GO AHEAD was executed without a choicepoint. */ +#define E404 "404 I'M ALL OUT OF CHOICES!\n\ + ON THE WAY TO %d\n" +/* (AIS) WHILE, MAYBE, GO BACK, or GO AHEAD used without the -m option. */ +#define E405 "405 PROGRAM REJECTED FOR MENTAL HEALTH REASONS\n\ + ON THE WAY TO %d\n" +/* A COME FROM statement references a non-existent line label. */ +#define E444 "444 IT CAME FROM BEYOND SPACE\n\ + ON THE WAY TO %d\n" +/* More than one COME FROM references the same label. */ +#define E555 "555 FLOW DIAGRAM IS EXCESSIVELY CONNECTED\n\ + ON THE WAY TO %d\n" +/* Too many source lines. */ +#define E666 "666 COMPILER HAS INDIGESTION\n\ + ON THE WAY TO %d\n" +/* No such source file. */ +#define E777 "777 A SOURCE IS A SOURCE, OF COURSE, OF COURSE\n\ + ON THE WAY TO %d\n" +/* Can't open C output file */ +#define E888 "888 I HAVE NO FILE AND I MUST SCREAM\n\ + ON THE WAY TO %d\n" +/* Can't open C skeleton file. */ +#define E999 "999 NO SKELETON IN MY CLOSET, WOE IS ME!\n\ + ON THE WAY TO %d\n" +/* Source file name with invalid extension (use .i or .[3-7]i). */ +#define E998 "998 EXCUSE ME,\n\ + YOU MUST HAVE ME CONFUSED WITH SOME OTHER COMPILER\n" +/* Illegal possession of a controlled unary operator. */ +#define E997 "997 ILLEGAL POSSESSION OF A CONTROLLED UNARY OPERATOR.\n\ + ON THE WAY TO %d\n" +/* (AIS) Command found after TRY AGAIN. */ +#define E993 "993 I GAVE UP LONG AGO\n\ + ON THE WAY TO %d\n" +/* (AIS) Memory allocation failure during multithreading */ +#define E991 "991 YOU HAVE TOO MUCH ROPE TO HANG YOURSELF\n\ + ON THE WAY TO %d\n" +/* (AIS) Unimplemented feature used. This should never come up, hopefully. */ +#define E995 "995 DO YOU REALLY EXPECT ME TO HAVE IMPLEMENTED THAT?\n\ + ON THE WAY TO %d\n" +/* + * AIS: These errors are specific to PIC-INTERCAL + */ +/* (AIS) Attempted to use an unsupported language feature. */ +#define E256 "256 THAT'S TOO HARD FOR MY TINY BRAIN\n\ + ON THE WAY TO %d\n" + +/* (AIS) Attempted to use a PIC feature in a non-PIC program. */ +#define E652 "652 HOW DARE YOU INSULT ME!\n\ + ON THE WAY TO %d\n" + +/* + * AIS: These errors are generated by the yuk debugger + */ +/* (AIS) fgets' buffer overflowed on debugger comand input. */ +#define E810 "810 ARE ONE-CHARACTER COMMANDS TOO SHORT FOR YOU?\n\ + ON THE WAY TO %d\n" + +/* (AIS) Too many breakpoints. */ +#define E811 "811 PROGRAM IS TOO BADLY BROKEN TO RUN\n\ + ON THE WAY TO %d\n" + +/* + * (AIS) Warnings produced by -l. + */ + +/* (AIS) Non-INTERCAL-72 identifier used. */ +#define W112 "112 THAT RELIES ON THE NEW WORLD ORDER\n\ + ON THE WAY TO %d\n" + +/* (AIS) That stupid idiom in syslib was used. */ +#define W128 "128 SYSLIB IS OPTIMIZED FOR OBFUSCATION\n\ + ON THE WAY TO %d\n" + +/* (AIS) Possibly nonportable unary operator. */ +#define W534 "534 KEEP LOOKING AT THE TOP BIT\n\ + ON THE WAY TO %d\n" + +/* (AIS) Expression still contains INTERCAL operators after + optimization. Only in binary, because this nearly always + happens in the higher bases. Syslib causes quite a lot of + these. This warning is fine on INTERCAL-like lines, but + flags a mistake on lines that are meant to be translations + of C. */ +#define W018 "018 THAT WAS MEANT TO BE A JOKE\n\ + ON THE WAY TO %d\n" + +/* (AIS) Possible misplaced unary operator. At the moment, ick -l cannot + detect this condition (so it never comes up). It's meant to detect + expressions like '?"?.1~#256"$#2'~#3 (from numio.i); in this expression, + the second what has no effect (it changes only the msb of the immediately + surrounding expression, which is eventually filtered out by the select + against #3). But detecting this would probably require code that could + check which bits of a result were going to be used elsewhere in an + expression, which is something I haven't written yet (but would make + a decent optimize_pass3). */ +#define W016 "016 DON'T TYPE THAT SO HASTILY\n\ + ON THE WAY TO %d\n" + +/* (AIS) Possibly overflowing assignment or mingle. Syslib causes some of + these too, in complicated situations where the bugcatcher can't figure + out what's happening, and also in a few blatant statements in the mould + of DO .3 <- :3, which are quite clearly possible overflows. Strangely + enough, there's a commented-out section of code in feh.c that suggests + that someone tried to make this an error (using a more general check + which would have caught more correct code involving GETS, but none + involving $). As a middle ground, I've made it an -l warning. */ +#define W276 "276 YOU CAN'T EXPECT ME TO CHECK BACK THAT FAR\n\ + ON THE WAY TO %d\n" + +/* (AIS) A line will inevitably cause an expression-reversal failure. */ +#define W278 "278 FROM A CONTRADICTION, ANYTHING FOLLOWS\n\ + ON THE WAY TO A HUGE DISASTER\n" + +/* (AIS) The two following warnings are both compile-time traps for + near-certain runtime errors. As such, they have similar numbers + and similar messages. In fact, they're a shameless ripoff of the + originals, but should serve as a reminder for anyone aware of the + original messages. */ +/* (AIS) Dimension given for an array will come out as #0. */ +#define W239 "239 WARNING HANDLER PRINTED SNIDE REMARK\n\ + ON THE WAY TO %d\n" + +/* (AIS) RESUME argument will come out as #0. */ +#define W622 "622 WARNING TYPE 622 ENCOUNTERED\n\ + ON THE WAY TO %d\n" + +extern int lineno; + +extern void lose(char *m, int n, char *s); + +extern void lwarn(char *m, int n, char *s); + +/* lose.h ends here */ diff --git a/include/syslib.3i b/include/syslib.3i new file mode 100644 index 0000000..44b3ba9 --- /dev/null +++ b/include/syslib.3i @@ -0,0 +1,323 @@ + PLEASE KNOCK THREE TIMES BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '^.1$.2'~'#0$#29524' + DO .6 <- '?"'V"'&.1$.2'~'#0$#29524'"$#29524' + ~'#0$#29524'"$#29524'~'#0$#29524' + PLEASE DO .5 <- 'V".6~#39366"$#1'~#1 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- 'V"!6~.6'~#2"$#1'~#1 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#9841$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?#59048$.2'~'#0$#29524' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- 'V"!1~.2'$#1"'~#1 + PLEASE DO .1 <- '^.1$.2'~'#0$#29524' + DO (1022) NEXT + DO .2 <- !2$#0'~'#9841$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#29524 + PLEASE DO .5 <- :1~'#29403$#29403' + DO .5 <- 'V"!5~.5'~#2"$#1'~#1 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#29403$#29403' + DO .5 <- 'V"!5~.5'~#2"$#1'~#1 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#29524 + PLEASE DO .2 <- :2~#29524 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#29403$#29403' + DO .2 <- :2~'#29403$#29403' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '&.6$.4' + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?#59048$":2~'#29524$#0'"'~'#0$#29524'" + $"'?#59048$":2~'#0$#29524'"'~'#0$#29524'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#22143 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#22143"'~'#0$#29524' + DO .3 <- .1~#7381 + PLEASE DO (1525) NEXT + DO :1 <- .4$"'V.3$".2~#7381"'~'#0$#29524'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"'"!3$#0'~'#9841$#1'"$#0'~'#3280$#4'" + $#0'~'#3280$#4' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + .3 + .5 + DO :1 <- #0 + DO :2 <- .2 + DO .3 <- #1 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .5 <- '@"'^".1~.3"$#7'~#4"$#2'~#10 + DO (1534) NEXT + DO (1500) NEXT + DO :1 <- :3 + DO (1536) NEXT + (1534) DO (1531) NEXT + (1536) DO (1500) NEXT + DO :1 <- :3 + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1001) NEXT + (1533) DO FORGET #2 + DO .3 <- !3$#0'~'#9841$#1' + DO :2 <- ":2~'#0$#29524'"$"'":2~'#9841$#0'"$#0' + ~'#9841$#1'" + PLEASE DO .5 <- 'V"!3~.3'~#2"$#1'~#1 + DO (1532) NEXT + DO (1535) NEXT + (1532) DO (1001) NEXT + PLEASE RETRIEVE :2 + :3 + .3 + .5 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#29524 + PLEASE DO .2 <- :2~'#29403$#29403' + DO .5 <- :1~'#29403$#29403' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#29524 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#29403$#29403'"$":4~'#29403 + $#29403'" + DO .5 <- ':1~:1'~#2 + DO .2 <- :2~'#29403$#29403' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#2"$.5'~#4 + DO .1 <- :3~#29524 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#29524 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$":4~#1"'~#31 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$":4~#1"'~#274 + DO .5 <- !5~.5'~#1 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :4 + :5 + :6 + .5 + DO :3 <- #0 + DO .5 <- 'V"':2~:2'~#2"$#1'~#1 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?"':2~"#39366$#0"'"$#1'~#1 + DO (1552) NEXT + DO :2 <- ":2~'#0$#29524'"$"'":2~'#9841$#0'"$#0' + ~'#9841$#1'" + PLEASE DO :4 <- ":4~'#0$#29524'"$"'":4~'#9841 + $#0'"$#0'~'#9841$#1'" + DO (1553) NEXT + (1552) DO (1001) NEXT + (1556) PLEASE FORGET #1 + DO :6 <- "'&":2~'#29524$#0'"$"'?#59048$":1 + ~'#29524$#0'"'~'#0$#29524'"'~'#0$#29524'"$ + "'&":2~'#0$#29524'"$"'?#59048$":1~'#0$ + #29524'"'~'#0$#29524'"'~'#0$#29524'" + DO :5 <- "'?":1~'#29524$#0'"$":2~'#29524$#0'"' + ~'#0$#59048'"$"'?":1~'#0$#29524'"$":2~'#0$ + #29524'"'~'#0$#59048'" + DO .5 <- "?'"':6~:5'~'"'"'&"':5~:5'~'#29524$#0'"$ + #19683'~'#0$#29524'"$"'?:5~:5'~'#9841$#0'"' + ~'#19683$#9841'"$"'?:5~:5'~'#0$#29524'"'" + ~#1'$#1"~#1 + DO (1554) NEXT + DO :5 <- :3 + DO (1510) NEXT + PLEASE DO :1 <- :3 + DO :6 <- "'&":2~'#29524$#0'"$"'?#59048$":1 + ~'#29524$#0'"'~'#0$#29524'"'~'#0$#29524'"$ + "'&":2~'#0$#29524'"$"'?#59048$":1~'#0$ + #29524'"'~'#0$#29524'"'~'#0$#29524'" + DO :3 <- "'?":1~'#29524$#0'"$":2~'#29524$#0'"' + ~'#0$#59048'"$"'?":1~'#0$#29524'"$":2~'#0$ + #29524'"'~'#0$#59048'" + DO .5 <- "?'"':6~:3'~'"'"'&"':3~:3'~'#29524$#0'"$ + #19683'~'#0$#29524'"$"'?:3~:3'~'#9841$#0'"' + ~'#19683$#9841'"$"'?:3~:3'~'#0$#29524'"'" + ~#1'$#1"~#1 + DO (1557) NEXT + DO (1510) NEXT + PLEASE DO :1 <- :3 + DO :3 <- "'V":4~'#59048$#0'"$":5~'#29524$#0'"' + ~'#0$#29524'"$"'V":4~'#0$#59048'"$":5~'#0$ + #29524'"'~'#0$#29524'" + PLEASE DO (1555) NEXT + (1557) PLEASE DO (1001) NEXT + PLEASE FORGET #1 + DO :3 <- "'V":4~'#29524$#0'"$":5~'#29524$#0'"' + ~'#0$#29524'"$"'V":4~'#0$#29524'"$":5~'#0$ + #29524'"'~'#0$#29524'" + PLEASE DO (1555) NEXT + (1554) PLEASE DO (1001) NEXT + (1555) PLEASE FORGET #1 + DO .5 <- "?':4~#2'$#1"~#1 + DO (1551) NEXT + DO :2 <- :2~'#29524$#29523' + DO :4 <- :4~'#29524$#29523' + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + PLEASE RETRIEVE :1 + :4 + :5 + :6 + .5 + PLEASE RESUME #2 + (1900) DO STASH .2 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) DO FORGET #1 + DO %50 (1904) NEXT + DO %50 (1901) NEXT + PLEASE DO (1903) NEXT + (1904) DO .1 <- '^.1$.2'~'#0$#29524' + DO %50 .1 <- '^.1$.2'~'#0$#29524' + (1903) PLEASE FORGET #1 + DO .2 <- !2$#0'~'#9841$#1' + PLEASE DO .5 <- 'V"!2~.2'~#2"$#1'~#1 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #59037 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET THREE FROM HERE + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#2"$#1'~#1 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #29524 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#29403$#29403' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/syslib.4i b/include/syslib.4i new file mode 100644 index 0000000..1710a1f --- /dev/null +++ b/include/syslib.4i @@ -0,0 +1,354 @@ + PLEASE KNOCK TWICE TWO TIMES BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '^.1$.2'~'#0$#21845' + DO .6 <- '?"'V"'&.1$.2'~'#0$#21845'"$"'^"'@.1$ + .2'~'#0$#21845'"$#21845'~'#0$#43690'"' + ~'#0$#21845'"$#43690'~'#0$#21845' + PLEASE DO .5 <- '?".6~#49152"$#4'~#4 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- '?"!6~.6'~#3"$#4'~#4 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#5461$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?#65535$.2'~'#0$#21845' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- '?"'V".1~.2"$#2'~#1"$#1'~#1 + PLEASE DO .1 <- '^.1$.2'~'#0$#21845' + DO (1022) NEXT + DO .2 <- !2$#0'~'#5461$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#21845 + PLEASE DO .5 <- :1~'#21760$#21760' + DO .5 <- '?"!5~.5'~#3"$#4'~#4 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#21760$#21760' + DO .5 <- '?"!5~.5'~#3"$#4'~#4 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1200) DO .2 <- '^.1$.1'~'#0$#21845' + DO .3 <- '?"'@.1$#0'~'#0$#21845'"$"'@.1$#65535' + ~'#0$#21845'"'~'#0$#21845' + DO .2 <- '^.2$"!3$#0'~'#5461$#1'"'~'#0$#21845' + DO .3 <- .3~#16384 + PLEASE RESUME #1 + (1210) DO .2 <- '?"'@.1$#0'~'#0$#21845'"$"'@.1$#65535' + ~'#0$#21845'"'~'#0$#21845' + DO .3 <- '^.1$.1'~'#0$#21845' + DO .2 <- '^.2$".3~#21844"'~'#0$#21845' + DO .3 <- .3~#1 + PLEASE RESUME #1 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#21845 + PLEASE DO .2 <- :2~#21845 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#21760$#21760' + DO .2 <- :2~'#21760$#21760' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '&.6$.4' + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?#65535$":2~'#21845$#0'"'~'#0$#21845'"$ + "'?#65535$":2~'#0$#21845'"'~'#0$#21845'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#17476 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#17476"'~'#0$#21845' + DO .3 <- .1~#4369 + PLEASE DO (1525) NEXT + DO :1 <- .4$"'V.3$".2~#4369"'~'#0$#21845'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"'"!3$#0'~'#5461$#1'"$#0'~'#5461$#1'"$ + #0'~'#1365$#5' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + .1 + .2 + .3 + DO :3 <- #0 + DO :2 <- .1 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .3 <- '?"!2~.2'~#3"$#4'~#4 + DO (1532) NEXT + DO .1 <- .2 + DO (1210) NEXT + DO .3 <- 'V.3$#1'~#1 + DO (1531) NEXT + DO :1 <- :3 + DO (1500) NEXT + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1534) NEXT + (1533) DO FORGET #1 + DO :1 <- :2 + DO (1700) NEXT + DO (1535) NEXT + (1534) PLEASE RESUME .3 + (1532) DO (1534) NEXT + DO :1 <- :3 + PLEASE RETRIEVE :2 + :3 + .1 + .2 + .3 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#21845 + PLEASE DO .2 <- :2~'#21760$#21760' + DO .5 <- :1~'#21760$#21760' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#21845 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#21760$#21760'"$":4 + ~'#21760$#21760'" + DO .5 <- ':1~:1'~#3 + DO .2 <- :2~'#21760$#21760' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#3"$.5'~#5 + DO .1 <- :3~#21845 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#21845 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$"'^":4~#1"$#1'~#1"'~#69 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$"'^":4~#1"$#1'~#1"'~#1093 + DO .5 <- '?"!5~.5'~#1"$#1'~#1 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :1 + :4 + :5 + :6 + .1 + .5 + DO :3 <- #0 + DO .5 <- '?"':2~:2'~#3"$#4'~#4 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?#0$"'V"'@":2~'#16384$#0'"$#3'~#1"$#2' + ~#1"'~#1 + DO (1552) NEXT + DO :5 <- :2 + DO :1 <- :4 + PLEASE DO (1700) NEXT + DO :4 <- :2 + DO :1 <- :5 + PLEASE DO (1700) NEXT + DO (1553) NEXT + (1552) DO (1001) NEXT + DO RETRIEVE :1 + (1556) PLEASE FORGET #1 + DO :6 <- "'&":2~'#21845$#0'"$"'?#65535$":1 + ~'#21845$#0'"'~'#0$#21845'"'~'#0$#21845'"$ + "'&":2~'#0$#21845'"$"'?#65535$":1~'#0$ + #21845'"'~'#0$#21845'"'~'#0$#21845'" + DO :6 <- "'?"'V":6~'#21845$#0'"$#21845'~'#0$ + #21845'"$#21845'~'#0$#65535'"$"'?"'V":6 + ~'#0$#21845'"$#21845'~'#0$#21845'"$#21845' + ~'#0$#65535'" + DO :5 <- "'?":1~'#21845$#0'"$":2~'#21845$#0'"' + ~'#0$#65535'"$"'?":1~'#0$#21845'"$":2~'#0$ + #21845'"'~'#0$#65535'" + DO .5 <- "?'"':6~:5'~'"'"'&"':5~:5'~'#21845$#0'"$ + #16384'~'#0$#21845'"$"'?:5~:5'~'#5461$#0'"' + ~'#16384$#5461'"$"'?:5~:5'~'#0$#21845'"'" + ~#1'$#2"~#1 + DO (1554) NEXT + DO :5 <- :3 + DO (1510) NEXT + PLEASE DO :1 <- :3 + DO :3 <- "'^":4~'#21845$#0'"$":5~'#21845$#0'"' + ~'#0$#21845'"$"'^":4~'#0$#21845'"$":5~'#0$ + #21845'"'~'#0$#21845'" + DO (1555) NEXT + (1554) PLEASE DO (1001) NEXT + (1555) DO FORGET #1 + DO .5 <- 'V":4~#1"$"'?#2$":4~#1"'~#1"'~#1 + DO (1551) NEXT + DO :5 <- :1 + DO :1 <- :4 + DO :4 <- :2 + DO (1710) NEXT + DO :1 <- :4 + DO :4 <- :2 + DO (1710) NEXT + DO :1 <- :5 + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + PLEASE RETRIEVE :1 + :4 + :5 + :6 + .1 + .5 + PLEASE RESUME #2 + (1700) PLEASE STASH .2 + DO .1 <- :1~'#0$#21845' + DO .2 <- :1~'#21845$#0' + DO :2 <- "'^.2$.2'~'#0$#21845'"$"'^.1$.1'~'#0$ + #21845'" + DO .1 <- '?"'@.1$#0'~'#0$#21845'"$"'@.1$#65535' + ~'#0$#21845'"'~'#0$#21845' + DO .2 <- '?"'@.2$#0'~'#0$#21845'"$"'@.2$#65535' + ~'#0$#21845'"'~'#0$#21845' + DO :2 <- "'^":2~'#21845$#0'"$.1'~'#0$#21845'"$ + "'^":2~'#0$#21845'"$"'.2$#0'~'#5461$#1'"' + ~'#0$#21845'" + DO .1 <- .2~#16384 + PLEASE RETRIEVE .2 + PLEASE RESUME #1 + (1710) PLEASE STASH :1 + .2 + DO .1 <- :1~'#0$#21845' + DO .2 <- :1~'#21845$#0' + DO :2 <- "'^.2$.2'~'#0$#21845'"$"'^.1$.1'~'#0$ + #21845'" + DO :1 <- "'?"'@.2$#0'~'#0$#21845'"$"'@.2$#65535' + ~'#0$#21845'"'~'#0$#21845'"$"'?"'@.1$#0' + ~'#0$#21845'"$"'@.1$#65535'~'#0$#21845'"' + ~'#0$#21845'" + DO .1 <- :2~#1 + DO :2 <- "'^":1~'#21845$#0'"$":2~'#0$#21844'"' + ~'#0$#21845'"$"'^":1~'#0$#21845'"$":2 + ~'#21845$#0'"'~'#0$#21845'" + PLEASE RETRIEVE :1 + .2 + PLEASE RESUME #1 + (1900) DO STASH .2 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) PLEASE FORGET #1 + DO %50 .1 <- 'V.1$.2'~'#0$#21845' + DO %50 .1 <- '^.1$".2~#43690"'~'#0$#21845' + DO .2 <- !2$#0'~'#5461$#1' + PLEASE DO .5 <- '^".2~.2"$#1'~#1 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #65524 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET ANYWHERE FROM HERE + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#3"$#2'~#1 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #32768 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#21760$#21760' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/syslib.5i b/include/syslib.5i new file mode 100644 index 0000000..c768250 --- /dev/null +++ b/include/syslib.5i @@ -0,0 +1,355 @@ + PLEASE KNOCK "SHAVE-AND-A-HAIRCUT" BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '^.1$.2'~'#0$#3906' + DO .6 <- '?"'V"'&.1$.2'~'#0$#3906'"$"'^"'@.1$ + .2'~'#0$#3906'"$#3906'~'#0$#11718'"' + ~'#0$#3906'"$#11718'~'#0$#3906' + PLEASE DO .5 <- "?!6~#12500'$#5"~#5 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- '?"!6~.6'~#4"$#5'~#5 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#781$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?#15624$.2'~'#0$#3906' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- '?"'V".1~.2"$#3'~#1"$#2'~#1 + PLEASE DO .1 <- '^.1$.2'~'#0$#3906' + DO (1022) NEXT + DO .2 <- !2$#0'~'#781$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#3906 + PLEASE DO .5 <- :1~'#3875$#3875' + DO .5 <- '?"!5~.5'~#4"$#5'~#5 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#3875$#3875' + DO .5 <- '?"!5~.5'~#4"$#5'~#5 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#3906 + PLEASE DO .2 <- :2~#3906 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#3875$#3875' + DO .2 <- :2~'#3875$#3875' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '&.6$.4' + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?#15624$":2~'#3906$#0'"'~'#0$#3906'"$ + "'?#15624$":2~'#0$#3906'"'~'#0$#3906'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#3255 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#3255"'~'#0$#3906' + DO .3 <- .1~#651 + PLEASE DO (1525) NEXT + DO :1 <- .4$"'V.3$".2~#651"'~'#0$#3906'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"!3$#0'~'#781$#1'"$#0'~'#156$#6' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + :4 + .1 + .2 + .5 + DO :3 <- #0 + DO :4 <- .2 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .5 <- '?".1~#4"$#5'~#5 + DO (1531) NEXT + DO :1 <- :4 + DO (1720) NEXT + DO :1 <- :3 + DO (1500) NEXT + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1001) NEXT + (1533) DO FORGET #1 + DO .1 <- .1~#3905 + DO :4 <- ":4~'#0$#3906'"$"'":4~'#781$#0'"$#0' + ~'#781$#1'" + PLEASE DO .5 <- '?"!1~.1'~#4"$#5'~#5 + DO (1532) NEXT + DO (1535) NEXT + (1532) DO (1001) NEXT + DO :1 <- :3 + PLEASE RETRIEVE :2 + :3 + :4 + .1 + .2 + .5 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#3906 + PLEASE DO .2 <- :2~'#3875$#3875' + DO .5 <- :1~'#3875$#3875' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#3906 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#3875$#3875'"$":4 + ~'#3875$#3875'" + DO .5 <- ':1~:1'~#4 + DO .2 <- :2~'#3875$#3875' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#4"$.5'~#6 + DO .1 <- :3~#3906 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#3906 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$"'^":4~#1"$#2'~#1"'~#131 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$"'^":4~#1"$#2'~#1"'~#3256 + DO .5 <- '?"!5~.5'~#1"$#2'~#1 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :4 + :5 + :6 + .1 + .5 + DO :5 <- #0 + DO .5 <- '?"':2~:2'~#4"$#5'~#5 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?"':2~"#12500$#0"'"$#3'~#1 + DO (1552) NEXT + DO :2 <- ":2~'#0$#3906'"$"'":2~'#781$#0'"$#0' + ~'#781$#1'" + PLEASE DO :4 <- ":4~'#0$#3906'"$"'":4~'#781 + $#0'"$#0'~'#781$#1'" + DO (1553) NEXT + (1552) DO (1001) NEXT + DO .1 <- #0 + (1556) PLEASE FORGET #1 + DO :6 <- "'&":2~'#3906$#0'"$"'?#15624$":1 + ~'#3906$#0'"'~'#0$#3906'"'~'#0$#3906'"$ + "'&":2~'#0$#3906'"$"'?#15624$":1~'#0$ + #3906'"'~'#0$#3906'"'~'#0$#3906'" + DO :6 <- "'?"'V":6~'#3906$#0'"$#7812'~'#0$ + #3906'"$#7812'~'#0$#15624'"$"'?"'V":6 + ~'#0$#3906'"$#7812'~'#0$#3906'"$#7812' + ~'#0$#15624'" + DO :3 <- "'?":1~'#3906$#0'"$":2~'#3906$#0'"' + ~'#0$#15624'"$"'?":1~'#0$#3906'"$":2~'#0$ + #3906'"'~'#0$#15624'" + DO .5 <- "?'"':6~:3'~'"'"'&"':3~:3'~'#3906$#0'"$ + #3125'~'#0$#3906'"$"'?:3~:3'~'#781$#0'"' + ~'#3125$#781'"$"'?:3~:3'~'#0$#3906'"'"~#1'$ + #3"~#1 + PLEASE DO (1557) NEXT + DO (1510) NEXT + PLEASE DO :1 <- :3 + DO .5 <- '?#0$"'V.1$#3'~#1"'~#1 + DO (1557) NEXT + DO .1 <- '^.1$#3906'~'#0$#3906' + DO (1556) NEXT + (1557) PLEASE DO (1001) NEXT + PLEASE FORGET #1 + DO :5 <- "'V":4~'.1$#0'"$":5~'#3906$#0'"' + ~'#0$#3906'"$"'V":4~'#0$.1'"$":5~'#0$ + #3906'"'~'#0$#3906'" + DO .5 <- "?#2$':4~#1'"~#1 + DO (1551) NEXT + DO :2 <- :2~'#3906$#3905' + DO :4 <- :4~'#3906$#3905' + DO .1 <- #0 + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + DO :3 <- :5 + PLEASE RETRIEVE :1 + :4 + :5 + :6 + .1 + .5 + PLEASE RESUME #2 + (1720) PLEASE STASH :1 + :3 + :4 + .1 + .5 + DO :2 <- #0 + DO .2 <- #0 + DO .5 <- '?".1~#4"$#5'~#5 + DO (1729) NEXT + DO .5 <- .1~#1 + DO .2 <- :1~'#3906$#0' + DO .1 <- :1~'#0$#3906' + PLEASE DO (1724) NEXT + DO :1 <- '"?#0$.2"~"#0$#3906"'$'"?#0$.1"~"#0$ + #3906"' + DO :2 <- '"?'"V.2$#3906"~"#0$#3906"'$ + #3906"~"#0$#3906"'$'"?'"V.1$#3906" + ~"#0$#3906"'$#3906"~"#0$#3906"' + DO (1728) NEXT + (1724) PLEASE DO (1723) NEXT + DO :1 <- '"?#0$'"^.2$.2"~"#0$#3906"'"~"#0$#3906"'$ + '"?#0$'"^.1$.1"~"#0$#3906"'"~"#0$#3906"' + DO :2 <- '"?'"V'"@.2$#11718"~"#0$#3906"'$#7812" + ~"#0$#3906"'$#7812"~"#0$#3906"'$'"?'"V'"@.1$ + #11718"~"#0$#3906"'$#7812"~"#0$#3906"'$#7812" + ~"#0$#3906"' + (1728) DO .2 <- :2~'#3125$#0' + DO :2 <- ':2~"#0$#3906"'$'"':2~"#781$#0"'$#0" + ~"#781$#1"' + DO (1509) NEXT + DO :2 <- :3 + DO .2 <- '^.2$"'?":4~#1"$#1'~#1"'~#1 + DO (1721) NEXT + (1723) PLEASE DO (1722) NEXT + DO :1 <- '"^.2$.2"~"#0$#3906"'$'"^.1$.1"~"#0$ + #3906"' + DO :2 <- '"?'"V'"2@.2$#15624"~"#0$#3906"'$ + #11718"~"#0$#3906"'$#11718"~"#0$#3906"'$ + '"?'"V'"2@.1$#15624"~"#0$#3906"'$#11718" + ~"#0$#3906"'$#11718"~"#0$#3906"' + PLEASE FORGET #2 + DO (1728) NEXT + (1729) DO (1001) NEXT + DO (1721) NEXT + (1722) PLEASE DO (1001) NEXT + DO :2 <- :1 + DO .2 <- #0 + DO FORGET #1 + (1721) PLEASE RETRIEVE :1 + :3 + :4 + .1 + .5 + PLEASE RESUME #3 + (1900) DO STASH .2 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) DO %20 (1903) NEXT + DO .1 <- 'V.1$.2'~'#0$#3906' + DO %50 .1 <- '^.1$".2~#7812"'~'#0$#3906' + DO %50 .1 <- '^.1$.2'~'#0$#3906' + PLEASE DO (1903) NEXT + (1903) PLEASE FORGET #2 + DO .2 <- !2$#0'~'#781$#1' + PLEASE DO .5 <- '^".2~.2"$#1'~#1 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #15613 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET SOMETHING FROM NOTHING + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#4"$#3'~#1 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #7812 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#3875$#3875' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/syslib.6i b/include/syslib.6i new file mode 100644 index 0000000..43e5f52 --- /dev/null +++ b/include/syslib.6i @@ -0,0 +1,373 @@ + PLEASE KNOCK THRICE TWO TIMES BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '^.1$.2'~'#0$#9331' + DO .6 <- '?"'V"'V"'&.1$.2'~'#0$#9331'"$"'^"'@.1$ + .2'~'#0$#9331'"$#9331'~'#0$#9331'"'~'#0$ + #9331'"$"'^"'2@.1$.2'~'#0$#9331'"$#18662' + ~'#0$#9331'"'~'#0$#37324'"$#37324'~'#0$#9331' + PLEASE DO .5 <- "?!6~#38880'$#6"~#6 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- '?"!6~.6'~#5"$#6'~#6 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#1555$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?#46655$.2'~'#0$#9331' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- '?"'V".1~.2"$#4'~#1"$#3'~#1 + PLEASE DO .1 <- '^.1$.2'~'#0$#9331' + DO (1022) NEXT + DO .2 <- !2$#0'~'#1555$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#9331 + PLEASE DO .5 <- :1~'#9288$#9288' + DO .5 <- '?"!5~.5'~#5"$#6'~#6 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#9288$#9288' + DO .5 <- '?"!5~.5'~#5"$#6'~#6 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1200) DO .2 <- '^.1$.1'~'#0$#9331' + DO .3 <- '?"'2@.1$#0'~'#0$#9331'"$"'2@.1$#46655' + ~'#0$#9331'"'~'#0$#9331' + DO .2 <- '^.2$"!3$#0'~'#1555$#1'"'~'#0$#9331' + DO .3 <- .3~#7776 + PLEASE RESUME #1 + (1210) DO .2 <- '^"'?"'@.1$#0'~'#0$#9331'"$"'@.1$#46655' + ~'#0$#9331'"'~'#0$#9331'"$"'?"'3@.1$#0'~'#0$ + #9331'"$"'3@.1$#46655'~'#0$#9331'"'~'#0$ + #9331'"'~'#0$#9331' + DO .3 <- '^"'^.1$.1'~'#0$#9331'"$.1'~'#0$#9331' + DO .2 <- '^.2$".3~#9330"'~'#0$#9331' + DO .3 <- .3~#1 + PLEASE RESUME #1 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#9331 + PLEASE DO .2 <- :2~#9331 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#9288$#9288' + DO .2 <- :2~'#9288$#9288' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '&.6$.4' + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?#46655$":2~'#9331$#0'"'~'#0$#9331'"$ + "'?#46655$":2~'#0$#9331'"'~'#0$#9331'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#7998 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#7998"'~'#0$#9331' + DO .3 <- .1~#1333 + PLEASE DO (1525) NEXT + DO :1 <- .4$"'V.3$".2~#1333"'~'#0$#9331'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"!3$#0'~'#1555$#1'"$#0'~'#259$#7' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + .1 + .2 + .3 + DO :3 <- #0 + DO :2 <- .1 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .3 <- '?"!2~.2'~#5"$#6'~#6 + DO (1532) NEXT + DO .1 <- .2 + DO (1210) NEXT + DO .3 <- '?#1$".3~#5"'~#1 + DO (1531) NEXT + DO :1 <- :3 + DO (1500) NEXT + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1534) NEXT + (1533) DO FORGET #1 + DO :1 <- :2 + DO (1700) NEXT + DO (1535) NEXT + (1534) PLEASE RESUME .3 + (1532) DO (1534) NEXT + DO :1 <- :3 + PLEASE RETRIEVE :2 + :3 + .1 + .2 + .3 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#9331 + PLEASE DO .2 <- :2~'#9288$#9288' + DO .5 <- :1~'#9288$#9288' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#9331 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#9288$#9288'"$":4 + ~'#9288$#9288'" + DO .5 <- ':1~:1'~#5 + DO .2 <- :2~'#9288$#9288' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#5"$.5'~#7 + DO .1 <- :3~#9331 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#9331 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$"'^":4~#1"$#3'~#1"'~#223 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$"'^":4~#1"$#3'~#1"'~#7999 + DO .5 <- '?"!5~.5'~#1"$#3'~#1 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :1 + :4 + :5 + :6 + .1 + .5 + DO :3 <- #0 + DO .5 <- '?"':2~:2'~#5"$#6'~#6 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?#0$"'V"'2@":2~'#7776$#0'"$#5'~#1"$#4' + ~#1"'~#1 + DO (1552) NEXT + DO :5 <- :2 + DO :1 <- :4 + PLEASE DO (1700) NEXT + DO :4 <- :2 + DO :1 <- :5 + PLEASE DO (1700) NEXT + DO (1553) NEXT + (1552) DO (1001) NEXT + DO RETRIEVE :1 + (1556) PLEASE FORGET #1 + DO :6 <- "'&":2~'#9331$#0'"$"'?#46655$":1 + ~'#9331$#0'"'~'#0$#9331'"'~'#0$#9331'"$ + "'&":2~'#0$#9331'"$"'?#46655$":1~'#0$ + #9331'"'~'#0$#9331'"'~'#0$#9331'" + DO :5 <- "'?":1~'#9331$#0'"$":2~'#9331$#0'"' + ~'#0$#9331'"$"'?":1~'#0$#9331'"$":2~'#0$ + #9331'"'~'#0$#9331'" + DO :6 <- "'&":6~'#9331$#0'"$":5~'#9331$#0'"' + ~'#0$#9331'"$"'&":6~'#0$#9331'"$":5~'#0$ + #9331'"'~'#0$#9331'" + DO :5 <- :5~'#46655$#46655' + DO :6 <- "'?"'V":6~'#9331$#0'"$#27993'~'#0$ + #9331'"$#27993'~'#0$#46655'"$"'?"'V":6 + ~'#0$#9331'"$#27993'~'#0$#9331'"$#27993' + ~'#0$#46655'" + DO .5 <- "?'"':6~:5'~'"'"'&"':5~:5'~'#9331$#0'"$ + #7776'~'#0$#9331'"$"'?:5~:5'~'#1555$#0'"' + ~'#7776$#1555'"$"'?:5~:5'~'#0$#9331'"'"~#1'$ + #4"~#1 + DO (1554) NEXT + DO :5 <- :3 + DO (1510) NEXT + DO :1 <- :4 + DO :4 <- :2 + DO :2 <- :5 + DO :5 <- :3 + DO (1500) NEXT + DO :2 <- :4 + DO :4 <- :1 + DO :1 <- :5 + DO (1555) NEXT + (1554) PLEASE DO (1001) NEXT + (1555) DO FORGET #1 + DO .5 <- '?#2$"'@#0$":4~#1"'~#1"'~#1 + DO (1551) NEXT + DO :5 <- :1 + DO :1 <- :4 + DO :4 <- :2 + DO (1710) NEXT + DO :1 <- :4 + DO :4 <- :2 + DO (1710) NEXT + DO :1 <- :5 + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + PLEASE RETRIEVE :1 + :4 + :5 + :6 + .1 + .5 + PLEASE RESUME #2 + (1700) PLEASE STASH .2 + DO .1 <- :1~'#0$#9331' + DO .2 <- :1~'#9331$#0' + DO :2 <- "'^.2$.2'~'#0$#9331'"$"'^.1$.1'~'#0$ + #9331'" + DO .1 <- '?"'2@.1$#0'~'#0$#9331'"$"'2@.1$#46655' + ~'#0$#9331'"'~'#0$#9331' + DO .2 <- '?"'2@.2$#0'~'#0$#9331'"$"'2@.2$#46655' + ~'#0$#9331'"'~'#0$#9331' + DO :2 <- "'^":2~'#9331$#0'"$.1'~'#0$#9331'"$"'^":2 + ~'#0$#9331'"$"'.2$#0'~'#1555$#1'"'~'#0$#9331'" + DO .1 <- .2~#7776 + PLEASE RETRIEVE .2 + PLEASE RESUME #1 + (1710) PLEASE STASH :1 + .2 + DO .2 <- :1~'#9331$#0' + DO .1 <- :1~'#0$#9331' + DO :2 <- "'^"'^.2$.2'~'#0$#9331'"$.2'~'#0$ + #9331'"$"'^"'^.1$.1'~'#0$#9331'"$.1'~'#0$ + #9331'" + DO .1 <- '^"'?"'@.1$#0'~'#0$#9331'"$"'@.1$#46655' + ~'#0$#9331'"'~'#0$#9331'"$"'?"'3@.1$#0'~'#0$ + #9331'"$"'3@.1$#46655'~'#0$#9331'"'~'#0$ + #9331'"'~'#0$#9331' + DO :1 <- "'^"'?"'@.2$#0'~'#0$#9331'"$"'@.2$#46655' + ~'#0$#9331'"'~'#0$#9331'"$"'?"'3@.2$#0'~'#0$ + #9331'"$"'3@.2$#46655'~'#0$#9331'"'~'#0$ + #9331'"'~'#0$#9331'"$.1 + DO .1 <- :2~#1 + DO :2 <- "'^":1~'#9331$#0'"$":2~'#0$#9330'"' + ~'#0$#9331'"$"'^":1~'#0$#9331'"$":2~'#9331$ + #0'"'~'#0$#9331'" + PLEASE RETRIEVE :1 + .2 + PLEASE RESUME #1 + (1900) DO STASH .2 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) DO FORGET #1 + DO %50 (1904) NEXT + DO %50 (1901) NEXT + PLEASE DO (1903) NEXT + (1904) DO .1 <- '^.1$.2'~'#0$#9331' + DO %50 .1 <- '^.1$.2'~'#0$#9331' + (1903) PLEASE FORGET #1 + DO %50 .1 <- '^.1$".2~#27993"'~'#0$#9331' + DO .2 <- !2$#0'~'#1555$#1' + PLEASE DO .5 <- '^".2~.2"$#1'~#1 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #46644 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET BLOOD FROM A TURNIP + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#5"$#4'~#1 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #23328 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#9288$#9288' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/syslib.7i b/include/syslib.7i new file mode 100644 index 0000000..ea218e0 --- /dev/null +++ b/include/syslib.7i @@ -0,0 +1,402 @@ + PLEASE KNOCK "SHAVE-AND-A-HAIRCUT-TWO-PLEASE" BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '^.1$.2'~'#0$#2801' + DO .6 <- '?"'V"'V"'&.1$.2'~'#0$#2801'"$"'^"'@.1$ + .2'~'#0$#2801'"$#2801'~'#0$#2801'"'~'#0$ + #2801'"$"'^"'2@.1$.2'~'#0$#2801'"$#5602' + ~'#0$#2801'"'~'#0$#14005'"$#14005'~'#0$#2801' + PLEASE DO .5 <- "?!6~#14406'$#7"~#7 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- '?"!6~.6'~#6"$#7'~#7 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#400$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?#16806$.2'~'#0$#2801' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- '?"'V".1~.2"$#5'~#1"$#4'~#1 + PLEASE DO .1 <- '^.1$.2'~'#0$#2801' + DO (1022) NEXT + DO .2 <- !2$#0'~'#400$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#2801 + PLEASE DO .5 <- :1~'#2793$#2744' + DO .5 <- '?"!5~.5'~#6"$#7'~#7 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#2793$#2744' + DO .5 <- '?"!5~.5'~#6"$#7'~#7 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#2801 + PLEASE DO .2 <- :2~#2801 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#2793$#2744' + DO .2 <- :2~'#2793$#2744' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '&.6$.4' + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?#16806$":2~'#2801$#0'"'~'#0$#2801'"$ + "'?#16806$":2~'#0$#2801'"'~'#0$#2801'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#2451 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#350"'~'#0$#2801' + DO .3 <- .1~#350 + PLEASE DO (1526) NEXT + DO :1 <- .4$"'V.3$".2~#2451"'~'#0$#2801'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"!3$#0'~'#400$#1'"$#0'~'#400$#1' + PLEASE RESUME #1 + (1526) DO .3 <- '"!3$#0'~'#400$#1'"$#0'~'#57$#8' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + :4 + .1 + .2 + .5 + DO :3 <- #0 + DO :4 <- .2 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .5 <- '?".1~#6"$#7'~#7 + DO (1531) NEXT + DO :1 <- :4 + DO (1720) NEXT + DO :1 <- :3 + DO (1500) NEXT + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1001) NEXT + (1533) DO FORGET #1 + DO .1 <- .1~#2800 + DO :4 <- ":4~'#0$#2801'"$"'":4~'#400$#0'"$#0' + ~'#400$#1'" + PLEASE DO .5 <- '?"!1~.1'~#6"$#7'~#7 + DO (1532) NEXT + DO (1535) NEXT + (1532) DO (1001) NEXT + DO :1 <- :3 + PLEASE RETRIEVE :2 + :3 + :4 + .1 + .2 + .5 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#2801 + PLEASE DO .2 <- :2~'#2793$#2744' + DO .5 <- :1~'#2793$#2744' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#2801 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#2793$#2744'"$":4 + ~'#2793$#2744'" + DO .5 <- ':1~:1'~#6 + DO .2 <- :2~'#2793$#2744' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#6"$.5'~#8 + DO .1 <- :3~#2801 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#2801 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$"'^":4~#1"$#4'~#1"'~#351 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$"'^":4~#1"$#4'~#1"'~'#57$#1' + DO .5 <- '?"!5~.5'~#1"$#4'~#1 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :4 + :5 + :6 + .1 + .5 + DO :5 <- #0 + DO .5 <- '?"':2~:2'~#6"$#7'~#7 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?"':2~"#14406$#0"'"$#5'~#1 + DO (1552) NEXT + DO :2 <- ":2~'#0$#2801'"$"'":2~'#400$#0'"$#0' + ~'#400$#1'" + PLEASE DO :4 <- ":4~'#0$#2801'"$"'":4~'#400 + $#0'"$#0'~'#400$#1'" + DO (1553) NEXT + (1552) DO (1001) NEXT + DO .1 <- #0 + (1556) PLEASE FORGET #1 + DO :6 <- "'&":2~'#2801$#0'"$"'?#16806$":1 + ~'#2801$#0'"'~'#0$#2801'"'~'#0$#2801'"$ + "'&":2~'#0$#2801'"$"'?#16806$":1~'#0$ + #2801'"'~'#0$#2801'"'~'#0$#2801'" + DO :3 <- "'?":1~'#2801$#0'"$":2~'#2801$#0'"' + ~'#0$#2801'"$"'?":1~'#0$#2801'"$":2~'#0$ + #2801'"'~'#0$#2801'" + DO :6 <- "'&":6~'#2801$#0'"$":3~'#2801$#0'"' + ~'#0$#2801'"$"'&":6~'#0$#2801'"$":3~'#0$ + #2801'"'~'#0$#2801'" + DO :3 <- :3~'#16806$#16806' + DO :6 <- "'?"'V":6~'#2801$#0'"$#11204'~'#0$ + #2801'"$#11204'~'#0$#16806'"$"'?"'V":6 + ~'#0$#2801'"$#11204'~'#0$#2801'"$#11204' + ~'#0$#16806'" + DO .5 <- "?'"':6~:3'~'"'"'&"':3~:3'~'#2801$#0'"$ + #2401'~'#0$#2801'"$"'?:3~:3'~'#400$#0'"' + ~'#2401$#400'"$"'?:3~:3'~'#0$#2801'"'"~#1'$ + #5"~#1 + PLEASE DO (1557) NEXT + DO (1510) NEXT + DO :1 <- :3 + DO .5 <- '?#0$"'V.1$#5'~#1"'~#1 + DO (1557) NEXT + DO .1 <- '^.1$#2801'~'#0$#2801' + DO (1556) NEXT + (1557) PLEASE DO (1001) NEXT + PLEASE FORGET #1 + DO :5 <- "'V":4~'.1$#0'"$":5~'#2801$#0'"' + ~'#0$#2801'"$"'V":4~'#0$.1'"$":5~'#0$ + #2801'"'~'#0$#2801'" + DO .5 <- "?#2$':4~#1'"~#1 + DO (1551) NEXT + DO :2 <- :2~'#2801$#2800' + DO :4 <- :4~'#2801$#2800' + DO .1 <- #0 + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + DO :3 <- :5 + PLEASE RETRIEVE :1 + :4 + :5 + :6 + .1 + .5 + PLEASE RESUME #2 + (1720) PLEASE STASH :1 + :3 + :4 + .1 + .5 + DO :2 <- #0 + DO .2 <- #0 + DO .5 <- '?".1~#6"$#7'~#7 + DO (1729) NEXT + DO .5 <- .1~#1 + DO .2 <- :1~'#2801$#0' + DO .1 <- :1~'#0$#2801' + PLEASE DO (1726) NEXT + DO :1 <- '"?#0$.2"~"#0$#2801"'$'"?#0$.1"~"#0$ + #2801"' + DO :2 <- '"?'"V.2$#2801"~"#0$#2801"'$#2801" + ~"#0$#2801"'$'"?'"V.1$#2801"~"#0$#2801"'$ + #2801"~"#0$#2801"' + DO (1728) NEXT + (1726) PLEASE DO (1725) NEXT + DO :1 <- '"?#0$'"^.2$.2"~"#0$#2801"'"~"#0$ + #2801"'$'"?#0$'"^.1$.1"~"#0$#2801"'"~"#0$ + #2801"' + DO .2 <- "^'"V'"2@.2$#11204"~"#0$#2801"'$ + #5602"~"#0$#2801"'$'"2@.2$#2801"~"#0$ + #2801"'"~"#0$#2801" + DO .1 <- "^'"V'"2@.1$#11204"~"#0$#2801"'$ + #5602"~"#0$#2801"'$'"2@.1$#2801"~"#0$ + #2801"'"~"#0$#2801" + DO :2 <- '"?.2$#8403"~"#0$#2801"'$'"?.1$#8403" + ~"#0$#2801"' + (1728) DO .2 <- :2~'#2401$#0' + DO :2 <- ':2~"#0$#2801"'$'"':2~"#400$#0"'$#0" + ~"#400$#1"' + DO (1509) NEXT + DO :2 <- :3 + DO .2 <- '^.2$"'?":4~#1"$#1'~#1"'~#1 + DO (1721) NEXT + (1725) PLEASE DO (1724) NEXT + DO :2 <- '"?'"V'"?'"3@.2$#14005"~"#0$#2801"'$ + '"@.2$#0"~"#0$#2801"'"~"#0$#11204"'$#8403" + ~"#0$#2801"'$#8403"~"#0$#2801"'$ + '"?'"V'"?'"3@.1$#14005"~"#0$#2801"'$'"@.1$ + #0"~"#0$#2801"'"~"#0$#11204"'$#8403"~"#0$ + #2801"'$#8403"~"#0$#2801"' + DO .2 <- '^.2$.2'~'#0$#2801' + DO .1 <- '^.1$.1'~'#0$#2801' + DO :1 <- '"^.2$.2"~"#0$#2801"'$'"^.1$.1"~"#0$ + #2801"' + PLEASE FORGET #2 + DO (1728) NEXT + (1724) PLEASE DO (1723) NEXT + DO :1 <- '"^'"^.2$.2"~"#0$#2801"'$.2"~"#0$ + #2801"'$'"^'"^.1$.1"~"#0$#2801"'$.1" + ~"#0$#2801"' + DO .2 <- "^'"V'"2@.2$#16806"~"#0$#2801"'$ + #14005"~"#0$#2801"'$'"V'"4@.2$#16806" + ~"#0$#2801"'$#14005"~"#0$#2801"'"~"#0$ + #2801" + DO .1 <- "^'"V'"2@.1$#16806"~"#0$#2801"'$ + #14005"~"#0$#2801"'$'"V'"4@.1$#16806" + ~"#0$#2801"'$#14005"~"#0$#2801"'"~"#0$ + #2801" + DO :2 <- '"?.2$#8403"~"#0$#2801"'$'"?.1$#8403" + ~"#0$#2801"' + PLEASE FORGET #3 + DO (1728) NEXT + (1723) PLEASE DO (1722) NEXT + DO :1 <- '"^.2$.2"~"#0$#2801"'$'"^.1$.1"~"#0$ + #2801"' + DO :2 <- '"?'"V'"3@.2$#16806"~"#0$#2801"'$ + #14005"~"#0$#2801"'$#14005"~"#0$#2801"'$ + '"?'"V'"3@.1$#16806"~"#0$#2801"'$#14005" + ~"#0$#2801"'$#14005"~"#0$#2801"' + PLEASE FORGET #4 + DO (1728) NEXT + (1729) DO (1001) NEXT + DO (1721) NEXT + (1722) PLEASE DO (1001) NEXT + DO :2 <- :1 + DO .2 <- #0 + DO FORGET #3 + (1721) PLEASE RETRIEVE :1 + :3 + :4 + .1 + .5 + PLEASE RESUME #3 + (1900) DO STASH .2 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) DO FORGET #1 + DO %50 (1905) NEXT + DO %50 (1904) NEXT + DO %50 (1901) NEXT + PLEASE DO (1903) NEXT + (1905) DO FORGET #1 + DO .1 <- '^.1$".2~#8403"'~'#0$#2801' + PLEASE DO %50 .1 <- '^.1$".2~#5602"'~'#0$#2801' + DO (1906) NEXT + (1904) DO .1 <- '^.1$.2'~'#0$#2801' + (1906) DO %50 .1 <- '^.1$.2'~'#0$#2801' + (1903) PLEASE FORGET #1 + DO .2 <- !2$#0'~'#400$#1' + PLEASE DO .5 <- '^".2~.2"$#1'~#1 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #16795 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET SENSE FROM INTERCAL + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#6"$#5'~#1 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #8403 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#2793$#2744' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/syslib.i b/include/syslib.i new file mode 100644 index 0000000..ace68f7 --- /dev/null +++ b/include/syslib.i @@ -0,0 +1,289 @@ + PLEASE KNOCK BEFORE ENTERING + + (1000) PLEASE IGNORE .4 + PLEASE ABSTAIN FROM (1005) + (1009) DO STASH .1 + .2 + .5 + .6 + DO .4 <- #1 + DO (1004) NEXT + (1004) PLEASE FORGET #1 + DO .3 <- '?.1$.2'~'#0$#65535' + DO .6 <- '&.1$.2'~'#0$#65535' + PLEASE DO .5 <- "?!6~#32768'$#1"~#3 + DO (1002) NEXT + DO .4 <- #2 + (1005) DO (1006) NEXT + (1999) DOUBLE OR SINGLE PRECISION OVERFLOW + (1002) DO (1001) NEXT + (1006) PLEASE FORGET #1 + DO .5 <- '?"!6~.6'~#1"$#1'~#3 + DO (1003) NEXT + DO .1 <- .3 + DO .2 <- !6$#0'~'#32767$#1' + DO (1004) NEXT + (1003) DO (1001) NEXT + DO REINSTATE (1005) + (1007) PLEASE RETRIEVE .1 + .2 + .5 + .6 + DO REMEMBER .4 + PLEASE RESUME #2 + (1001) DO RESUME .5 + (1010) DO STASH .1 + .2 + .4 + DO .4 <- .1 + DO .1 <- '?.2$#65535'~'#0$#65535' + DO (1020) NEXT + PLEASE DO .2 <- .4 + PLEASE DO (1009) NEXT + DO RETRIEVE .1 + .2 + .4 + PLEASE RESUME #1 + (1020) DO STASH .2 + .3 + DO .2 <- #1 + PLEASE DO (1021) NEXT + (1021) DO FORGET #1 + DO .3 <- "?!1~.2'$#1"~#3 + PLEASE DO .1 <- '?.1$.2'~'#0$#65535' + DO (1022) NEXT + DO .2 <- !2$#0'~'#32767$#1' + DO (1021) NEXT + (1023) PLEASE RESUME .3 + (1022) DO (1023) NEXT + PLEASE RETRIEVE .2 + .3 + PLEASE RESUME #2 + (1030) DO ABSTAIN FROM (1033) + PLEASE ABSTAIN FROM (1032) + (1039) DO STASH :1 + .5 + DO (1530) NEXT + DO .3 <- :1~#65535 + PLEASE DO .5 <- :1~'#65280$#65280' + DO .5 <- '?"!5~.5'~#1"$#1'~#3 + DO (1031) NEXT + (1032) DO (1033) NEXT + DO (1999) NEXT + (1031) DO (1001) NEXT + (1033) DO .4 <- .5 + DO REINSTATE (1032) + PLEASE REINSTATE (1033) + DO RETRIEVE :1 + .5 + PLEASE RESUME #2 + (1040) PLEASE STASH .1 + .2 + .2 + :1 + :2 + :3 + DO .2 <- #0 + DO (1520) NEXT + DO STASH :1 + PLEASE RETRIEVE .2 + DO .1 <- .2 + DO .2 <- #0 + PLEASE DO (1520) NEXT + DO :2 <- :1 + DO RETRIEVE .1 + .2 + :1 + DO (1550) NEXT + PLEASE DO .3 <- :3 + DO RETRIEVE :1 + :2 + :3 + DO RESUME #1 + (1050) PLEASE STASH :2 + :3 + .5 + DO :2 <- .1 + PLEASE DO (1550) NEXT + DO .5 <- :3~'#65280$#65280' + DO .5 <- '?"!5~.5'~#1"$#1'~#3 + DO (1051) NEXT + DO (1999) NEXT + (1051) DO (1001) NEXT + DO .2 <- :3 + PLEASE RETRIEVE :2 + :3 + .5 + DO RESUME #2 + (1500) PLEASE ABSTAIN FROM (1502) + PLEASE ABSTAIN FROM (1506) + (1509) PLEASE STASH :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO .1 <- :1~#65535 + PLEASE DO .2 <- :2~#65535 + DO (1009) NEXT + DO .5 <- .3 + PLEASE DO .6 <- .4 + DO .1 <- :1~'#65280$#65280' + DO .2 <- :2~'#65280$#65280' + DO (1009) NEXT + DO .1 <- .3 + PLEASE DO (1503) NEXT + DO .6 <- .4 + DO .2 <- #1 + DO (1009) NEXT + DO .1 <- .3 + DO (1501) NEXT + (1504) PLEASE RESUME .6 + (1503) DO (1504) NEXT + (1501) DO .2 <- .5 + DO .5 <- '?"'&.6$.4'~#1"$#2'~#3 + DO (1505) NEXT + (1506) DO (1502) NEXT + PLEASE DO (1999) NEXT + (1505) DO (1001) NEXT + (1502) DO :4 <- .5 + DO (1520) NEXT + DO :3 <- :1 + PLEASE RETRIEVE :1 + .1 + .2 + .3 + .4 + .5 + .6 + DO REINSTATE (1502) + DO REINSTATE (1506) + PLEASE RESUME #3 + (1510) DO STASH :1 + :2 + :4 + DO :1 <- "'?":2~'#65535$#0'"$#65535'~'#0$#65535'"$ + "'?":2~'#0$#65535'"$#65535'~'#0$#65535'" + DO :2 <- #1 + DO (1509) NEXT + PLEASE RETRIEVE :1 + DO :2 <- :3 + PLEASE DO (1509) NEXT + DO RETRIEVE :2 + :4 + PLEASE RESUME #1 + (1520) PLEASE STASH .3 + .4 + DO .3 <- .1~#43690 + DO (1525) NEXT + PLEASE DO .4 <- 'V.3$".2~#43690"'~'#0$#65535' + DO .3 <- .1~#21845 + PLEASE DO (1525) NEXT + DO :1 <- .4$"'V.3$".2~#21845"'~'#0$#65535'" + PLEASE RETRIEVE .3 + .4 + DO RESUME #1 + (1525) DO .3 <- '"'"'"!3$#0'~'#32767$#1'"$#0'~'#32767$ + #1'"$#0'~'#16383$#3'"$#0'~'#4095$#15' + PLEASE RESUME #1 + (1530) DO STASH :2 + :3 + .3 + .5 + DO :1 <- #0 + DO :2 <- .2 + DO .3 <- #1 + DO (1535) NEXT + (1535) PLEASE FORGET #1 + DO .5 <- "?!1~.3'$#1"~#3 + DO (1531) NEXT + DO (1500) NEXT + DO :1 <- :3 + PLEASE DO (1533) NEXT + (1531) PLEASE DO (1001) NEXT + (1533) DO FORGET #1 + DO .3 <- !3$#0'~'#32767$#1' + DO :2 <- ":2~'#0$#65535'"$"'":2~'#32767$#0'"$ + #0'~'#32767$#1'" + PLEASE DO .5 <- "?!3~.3'$#1"~#3 + DO (1532) NEXT + DO (1535) NEXT + (1532) DO (1001) NEXT + PLEASE RETRIEVE :2 + :3 + .3 + .5 + DO RESUME #2 + (1540) PLEASE ABSTAIN FROM (1541) + DO ABSTAIN FROM (1542) + (1549) PLEASE STASH :1 + :2 + :4 + :5 + .1 + .2 + .5 + DO .1 <- :1~#65535 + PLEASE DO .2 <- :2~'#65280$#65280' + DO .5 <- :1~'#65280$#65280' + DO (1530) NEXT + DO :3 <- :1 + DO .2 <- :2~#65535 + PLEASE DO (1530) NEXT + DO :5 <- :1 + DO .1 <- .5 + DO (1530) NEXT + DO :4 <- :1 + PLEASE DO :1 <- ":3~'#65280$#65280'"$":4~'#65280$ + #65280'" + DO .5 <- ':1~:1'~#1 + DO .2 <- :2~'#65280$#65280' + DO (1530) NEXT + PLEASE DO .5 <- '"':1~:1'~#1"$.5'~#3 + DO .1 <- :3~#65535 + DO .2 <- #0 + DO (1520) NEXT + PLEASE DO :2 <- :1 + PLEASE DO .1 <- :4~#65535 + DO (1520) NEXT + DO (1509) NEXT + DO .5 <- !5$":4~#3"'~#15 + DO :1 <- :3 + DO :2 <- :5 + DO (1509) NEXT + PLEASE DO .5 <- !5$":4~#3"'~#172 + DO .5 <- '?"!5~.5'~#1"$#1'~#3 + PLEASE RETRIEVE :4 + (1541) DO :4 <- .5 + DO (1543) NEXT + (1542) DO (1544) NEXT + PLEASE DO (1999) NEXT + (1543) DO (1001) NEXT + (1544) DO REINSTATE (1541) + PLEASE REINSTATE (1542) + PLEASE RETRIEVE :1 + :2 + :5 + .1 + .2 + .5 + DO RESUME #2 + (1550) DO STASH :1 + :4 + :5 + .5 + DO :3 <- #0 + DO .5 <- '?"':2~:2'~#1"$#1'~#3 + PLEASE DO (1551) NEXT + DO :4 <- #1 + PLEASE DO (1553) NEXT + (1553) DO FORGET #1 + DO .5 <- '?":2~'#32768$#0'"$#2'~#3 + DO (1552) NEXT + DO :2 <- ":2~'#0$#65535'"$"'":2~'#32767$#0'"$# + 0'~'#32767$#1'" + PLEASE DO :4 <- ":4~'#0$#65535'"$"'":4~'#32767 + $#0'"$#0'~'#32767$#1'" + DO (1553) NEXT + (1552) DO (1001) NEXT + (1556) PLEASE FORGET #1 + DO :5 <- "'?":1~'#65535$#0'"$":2~'#65535$#0'"' + ~'#0$#65535'"$"'?":1~'#0$#65535'"$":2~'#0$ + #65535'"'~'#0$#65535'" + DO .5 <- '?"'&"':2~:5'~'"'?"'?":5~:5"~"#65535$ + #65535"'~'#65535$#0'"$#32768'~'#0$#65535'" + $"'?":5~:5"~"#65535$#65535"'~'#0$#65535'"' + "$"':5~:5'~#1"'~#1"$#2'~#3 + DO (1554) NEXT + DO :5 <- :3 + DO (1510) NEXT + PLEASE DO :1 <- :3 + DO :3 <- "'V":4~'#65535$#0'"$":5~'#65535$#0'"' + ~'#0$#65535'"$"'V":4~'#0$#65535'"$":5~'#0$ + #65535'"'~'#0$#65535'" + DO (1555) NEXT + (1554) PLEASE DO (1001) NEXT + (1555) DO FORGET #1 + DO .5 <- "?':4~#1'$#2"~#3 + DO (1551) NEXT + DO :2 <- ":2~'#0$#65534'"$":2~'#65535$#0'" + DO :4 <- ":4~'#0$#65534'"$":4~'#65535$#0'" + PLEASE DO (1556) NEXT + (1551) DO (1001) NEXT + PLEASE RETRIEVE :1 + :4 + :5 + .5 + PLEASE RESUME #2 + (1900) DO STASH .2 + .3 + .5 + DO .1 <- #0 + DO .2 <- #1 + PLEASE DO (1901) NEXT + (1901) DO FORGET #1 + DO %50 .1 <- 'V.1$.2'~'#0$#65535' + DO .2 <- !2$#0'~'#32767$#1' + PLEASE DO .5 <- "?!2~.2'$#1"~#3 + DO (1902) NEXT + DO (1901) NEXT + (1902) DO (1001) NEXT + DO RETRIEVE .2 + .3 + .5 + PLEASE RESUME #2 + (1910) PLEASE STASH .1 + .3 + .5 + :1 + :2 + :3 + DO .3 <- #65524 + DO :1 <- #6 + DO (1911) NEXT + PLEASE NOTE THAT YOU CAN'T GET THERE FROM HERE + (1912) DO (1001) NEXT + (1911) DO FORGET #1 + PLEASE DO (1900) NEXT + DO :2 <- .1 + DO (1500) NEXT + PLEASE DO :1 <- :3 + DO .1 <- .3 + DO (1020) NEXT + PLEASE DO .3 <- .1 + DO .5 <- '?"!3~.3'~#1"$#2'~#3 + DO (1912) NEXT + DO .1 <- #12 + PLEASE DO (1050) NEXT + DO RETRIEVE .1 + DO (1530) NEXT + DO :2 <- #32768 + DO (1500) NEXT + PLEASE DO .2 <- :3~'#65280$#65280' + PLEASE RETRIEVE .3 + .5 + :1 + :2 + :3 + DO RESUME #1 diff --git a/include/yuk.h b/include/yuk.h new file mode 100644 index 0000000..4a3d1ca --- /dev/null +++ b/include/yuk.h @@ -0,0 +1,127 @@ +/* yuk.h - header file for yuk.c and debugging versions of ick-wrap.c */ +/* Copyright (C) Alex Smith 2006. See yuk.c for copyright conditions. + This file is GPL'd, and so can be freely redistributed but has + absolutely no warranty. */ + +#define YUK(t,u) yukline(t,u) +#define YUKTERM yukterm() + +#define YUKEND 5 + +extern void yukline(int,int); +extern void yukterm(void); + +extern int abstained[]; +extern int yukopts; +extern int lineno; +extern int yuklines; +extern int yukcommands; +extern char *textlines[]; +extern int lineofaboff[]; +extern char *yukexplain[]; + +extern int yukloop; + +/* Defines that change the functions used for profiling. */ + +/* Define the following to the timing function you want for profiling, or leave + it undef to use the value computed by config.sh. */ +#undef YPTIMERTYPE +/* 0 to use clock(), 1 to use gettimeofday() and long, + 2 to use gettimeofday() and long long, 3 to use gethrtime() + 4 to use times() */ +/* Note: On many systems, 0's resolution is too low to produce any output + 1 and 2 produce the same output; use 2 if your system can handle + long long because the overflow is dealt with more simply. + 3 is a system-specific function. If there are more system-specific + functions around that return more accurate times than the others + used here, it would improve the profiler on those systems. + According to the DJGPP documentation, it's impossible to get times + with decent accuracy under DOS. DJGPP implements timer types 0, 1, + and 2, so it will 'work' with the default value of 2, but the results + you get will be basically meaningless as the base information can't + be accurately obtained (the resolution is slightly worse than 50ms, + which is far too slow for profiling). */ +#ifndef YPTIMERTIME +# ifdef HAVE_GETHRTIME +# define YPTIMERTYPE 3 +# else +# ifdef HAVE_GETTIMEOFDAY +/* Allow for an erroneous blank value for SIZEOF_LONG_LONG_INT. */ +# if SIZEOF_LONG_LONG_INT + 0 > 0 +# define YPTIMERTYPE 2 +# else +# define YPTIMERTYPE 1 +# endif +# else +# define YPTIMERTYPE 0 +# endif +# endif +#endif + + +#if YPTIMERTYPE == 0 +#define YPTIMERTFORMAT "lu" +#define YPCOUNTERTFORMAT "lu" +#define YPTIMERTFORMATD "6" YPTIMERTFORMAT +#define YPTIMERSCALE CLOCKS_PER_SEC +#define YPGETTIME clock() +typedef unsigned long yptimer; +typedef unsigned long ypcounter; + +#elif YPTIMERTYPE == 1 +#define YPTIMERTFORMAT "lu" +#define YPCOUNTERTFORMAT "lu" +#define YPTIMERTFORMATD "6" YPTIMERTFORMAT +#define YPTIMERSCALE 1000000LU +#define YPGETTIME yukgettimeofday() +typedef unsigned long yptimer; +typedef unsigned long ypcounter; + +#elif YPTIMERTYPE == 2 +#define YPTIMERTFORMAT "llu" +#define YPCOUNTERTFORMAT "lu" +#define YPTIMERTFORMATD "6" YPTIMERTFORMAT +#define YPTIMERSCALE 1000000LU +#define YPGETTIME yukgettimeofday() +typedef unsigned long long yptimer; +typedef unsigned long ypcounter; + +#elif YPTIMERTYPE == 3 +#define YPTIMERTFORMAT "llu" +#define YPCOUNTERTFORMAT "lu" +#define YPTIMERTFORMATD "9" YPTIMERTFORMAT +#define YPTIMERSCALE 1000000000LLU +#define YPGETTIME gethrtime() +typedef unsigned long long yptimer; +typedef unsigned long ypcounter; + +#elif YPTIMERTYPE == 4 +#define YPTIMERTFORMAT "lu" +#define YPCOUNTERTFORMAT "lu" +#define YPTIMERTFORMATD "6" YPTIMERTFORMAT +#define YPTIMERSCALE CLK_TCK +#define YPGETTIME yuktimes() +typedef unsigned long yptimer; +typedef unsigned long ypcounter; + +#else +#error Invalid YPTIMERTYPE in yuk.h + +#endif /* YPTIMERTYPE cases */ + +extern yptimer ypexectime[]; +extern ypcounter ypexecount[]; +extern ypcounter ypabscount[]; + +typedef struct yukvar_tag +{ + int vartype; + int extername; + int intername; +} yukvar; + +extern yukvar yukvars[]; + +extern char** globalargv; +extern int globalargc; diff --git a/install.sh b/install.sh deleted file mode 100755 index 0ff4b6a..0000000 --- a/install.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -# -# install - install a program, script, or datafile -# This comes from X11R5; it is not part of GNU. -# -# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" - -instcmd="$mvprog" -chmodcmd="" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -fi - -if [ x"$dst" = x ] -then - echo "install: no destination specified" - exit 1 -fi - - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - -if [ -d $dst ] -then - dst="$dst"/`basename $src` -fi - -# Make a temp file name in the proper directory. - -dstdir=`dirname $dst` -dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - -$doit $instcmd $src $dsttmp - -# and set any options; do chmod last to preserve setuid bits - -if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi -if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi -if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi -if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi - -# Now rename the file to the real destination. - -$doit $rmcmd $dst -$doit $mvcmd $dsttmp $dst - - -exit 0 diff --git a/makeick.bat b/makeick.bat index 24d2efc..c4d79a2 100755 --- a/makeick.bat +++ b/makeick.bat @@ -5,29 +5,28 @@ rem C-INTERCAL 0.25 compilation batch file for DJGPP. rem This code will attempt to recompile the parser and lexer using rem bison and flex. If you don't have them, you will get an error rem message and the parser and lexer included with the distribution -rem will be used. My DJGPP distribution seems to require that you -rem copy DJDIR\bin\m4.exe to the temp subdir of the INTERCAL -rem distribution or bison won't work; YMMV. +rem will be used. if not exist makeick.bat goto :direrror copy /y src\*.* temp cd temp +copy /y configdj.h config.h +echo Trying to build parsers and lexers (if this fails, e.g. if you do not +echo have bison/flex, this will produce errors but the compiler will build +echo anyway using prebuilt versions)... bison -d -oparser.c parser.y flex -olexer.c lexer.l +bison -ooil.c oil.y rem If you don't care about being able to debug ick, use rem set CFLAGS=-s -O2 -DICKNOSEARCH -W -Wall set CFLAGS=-gstabs+ -O2 -DICKNOSEARCH -W -Wall -rem Set this to a location of the GNU GPL on your system... -set COPYLOC=C:\DJGPP\COPYING -rem ...and this to the same thing, but within "s and with backslashes doubled. -set COPYLOCC="C:\\DJGPP\\COPYING" - -if not exist %COPYLOC% goto :error echo Compiling... - +gcc %CFLAGS% -o oil.exe oil.c +oil.exe < idiotism.oil > idiotism.c +gcc -c %CFLAGS% idiotism.c gcc -c %CFLAGS% parser.c gcc -c %CFLAGS% lexer.c gcc -c %CFLAGS% feh2.c @@ -39,14 +38,15 @@ gcc -c %CFLAGS% unravel.c gcc -c %CFLAGS% fiddle.c gcc -c %CFLAGS% arrgghh.c gcc -c %CFLAGS% lose.c -gcc -c %CFLAGS% -DYUKCOPYLOC=\"%COPYLOCC%\" yuk.c +gcc -c %CFLAGS% uncommon.c +gcc -c %CFLAGS% yuk.c ar cr libick.a cesspool.o numerals.o fiddle.o arrgghh.o lose.o ranlib libick.a ar cr libickmt.a cesspool.o numerals.o fiddle.o arrgghh.o lose.o unravel.o ranlib libickmt.a -ar cr libyuk.a yuk.o +ar cr libyuk.a yuk.o uncommon.o ranlib libyuk.a -gcc %CFLAGS% -oick.exe parser.o lexer.o perpet.o feh2.o dekludge.o lose.o fiddle.o +gcc %CFLAGS% -oick.exe parser.o lexer.o perpet.o feh2.o idiotism.o dekludge.o lose.o fiddle.o uncommon.o copy /y ick.exe ..\bin copy /y *.a ..\lib cd .. @@ -54,17 +54,13 @@ copy /y src\ick-wrap.c lib copy /y src\pickwrap.c lib copy /y pit\lib\syslib.i lib copy /y pit\lib\syslib.?i lib +copy /y COPYING.txt lib copy /y src\fiddle.h include copy /y src\abcess.h include copy /y src\lose.h include copy /y src\yuk.h include echo Compilation complete unless there were errors. goto :end -:error -echo You need to tell this batch file where the GNU GPL is on your system. -echo Please edit this batch file and set COPYLOC to a correct location. -echo (You can point it to the copy of COPYING.txt provided.) -goto :end :direrror echo Please run this batch file from its own directory. -:end \ No newline at end of file +:end diff --git a/makeick.sh b/makeick.sh index e4551ee..8b312d0 100755 --- a/makeick.sh +++ b/makeick.sh @@ -5,13 +5,10 @@ # This code will attempt to recompile the parser and lexer using # bison and flex. If you don't have them, you will get an error # message and the parser and lexer included with the distribution -# will be used. My DJGPP distribution seems to require that you -# copy DJDIR/bin/m4.exe to the temp subdir of the INTERCAL -# distribution or bison won't work; YMMV. +# will be used. # Using configure.sh and make is recommended; this script is a fallback for -# when you can't get configure.sh and/or make to work on your system; make -# is broken on my DJGPP distribution, so I use this file instead. +# when you can't get configure.sh and/or make to work on your system. # This file is meant to contain the same content as makeick.bat; it's simply # written for sh rather than COMMAND.COM (and doesn't make use of all its @@ -21,22 +18,22 @@ cp src/* temp cd temp +cp configdj.h config.h +echo 'Trying to build parsers and lexers (if this fails, e.g. if you do not' +echo 'have bison/flex, this will produce errors but the compiler will build' +echo 'anyway using prebuilt versions)...' bison -d -oparser.c parser.y flex -olexer.c lexer.l +bison -ooil.c oil.y # If you don't care about being able to debug ick, use # CFLAGS=-s -O2 -DICKNOSEARCH -W -Wall CFLAGS='-gstabs+ -O2 -DICKNOSEARCH -W -Wall' -# Set this to a location of the GNU GPL on your system. -# Please use forward-slash notation! -COPYLOC=c:/djgpp/copying - -echo If the following line fails, edit makeick.sh to point COPYLOC at a -echo location of the GNU GPL on your system. You can point it to the copy of -echo COPYING.txt provided. -cp ${COPYLOC} /dev/null || exit echo Compiling... +gcc ${CFLAGS} -o oil.exe oil.c +oil.exe < idiotism.oil > idiotism.c +gcc -c ${CFLAGS} idiotism.c gcc -c ${CFLAGS} parser.c gcc -c ${CFLAGS} lexer.c gcc -c ${CFLAGS} feh2.c @@ -48,14 +45,15 @@ gcc -c ${CFLAGS} unravel.c gcc -c ${CFLAGS} fiddle.c gcc -c ${CFLAGS} arrgghh.c gcc -c ${CFLAGS} lose.c -gcc -c ${CFLAGS} "-DYUKCOPYLOC=\"${COPYLOC}\"" yuk.c +gcc -c ${CFLAGS} uncommon.c +gcc -c ${CFLAGS} yuk.c ar cr libick.a cesspool.o numerals.o fiddle.o arrgghh.o lose.o ranlib libick.a ar cr libickmt.a cesspool.o numerals.o fiddle.o arrgghh.o lose.o unravel.o ranlib libickmt.a -ar cr libyuk.a yuk.o +ar cr libyuk.a yuk.o uncommon.o ranlib libyuk.a -gcc ${CFLAGS} -oick.exe parser.o lexer.o perpet.o feh2.o dekludge.o lose.o fiddle.o +gcc ${CFLAGS} -oick.exe parser.o lexer.o perpet.o feh2.o idiotism.o dekludge.o lose.o fiddle.o uncommon.o cp ick.exe ../bin cp *.a ../lib cd .. @@ -63,8 +61,9 @@ cp src/ick-wrap.c lib cp src/pickwrap.c lib cp pit/lib/syslib.i lib cp pit/lib/syslib.?i lib +cp COPYING.txt lib cp src/fiddle.h include cp src/abcess.h include cp src/lose.h include cp src/yuk.h include -echo Compilation complete unless there were errors. \ No newline at end of file +echo Compilation complete unless there were errors. diff --git a/pit/CATALOG b/pit/CATALOG index 68c9bc1..cbcf63c 100644 --- a/pit/CATALOG +++ b/pit/CATALOG @@ -113,6 +113,7 @@ by Alex Smith tests/arrtest.doc The history behind those changes tests/permute.i A permutation-printing program to test backtracking tests/permute.doc Information about the permutation-printer + tests/whileadd.i Adds two input numbers with a single WHILE statement sort.i An insertion-sort program testing computed ABSTAIN by Malcom Ryan diff --git a/pit/tests/arrtest.doc b/pit/tests/arrtest.doc index fcae369..7c539a1 100644 --- a/pit/tests/arrtest.doc +++ b/pit/tests/arrtest.doc @@ -86,7 +86,7 @@ uses, because it's the default everywhere it isn't illegal). The solution I've used places a limit on the maximum nesting depth of an expression. Strangely, it also limits the number of sparks and ears -that can be written into a 'comment' to 31. As care has to be taken +that can be written into a 'comment' to 256. As care has to be taken anyway that malformed abstained statements don't look sufficiently like real statements to cause errors, this should be a trivial extra addition. @@ -100,4 +100,5 @@ The program arrtest.i will not actually run, but it will compile as far as degenerating C code. I don't believe every line would have come out as a valid statement in any version of INTERCAL 0.24 or earlier (except the one labeled as invalid, which would have come out as valid -but is really bad style anyway). \ No newline at end of file +but is really bad style anyway). + diff --git a/pit/tests/whileadd.i b/pit/tests/whileadd.i new file mode 100644 index 0000000..7caecfc --- /dev/null +++ b/pit/tests/whileadd.i @@ -0,0 +1,6 @@ + PLEASE NOTE THIS PROGRAM READS IN TWO 16-BIT NUMBERS AND ADDS THEM + DO WRITE IN .1 + DO WRITE IN .2 +(1) DO COME FROM ".2~.2"~#1 WHILE :1 <- "'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1" + DO READ OUT .1 + PLEASE GIVE UP diff --git a/src/abcess.h b/src/abcess.h index 7a49e3b..e677d46 100644 --- a/src/abcess.h +++ b/src/abcess.h @@ -109,7 +109,7 @@ extern void parseargs(int argc, char **argv); typedef struct tag_ickthread ickthread; struct tag_ickthread { - void* varforget[8]; /* holds all four variable types, and forgetting data */ + void* varforget[10]; /* holds all four variable types, and forgetting data */ int* nextstack; int nextpointer; jmp_buf pc; /* program counter */ @@ -126,14 +126,18 @@ struct tag_ickthread mechanism works.) This only applies to ickthreads that are acting as choicepoints, not those acting as threads. */ int ccfc; /* number of comefroms currently active */ - int skipto; /* compucome line number */ + unsigned skipto; /* compucome line number */ jmp_buf cjb; /* keeps track of compucomes */ + ickthread* dsi; /* which thread's varforget and sb to use */ + ickthread* usesthis; /* for garbage collection purposes */ }; extern ickthread* ickmt_cur; /* current thread */ extern ickthread* ickmt_prev; /* previous thread: an optimisation to make thread switching O(1), not O(n), with respect to the number of threads */ -#define NEXTTHREAD if(printflow) printf("[%d]",lineno); \ +extern int weaving; /* whether to weave newly created threads */ +#define NEXTTHREAD if(printflow) printf("[%d:%lx]",lineno,(unsigned long)\ + ickmt_cur); \ if(setjmp(cjb) == 0) \ nextthread(cjb, lineno, 3); @@ -155,7 +159,7 @@ extern int hybridcount; extern int oldabstain; extern int gonebackto; extern int ccfc; -extern int skipto; +extern unsigned skipto; extern jmp_buf btjb; extern jmp_buf cjb; @@ -174,6 +178,10 @@ extern array* tails; extern bool* tailforget; extern array* hybrids; extern bool* hyforget; +#if (MULTITHREAD != 0) +extern overop* oo_onespots; +extern overop* oo_twospots; +#endif #endif /* abcess.h ends here */ diff --git a/src/arrgghh.c b/src/arrgghh.c index 05dd619..92dd1f7 100644 --- a/src/arrgghh.c +++ b/src/arrgghh.c @@ -24,7 +24,6 @@ LICENSE TERMS */ #include #include -#include #include #include #include "abcess.h" @@ -78,7 +77,6 @@ parseargs(int argc, char **argv) fprintf(stderr, "Once you start messing with INTERCAL... \n"); fprintf(stderr,"\t\tthere is no help for you!\n\n"); - sleep(3); } fprintf(stderr,"Current flags (and current state) are:\n"); for(i = 0;i < nflags;i++) { @@ -91,7 +89,6 @@ parseargs(int argc, char **argv) fprintf(stderr," do anything, but you can switch them on or off\n"); fprintf(stderr," if you like anyway. Isn't this helpful?\n\n"); fflush(stderr); - sleep(3); lose(E778, 0, (char *)NULL); } if(wimp_mode) { diff --git a/src/configdj.h b/src/configdj.h new file mode 100644 index 0000000..fe8e2a0 --- /dev/null +++ b/src/configdj.h @@ -0,0 +1,52 @@ +/* A preconfigured config.sh designed for use with DJGPP. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you have the gethrtime function. */ +/* #undef HAVE_GETHRTIME */ + +/* Define if you have the gettimeofday function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the strtol function. */ +#define HAVE_STRTOL 1 + +/* Define if you have the strtoul function. */ +#define HAVE_STRTOUL 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the number of bytes in a long long, or 0 if not available. */ +#define SIZEOF_LONG_LONG_INT 8 + +/* Define to the number of bytes in a _Bool, or 0 if not available. */ +#define SIZEOF__BOOL 1 + +/* Define if sh is available. */ +/* #undef HAVE_PROG_SH */ + +/* Define if the #! notation works. */ +/* #undef HAVE_SYS_INTERPRETER */ + +/* Define as the extension of executables (including the . if needed). */ +#define EXEEXT ".exe" + +/* Define if lex defines yyrestart(). */ +#define NEED_YYRESTART 1 diff --git a/src/configh.in b/src/configh.in new file mode 100644 index 0000000..23a5f31 --- /dev/null +++ b/src/configh.in @@ -0,0 +1,52 @@ +/* configh.in. Input to config.sh. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define if you have the gethrtime function. */ +#undef HAVE_GETHRTIME + +/* Define if you have the gettimeofday function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the strtol function. */ +#undef HAVE_STRTOL + +/* Define if you have the strtoul function. */ +#undef HAVE_STRTOUL + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the number of bytes in a long long, or 0 if not available. */ +#define SIZEOF_LONG_LONG_INT 0 + +/* Define to the number of bytes in a _Bool, or 0 if not available. */ +#define SIZEOF__BOOL 0 + +/* Define if sh is available. */ +#define HAVE_PROG_SH 1 + +/* Define if the #! notation works. */ +#undef HAVE_SYS_INTERPRETER + +/* Define as the extension of executables (including the . if needed). */ +#undef EXEEXT + +/* Define if lex defines yyrestart(). */ +#undef NEED_YYRESTART diff --git a/src/coopt.sh b/src/cooptsh.in old mode 100755 new mode 100644 similarity index 88% rename from src/coopt.sh rename to src/cooptsh.in index 1195018..2b0622c --- a/src/coopt.sh +++ b/src/cooptsh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh ########################################################################### # # Name @@ -34,12 +34,13 @@ ########################################################################### rm icktemp.out >/dev/null 2>/dev/null -if $1 +mystery >icktemp.out 2>/dev/null ; then : ; else exit 0 ; fi +if $1@EXEEXT@ +mystery >icktemp.out 2>/dev/null ; then : ; else +rm icktemp.out ; exit 0 ; fi if grep 'ickoutTERM???!' icktemp.out ; then rm icktemp.out ; exit 0 ; fi echo 'ickoutTERM???!' >> icktemp.out -rm $1 -echo "#!/bin/sh -cat <<'ickoutTERM???!'" | cat - icktemp.out > $1 -chmod +x $1 +rm $1@EXEEXT@ +echo "#! /bin/sh +cat <<'ickoutTERM???!'" | cat - icktemp.out > $1@EXEEXT@ +chmod +x $1@EXEEXT@ rm icktemp.out exit 0 diff --git a/src/dekludge.c b/src/dekludge.c index e997e98..9415fd1 100644 --- a/src/dekludge.c +++ b/src/dekludge.c @@ -25,6 +25,7 @@ LICENSE TERMS ****************************************************************************/ /*LINTLIBRARY */ +#include "config.h" #include #include #include @@ -50,7 +51,7 @@ extern int emitlineno; /* AIS: From feh2.c */ if(optdebug >= 2) putc('\n',stderr);\ opted = 1; -static void checknodeactbits(node *np); /* AIS: This prototype needed early */ +void checknodeactbits(node *np); /* AIS: This prototype needed early */ extern void prexpr(node *np, FILE* fp, int freenode); /* AIS */ /* By AIS. This function looks remarkably like a C++ copy-constructor to me, @@ -68,7 +69,7 @@ node *nodecopy(node* n) /* This function by AIS. Compares expressions. In C++, I'd call this node::operator== . */ -static bool nodessame(node* n1, node* n2) +bool nodessame(node* n1, node* n2) { if(!n1) return !n2; if(!n2) return 0; @@ -101,6 +102,8 @@ int abstainmatch(int npconstant, int tptype) if(tptype == FROM || tptype == MANYFROM || tptype == DISABLE) return 1; if(npconstant == REINSTATE) if(tptype == ENABLE) return 1; + if(npconstant == GETS) + if(tptype == RESIZE) return 1; return 0; } @@ -129,7 +132,7 @@ void optimizef(void) tuple* tp, *tpa, *tpb; atom* op; node* np; - if(!flowoptimize) lose(E778, yylineno, (char *) NULL); + if(!flowoptimize) lose(E778, iyylineno, (char *) NULL); for (tp = tuples; tp < tuples + lineno; tp++) tp->abstainable = 0; /* abstainable holds whether a line's abstention status can change */ for (op = oblist; op < obdex; op++) op->ignorable = 0; @@ -231,11 +234,11 @@ void optimizef(void) { if(tp->type == GETS) { - if(tp->u.node->rval->opcode == C_AND1ADD1 || +/* if(tp->u.node->rval->opcode == C_AND1ADD1 || tp->u.node->rval->opcode == C_2SUBAND1 || ((tp->u.node->rval->opcode == C_1PLUS || tp->u.node->rval->opcode == C_2MINUS) && - tp->u.node->rval->rval->optdata == 1)) + tp->u.node->rval->rval->optdata == 1)) //debug for now */ if(0) { /* This won't catch all <1-or-2-expressions>, but will get most of them. */ @@ -275,11 +278,11 @@ void optimizef(void) && !tp->ncomefrom && !tpa->ncomefrom) { tpb = tuples + tpa->nexttarget - 1; - if(tpb->type == RESUME && ((tpb->u.node->opcode == C_AND1ADD1 || + if(tpb->type == RESUME && (/*(tpb->u.node->opcode == C_AND1ADD1 || tpb->u.node->opcode == C_2SUBAND1 || ((tpb->u.node->opcode == C_1PLUS || tpb->u.node->opcode == C_2MINUS) && - tpb->u.node->rval->optdata == 1)) || + tpb->u.node->rval->optdata == 1)) ||*/ (np&&nodessame(tpb->u.node,np))) && !tpb->abstainable) /* No COMING FROM a nonabstainable RESUME line! */ @@ -317,12 +320,11 @@ void optimizef(void) * **************************************************************************/ -static int optimize_pass1(node *np); -static int optimize_pass2(node *np); +extern int optimize_pass1(node *np); /* Read from idiotism.c */ static void checkforintercaloperators(node *np); static void checkW534(node *np); -static node* optdebugnode; +node* optdebugnode; /* This function by AIS */ void optimize(node *np) @@ -338,7 +340,7 @@ void optimize(node *np) if(optdebug == 1) explexpr(np,stderr); if(optdebug == 1) fprintf(stderr," becomes "); if(optdebug >= 2) optdebugnode = np; - optimize_pass1(np); /* Optimize idioms */ + if(Base==2) optimize_pass1(np); /* Optimize idioms; from idiotism.oil */ if(Base!=2) { if(optdebug && optdebug != 3) explexpr(np,stderr); @@ -349,9 +351,7 @@ void optimize(node *np) } do { - checknodeactbits(np); /* Determine bitranges */ - optflag = optimize_pass2(np); /* Optimize based on those bitranges */ - optflag |= optimize_pass1(np); + optflag = optimize_pass1(np); } while(optflag); /* Keep optimizing until no optimizations are found */ if(optdebug && optdebug != 3) explexpr(np,stderr); if(optdebug == 3) prexpr(np,stderr,0); @@ -404,8 +404,9 @@ static void checkforintercaloperators(node *np) } } -/* By AIS (with a few code fragments copied from elsewhere in this file) */ -static void checknodeactbits(node *np) +/* By AIS (with a few code fragments copied from elsewhere in this file) + This generates the values of c used by the OIL idiom file idiotism.oil. */ +void checknodeactbits(node *np) { int temp; if (np == (node *)NULL) @@ -489,55 +490,68 @@ static void checknodeactbits(node *np) break; case C_NOTEQUAL: - case C_NNAND: - case C_ISNONZERO: - case C_XORGREATER: - np->optdata = 1; /* that's what !! does! */ + case C_ISEQUAL: + case C_LOGICALNOT: + case C_LOGICALAND: + case C_LOGICALOR: + case C_GREATER: + case C_LESS: + np->optdata = 1; /* this is a logical function */ break; - case C_AND1ADD1: - case C_2SUBAND1: - np->optdata = 3; /* the value could be 1 or 2 */ - break; - - case C_1PLUS: - np->optdata = np->rval->optdata | (np->rval->optdata << 1); - /* this relies on unsigned overflow handling to work correctly */ - break; - - case C_2MINUS: - if(np->rval->optdata == 1) np->optdata = 3; - else np->optdata = (np->width == 16 ? 0xffff : 0xfffffffflu); - /* alright, so this might not be ruthless enough, but C_2MINUS is - only meant to be generated when the condition is true anyway */ - break; - - case C_LSHIFT: - np->optdata = (np->lval->optdata & np->rval->optdata) << 1; + case C_RSHIFTBY: + if(np->rval->opcode == MESH || np->rval->opcode == MESH32) + np->optdata = np->lval->optdata >> np->rval->constant; + else np->optdata = (np->width == 16 ? 0xffff : 0xffffffffLU); + /* Play safe if the RHS isn't a constant */ break; - case C_LSHIFTIN1: - np->optdata = ((np->lval->optdata & np->rval->optdata) << 1) | 1; + case C_LSHIFTBY: + if(np->rval->opcode == MESH || np->rval->opcode == MESH32) + np->optdata = np->lval->optdata << np->rval->constant; + else np->optdata = (np->width == 16 ? 0xffff : 0xffffffffLU); + /* Play safe if the RHS isn't a constant */ break; - case C_LSHIFT2: - np->optdata = (np->lval->optdata & np->rval->optdata) << 2; + case C_PLUS: + /* A bit could be set if it's set in either of the numbers, or if it's set + by a carry; so OR together the two numbers and their sum. */ + np->optdata = np->lval->optdata | np->rval->optdata | + (np->lval->optdata + np->rval->optdata); break; - case C_LSHIFT8: - np->optdata = (np->lval->optdata & np->rval->optdata) << 8; + case C_MINUS: + case C_DIVIDEBY: + /* The optimizer shouldn't be able to generate negative answers or + divisions by 0, so just fill in all bits from lval rightwards */ + np->optdata = np->lval->optdata; + np->optdata |= np->optdata >> 1; + np->optdata |= np->optdata >> 2; + np->optdata |= np->optdata >> 4; + np->optdata |= np->optdata >> 8; + np->optdata |= np->optdata >> 16; break; - case C_RSHIFTBY: - if(np->rval->opcode == MESH || np->rval->opcode == MESH32) - np->optdata = np->lval->optdata >> np->rval->constant; - else np->optdata = (np->width == 16 ? 0xffff : 0xffffffffLU); - /* Just like C_2MINUS, play safe if the RHS isn't a constant */ + case C_MODULUS: + /* The answer must be smaller than both inputs, but we can't tell anything + else */ + np->optdata = np->lval->optdata; + if(np->rval->optdata < np->optdata) np->optdata = np->rval->optdata; + np->optdata |= np->optdata >> 1; + np->optdata |= np->optdata >> 2; + np->optdata |= np->optdata >> 4; + np->optdata |= np->optdata >> 8; + np->optdata |= np->optdata >> 16; break; - case C_RSHIFT: - np->optdata = (np->lval->optdata & np->rval->optdata) >> 1; - break; + case C_TIMES: + /* Convolve one set of active bits with the other, ORadding the results */ + np->optdata=0; + temp=32; + while(temp--) + if(np->lval->optdata & (1LU << temp)) + np->optdata = np->optdata | (np->rval->optdata << temp) | + ((np->rval->optdata << temp) + np->optdata); case GETS: /* Of course, this doesn't return a value. So this uses the default @@ -557,1647 +571,5 @@ static void checknodeactbits(node *np) } } -/* This function by AIS. Pass 2 removes redundant logical operations, - mostly explicit and implied C_AND. It destroys information needed by - Pass 1, which is why it's in a separate function. */ -static int optimize_pass2(node *np) -{ - node *op; - int opted = 0; - /* AIS: Paraphrased from code in the old 'optimize' function */ - /* recurse so we simplify each node after all its subnodes */ - if (np == (node *)NULL) - return 0; - else if (np->lval != (node *)NULL) - opted |= optimize_pass2(np->lval); - if (np->rval != (node *)NULL) - opted |= optimize_pass2(np->rval); - /* End of paraphrase */ - - /* Put constants of AND-like opcodes on the right */ - if((np->opcode == C_AND || np->opcode == C_NNAND || - np->opcode == C_LSHIFT || np->opcode == C_LSHIFTIN1 || - np->opcode == C_LSHIFT2 || np->opcode == C_LSHIFT8 || - np->opcode == C_RSHIFT) && - (np->lval->opcode == MESH || np->lval->opcode == MESH32)) - { - OPTING(andlikeconstmove) - op = np->lval; - np->lval = np->rval; - np->rval = op; - } - - /* The implicit &1 in C_AND1ADD1 and C_2SUBAND1 may be removable. */ - if(np->opcode == C_AND1ADD1 && np->rval->optdata == 1) - { - OPTING(impand1a1) - np->opcode = C_1PLUS; - } - if(np->opcode == C_2SUBAND1 && np->rval->optdata == 1) - { - OPTING(impand12m) - np->opcode = C_2MINUS; - } - - if(np->opcode == C_AND && (np->rval->opcode == MESH || - np->rval->opcode == MESH32) && - !(np->lval->optdata & ~np->rval->constant)) - { - OPTING(unneededand) - /* This AND is unnecessary. optdata stays the same. */ - op = np->lval; - free(np->rval); - *np = *op; - free(op); - } - - if((np->opcode == C_NNAND || np->opcode == C_RSHIFT) && - (np->rval->opcode == MESH || np->rval->opcode == MESH32) && - !(np->lval->optdata & ~np->rval->constant)) - { - /* The implicit AND here is unneccesary. Eliminate it. */ - OPTING(unneededimpand) - if(np->opcode == C_RSHIFT) - { - np->rval->constant = 1; - np->rval->optdata = 1; - np->opcode = C_RSHIFTBY; - } - else - { - np->opcode = C_ISNONZERO; - free(np->rval); - np->rval = np->lval; - np->lval = (node*) NULL; - } - } - - if((np->opcode == C_AND || np->opcode == C_NNAND || - np->opcode == C_LSHIFT || np->opcode == C_LSHIFTIN1 || - np->opcode == C_LSHIFT2 || np->opcode == C_LSHIFT8 || - np->opcode == C_RSHIFT) && np->lval->opcode == C_AND && - (np->rval->opcode == MESH || np->rval->opcode == MESH32) && - (np->lval->rval->opcode == MESH || np->lval->rval->opcode == MESH32)) - { - OPTING(combineand) - /* Combine the two ANDs into one. (The AND at np may be implicit.) - Leave opdata the same. */ - np->rval->constant &= np->lval->rval->constant; - op = np->lval; - free(op->rval); - np->lval = op->lval; - free(op); - } - - if((np->opcode == C_AND || np->opcode == C_NNAND || - np->opcode == C_LSHIFT || np->opcode == C_LSHIFTIN1 || - np->opcode == C_LSHIFT2 || np->opcode == C_LSHIFT8 || - np->opcode == C_RSHIFT) && - (np->rval->opcode == MESH || np->rval->opcode == MESH32) && - (~np->lval->optdata & np->rval->constant)) - { - OPTING(weakenand) - /* Reduce the constant in this C_AND-like expression - to aid further optimization */ - np->rval->constant &= np->lval->optdata; - } - return opted; -} - -/* Pass 1. Optimizes idioms. */ -static int optimize_pass1(node *np) /* AIS: was 'optimize'. Recursive calls in - here have been updated. */ -{ - node *mingleop, *op, *op2; - unsigned long temp = 0; - int temp2 = 0; - int opted = 0; - - /* recurse so we simplify each node after all its subnodes - AIS: Keep track of whether we've optimized anything. I added - all uses of the variable 'opted', and a return value. */ - if (np == (node *)NULL) - return 0; - else if (np->lval != (node *)NULL) - opted |= optimize_pass1(np->lval); - if (np->rval != (node *)NULL) - opted |= optimize_pass1(np->rval); - - /* - * OK, now do complete folding of constant expressions. - */ - - /* fold MINGLE operations on constants */ - if (np->opcode==MINGLE && (np->lval->opcode==MESH&&np->rval->opcode==MESH)) - { - OPTING(minglefold) - np->opcode = MESH32; - np->constant = mingle(np->lval->constant, np->rval->constant); - free(np->lval); - free(np->rval); - np->lval=(node*)NULL; - np->rval=(node*)NULL; - } - - /* fold SELECT operations on constants */ - if (np->opcode == SELECT - && ((np->lval->opcode==MESH || np->lval->opcode==MESH32) - && (np->rval->opcode==MESH || np->rval->opcode==MESH32))) - { - OPTING(selectfold) - np->opcode = np->rval->opcode; - np->constant = iselect(np->lval->constant, np->rval->constant); - free(np->lval); - free(np->rval); - np->lval=(node*)NULL; - np->rval=(node*)NULL; - } - - /* fold AND operations on 16-bit constants */ - if (np->opcode == AND && np->rval->opcode == MESH) - { - OPTING(and16fold) - np->opcode = MESH; - np->constant = and16(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* fold AND operations on 32-bit constants */ - if (np->opcode == AND && np->rval->opcode == MESH32) - { - OPTING(and32fold) - np->opcode = MESH32; - np->constant = and32(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* fold OR operations on 16-bit constants */ - if (np->opcode == OR && np->rval->opcode == MESH) - { - OPTING(or16fold) - np->opcode = MESH; - np->constant = or16(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* fold OR operations on 32-bit constants */ - if (np->opcode == OR && np->rval->opcode == MESH32) - { - OPTING(or32fold) - np->opcode = MESH32; - np->constant = or32(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* fold XOR operations on 16-bit constants */ - if (np->opcode == XOR && np->rval->opcode == MESH) - { - OPTING(xor16fold) - np->opcode = MESH; - np->constant = xor16(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* fold XOR operations on 32-bit constants */ - if (np->opcode == XOR && np->rval->opcode == MESH32) - { - OPTING(xor32fold) - np->opcode = MESH32; - np->constant = xor32(np->rval->constant); - free(np->rval); - np->rval=(node*)NULL; - } - - /* - * Less trivial stuff begins here - */ - - /* following optimizations only work in binary */ - if (Base != 2) - return opted; - - /* recognize the idioms for various C binary logical operations */ - if (np->opcode == SELECT - && np->rval->opcode == MESH32 && np->rval->constant == 0x55555555 - && (op = np->lval) - && (op->opcode == AND || op->opcode == OR || op->opcode == XOR) - && (mingleop = op->rval) && mingleop->opcode == MINGLE - && mingleop->rval->width == 16 - && mingleop->lval->width == 16) - { - OPTING(cbinlogop) - free(np->rval); /* AIS */ - - np->lval = mingleop->lval; - np->rval = mingleop->rval; - - switch(op->opcode) - { - case AND: np->opcode = C_AND; break; - case OR: np->opcode = C_OR; break; - case XOR: np->opcode = C_XOR; break; - default: lose(E778, yylineno, (char *)NULL); - } - - free(mingleop); free(op); - } - - /* AIS: Sometimes C binary logical operations have a smaller rval->constant. */ - if (np->opcode == SELECT - && (np->rval->opcode == MESH32||np->rval->opcode == MESH) - && (op = np->lval) && !(np->rval->constant&0xAAAAAAAALU) - && (op->opcode == AND || op->opcode == OR || op->opcode == XOR) - && (mingleop = op->rval) && mingleop->opcode == MINGLE - && mingleop->rval->width == 16 - && mingleop->lval->width == 16) - { - unsigned long i=iselect(np->rval->constant,0x55555555LU); - if(i==iselect(i,i)) - { - OPTING(smallcbinlogop) - np->lval = mingleop; - - switch(op->opcode) - { - case AND: np->lval->opcode = C_AND; break; - case OR: np->lval->opcode = C_OR; break; - case XOR: np->lval->opcode = C_XOR; break; - default: lose(E778, yylineno, (char *)NULL); - } - np->opcode = C_AND; - np->rval->constant=i; /* np->rval->opcode already correct */ - - free(op); - } - } - - /* recognize idioms for ~ */ - if (np->opcode == C_XOR) - { - /* AIS: Warning! We have to check again for C_XOR, else we will - be making use of the freed np->lval. This is not strictly necessary in - the first case. I added extra conditions to prevent np->lval being - used after deallocation, which is how I discovered the error in the - first place. (Some code elsewhere was messing up, and I suspected - memory allocation problems.) */ - if (np->opcode == C_XOR && np->rval->width == 16 - && np->lval->opcode == MESH &&np->lval->constant == 0xffff) - { - OPTING(cnot1) - np->opcode = C_NOT; - free(np->lval); - np->lval=(node*)NULL; - } - - if (np->opcode == C_XOR && np->lval->width == 16 - && np->rval->opcode == MESH && np->rval->constant == 0xffff) - { - OPTING(cnot2) - np->opcode = C_NOT; - free(np->rval); - np->rval = np->lval; - np->lval=(node*)NULL; - } - - if (np->opcode == C_XOR && np->rval->width == 32 - && np->lval->opcode == MESH32 && np->lval->constant == 0xffffffffLU) - { - OPTING(cnot3) - np->opcode = C_NOT; - free(np->lval); - np->lval=(node*)NULL; - } - - if (np->opcode == C_XOR && np->lval->width == 32 - && np->rval->opcode == MESH32 && np->rval->constant == 0xffffffffLU) - { - OPTING(cnot4) - np->opcode = C_NOT; - free(np->rval); - np->rval = np->lval; - np->lval=(node*)NULL; - } - } - - /* AIS: I wrote everything from here to the end of this function. */ - - /* recognize the idiom x~'pow(2,n)-1' */ - if (np->opcode==SELECT&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - iselect(np->rval->constant,np->rval->constant)==np->rval->constant) - { - OPTING(pow2m1select) - np->opcode = C_AND; /* This is cheaper than both SELECT and C_NNAND. - lval, rval already correct. */ - } - - /* recognize the idiom x~pow(2,n). */ - if (np->opcode==SELECT&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - iselect(np->rval->constant,np->rval->constant)==1) /* see, INTERCAL - operators can be - useful in C! */ - { - OPTING(pow2select) - np->opcode = C_NNAND; /* lval, rval already correct. C_NNAND is cheaper - than iselect. */ - if(np->rval->constant==1) np->opcode = C_AND; - } - - /* recognize select-mingle combinations which can be replaced by &, | and - single bitshifts (there are five of these in total) - Most of these idioms are used when doing 32-bit logical operations - separately on odd and even bits. Although these optimizations can speed - up code containing them a bit, their main purpose is to replace the - expressions with a consistent, short form that later optimizations can - recognize. (In fact, some later optimizations are effectively - optimizations on the degenerated C code, not on the INTERCAL original.) */ - if (np->opcode==MINGLE&&np->lval->opcode==SELECT&& - np->lval->rval->opcode==MESH32&&np->lval->rval->constant==0xaaaaaaaa) - { - OPTING(selectmingle1) - np->opcode=C_OR; - np->lval->opcode=C_AND; - op=np->rval; - np->rval=newnode(); - np->rval->opcode=MINGLE; - np->rval->lval=newnode(); - np->rval->lval->opcode=MESH; - np->rval->lval->width=16; - np->rval->lval->constant=0; - np->rval->rval=op; - np->rval->width=32; - optimize_pass1(np->rval); - optimize_pass1(np->lval); - /* replace (a~0xaaaaaaaa)$b with (a&0xaaaaaaaa)|(0$b) - if b is a constant, the recursive call to optimize does - constant folding */ - if(np->opcode==C_OR&&np->lval->opcode==C_AND&& - np->rval->opcode==MESH32&&np->rval->constant==0) - { /* check the conditions again in case it's been optimized */ - /* get rid of the C_OR */ - np->opcode=C_AND; - op=np->lval; - np->lval=op->lval; - np->rval->constant=op->rval->constant; - free(op->rval); - free(op); - optimize_pass1(np->lval); - } - else if(np->opcode==C_OR&&np->lval->opcode==C_AND&& - np->rval->opcode==MESH32&&np->rval->constant==0x55555555) - { /* check the conditions again in case it's been optimized */ - /* get rid of the C_AND */ - op=np->lval; - np->lval=op->lval; - free(op->rval); - free(op); - optimize_pass1(np->lval); - } - } - - if (np->opcode==MINGLE&&np->rval->opcode==SELECT&& - np->rval->rval->opcode==MESH32&&np->rval->rval->constant==0x55555555) - { - OPTING(selectmingle2) - np->opcode=C_OR; - np->rval->opcode=C_AND; - op=np->lval; - np->lval=newnode(); - np->lval->opcode=MINGLE; - np->lval->rval=newnode(); - np->lval->rval->opcode=MESH; - np->lval->rval->width=16; - np->lval->rval->constant=0; - np->lval->lval=op; - np->lval->width=32; - optimize_pass1(np->lval); - optimize_pass1(np->rval); - /* replace b$(a~0x55555555) with (a&0x55555555)|(b$0) - if b is a constant, the recursive call to optimize does - constant folding */ - if(np->opcode==C_OR&&np->rval->opcode==C_AND&& - np->lval->opcode==MESH32&&np->lval->constant==0) - { /* check the conditions again in case it's been optimized */ - /* get rid of the C_OR */ - np->opcode=C_AND; - op=np->rval; - np->rval=op->lval; - np->lval->constant=op->rval->constant; - free(op->rval); - free(op); - optimize_pass1(np->rval); - } - else if(np->opcode==C_OR&&np->rval->opcode==C_AND&& - np->lval->opcode==MESH32&&np->lval->constant==0xaaaaaaaa) - { /* check the conditions again in case it's been optimized */ - /* get rid of the C_AND */ - op=np->rval; - np->rval=op->lval; - free(op->rval); - free(op); - optimize_pass1(np->rval); - } - } - - if (np->opcode==MINGLE&&np->lval->opcode==SELECT&& - np->lval->rval->opcode==MESH32&&np->lval->rval->constant==0x55555555) - { - OPTING(selectmingle3) - np->opcode=C_OR; - np->lval->opcode=C_LSHIFT; /* (a&b)<<1 */ - op=np->rval; - np->rval=newnode(); - np->rval->opcode=MINGLE; - np->rval->lval=newnode(); - np->rval->lval->opcode=MESH; - np->rval->lval->width=16; - np->rval->lval->constant=0; - np->rval->rval=op; - np->rval->width=32; - optimize_pass1(np->rval); - optimize_pass1(np->lval); - /* replace (a~0x55555555)$b with ((a&0x55555555)<<1)|(0$b) - if b is a constant, the recursive call to optimize does - constant folding */ - if(np->opcode==C_OR&&np->lval->opcode==C_LSHIFT&& - np->rval->opcode==MESH32&&np->rval->constant==0) - { /* check the conditions again in case it's been optimized */ - /* get rid of the C_OR */ - np->opcode=C_LSHIFT; - op=np->lval; - np->lval=op->lval; - np->rval->constant=op->rval->constant; - free(op->rval); - free(op); - optimize_pass1(np->lval); /* 32-bit logic recognition */ - } - } - - if (np->opcode==MINGLE&&np->rval->opcode==SELECT&& - np->rval->rval->opcode==MESH32&&np->rval->rval->constant==0xaaaaaaaa) - { - OPTING(selectmingle4) - np->opcode=C_OR; - np->rval->opcode=C_RSHIFT; /* (a&b)>>1 */ - op=np->lval; - np->lval=newnode(); - np->lval->opcode=MINGLE; - np->lval->rval=newnode(); - np->lval->rval->opcode=MESH; - np->lval->rval->width=16; - np->lval->rval->constant=0; - np->lval->lval=op; - np->lval->width=32; - optimize_pass1(np->lval); - optimize_pass1(np->rval); - /* replace b$(a~0xaaaaaaaa) with ((a&0xaaaaaaaa)>>1)|(b$0) - if b is a constant, the recursive call to optimize does - constant folding */ - if(np->opcode==C_OR&&np->rval->opcode==C_RSHIFT&& - np->lval->opcode==MESH32&&np->lval->constant==0) - { /* check for these conditions again in case it's been optimized */ - /* get rid of the C_OR */ - np->opcode=C_RSHIFT; - op=np->rval; - np->rval=op->lval; - np->lval->constant=op->rval->constant; - free(op->rval); - free(op); - optimize_pass1(np->rval); - } - } - - if(np->opcode==MINGLE&&(np->lval->opcode==MESH|| - np->lval->opcode==MESH32)&& - np->lval->constant==0&&np->rval->opcode==C_LSHIFT&& - (np->rval->rval->opcode==MESH||np->rval->rval->opcode==MESH32)&& - np->rval->rval->constant==0x7fff&&np->rval->lval->opcode==SELECT&& - np->rval->lval->rval->opcode==MESH32&&np->rval->lval->rval->constant== - 0x2aaaaaaa) - { - OPTING(selectmingle5) - /* this is equivalent to (np->rval->lval->lval&0x2aaaaaaa)<<1 */ - np->opcode=C_LSHIFT; - np->lval->opcode=MESH32; - np->lval->constant=0x2aaaaaaa; - op=np->rval; - np->rval=op->lval->lval; - free(op->lval->rval); - free(op->lval); - free(op->rval); - free(op); - } - - /* recognize the idiom (x~x)~1 (already optimized to (x~x)&1). */ - - if (np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==1&&np->lval->opcode==SELECT&& - nodessame(np->lval->lval,np->lval->rval)) -/* (np->lval->lval->opcode==ONESPOT||np->lval->lval->opcode==TWOSPOT)&& - np->lval->lval->opcode==np->lval->rval->opcode&& - np->lval->lval->constant==np->lval->rval->constant)*/ - { - OPTING(xselxsel1) - free(np->rval); - np->rval=np->lval->rval; - nodefree(np->lval->lval); - free(np->lval); - np->lval=(node*) NULL; - np->opcode = C_ISNONZERO; - } - - /* recognize the idiom (x~y)~1 (already optimized to (x~y)&1) in other cases. - if (np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==1&&np->lval->opcode==SELECT) - { - OPTING(xselysel1) - np->opcode = C_NNAND; - free(np->rval); - np->rval = np->lval->rval; - op = np->lval; - np->lval = np->lval->lval; - free(op); - } - This idiom is commented out because I thought it simplified to !!(x & y), - and of course it doesn't. The next two idioms are (hopefully correct) - idioms that were inspired by this idea. - */ - - /* recognize the idiom (x ~ k) ~ 1 (ie (x ~ k) & 1) for constant k */ - if(np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==1&&np->lval->opcode==SELECT&& - (np->lval->rval->opcode==MESH||np->lval->rval->opcode==MESH32)) - { - OPTING(xselksel1) - np->opcode = C_NNAND; - free(np->rval); - np->rval = np->lval->rval; - op = np->lval; - np->lval = np->lval->lval; - free(op); - temp = 1; - if(np->rval->constant == 0) temp = 0; else - while(!(np->rval->constant % 2)) - { - np->rval->constant /= 2; - temp *= 2; - } - np->rval->constant = temp; - /* So (x ~ k) ~ 1 optimizes to !!(x & n) where n is the lowest set - bit in k. */ - } - - /* recognize the idiom (k ~ x) ~ 1 (ie (k ~ x) & 1) where k is a power - of 2 minus 1 */ - if (np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==1&&np->lval->opcode==SELECT&& - (np->lval->lval->opcode==MESH||np->lval->lval->opcode==MESH32)&& - iselect(np->lval->lval->constant,np->lval->lval->constant)== - np->lval->lval->constant) - { - OPTING(p2m1selxsel1) - np->opcode = C_NNAND; - free(np->rval); - np->rval = np->lval->rval; - op = np->lval; - np->lval = np->lval->lval; - free(op); - } - - /* recognize idioms for left-shift and right-shift */ - /* 16- or 32-bit right-shift by 1, not necessarily all the bits */ - if(np->opcode==SELECT&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - iselect(np->rval->constant,np->rval->constant)<<1==np->rval->constant) - { - OPTING(rshift1) - np->opcode = C_RSHIFT; /* Keep rval as it tells us what to & with */ - } - - /* 16- or 32-bit right-shift by a higher number */ - if(np->opcode==SELECT&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - iselect(xor32(np->rval->constant),xor32(np->rval->constant))==3&& - !(np->rval->constant&1)) - { - OPTING(rshiftby) - np->opcode = C_RSHIFTBY; - temp2 = 0; - temp = np->rval->constant; - while(!(np->rval->constant&1)) - { - np->rval->constant>>=1; - temp2++; - } - np->rval->constant = temp2; - op = np->lval; - np->lval = newnode(); - np->lval->width = np->width; - np->lval->rval = newnode(); - np->lval->opcode = C_AND; - np->lval->rval->opcode = np->rval->opcode; - np->rval->opcode = MESH; - np->lval->rval->width = np->rval->width; - np->rval->width = 16; - np->lval->rval->constant = temp; - np->lval->lval = op; - optimize_pass1(np->lval); /* not sure what good this will do, but it's good practice - to optimize newly created nodes, in case someone invents - a new optimization (this caught me out elsewhere) */ - /* The joke with this optimization is that it comes out with more nodes than - when it started. However, under most implementations of C, & and >> are - significantly cheaper than iselect. */ - } - - /* 16-bit left-shift by 1 */ - if(np->opcode==SELECT&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->lval->opcode==MINGLE&&(np->rval->constant & 0x55555555LU)==1&& - (np->lval->rval->opcode==MESH||np->lval->rval->opcode==MESH32)&& - (np->lval->rval->constant==0||np->lval->rval->constant==1)) - { - unsigned long i=iselect(np->rval->constant, 0xaaaaaaaaLU); - if(i==iselect(i,i)) - { - OPTING(lshift16by1) - np->opcode = np->lval->rval->constant?C_LSHIFTIN1:C_LSHIFT; - /* We can shift either a 1 or a 0 into the right end of the number. */ - np->rval->constant=i; /* New effect of this node: (lval->lval & i)<<1 */ - /* We know that np->rval has the right opcode. */ - op=np->lval->lval; - free(np->lval); - np->lval=op; - } - } - - /* 32-bit left-shift of a variable by 1 */ - if(np->opcode==C_OR&&np->lval->opcode==C_LSHIFT&& - np->rval->opcode==C_LSHIFT) - do - { /* this is so we can break; out of the if */ - temp=0; - if(np->lval->lval->opcode==MESH32&& - np->lval->lval->constant==0x55555555) temp++; - if(np->lval->rval->opcode==MESH32&& - np->lval->rval->constant==0x55555555) temp++; - if(np->rval->lval->opcode==MESH32&& - np->rval->lval->constant==0x55555555) temp++; - if(np->rval->rval->opcode==MESH32&& - np->rval->rval->constant==0x55555555) temp++; - if(temp!=1) break; - temp=0; - if(np->lval->lval->opcode==MESH32&& - np->lval->lval->constant==0x2aaaaaaa) temp++; - if(np->lval->rval->opcode==MESH32&& - np->lval->rval->constant==0x2aaaaaaa) temp++; - if(np->rval->lval->opcode==MESH32&& - np->rval->lval->constant==0x2aaaaaaa) temp++; - if(np->rval->rval->opcode==MESH32&& - np->rval->rval->constant==0x2aaaaaaa) temp++; - if(temp!=1) break; - /* found the two required constants. Now we need two - identical TWOSPOTs on opposite sides of the C_OR. */ - temp=0xffffffff; /* who'd use that many variables? */ - if(np->lval->lval->opcode==TWOSPOT&& - np->rval->lval->opcode==TWOSPOT&& - np->lval->lval->constant== - np->rval->lval->constant) temp=np->lval->lval->constant; - if(np->lval->lval->opcode==TWOSPOT&& - np->rval->rval->opcode==TWOSPOT&& - np->lval->lval->constant== - np->rval->rval->constant) temp=np->lval->lval->constant; - if(np->lval->rval->opcode==TWOSPOT&& - np->rval->lval->opcode==TWOSPOT&& - np->lval->rval->constant== - np->rval->lval->constant) temp=np->lval->rval->constant; - if(np->lval->rval->opcode==TWOSPOT&& - np->rval->rval->opcode==TWOSPOT&& - np->lval->rval->constant== - np->rval->rval->constant) temp=np->lval->rval->constant; - if(temp==0xffffffff) break; /* Patched by Joris Huizer */ - /* recognized a 32-bit leftshift */ - OPTING(lshift32by1) - free(np->lval->lval); - free(np->lval->rval); - free(np->rval->lval); - free(np->rval->rval); - np->lval->opcode=TWOSPOT; - np->lval->constant=temp; - np->rval->opcode=MESH32; - np->rval->constant=0x7fffffff; - np->lval->lval=(node*)NULL; - np->lval->rval=(node*)NULL; - np->rval->lval=(node*)NULL; - np->rval->rval=(node*)NULL; - np->opcode=C_LSHIFT; - } while(0); - - /* 16-bit left-shift by 2 */ - if(np->opcode==C_LSHIFT&&np->lval->opcode==C_LSHIFT&& - np->rval->constant==np->lval->rval->constant) - { - OPTING(lshift16by2) - op=np->lval->lval; - np->opcode=C_LSHIFT2; - free(np->lval); - np->lval=op; - np->rval->constant>>=1; - } - - /* An idiom for 16-bit left-shift by 8 is caught later. */ - - /* recognize the idiom '?x$#y'~#3, where y is 1 or 2 - The ~ is already optimized to &. */ - if(np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==3&&np->lval->opcode==XOR&& - np->lval->rval->opcode==MINGLE&&(mingleop=np->lval->rval)&& - (mingleop->rval->opcode==MESH||mingleop->rval->opcode==MESH32)&& - (mingleop->rval->constant==1||mingleop->rval->constant==2)) - { - OPTING(xorto1or2) - /* This depends only on the rightmost bit of x, and y. - For y=1: - If 0, answer = 0x1 - If 1, answer = 0x2 - For y=2: - If 0, answer = 0x2 - Id 1, answer = 0x1 - */ - np->opcode = mingleop->rval->constant==1?C_AND1ADD1:C_2SUBAND1; - free(np->rval); - np->rval=mingleop->lval; - free(mingleop->rval); - free(mingleop); - free(np->lval); - /*free(mingleop->rval);*/ - np->lval=(node*)NULL; - - /* np->rval could be an iselect of a variable with itself, - and not have been caught yet (because the &1 was implied, - not explicit). Catch this now. */ - if(np->rval->opcode==SELECT&& - (np->rval->lval->opcode==ONESPOT||np->rval->lval->opcode==TWOSPOT)&& - np->rval->lval->opcode==np->rval->rval->opcode&& - np->rval->lval->constant==np->rval->rval->constant) - { - np->rval->opcode=C_ISNONZERO; - free(np->rval->lval); - np->rval->lval=(node*)NULL; - } - - /* Even if that didn't work, iselect can still be replaced by nnand - (because we have an implicit (x~y)&1) */ - if(np->rval->opcode==SELECT) np->rval->opcode=C_NNAND; - - /* If we know np->rval must be 0 or 1 at runtime, we can optimize further - (to avoid (1&x)&1, (x&1)&1 or (!!x)&1) */ - if(np->rval->opcode==C_NNAND||np->rval->opcode==C_ISNONZERO|| - (np->rval->opcode==C_AND&& - (np->rval->lval->opcode==MESH||np->rval->lval->opcode==MESH32) - &&np->rval->lval->constant==1) - ||(np->rval->opcode==C_AND&& - (np->rval->rval->opcode==MESH||np->rval->rval->opcode==MESH32) - &&np->rval->rval->constant==1) - ) - { - np->opcode=np->opcode==C_AND1ADD1?C_1PLUS:C_2MINUS; - } - } - - /* optimize a select with 0xffffffff (already optimized to &) */ - if(np->opcode==C_AND&&np->rval->opcode==MESH32&& - np->rval->constant==0xffffffff) - { - OPTING(noopand1r) - free(np->rval); - op=np->lval; - *np=*op; /* copy the whole node */ - np->width=32; - free(op); - } - if(np->opcode==C_AND&&np->lval->opcode==MESH32&& - np->lval->constant==0xffffffff) - { - OPTING(noopand1l) - free(np->lval); - op=np->rval; - *np=*op; /* copy the whole node */ - np->width=32; - free(op); - } - - /* optimize complementing the odd or even bits of a 32-bit number */ - /* complement odd bits, zero even bits */ - if(np->opcode==C_LSHIFT&&np->rval->opcode==MESH32&& - np->rval->constant==0x55555555&&np->lval->opcode==XOR&& - np->lval->width==32&&np->lval->rval->opcode==C_OR&& - ((np->lval->rval->rval->opcode==MESH32&&np->lval->rval->rval-> - constant==0x55555555&&((temp2 = 0),1))|| - (np->lval->rval->lval->opcode==MESH32&&np->lval->rval->lval-> - constant==0x55555555&&(temp2 = 1)))) - { - OPTING(com1z0l) - /* optimizations so far have given us code which sets all even - bits of a 32-bit expression, xor32s it, selects the even bits - and left-shifts. This is equivalent to complementing all odd - bits of the number and zeroing the even bits. */ - np->rval->constant = 0xaaaaaaaa; - np->lval->rval->opcode = C_AND; - op = temp2 ? np->lval->rval->lval : np->lval->rval->rval; - op->constant = 0xaaaaaaaa; - op = np->lval->rval; - free(np->lval); - np->lval = op; - np->opcode = C_XOR; - } - - /* same optimization with np's operands exchanged */ - if(np->opcode==C_LSHIFT&&np->lval->opcode==MESH32&& - np->lval->constant==0x55555555&&np->rval->opcode==XOR&& - np->rval->width==32&&np->rval->rval->opcode==C_OR&& - ((np->rval->rval->rval->opcode==MESH32&&np->rval->rval->rval-> - constant==0x55555555&&((temp2 = 0),1))|| - (np->rval->rval->lval->opcode==MESH32&&np->rval->rval->lval-> - constant==0x55555555&&(temp2 = 1)))) - { - OPTING(com1z0r) - /* optimizations so far have given us code which sets all even - bits of a 32-bit expression, xor32s it, selects the even bits - and left-shifts. This is equivalent to complementing all odd - bits of the number and zeroing the even bits. */ - np->lval->constant = 0xaaaaaaaa; - np->rval->rval->opcode = C_AND; - op = temp2 ? np->rval->rval->lval : np->rval->rval->rval; - op->constant = 0xaaaaaaaa; - op = np->rval->rval; - free(np->rval); - np->rval = op; - np->opcode = C_XOR; - } - - /* complement even bits, zero odd bits */ - if(np->opcode==C_AND&&np->rval->opcode==MESH32&& - np->rval->constant==0x55555555&&np->lval->opcode==XOR&& - np->lval->width==32&&np->lval->rval->opcode==C_OR&& - np->lval->rval->rval->opcode==MESH32&& - np->lval->rval->rval->constant==0x55555555&& - np->lval->rval->lval->opcode==C_LSHIFT&& - np->lval->rval->lval->rval->opcode==MESH32&& - np->lval->rval->lval->rval->constant==0x55555555) - { - OPTING(com0z1) - /* There are another 7 ways this expression could be written. - However, this is the only way likely to be generated by - the rest of the optimizer. */ - op=np->lval->rval->lval->lval; - free(np->lval->rval->lval->rval); - free(np->lval->rval->lval); - free(np->lval->rval->rval); - np->lval->opcode = C_AND; - np->opcode = C_XOR; - np->lval->lval = op; - np->lval->rval->opcode = MESH32; - np->lval->rval->lval = (node*) NULL; - np->lval->rval->rval = (node*) NULL; - np->lval->rval->constant = 0x55555555; - /* and np->rval is already correct! */ - } - - /* optimize no-op C_OR, C_AND, C_XOR - (some of these are produced as a result of earlier optimizations). - This sort of thing was also used in the days of INTERCAL-72 to - convert information to 16- or 32-bit representations. As C-INTERCAL - is almost untyped and the typechecker has already run, this can be - done safely. One of these cases has already been considered earlier - (the one generated by the code (something)~'#65535$#65535'), but it - is included it again to complete the list. */ - /* (something op constant) */ - if(np->opcode==C_OR&&(np->lval->opcode==MESH||np->lval->opcode==MESH32) - &&np->lval->constant==0) - { - OPTING(nooporl) - free(np->lval); - op=np->rval; - *np=*op; - free(op); - } - if(np->opcode==C_XOR&&(np->lval->opcode==MESH||np->lval->opcode==MESH32) - &&np->lval->constant==0) - { - OPTING(noopxorl) - free(np->lval); - op=np->rval; - *np=*op; - free(op); - } - if(np->opcode==C_AND&&(np->lval->opcode==MESH||np->lval->opcode==MESH32) - &&np->lval->constant==0xffffffff) - { - OPTING(noopandl) - free(np->lval); - op=np->rval; - *np=*op; - free(op); - } - if(np->opcode==C_OR&&(np->rval->opcode==MESH||np->rval->opcode==MESH32) - &&np->rval->constant==0) - { - OPTING(nooporr) - free(np->rval); - op=np->lval; - *np=*op; - free(op); - } - if(np->opcode==C_XOR&&(np->rval->opcode==MESH||np->rval->opcode==MESH32) - &&np->rval->constant==0) - { - OPTING(noopxorr) - free(np->rval); - op=np->lval; - *np=*op; - free(op); - } - if(np->opcode==C_AND&&(np->rval->opcode==MESH||np->rval->opcode==MESH32) - &&np->rval->constant==0xffffffff) - { - OPTING(noopandr) - free(np->rval); - op=np->lval; - *np=*op; - free(op); - } - /* something op itself */ - if((np->opcode==C_AND||np->opcode==C_OR)&&nodessame(np->lval,np->rval)) - { - OPTING(andoritself) - nodefree(np->rval); - op=np->lval; - *np=*op; - free(op); - } - if(np->opcode==C_XOR&&nodessame(np->lval,np->rval)) - { - OPTING(xoritself) - nodefree(np->lval); - nodefree(np->rval); - np->opcode = (np->width==16?MESH:MESH32); - np->lval = (node*) NULL; - np->rval = (node*) NULL; - np->constant = 0; - } - /* repetitive implicit C_AND */ - if(np->opcode==C_NNAND&&nodessame(np->lval,np->rval)) - { - OPTING(reptimpand) - nodefree(np->lval); - np->lval = (node*) NULL; - np->opcode = C_ISNONZERO; - } - - /* optimize 32-bit complement */ - if(np->opcode==C_OR&&np->lval->opcode==C_XOR&&np->lval->lval->opcode==C_AND&& - np->rval->opcode==C_XOR&&np->rval->lval->opcode==C_AND&& - np->lval->rval->opcode==MESH32&&np->lval->lval->rval->opcode==MESH32&& - np->rval->rval->opcode==MESH32&&np->rval->lval->rval->opcode==MESH32&& - np->lval->rval->constant==np->lval->lval->rval->constant&& - np->rval->rval->constant==np->rval->lval->rval->constant&& - (np->lval->rval->constant^np->rval->rval->constant)==0xffffffff&& - nodessame(np->lval->lval->lval,np->rval->lval->lval)) - { - OPTING(com32) - np->opcode = C_NOT; - np->width = 32; - free(np->rval->lval->lval); - free(np->rval->lval->rval); - free(np->rval->lval); - free(np->rval->rval); - free(np->rval); - op = np->lval->lval->lval; - free(np->lval->lval->rval); - free(np->lval->lval); - free(np->lval->rval); - free(np->lval); - np->rval = op; - np->lval = (node*)NULL; - } - - /* If constant is on the left, move it to the right. This will - simplify checking for the remaining optimizations, while not - altering the effect of code that cannot be optimized further. - (There are furious debates within the C community as to - whether a constant should be written on the left or right of - an operation. The argument in favour of 'constant on the left' - is mainly that it's better at detecting a mistype of = for ==. - This code assumes that ick won't make that mistake.) */ - if(np->opcode==C_LSHIFT||np->opcode==C_AND||np->opcode==C_OR|| - np->opcode==C_XOR||np->opcode==C_NNAND||np->opcode==C_RSHIFT) - { /* all the above opcodes are symmetrical wrt their operands */ - if(np->lval->opcode==MESH||np->lval->opcode==MESH32) - { - OPTING(constswitch) - op = np->lval; - np->lval = np->rval; - np->rval = op; - } - } - - /* 32-bit logical operations on alternate bits. - At this point, they have been optimized - to an expression of the form op32(oddbits | evenbits)&0x55555555, - which is good but still uses the INTERCAL operator op32. We should - be able to optimize this using & | ^ and bitshifts. */ - if((np->opcode==C_AND||np->opcode==C_LSHIFT)&&np->rval->opcode==MESH32&& - np->rval->constant==0x55555555&&np->lval->width==32&& - (np->lval->opcode==XOR||np->lval->opcode==OR|| - np->lval->opcode==AND)&&np->lval->rval->opcode==C_OR) - do /* so we can break; out */ - { - /* Check to see if the op32 is a C_OR of an oddbits and an - evenbits */ - op=np->lval->rval; - temp2=0; /* |=1 for oddbits found, |=2 for evenbits found */ - if(op->lval->opcode==C_AND&&op->lval->rval->opcode==MESH32&& - op->lval->rval->constant==0x55555555) temp2|=2; - if(op->lval->opcode==C_AND&&op->lval->rval->opcode==MESH32&& - op->lval->rval->constant==0xaaaaaaaa) temp2|=1; - if(op->rval->opcode==C_AND&&op->rval->rval->opcode==MESH32&& - op->rval->rval->constant==0x55555555) temp2|=2; - if(op->rval->opcode==C_AND&&op->rval->rval->opcode==MESH32&& - op->rval->rval->constant==0xaaaaaaaa) temp2|=1; - if(op->lval->opcode==C_LSHIFT&&op->lval->rval->opcode==MESH32&& - op->lval->rval->constant==0x55555555) temp2|=1; - if(op->lval->opcode==C_RSHIFT&&op->lval->rval->opcode==MESH32&& - op->lval->rval->constant==0xaaaaaaaa) temp2|=2; - if(op->rval->opcode==C_LSHIFT&&op->rval->rval->opcode==MESH32&& - op->rval->rval->constant==0x55555555) temp2|=1; - if(op->rval->opcode==C_RSHIFT&&op->rval->rval->opcode==MESH32&& - op->rval->rval->constant==0xaaaaaaaa) temp2|=2; - if(temp2!=3) break; - /* this expression can be optimized */ - OPTING(shiftand) - if(np->lval->opcode==XOR) op->opcode=C_XOR; - if(np->lval->opcode==OR) op->opcode=C_OR; - if(np->lval->opcode==AND) op->opcode=C_AND; - if(np->opcode==C_LSHIFT) - { - /* odd-bit-ize the evenbits we found */ - if(op->lval->rval->constant==0x55555555) op->lval->opcode=C_LSHIFT; - if(op->rval->rval->constant==0x55555555) op->rval->opcode=C_LSHIFT; - if(op->lval->rval->constant==0xaaaaaaaa) op->lval->opcode=C_AND; - if(op->rval->rval->constant==0xaaaaaaaa) op->rval->opcode=C_AND; - } else { - /* even-bit-ize the oddbits we found */ - if(op->lval->rval->constant==0x55555555) op->lval->opcode=C_AND; - if(op->rval->rval->constant==0x55555555) op->rval->opcode=C_AND; - if(op->lval->rval->constant==0xaaaaaaaa) op->lval->opcode=C_RSHIFT; - if(op->rval->rval->constant==0xaaaaaaaa) op->rval->opcode=C_RSHIFT; - } - /* What np should be is now in op */ - free(np->lval); - free(np->rval); - *np=*op; - } while(0); - - /* Optimize 32-bit logical expressions on the whole number. - At this point, the most common idiom for a 32-bit logical operation - (we write it here as %) looks like this: - ((a&0xaaaaaaaa)%(b&0xaaaaaaaa))|((a&0x55555555)%(b&0x55555555)) - So first, we use distributive laws to simplify such constructions - further. - The distribution is done at a lower level of the expression tree, - but this is where it is done in the sequence of optimizations needed - to optimize a 32-bit expression. These optimizations are unlikely to - help in 16-bit code, because it's unlikely a programmer would take the - effort to code an expression like the ones below unless he/she had to. - - Expressions that distribute: - (a&k)&(b&k) == (a&b)&k - (a|k)&(b|k) == (a&b)|k - (a&k)|(b&k) == (a|b)&k - (a|k)|(b|k) == (a|b)|k - (a&k)^(b&k) == (a^b)&k */ - if((np->opcode==C_AND||np->opcode==C_OR||np->opcode==C_XOR)&& - (np->lval->opcode==C_AND||np->lval->opcode==C_OR)&& - !(np->lval->opcode==C_OR&&np->opcode==C_XOR)&& - np->lval->opcode==np->rval->opcode) - { - if(nodessame(np->lval->lval,np->rval->lval)) - { - OPTING(distribll) - nodefree(np->lval->lval); - np->lval->lval = np->rval->rval; - np->lval->opcode = np->opcode; - np->opcode = np->rval->opcode; - op = np->rval; - np->rval = np->rval->lval; - free(op); - } - else if(nodessame(np->lval->rval,np->rval->lval)) - { - OPTING(distribrl) - nodefree(np->lval->rval); - np->lval->rval = np->rval->rval; - np->lval->opcode = np->opcode; - np->opcode = np->rval->opcode; - op = np->rval; - np->rval = np->rval->lval; - free(op); - } - else if(nodessame(np->lval->lval,np->rval->rval)) - { - OPTING(distriblr) - nodefree(np->lval->lval); - np->lval->lval = np->rval->lval; - np->lval->opcode = np->opcode; - np->opcode = np->rval->opcode; - op = np->rval; - np->rval = np->rval->rval; - free(op); - } - else if(nodessame(np->lval->rval,np->rval->rval)) - { - OPTING(distribrr) - nodefree(np->lval->rval); - np->lval->rval = np->rval->lval; - np->lval->opcode = np->opcode; - np->opcode = np->rval->opcode; - op = np->rval; - np->rval = np->rval->rval; - free(op); - } - } - - /* At this point, the 32-bit logical expression looks like this: - (with % substituting for &,|, or ^) - (0xaaaaaaaa|0x55555555)&(a%b) - Clearly, what is needed is a bit of constant folding on C_OR. We - might as well do C_AND and C_XOR while we're at it. This will get - done during the second run of optimize_pass1. */ - if((np->opcode==C_AND||np->opcode==C_OR||np->opcode==C_XOR)&& - (np->lval->opcode==MESH||np->lval->opcode==MESH32)&& - (np->rval->opcode==MESH||np->rval->opcode==MESH32)) - { - OPTING(clogopfold) - switch(np->opcode) - { - case C_AND: np->constant = np->lval->constant & np->rval->constant; break; - case C_OR: np->constant = np->lval->constant | np->rval->constant; break; - case C_XOR: np->constant = np->lval->constant ^ np->rval->constant; break; - default: lose(E778, yylineno, (char*) NULL); - } - free(np->lval); - np->lval = (node*) NULL; - free(np->rval); - np->rval = (node*) NULL; - np->opcode = np->width == 16 ? MESH : MESH32; - } - - /* Somewhat incomprehensibly, there is a 32-bit right-shift in the - standard library that has been done using separation into even - and odd bits! This code recognizes that idiom, even though - surely it would have been simpler to select against - 0xfffffffe? (This would have been optimized much earlier in this - function, and would also be shorter and clearer. Perhaps the - obfuscation is the reason that it was written in separate bits.) */ - - /* Selecting something with 0x55555554, then mingling with 0, - right-shifts the even bits onto the odd bits. */ - if(np->opcode==MINGLE&&np->lval->opcode==SELECT&& - (np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==0&&np->lval->rval->opcode==MESH32&& - np->lval->rval->constant==0x55555554) - { - OPTING(selminglershift) - np->opcode = C_RSHIFT; - np->rval->opcode = MESH32; - np->rval->width = 32; - np->rval->constant = 0x55555554; - free(np->lval->rval); - op = np->lval->lval; - free(np->lval); - np->lval = op; - } - - /* Since it's such a stupid idiom anyway, we'll just optimize it the - way round that the standard library has it. It looks like this: - (((a&0x55555554)>>1)|((a&0xaaaaaaaa)>>1)) */ - if(np->opcode==C_OR&&np->lval->opcode==C_RSHIFT&& - np->rval->opcode==C_RSHIFT&&np->lval->rval->opcode==MESH32&& - np->lval->rval->constant==0x55555554&& - np->rval->rval->opcode==MESH32&&np->rval->rval->constant== - 0xaaaaaaaa&&np->lval->lval->opcode==TWOSPOT&& - np->rval->lval->opcode==TWOSPOT&&np->lval->lval->constant== - np->rval->lval->constant) - { - OPTING(sillysyslibidiom) - op = np->lval; - free(np->rval->lval); - free(np->rval->rval); - free(np->rval); - op->rval->constant = 0xfffffffe; - *np = *op; - free(op); - optuple->warn128 = 1; - } - - /* A more useful idiom in the standard library is on the - internal subroutine labelled (1525). It's an 8-bit - left-shift. In INTERCAL, this is done with repeated - mingling and selection. So far, the optimiser can only - recognize two leftshifts in the inside, because the rest - of the expression is written assuming that the low-bits - of the result are unset (which is correct after a two-bit - left-shift). This code recognizes the entire idiom straight - off, rather than optimizing in stages, after the optimization - of the inside to a double-leftshift. */ - if(np->opcode==SELECT&&np->rval->opcode==MESH32&& - np->rval->constant==0xaaaaff&&np->lval->opcode==MINGLE&& - (np->lval->rval->opcode==MESH||np->lval->rval->opcode==MESH32)&& - np->lval->rval->constant==0&&np->lval->lval->opcode==SELECT&& - np->lval->lval->rval->opcode==MESH32&& - np->lval->lval->rval->constant==0xaaaaaaf&& - np->lval->lval->lval->opcode==MINGLE&&( - np->lval->lval->lval->rval->opcode==MESH|| - np->lval->lval->lval->rval->opcode==MESH32)&& - np->lval->lval->lval->rval->constant==0&& - np->lval->lval->lval->lval->opcode==C_LSHIFT2&&( - np->lval->lval->lval->lval->rval->opcode==MESH|| - np->lval->lval->lval->lval->rval->opcode==MESH32)&& - np->lval->lval->lval->lval->rval->constant==0x3fff) - { - OPTING(lshift8) - /* left-shift np->lval->lval->lval->lval->lval by 8 */ - op = np->lval->lval->lval->lval->lval; - free(np->lval->lval->lval->lval->rval); - free(np->lval->lval->lval->lval); - free(np->lval->lval->lval->rval); - free(np->lval->lval->lval); - free(np->lval->lval->rval); - free(np->lval->lval); - free(np->lval->rval); - free(np->lval); - np->lval = op; - np->opcode = C_LSHIFT8; - np->rval->constant = 0x00ffffff; - } - - /* recognize an idiom for ==, != */ - if(np->opcode == C_ISNONZERO && np->rval->opcode == C_XOR) - { - OPTING(xortoequal) - np->opcode = C_NOTEQUAL; - op = np->rval; - np->lval = op->lval; - np->rval = op->rval; - free(op); - /* So !!(a ^ b), as in 1 + !!(a^b), has become (a!=b). */ - } - - /* Some of the remaining idioms depend on active-bit analysis */ - checknodeactbits(np); - /* C binary logical operations can be done in 'expanded' form, that is, on - just oddbits or evenbits of a 32-bit number. */ - if((np->opcode==C_AND || np->opcode==C_LSHIFT || np->opcode == C_LSHIFT2 || - np->opcode==C_LSHIFT8 || np->opcode==C_LSHIFTIN1 || np->opcode==C_NNAND) - && (np->rval->opcode==MESH32 || np->rval->opcode==MESH) - && !(np->rval->constant & 0xaaaaaaaaLU)) - { - unsigned long i=iselect(np->rval->constant, 0x55555555LU); - if(i==iselect(i,i) && (np->lval->opcode == OR || - np->lval->opcode == AND || - np->lval->opcode == XOR) && - np->lval->rval->opcode==C_OR) - { - if(!(np->lval->rval->lval->optdata & 0x55555555LU) && - !(np->lval->rval->rval->optdata & 0xaaaaaaaaLU) && - (np->lval->rval->lval->opcode == C_AND || - np->lval->rval->lval->opcode == C_LSHIFT || - np->lval->rval->lval->opcode == MESH || - np->lval->rval->lval->opcode == MESH32)) - { /* recognized the idiom. Swap the C_OR round so we don't have to write - the code for this out twice. */ - OPTING(clogopexpswitch) - op=np->lval->rval->rval; - np->lval->rval->rval=np->lval->rval->lval; - np->lval->rval->lval=op; - } - if(!(np->lval->rval->lval->optdata & 0xaaaaaaaaLU) && - !(np->lval->rval->rval->optdata & 0x55555555LU) && - (np->lval->rval->rval->opcode == C_AND || - np->lval->rval->rval->opcode == C_LSHIFT || - np->lval->rval->lval->opcode == MESH || - np->lval->rval->lval->opcode == MESH32)) - { - OPTING(clogopexpand) - op = np->lval->rval; - switch(np->lval->opcode) - { - case AND: op->opcode = C_AND; break; - case OR: op->opcode = C_OR; break; - case XOR: op->opcode = C_XOR; break; - default: lose(E778, yylineno, (char*) NULL); - } - free(np->lval); - np->lval = op; - if(np->lval->rval->opcode == MESH || np->lval->rval->opcode == MESH32) - np->lval->rval->constant >>= 1; - else np->lval->rval->opcode = np->lval->rval->opcode == C_AND ? - C_RSHIFT : C_AND; - if(np->opcode == C_LSHIFT&&(np->lval->lval->opcode == C_AND || - np->lval->lval->opcode == C_RSHIFT || - np->lval->lval->opcode == MESH || - np->lval->lval->opcode == MESH32)) - { - /* Instead of doing the calculation on the evenbits, do it on the - oddbits; that'll save a bitshift (possibly even save two - bitshifts). */ - np->opcode = C_AND; - if(np->lval->lval->opcode == MESH || - np->lval->lval->opcode == MESH32) np->lval->lval->constant <<= 1; - else np->lval->lval->opcode = np->lval->lval->opcode == C_AND ? - C_LSHIFT : C_AND; - if(np->lval->rval->opcode == MESH || - np->lval->rval->opcode == MESH32) np->lval->rval->constant <<= 1; - else np->lval->rval->opcode = np->lval->rval->opcode == C_AND ? - C_LSHIFT : C_AND; - np->rval->constant <<= 1; - } - checknodeactbits(np); /* To calculate an improved active-bits value */ - } - } - } - - /* One common situation in which the previous idiom is used is a 32-bit - logic operation with a constant. The distributive law will not catch - such cases because even bits of the constant are used on one side and - odd bits of the constant are used on the other side, making the - expressions different. In syslib, the idiom is only used with the - constant equal to 0x80000000, leading to another problem; the logic - operation may not have been written at all on one side of the - expression, due to one parity set of bits having no effect. The - following code catches three cases involving 32-bit logical operations - with constants. Of course, some loony could theoretically write the - 16-bit version like this... */ - if(np->opcode==C_OR&&(np->lval->opcode==C_AND||np->lval->opcode==C_XOR|| - np->lval->opcode==C_OR||np->lval->opcode==C_LSHIFT|| - np->lval->opcode==C_RSHIFT)&& - (np->rval->opcode==C_AND||np->rval->opcode==C_XOR|| - np->rval->opcode==C_OR||np->rval->opcode==C_LSHIFT|| - np->rval->opcode==C_RSHIFT)&& - !(np->lval->optdata&np->rval->optdata)) - { - op = np->lval; - op2 = np->rval; - /* rely on the 'constant on the right' optimization */ - if(op->opcode!=C_LSHIFT&&op->opcode!=C_RSHIFT) - if(op->lval->opcode==C_AND || op->lval->opcode==C_LSHIFT) - if(op->rval->opcode==MESH || op->rval->opcode==MESH32) op=op->lval; - if(op2->opcode!=C_LSHIFT&&op2->opcode!=C_RSHIFT) - if(op2->lval->opcode==C_AND || op2->lval->opcode==C_LSHIFT) - if(op2->rval->opcode==MESH || op2->rval->opcode==MESH32) op2=op2->lval; - if(nodessame(op->lval,op2->lval) && - (op->rval->opcode==MESH||op->rval->opcode==MESH32) && - (op2->rval->opcode==MESH||op2->rval->opcode==MESH32) && - !(op->rval->constant&op2->rval->constant) && - (op->opcode==op2->opcode) && - (op->opcode==C_AND||op->opcode==C_LSHIFT||op->opcode==C_RSHIFT)&& - (op2->opcode==C_AND||op2->opcode==C_LSHIFT||op2->opcode==C_RSHIFT)) - { - /* Now op and op2 are & or implied & (only <<, >>, & are at all likely - to be here), and have the same lval. The only check left is that - this does actually correspond to (something32 op constant), in - other words that there is exactly one possibility for op. */ - if((np->lval==op||np->rval==op2||np->lval->opcode==np->rval->opcode) - &&(np->lval!=op||np->rval!=op2)) - { - OPTING(clogopwithconst) - if(np->lval!=op) temp2=np->lval->opcode; - if(np->rval!=op2) temp2=np->rval->opcode; - if(np->lval==op) temp=np->rval->rval->constant; - else if(np->rval==op2) temp=np->lval->rval->constant; - else switch(temp2) - { - case C_AND: - temp = np->rval->rval->constant & np->lval->rval->constant; break; - case C_OR: - temp = np->rval->rval->constant | np->lval->rval->constant; break; - case C_XOR: - temp = np->rval->rval->constant ^ np->lval->rval->constant; break; - default: lose(E778, yylineno, (char*)NULL); - } - np->opcode = temp2; - np->rval->opcode = np->width==16 ? MESH : MESH32; - np->rval->constant = temp; - temp = op->rval->constant | op2->rval->constant; - nodefree(np->rval->lval); - nodefree(np->rval->rval); - np->rval->lval = (node*) NULL; - np->rval->rval = (node*) NULL; - if(np->lval!=op) - { - op2 = np->lval; - np->lval = op; - free(op2); - } - np->lval->rval->constant = temp; - if(np->lval->rval->constant>0xffff) np->lval->rval->opcode = MESH32; - optimize_pass1(np->lval); - /* it's pretty likely that there's an & with 0xffffffff here, although - not guaranteed, so reoptimize it */ - } - } - } - - /* Greater than/less than. The longest idiom in syslib, it stretches over 2 - statements. The first statement will already be optimized to - :a <- (:b ^ :c) or similar. At this point in the code, the second - statement looks like ((:c ~ :a) ~ ((? (:a ~ :a)) ^ 0x80000000)) or - similar. (That's a 32-bit ?.) The idiom, obviously, also could work - with a 16-bit ? and 0x8000. The point is, it returns the bit of :c - that corresponds to the most significant set bit in :a, which is the - most significant bit that differs between :b and :c. So if this bit is - a 1, it means that :c is greater; if it's a 0, it means that :b is - greater, or the numbers are equal. optimize_pass1 only optimizes within - an expression, so we're going to render it as :c > (:a ^ :c). */ - if(np->opcode==SELECT&&np->lval->opcode==SELECT&&np->rval->opcode==C_XOR&& - (np->rval->rval->opcode==MESH||np->rval->rval->opcode==MESH32)&& - np->rval->lval->opcode==XOR&&np->rval->lval->rval->opcode==SELECT&& - ((np->rval->lval->width==32&&np->rval->rval->constant==0x80000000LU)|| - (np->rval->lval->width==16&&np->rval->rval->constant==0x8000))&& - nodessame(np->lval->rval,np->rval->lval->rval->lval)&& - nodessame(np->lval->rval,np->rval->lval->rval->rval)) - { - temp=np->rval->lval->width; - if(temp==32||(np->lval->lval->width==16&&np->lval->rval->width==16&& - np->rval->lval->rval->lval->width==16&& - np->rval->lval->rval->rval->width==16)) - { - OPTING(greaterthan) - nodefree(np->rval); - op = np->lval; - *np=*op; - free(op); - np->opcode = C_XORGREATER; - np->optdata = 1; - } - } - - /* Many previous optimizations generate Boolean values. In INTERCAL, - Boolean algebra on these will be done with the familiar mingle, - unary, select routine. However, in many cases the 'select' will be - an implied &1, which could have been computed by many of the earlier - optimizations. These Boolean algebra operations are caught here. */ - if((np->opcode==C_AND1ADD1||np->opcode==C_2SUBAND1|| - ((np->opcode==C_AND||np->opcode==C_NNAND||np->opcode==C_LSHIFT|| - np->opcode==C_RSHIFT||np->opcode==C_LSHIFT2||np->opcode==C_LSHIFT8|| - np->opcode==C_LSHIFTIN1)&& - (np->rval->opcode==MESH||np->rval->opcode==MESH32)&& - np->rval->constant==1))) - { - if(np->opcode==C_AND1ADD1||np->opcode==C_2SUBAND1) op = np->rval; - else op = np->lval; - if((op->opcode==AND||op->opcode==OR||op->opcode==XOR)&& - op->rval->opcode==MINGLE) - { - OPTING(clogopand1) - mingleop = op->rval; - switch(op->opcode) - { - case AND: mingleop->opcode = C_AND; break; - case OR: mingleop->opcode = C_OR; break; - case XOR: mingleop->opcode = C_XOR; break; - default: lose(E778, yylineno, (char *) NULL); - } - free(op); - if(np->opcode==C_AND1ADD1||np->opcode==C_2SUBAND1) - np->rval = mingleop; - else np->lval = mingleop; - } - } - - /* The next optimization is aided by splitting C_NNANDs when they are - the argument to C_OR. Two cases. */ - - if(np->opcode == C_OR && np->lval->opcode == C_NNAND) - { - OPTING(splitnnandinorl) - op = np->lval; - np->lval = cons(C_ISNONZERO, (node *) NULL, op); - np->lval->width = np->lval->rval->width; - np->lval->rval->opcode = C_AND; - np->lval->optdata = 1; - } - - if(np->opcode == C_OR && np->rval->opcode == C_NNAND) - { - OPTING(splitnnandinorr) - op = np->rval; - np->rval = cons(C_ISNONZERO, (node *) NULL, op); - np->rval->width = np->rval->rval->width; - np->rval->rval->opcode = C_AND; - np->rval->optdata = 1; - } - - /* We can save a small amount of time, and aid further optimization, - by undistributing C_ISNONZERO across C_OR. This is used in some tests - which produce Booolean output, when testing the oddbits and - evenbits separately. Unfortunately, this doesn't work for C_AND. */ - if(np->opcode == C_OR && np->lval->opcode == C_ISNONZERO && - np->rval->opcode == C_ISNONZERO) - { - OPTING(distribnon0overor) - np->opcode = C_ISNONZERO; - np->rval->opcode = C_OR; - np->rval->lval = np->lval->rval; - free(np->lval); - np->lval = 0; - optimize_pass1(np->rval); /* reoptimize this */ - } - - /* Recognize a C logical operation on just the oddbits or evenbits of a - number. Two cases (evenbits and oddbits). */ - - if (np->opcode==SELECT && np->rval->opcode==MESH32 && - np->rval->constant==0x55555555LU && - (np->lval->opcode==AND||np->lval->opcode==OR||np->lval->opcode==XOR) && - np->lval->rval->opcode == C_OR && - ((np->lval->rval->lval->opcode == C_LSHIFT && - np->lval->rval->rval->opcode == C_AND) || - (np->lval->rval->lval->opcode == C_AND && - np->lval->rval->rval->opcode == C_LSHIFT)) && - np->lval->rval->lval->rval->opcode == MESH32 && - np->lval->rval->rval->rval->opcode == MESH32 && - np->lval->rval->lval->rval->constant == 0x55555555LU && - np->lval->rval->rval->rval->constant == 0x55555555LU) - { - OPTING(clogopevenbits) - switch(np->lval->opcode) - { - case AND: np->lval->rval->opcode = C_AND; break; - case OR: np->lval->rval->opcode = C_OR; break; - case XOR: np->lval->rval->opcode = C_XOR; break; - default: lose(E778, yylineno, (char *) NULL); - } - op = np->lval->rval; - free(np->lval); - np->lval = op; - op = np->lval->lval->lval; - free(np->lval->lval->rval); - free(np->lval->lval); - np->lval->lval = op; - op = np->lval->rval->lval; - free(np->lval->rval->rval); - free(np->lval->rval); - np->lval->rval = op; - } - - if (np->opcode==SELECT && np->rval->opcode==MESH32 && - np->rval->constant==0x55555555LU && - (np->lval->opcode==AND||np->lval->opcode==OR||np->lval->opcode==XOR) && - np->lval->rval->opcode == C_OR && - ((np->lval->rval->lval->opcode == C_RSHIFT && - np->lval->rval->rval->opcode == C_AND) || - (np->lval->rval->lval->opcode == C_AND && - np->lval->rval->rval->opcode == C_RSHIFT)) && - np->lval->rval->lval->rval->opcode == MESH32 && - np->lval->rval->rval->rval->opcode == MESH32 && - np->lval->rval->lval->rval->constant == 0xAAAAAAAALU && - np->lval->rval->rval->rval->constant == 0xAAAAAAAALU) - { - OPTING(clogopoddbits) - switch(np->lval->opcode) - { - case AND: np->lval->rval->opcode = C_AND; break; - case OR: np->lval->rval->opcode = C_OR; break; - case XOR: np->lval->rval->opcode = C_XOR; break; - default: lose(E778, yylineno, (char *) NULL); - } - op = np->lval->rval; - free(np->lval); - np->lval = op; - op = np->lval->lval->lval; - free(np->lval->lval->rval); - free(np->lval->lval); - np->lval->lval = op; - op = np->lval->rval->lval; - free(np->lval->rval->rval); - free(np->lval->rval); - np->lval->rval = op; - np->rval->constant = 0xAAAAAAAALU; - } - - /* !!(a ~ b) can be weakened to !!(a & b) */ - if(np->opcode == C_ISNONZERO && np->rval->opcode == SELECT) - { - OPTING(non0seltonnand) - np->lval = np->rval->lval; - op = np->rval->rval; - free(np->rval); - np->rval = op; - np->opcode = C_NNAND; - } - return opted; -} diff --git a/src/feh.h b/src/feh.h index 582364a..e629112 100644 --- a/src/feh.h +++ b/src/feh.h @@ -6,6 +6,8 @@ extern unsigned int intern(int type, unsigned int index); extern void checklabel(int label); extern void treset(void); extern tuple *newtuple(void); +extern void tupleswap(int,int); /* AIS */ +extern void ppinit(int); /* AIS */ extern void typecast(node *np); extern void codecheck(void); extern void optimize(node *np); @@ -16,10 +18,15 @@ extern void emitslatproto(FILE *fp); /* AIS: emit prototypes for /-functions */ extern void emitslat(FILE* fp); /* AIS: emit bodies of /-functions */ extern int comefromsearch(tuple *tn, unsigned int index); /* AIS */ extern void explexpr(node* np, FILE* fp); /* AIS */ +extern void prexpr(node *np, FILE* fp, int freenode); /* AIS: destaticed */ +extern void checknodeactbits(node *np); /* AIS */ extern void optimizef(); /* AIS */ extern void nodefree(node* np); /* AIS */ extern unsigned long varextern(unsigned long intern, int vartype); /* AIS */ +extern node *nodecopy(node*); /* AIS */ +extern bool nodessame(node*, node*); /* AIS */ +extern node *optdebugnode; /* AIS */ extern char **enablers; /* AIS: so that there can be an element before the first element of the array (UNKNOWN is element -1, just to cause a bit more confusion) */ diff --git a/src/feh2.c b/src/feh2.c index 83ccc10..c8b3c3e 100644 --- a/src/feh2.c +++ b/src/feh2.c @@ -27,6 +27,7 @@ LICENSE TERMS ****************************************************************************/ /*LINTLIBRARY */ +#include "config.h" #include #include #include @@ -44,6 +45,7 @@ int mark112 = 0; /* AIS: Mark the next generated tuple for W112 */ /* AIS: From perpet.c */ extern int pickcompile; +extern int clclex; /************************************************************************* * @@ -85,14 +87,14 @@ unsigned int intern(int type, unsigned int index) /* AIS: Allow use of a modifiable constant 0. */ if ((index < 1 || index > 65535) && type!=MESH) - lose(E200, yylineno, (char *)NULL); + lose(E200, iyylineno, (char *)NULL); if (!oblist) { /* initialize oblist and obdex */ oblist = malloc(ALLOC_CHUNK * sizeof(atom)); if (!oblist) - lose(E778, yylineno, (char *)NULL); + lose(E778, iyylineno, (char *)NULL); obdex = oblist; obcount = ALLOC_CHUNK; } @@ -108,7 +110,7 @@ unsigned int intern(int type, unsigned int index) obcount += ALLOC_CHUNK; x = realloc(oblist, obcount * sizeof(atom)); if (!x) - lose(E333, yylineno, (char *)NULL); + lose(E333, iyylineno, (char *)NULL); obdex = x + (obdex - oblist); oblist = x; } @@ -136,10 +138,14 @@ unsigned int intern(int type, unsigned int index) * **************************************************************************/ +/* AIS: I haven't modified this function, but I have repurposed it without + changing the code; this function must not now have side effects (apart from + an error exit), because some labels are initialised in the preprocessor + without causing this. */ void checklabel(int label) { if (label < 1 || label > 65535) - lose(E197, yylineno, (char *)NULL); + lose(E197, iyylineno, (char *)NULL); } /************************************************************************* @@ -185,22 +191,43 @@ void treset(void) tuple *newtuple(void) /* allocate and zero out a new expression tuple */ { - if (lineno >= tuplecount) + if (lineno >= tuplecount - 1) /* Patch by Joris Huizer: must leave 1 empty */ + { + tuplecount += ALLOC_CHUNK; + if (tuples) + tuples = realloc(tuples, tuplecount * sizeof(tuple)); + else + tuples = malloc(tuplecount * sizeof(tuple)); + if (!tuples) { - tuplecount += ALLOC_CHUNK; - if (tuples) - tuples = realloc(tuples, tuplecount * sizeof(tuple)); - else - tuples = malloc(tuplecount * sizeof(tuple)); - if (!tuples) - { - lose(E666, yylineno, (char *)NULL); - return NULL; - } - memset(tuples + lineno, 0, (tuplecount - lineno) * sizeof(tuple)); + lose(E666, iyylineno, (char *)NULL); + return NULL; } - if(mark112) tuples[lineno].warn112 = 1; mark112 = 0; /* AIS */ - return(tuples + lineno++); + memset(tuples + lineno, 0, (tuplecount - lineno) * sizeof(tuple)); + } + if(mark112) tuples[lineno].warn112 = 1; mark112 = 0; /* AIS */ + return(tuples + lineno++); +} + +void tupleswap(int distback1, int distback2) +{ + tuple temp; + memcpy(&temp, &tuples[lineno-distback1], sizeof(tuple)); + memcpy(&tuples[lineno-distback1], &tuples[lineno-distback2], sizeof(tuple)); + memcpy(&tuples[lineno-distback2], &temp, sizeof(tuple)); +} + +void ppinit(int tuplecount) +{ + while(tuplecount) + { + /* 0 is an impossible exechance; make sure it's set for tuple elements. */ + if(!tuples[lineno-tuplecount].exechance) + tuples[lineno-tuplecount].exechance=100; + /* The onceagainflag also needs to be set. */ + tuples[lineno-tuplecount].onceagainflag=onceagain_NORMAL; + tuplecount--; + } } /************************************************************************* @@ -328,7 +355,7 @@ void codecheck(void) else if (tp->type == COME_FROM || tp->type == NEXTFROMLABEL) { if (up->ncomefrom && !multithread) /* AIS: multithread check */ - lose(E555, yylineno, (char *)NULL); + lose(E555, iyylineno, (char *)NULL); else up->ncomefrom++; /* AIS: to handle multiple COME FROMs */ } @@ -403,6 +430,8 @@ char *enablersm1[MAXTYPES+1] = "NEXTFROMGERUND", /* AIS */ "COMPUCOME", /* AIS: Added COMPUCOME */ "GERUCOME", /* AIS: This is COME FROM gerunds */ + "PREPROC", /* AIS: Nonexistent statement */ + "WHILE", /* AIS: statement WHILE statement */ "TRY_AGAIN", /* AIS: Added TRY AGAIN */ "FROM", /* AIS: ABSTAIN expr FROM LABEL */ }; @@ -647,98 +676,104 @@ void explexpr(node* np, FILE* fp) (void) fprintf(fp, "a"); break; - case C_NNAND: - (void) fprintf(fp, "(!!("); + case C_RSHIFTBY: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " >> "); explexpr(np->rval, fp); - (void) fprintf(fp, "))"); + (void) fprintf(fp, ")"); break; - case C_AND1ADD1: - (void) fprintf(fp, "(("); - explexpr(np->rval,fp); - (void) fprintf(fp, " & 0x1) + 0x1)"); + case C_LOGICALNOT: + (void) fprintf(fp, "(! "); + explexpr(np->rval, fp); + (void) fprintf(fp, ")"); break; - case C_1PLUS: + case C_LSHIFTBY: (void) fprintf(fp, "("); - explexpr(np->rval,fp); - (void) fprintf(fp, " + 0x1)"); + explexpr(np->lval, fp); + (void) fprintf(fp, " << "); + explexpr(np->rval, fp); + (void) fprintf(fp, ")"); break; - case C_2MINUS: - (void) fprintf(fp, "(0x2 - "); - explexpr(np->rval,fp); + case C_PLUS: + (void) fprintf(fp, "("); + explexpr(np->lval, fp); + (void) fprintf(fp, " + "); + explexpr(np->rval, fp); (void) fprintf(fp, ")"); break; - case C_2SUBAND1: - (void) fprintf(fp, "(0x2 - ("); - explexpr(np->rval,fp); - (void) fprintf(fp, " & 0x1))"); + case C_MINUS: + (void) fprintf(fp, "("); + explexpr(np->lval, fp); + (void) fprintf(fp, " - "); + explexpr(np->rval, fp); + (void) fprintf(fp, ")"); break; - case C_LSHIFT: - (void) fprintf(fp, "(("); + case C_TIMES: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " * "); explexpr(np->rval, fp); - (void) fprintf(fp, ") << 0x1)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFTIN1: - (void) fprintf(fp, "((("); + case C_DIVIDEBY: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " / "); explexpr(np->rval, fp); - (void) fprintf(fp, ") << 0x1) | 0x1)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFT2: - (void) fprintf(fp, "(("); + case C_MODULUS: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " %% "); explexpr(np->rval, fp); - (void) fprintf(fp, ") << 0x2)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFT8: - (void) fprintf(fp, "(("); + case C_GREATER: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " > "); explexpr(np->rval, fp); - (void) fprintf(fp, ") << 0x8)"); + (void) fprintf(fp, ")"); break; - case C_RSHIFTBY: + case C_LESS: (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " >> "); + (void) fprintf(fp, " < "); explexpr(np->rval, fp); (void) fprintf(fp, ")"); break; - case C_RSHIFT: - (void) fprintf(fp, "(("); + case C_ISEQUAL: + (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " == "); explexpr(np->rval, fp); - (void) fprintf(fp, ") >> 0x1)"); + (void) fprintf(fp, ")"); break; - case C_XORGREATER: + case C_LOGICALAND: (void) fprintf(fp, "("); explexpr(np->lval, fp); - (void) fprintf(fp, " > ("); + (void) fprintf(fp, " && "); explexpr(np->rval, fp); - (void) fprintf(fp, " ^ "); - explexpr(np->lval, fp); - (void) fprintf(fp, "))"); + (void) fprintf(fp, ")"); break; - - case C_ISNONZERO: - (void) fprintf(fp, "(!!"); + + case C_LOGICALOR: + (void) fprintf(fp, "("); + explexpr(np->lval, fp); + (void) fprintf(fp, " || "); explexpr(np->rval, fp); (void) fprintf(fp, ")"); break; @@ -1017,7 +1052,7 @@ void revprexpr(node *np, FILE *fp, node *target) ooprvar(np, fp, 0); (void) fprintf(fp,".set("); prexpr(target, fp, 0); - (void) fprintf(fp,",(void(*)())os%dspot%lu);\n", + (void) fprintf(fp,",os%dspot%lu);\n", (np->opcode==TWOSPOT)+1, np->constant); } else if(!pickcompile) @@ -1062,19 +1097,19 @@ void revprexpr(node *np, FILE *fp, node *target) case C_NOT: case C_NOTEQUAL: case C_A: - case C_NNAND: - case C_AND1ADD1: - case C_1PLUS: - case C_2MINUS: - case C_2SUBAND1: - case C_LSHIFT: - case C_LSHIFTIN1: - case C_LSHIFT2: - case C_LSHIFT8: case C_RSHIFTBY: - case C_RSHIFT: - case C_XORGREATER: - case C_ISNONZERO: + case C_LOGICALNOT: + case C_LSHIFTBY: + case C_PLUS: + case C_MINUS: + case C_TIMES: + case C_DIVIDEBY: + case C_MODULUS: + case C_GREATER: + case C_LESS: + case C_ISEQUAL: + case C_LOGICALAND: + case C_LOGICALOR: case GETS: /* should never come up */ default: lose(E778, emitlineno, (char*) NULL); @@ -1284,103 +1319,109 @@ void prexpr(node *np, FILE *fp, int freenode) case C_A: (void) fprintf(fp, "a"); break; - - case C_NNAND: - (void) fprintf(fp, "(!!("); - prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); - prexpr(np->rval, fp, freenode); - (void) fprintf(fp, "))"); - break; - case C_AND1ADD1: - (void) fprintf(fp, "(("); - prexpr(np->rval,fp, freenode); - (void) fprintf(fp, " & 0x1) + 0x1)"); + case C_RSHIFTBY: + (void) fprintf(fp, "("); + prexpr(np->lval, fp, freenode); + (void) fprintf(fp, " >> "); + prexpr(np->rval, fp, freenode); + (void) fprintf(fp, ")"); break; - case C_1PLUS: + case C_LOGICALNOT: + (void) fprintf(fp, "(!"); + prexpr(np->rval, fp, freenode); + (void) fprintf(fp, ")"); + break; + + case C_LSHIFTBY: (void) fprintf(fp, "("); - prexpr(np->rval,fp, freenode); - (void) fprintf(fp, " + 0x1)"); + prexpr(np->lval, fp, freenode); + (void) fprintf(fp, " << "); + prexpr(np->rval, fp, freenode); + (void) fprintf(fp, ")"); break; - case C_2MINUS: - (void) fprintf(fp, "(0x2 - "); - prexpr(np->rval,fp, freenode); + case C_PLUS: + (void) fprintf(fp, "("); + prexpr(np->lval, fp, freenode); + (void) fprintf(fp, " + "); + prexpr(np->rval, fp, freenode); (void) fprintf(fp, ")"); break; - case C_2SUBAND1: - (void) fprintf(fp, "(0x2 - ("); - prexpr(np->rval,fp, freenode); - (void) fprintf(fp, " & 0x1))"); + case C_MINUS: + (void) fprintf(fp, "("); + prexpr(np->lval, fp, freenode); + (void) fprintf(fp, " - "); + prexpr(np->rval, fp, freenode); + (void) fprintf(fp, ")"); break; - case C_LSHIFT: - (void) fprintf(fp, "(("); + case C_TIMES: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " * "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, ") << 0x1)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFTIN1: - (void) fprintf(fp, "((("); + case C_DIVIDEBY: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " / "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, ") << 0x1) | 0x1)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFT2: - (void) fprintf(fp, "(("); + case C_MODULUS: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " %% "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, ") << 0x2)"); + (void) fprintf(fp, ")"); break; - case C_LSHIFT8: - (void) fprintf(fp, "(("); + case C_GREATER: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " > "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, ") << 0x8)"); + (void) fprintf(fp, ")"); break; - case C_RSHIFTBY: - (void) fprintf(fp, "(("); + case C_LESS: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, ") >> "); + (void) fprintf(fp, " < "); prexpr(np->rval, fp, freenode); (void) fprintf(fp, ")"); break; - case C_RSHIFT: - (void) fprintf(fp, "(("); + case C_ISEQUAL: + (void) fprintf(fp, "("); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, " & "); + (void) fprintf(fp, " == "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, ") >> 0x1)"); + (void) fprintf(fp, ")"); break; - - case C_XORGREATER: + + case C_LOGICALAND: (void) fprintf(fp, "("); - prexpr(np->lval, fp, 0); /* Patched by Joris Huizer */ - (void) fprintf(fp, " > ("); - prexpr(np->rval, fp, freenode); - (void) fprintf(fp, " ^ "); prexpr(np->lval, fp, freenode); - (void) fprintf(fp, "))"); + (void) fprintf(fp, " && "); + prexpr(np->rval, fp, freenode); + (void) fprintf(fp, ")"); break; - case C_ISNONZERO: - (void) fprintf(fp, "(!!("); + case C_LOGICALOR: + (void) fprintf(fp, "("); + prexpr(np->lval, fp, freenode); + (void) fprintf(fp, " || "); prexpr(np->rval, fp, freenode); - (void) fprintf(fp, "))"); + (void) fprintf(fp, ")"); break; - + case GETS: /* AIS: this is used only if freenode == 0 */ if(freenode) lose(E778, emitlineno, (char*) NULL); prexpr(np->lval, fp, freenode); @@ -1481,7 +1522,7 @@ void emittextlines(FILE *fp) { int i=0; /* The first textline is line 1 */ (void) fprintf(fp, "\"\",\n"); - while(++isetweave) + (void) fprintf(fp, " weaving = %d;\n", tn->setweave>0); + + /* AIS: print warnings on -l */ if(checkforbugs) { if(tn->warn112) lwarn(W112, emitlineno, (char*) NULL); @@ -1548,7 +1593,7 @@ void emit(tuple *tn, FILE *fp) if(tn->warn622) lwarn(W622, emitlineno, (char*) NULL); } - /* emit debugging information */ + /* AIS: emit debugging information */ if (yukdebug||yukprofile) { (void) fprintf(fp, " YUK(%d,%d);\n", @@ -1618,6 +1663,11 @@ void emit(tuple *tn, FILE *fp) "linetype[truelineno] == %s || linetype[truelineno] == %s || ", enablers[np->constant-GETS], enablers[np->constant-GETS+2]); + } else if (np->constant == GETS) { + (void) fprintf(fp, +"linetype[truelineno] == %s || linetype[truelineno] == %s || ", + enablers[GETS-GETS], + enablers[RESIZE-GETS]); } else if (np->constant == COME_FROM) { (void) fprintf(fp, "linetype[truelineno] == %s || linetype[truelineno] == %s || " @@ -1715,9 +1765,9 @@ void emit(tuple *tn, FILE *fp) ooprvar(tn->u.node->lval, fp, 1); (void) fprintf(fp,".set("); prexpr(tn->u.node->rval, fp, 1); - (void) fprintf(fp,",(void(*)())os%dspot%lu);\n", - (tn->u.node->rval->opcode==TWOSPOT)+1, - tn->u.node->rval->constant); + (void) fprintf(fp,",os%dspot%lu);\n", + (tn->u.node->lval->opcode==TWOSPOT)+1, + tn->u.node->lval->constant); } else if(!pickcompile) { @@ -1863,11 +1913,18 @@ void emit(tuple *tn, FILE *fp) /* All abstention code has been edited by AIS to allow for the new abstention rules */ case ABSTAIN: - if(!pickcompile) - (void) fprintf(fp, "\tif(!ICKABSTAINED(%d)) ICKABSTAINED(%d) = 1;\n", tn->u.target - 1, tn->u.target-1); + /* AIS: In CLC-INTERCAL, you can't abstain a GIVE UP line, so I copied + a modified version of Joris's REINSTATE patch here as well */ + if (!clclex || (tuples + tn->u.target - 1)->type != GIVE_UP) + { + if(!pickcompile) + (void) fprintf(fp, "\tif(!ICKABSTAINED(%d)) ICKABSTAINED(%d) = 1;\n", tn->u.target - 1, tn->u.target-1); + else + (void) fprintf(fp, "ICKABSTAINED(%d) = 1;\n", tn->u.target-1); + } else - (void) fprintf(fp, "ICKABSTAINED(%d) = 1;\n", tn->u.target-1); - break; + (void) fprintf(fp, "\t/* not abstaining from a GIVE UP line */\n");; + break; case FROM: if(pickcompile) lose(E256, emitlineno, (char*) NULL); @@ -1878,11 +1935,17 @@ void emit(tuple *tn, FILE *fp) break; case REINSTATE: - if(!pickcompile) - (void) fprintf(fp, "\tif(ICKABSTAINED(%d)) ICKABSTAINED(%d)--;\n", tn->u.target - 1, tn->u.target-1); - else - (void) fprintf(fp, "\tICKABSTAINED(%d)=0;\n", tn->u.target - 1); - break; + /* (Joris Huizer) ensure it is not an GIVE UP statement */ + if ((tuples + tn->u.target - 1)->type != GIVE_UP) + { + if(!pickcompile) + (void) fprintf(fp, "\tif(ICKABSTAINED(%d)) ICKABSTAINED(%d)--;\n", tn->u.target - 1, tn->u.target-1); + else + (void) fprintf(fp, "\tICKABSTAINED(%d)=0;\n", tn->u.target - 1); + } + else + (void) fprintf(fp, "\t/* not reinstating a GIVE UP line */\n"); + break; case ENABLE: if(pickcompile) lose(E256, emitlineno, (char*) NULL); /* AIS */ @@ -1898,6 +1961,9 @@ void emit(tuple *tn, FILE *fp) } else if (np->constant == REINSTATE) { (void) fprintf(fp, "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[np->constant-GETS], enablers[np->constant-GETS+2]); + } else if (np->constant == GETS) { + (void) fprintf(fp, + "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[GETS-GETS], enablers[RESIZE-GETS]); } else if (np->constant == COME_FROM) { (void) fprintf(fp, "\t if (linetype[i] == %s || linetype[i] == %s || linetype[i] == %s)\n", enablers[COME_FROM-GETS], enablers[COMPUCOME-GETS], enablers[GERUCOME-GETS]); @@ -1927,6 +1993,9 @@ void emit(tuple *tn, FILE *fp) } else if (np->constant == REINSTATE) { (void) fprintf(fp, "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[np->constant-GETS], enablers[np->constant-GETS+2]); + } else if (np->constant == GETS) { + (void) fprintf(fp, + "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[GETS-GETS], enablers[RESIZE-GETS]); } else if (np->constant == COME_FROM) { (void) fprintf(fp, "\t if (linetype[i] == %s || linetype[i] == %s || linetype[i] == %s)\n", enablers[COME_FROM-GETS], enablers[COMPUCOME-GETS], enablers[GERUCOME-GETS]); @@ -1960,6 +2029,15 @@ void emit(tuple *tn, FILE *fp) } else if (np->constant == REINSTATE) { (void) fprintf(fp, "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[np->constant-GETS], enablers[np->constant-GETS+2]); + } else if (np->constant == GETS) { + (void) fprintf(fp, + "\t if (linetype[i] == %s || linetype[i] == %s)\n", enablers[GETS-GETS], enablers[RESIZE-GETS]); + } else if (np->constant == COME_FROM) { + (void) fprintf(fp, + "\t if (linetype[i] == %s || linetype[i] == %s || linetype[i] == %s)\n", enablers[COME_FROM-GETS], enablers[COMPUCOME-GETS], enablers[GERUCOME-GETS]); + } else if (np->constant == NEXTFROMLABEL) { + (void) fprintf(fp, + "\t if (linetype[i] == %s || linetype[i] == %s || linetype[i] == %s)\n", enablers[NEXTFROMLABEL-GETS], enablers[NEXTFROMGERUND-GETS], enablers[NEXTFROMEXPR-GETS]); } else { (void) fprintf(fp, "\t if (linetype[i] == %s)\n", enablers[np->constant-GETS]); @@ -1976,17 +2054,34 @@ void emit(tuple *tn, FILE *fp) braces; it's designed to work with COMPUCOME's crazy guarding arrangements */ if(pickcompile) lose(E256, emitlineno, (char*) NULL); /* AIS */ - fprintf(fp,"\t;} else goto CCF%d;\n",compucomecount); + fprintf(fp,"\t%s;} else goto CCF%d;\n",multithread?"NEXTTHREAD":"", + compucomecount); break; case GIVE_UP: /* AIS: Edited to allow for yuk */ - if(!tn->initabstain) /* AIS: DON'T GIVE UP is a no-op, so ignore it */ + if(yukprofile||yukdebug) fprintf(fp, "\tYUKTERM;\n"); + if(multithread) fprintf(fp, "\tkillthread();\n"); + else { - (void) fprintf(fp, "\t;};{\n"); /* AIS: can't be abstained from */ - if(yukprofile||yukdebug) fprintf(fp, "\tYUKTERM;\n"); - if(multithread) fprintf(fp, "\tkillthread();\n"); - (void) fprintf(fp, "\treturn(0);\n"); + if(nonespots||opoverused) + fprintf(fp,"\tif(onespots) free(onespots);\n"); + if(ntwospots||opoverused) + fprintf(fp,"\tif(twospots) free(twospots);\n"); + if(ntails) fprintf(fp,"\tif(tails) free(tails);\n"); + if(nhybrids) fprintf(fp,"\tif(hybrids) free(hybrids);\n"); + if(nonespots||opoverused) + fprintf(fp,"\tif(oneforget) free(oneforget);\n"); + if(ntwospots||opoverused) + fprintf(fp,"\tif(twoforget) free(twoforget);\n"); + if(ntails) fprintf(fp,"\tif(tailforget) free(tailforget);\n"); + if(nhybrids) fprintf(fp,"\tif(hyforget) free(hyforget);\n"); + if(opoverused) + { + fprintf(fp,"\tif(oo_onespots) free(oo_onespots);\n"); + fprintf(fp,"\tif(oo_twospots) free(oo_twospots);\n"); + } } + (void) fprintf(fp, "\treturn(0);\n"); break; case TRY_AGAIN: /* By AIS */ @@ -1994,6 +2089,26 @@ void emit(tuple *tn, FILE *fp) if(yukprofile||yukdebug) fprintf(fp, " if(yukloop) goto ick_restart;\n"); if(yukprofile||yukdebug) fprintf(fp, " YUKTERM;\n"); if(multithread) fprintf(fp, "\tkillthread();\n"); + else + { + if(nonespots||opoverused) + fprintf(fp,"\tif(onespots) free(onespots);\n"); + if(ntwospots||opoverused) + fprintf(fp,"\tif(twospots) free(twospots);\n"); + if(ntails) fprintf(fp,"\tif(tails) free(tails);\n"); + if(nhybrids) fprintf(fp,"\tif(hybrids) free(hybrids);\n"); + if(nonespots||opoverused) + fprintf(fp,"\tif(oneforget) free(oneforget);\n"); + if(ntwospots||opoverused) + fprintf(fp,"\tif(twoforget) free(twoforget);\n"); + if(ntails) fprintf(fp,"\tif(tailforget) free(tailforget);\n"); + if(nhybrids) fprintf(fp,"\tif(hyforget) free(hyforget);\n"); + if(opoverused) + { + fprintf(fp,"\tif(oo_onespots) free(oo_onespots);\n"); + fprintf(fp,"\tif(oo_twospots) free(oo_twospots);\n"); + } + } (void) fprintf(fp, " {\n\treturn(0);\n"); /* because if TRY AGAIN is the last line, falling off the end isn't an error */ pasttryagain=1; /* flag an error if we try any more commands */ @@ -2090,22 +2205,38 @@ void emit(tuple *tn, FILE *fp) break; case SPLATTERED: - dim = emitlineno - tn->lineno; - if (tn->sharedline) - ++dim; - (void) fprintf(fp, "\tlose(E000, %d, \"%s\");\n", - emitlineno, nice_text(textlines + tn->lineno, dim)); - break; + /* AIS: The code previously here could access unallocated memory due to + a bug if the comment was a COME FROM target. The problem is that + emitlineno (the line to show an error on) is usually the line after + this one, but not always, and in this case the line after this one is + always what we want, so I copied the relevant part of the emitlineno + logic here to fix the bug. */ + if (tn < tuples + lineno - 1) + dim = tn[1].lineno - tn->lineno; + else + dim = iyylineno - tn->lineno; + if (tn->sharedline) + ++dim; + (void) fprintf(fp, "\tlose(E000, %d, \"%s\");\n", + emitlineno, nice_text(textlines + tn->lineno, dim)); + break; + + case PREPROC: /* AIS: 'DO NOTHING', but not enterable into a program. This + is generated by the preprocessor. */ + fprintf(fp,"\t; /* do nothing */\n"); case COME_FROM: case NEXTFROMLABEL: /* AIS */ - (void) fprintf(fp, "if(0) {C%ld: %s;}\n", (long)(tn-tuples+1), - tn->type==NEXTFROMLABEL ? "pushnext(truelineno+1)":""); + (void) fprintf(fp, "if(0) {C%ld: %s;%s}\n", (long)(tn-tuples+1), + tn->type==NEXTFROMLABEL ? "pushnext(truelineno+1)":"", + multithread?" NEXTTHREAD;":""); /* AIS: Changed so all COME_FROMs have unique labels even if two of them aim at the same line, and added the NEXT FROM case (which - invloves hiding COME FROM labels in an unreachable if()). */ + involves hiding COME FROM labels in an unreachable if()). */ break; + case WHILE: /* AIS: fall through to the error, because this shouldn't + come up yet. */ default: lose(E778, emitlineno, (char *)NULL); break; @@ -2209,8 +2340,12 @@ void emit(tuple *tn, FILE *fp) If (at runtime) ccfc is nonzero, we know cjb has already been set; otherwise, set it now. In the case of a multithread non-COMPUCOME program, the goto will just jump to a longjmp, switching to the - one and only one COME FROM that hasn't been given its own thread. */ - if ((tn->label && compucomesused) || generatecfjump || gerucomesused) + one and only one COME FROM that hasn't been given its own thread. + However, skip all the compucomes and gerucomes if preproc is set, + because COMING FROM a preproc + should only ever be done by label. */ + if (((tn->label && compucomesused) || generatecfjump || gerucomesused) && + (!tn->preproc || generatecfjump)) { if(compucomesused) { @@ -2220,8 +2355,9 @@ void emit(tuple *tn, FILE *fp) { (void) fprintf(fp, " truelineno = %d;\n", (int)(tn-tuples)); } - if(generatecfjump) (void) fprintf(fp, " if(ccfc) goto CCF0;\n"); - if(compucomesused || gerucomesused) + if(generatecfjump) (void) fprintf(fp, " if(ccfc) goto CCF%s;\n", + tn->preproc?"L":"0"); + if((compucomesused || gerucomesused) && !tn->preproc) { /* check all the COMPUCOMES */ (void) fprintf(fp, " %sif(setjmp(cjb) == 0) goto CCF0;\n", generatecfjump?"else ":""); @@ -2263,9 +2399,9 @@ void emitslat(FILE* fp) { fprintf(fp, "void os%lx(%s a, void(*f)())\n{\n static int l=0;\n" - " if(l)\n {\n if(!f)lose(E778, lineno, (char *)NULL);\n" - " ((void(*)(%s,void(*)()))f)(a,0);\n return;\n }\n l=1;\n", - (unsigned long)np,t,t); + " if(l)\n {\n if(!f) lose(E778, lineno, (char *)NULL);\n" + " f(a,0);\n return;\n }\n l=1;\n", + (unsigned long)np,t); temp=cons(C_A, 0, 0); revprexpr(np->rval, fp, temp); /* revprexpr can't free */ fprintf(fp," l=0;\n}\n"); diff --git a/src/fiddle.c b/src/fiddle.c index 239e02f..e32c295 100644 --- a/src/fiddle.c +++ b/src/fiddle.c @@ -375,4 +375,41 @@ unsigned int rev_whirl32(unsigned int p, unsigned int n) return 0; } +/* AIS: Some helper functions for the optimizer, only working in base 2 */ + +unsigned int xselx(unsigned int x) +{ + register int r=0; + if(Base != 2) lose(E778, lineno, (char*) NULL); + while(x) {if(x&1) r=(r<<1)|1; x>>=1;} + return r; +} + +unsigned int setbitcount(unsigned int x) +{ + register int r=0; + while(x) {if(x&1) r++; x>>=1;} + return r; +} + +unsigned int smudgeright(unsigned int x) +{ + x=x|(x>>1); + x=x|(x>>2); + x=x|(x>>4); + x=x|(x>>8); + x=x|(x>>18); + return x; +} + +unsigned int smudgeleft(unsigned int x) +{ + x=x|(x<<1); + x=x|(x<<2); + x=x|(x<<4); + x=x|(x<<8); + x=x|(x<<18); + return x; +} + /* fiddle.c */ diff --git a/src/fiddle.h b/src/fiddle.h index a68d3d2..a5289bd 100644 --- a/src/fiddle.h +++ b/src/fiddle.h @@ -15,4 +15,9 @@ extern unsigned int rev_whirl16(unsigned int p, unsigned int n); extern unsigned int rev_and32(unsigned int n), rev_or32(unsigned int n), rev_xor32(unsigned int n), rev_fin32(unsigned int n); extern unsigned int rev_whirl32(unsigned int p, unsigned int n); +/* AIS: Optimizer helper operators */ +extern unsigned int xselx(unsigned int x); +extern unsigned int setbitcount(unsigned int x); +extern unsigned int smudgeleft(unsigned int x); +extern unsigned int smudgeright(unsigned int x); /* fiddle.h ends here */ diff --git a/src/ick-wrap.c b/src/ick-wrap.c index 50ce9c6..6b6cdd5 100644 --- a/src/ick-wrap.c +++ b/src/ick-wrap.c @@ -35,7 +35,9 @@ $E $P int main(int argc, char *argv[]) { +#ifndef YUK parseargs(argc,argv); +#endif skipto = 0; @@ -45,6 +47,8 @@ $N #ifdef YUK yuklines = $J; yukcommands = $B; + globalargv = argv; + globalargc = argc; #endif /* set seed for random error generation */ #ifdef USG diff --git a/src/ick.h b/src/ick.h index 85e0581..aa6d1f6 100644 --- a/src/ick.h +++ b/src/ick.h @@ -12,11 +12,11 @@ #define YYDEBUG 1 #endif -/* Comment this out if your version of lex automatically supplies yylineno. */ -#define YYLINENO_BY_HAND - -/* Comment this out if your version of lex doesn't use yyrestart(). */ -#define USE_YYRESTART +/* AIS: This is now detected by autoconf and doesn't need to be set by the + user. */ +#ifdef NEED_YYRESTART +# define USE_YYRESTART +#endif #define YY_NO_UNPUT @@ -37,7 +37,7 @@ typedef int bool; * Maximum supported statement types; should be equal to (FROM - GETS + 1) * AIS: Changed this when I added new statements. */ -#define MAXTYPES 28 +#define MAXTYPES 30 /* AIS: Maximum supported spark/ears nesting, divided by 32. The value given allows for 256 nested spark/ears groupings, which should be enough. */ @@ -73,6 +73,9 @@ typedef struct tuple_t bool optversion; /* AIS: Use an optimized version? (Only set if the optimizer thinks that it's safe.) */ + bool preproc; /* AIS: Is this line a nonexistent one + that was added to implement a + command in the parser? */ bool warn112:1; /* AIS: Should this line produce warning 112 during degeneration? */ bool warn128:1, warn534:1, warn018:1, warn016:1, warn276:1, warn239:1, @@ -88,6 +91,12 @@ typedef struct tuple_t int lineno; /* source line for error messages */ bool sharedline; /* if NZ, two statements on a line */ enum onceagain onceagainflag; /* AIS: ONCE / AGAIN */ + int ppnewtype; /* AIS: 'real' type of this line when + the preprocessor is used; 0 on all + statements but the 'real' + statement */ + signed setweave; /* AIS: +1 to turn weaving on, -1 to + turn it off, before this command */ } tuple; /* this maps the `external' name of a variable to an internal array index */ @@ -124,7 +133,7 @@ extern assoc vartypes[]; /* the lexical analyzer keeps copies of the source logical lines */ extern char **textlines; extern int textlinecount; -extern int yylineno; +extern int iyylineno; /* AIS: These are needed to sort out a grammar near-ambiguity */ extern unsigned long sparkearsstack[SENESTMAX]; diff --git a/src/idiotism.oil b/src/idiotism.oil new file mode 100644 index 0000000..2a7af1a --- /dev/null +++ b/src/idiotism.oil @@ -0,0 +1,528 @@ +; +; NAME +; idiotism.oil -- optimizer idioms for C-INTERCAL +; +; LICENSE TERMS +; Copyright (C) 2007 Alex Smith +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +; + +; Optimizer Idiom Language input file for C-INTERCAL + +; See the file ../doc/oil.txt for information about the format of this file. + +; Some useful constants: +; 0x55555555 1431655765 +; 0xAAAAAAAA 2863311530 +; 0x0000FFFF 65535 +; 0xFFFF0000 4294901760 +; 0xFFFFFFFF 4294967295 + +; Constant folding +[minglefold] +(#{1}1$#{1}2)->(#{mingle(x1,x2)}0) +[selectfold] +(#{1}1~#{1}2)->(#{iselect(x1,x2)}0) +; Strangely, due to a deficiency in OIL, and16fold can't be expressed easily. +; But it's possible to verify that a constant is 32-bit by checking that its +; value is greater than 65535. (A 32-bit constant could have a value lower as +; well, which is why this isn't perfect and why and16, etc., aren't here.) +[and32fold] +(& #{x>65535LU}1)->(#{and32(x1)}0) +[or32fold] +(V #{x>65535LU}1)->(#{or32(x1)}0) +[xor32fold] +(? #{x>65535LU}1)->(#{xor32(x1)}0) +; On the other hand... it's possible to do a 15-bit and, or 14-bit or/xor, by +; observing that in certain cases it doesn't matter whether the and/or/xor is +; 16 or 32 bits. +[and15fold] +(& #{!(x&~32767LU)}1)->(#{and16(x1)}0) +[or14fold] +(V #{!(x&~32766LU)}1)->(#{or16(x1)}0) +[xor14fold] +(? #{!(x&~32766LU)}1)->(#{xor16(x1)}0) +; C operations can, and should, be folded too +[cfold] +(#{1}1 & #{1}2)->(#{x1 & x2}0) +(#{1}1 | #{1}2)->(#{x1 | x2}0) +(#{1}1 ^ #{1}2)->(#{x1 ^ x2}0) +(#{1}1 + #{1}2)->(#{x1 + x2}0) +(#{1}1 - #{1}2)->(#{x1 - x2}0) +(#{1}1 * #{1}2)->(#{x1 * x2}0) +(#{1}1 / #{1}2)->(#{x1 / x2}0) +(#{1}1 % #{1}2)->(#{x1 % x2}0) +(#{1}1 > #{1}2)->(#{x1 > x2}0) +(#{1}1 < #{1}2)->(#{x1 < x2}0) +(#{1}1 >> #{1}2)->(#{x1 >> x2}0) +(#{1}1 << #{1}2)->(#{x1 << x2}0) +(#{1}1 == #{1}2)->(#{x1 == x2}0) +(#{1}1 != #{1}2)->(#{x1 != x2}0) + + +; Binary bitwise optimizations +[cbinand] +((&(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->((_1 & _2) & #{iselect(x3,1431655765LU)}0) +[cbinor] +((V(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->((_1 | _2) & #{iselect(x3,1431655765LU)}0) +[cbinxor] +((?(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->((_1 ^ _2) & #{iselect(x3,1431655765LU)}0) +; Sometimes, an expanded output is wanted, optimizations happen in the wrong +; order, and we end up with & rather than ~ on the previous idiom. Correct +; such situations now. +[cbinandnoselect] +((&(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(#0 $ ((_1 & _2) & #{iselect(x3,1431655765LU)}0)) +[cbinornoselect] +((&(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(#0 $ ((_1 | _2) & #{iselect(x3,1431655765LU)}0)) +[cbinxornoselect] +((&(_{!(c&4294901760LU)}1$_{!(c&4294901760LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(#0 $ ((_1 ^ _2) & #{iselect(x3,1431655765LU)}0)) +; Sometimes, there isn't even a mingle... +[cbinandnomingle] +((&(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) & _1) ~ _3) +((&(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) & _1) ~ _3) +((&(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) & _1) & _3) +((&(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) & _1) & _3) +[cbinornomingle] +((V(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) | _1) ~ _3) +((V(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) | _1) ~ _3) +((V(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) | _1) & _3) +((V(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) | _1) & _3) +[cbinxornomingle] +((?(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) ^ _1) ~ _3) +((?(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))~ + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) ^ _1) ~ _3) +((?(_{!(c&2863311530LU)}1|_{!(c&1431655765LU)}2))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) ^ _1) & _3) +((?(_{!(c&1431655765LU)}2|_{!(c&2863311530LU)}1))& + #{!(x&2863311530LU)&&iselect(x,1431655765LU)==xselx(iselect(x,1431655765LU))}3 +)->(((_2 >> #1) ^ _1) & _3) + +; Bitwise complements. (The INTERCAL which ultimately leads to cases 3 and 4 +; is not the most efficient way to do this, by the way.) +[cnot1] +(#65535 ^ .{!c&4294901760LU}1)->(~16 .1) +[cnot2] +(.{!c&4294901760LU}1 ^ #65535)->(~16 .1) +[cnot3] +(#4294967295 ^ :1)->(~32 :1) +[cnot4] +(:1 ^ #4294967295)->(~32 :1) + +; Special cases of select + +; Selecting the rightmost bits of a number +[xselpow2m1] +(_1 ~ #{x==xselx(x)}2)->(_1 & _2) +; Selecting one bit from a number +[xselpow2] +(_1 ~ #{xselx(x)==1}2)->(!(!(_1 & _2))) +; Selecting a number against itself and then selecting 1 from that +[xselxsel1] +((_1~_1)~#1)->(!(!_1)) +((_1~_1))->(!(!_1)) +(#1&(_1~_1))->(!(!_1)) +((_1~_1)&_{c==1}2)->(_1 && _2) +(_{c==1}2&(_1~_1))->(_1 && _2) +; Selecting a number from a constant that's just below a power of 2 +[pow2m1selx] +((#{x==xselx(x)}1 ~ _2) ~ #1)->(!(!(_1 & _2))) +; Boolean-negating a select +[notselect] +(!(_1~_2))->(!(_1&_2)) + +; Sometimes select and mingle cancel each other out +[selectmingle1] +((_1~#2863311530)$_2)->((_1�)|(#0$_2)) +[selectmingle2] +(_1$(_2~#1431655765))->((_1$#0)|(_2�)) +[selectmingle3] +((_1~#1431655765)$_2)->(((_1�)<<#1)|(#0$_2)) +[selectmingle4] +(_1$(_2~#2863311530))->(((_2�)>>#1)|(_1$#0)) + +; Shifts + +; A helper in calculating 32-bit shifts; this is a shift on half the bits of +; a 32-bit number. +[lshift32half] +(#0$((_1~#715827882)<<#1))->((_1�)<<#1) +; Rightshift some of the bits +[rshift] +<#1-#31 +(_1~#{xselx(x)<((_1&_2)>>#{r}0) +> +; General 16-bit leftshifts +; +; Large left-shifts can be written in an optimized way using knowledge of the +; rightmost bits to shift more than one bit at a time. +; If the rightmost few bits of a number are known to be 0, it can be mingled +; with 0, and then selected with a number which has many 0s to do a leftshift. +; Here, if none of the bits marked l are set this is a right-shift by 3, and +; for each bit set, the shift goes 1 leftwards. +; (xxxxxxxxxxxxxttt $ 000000000000uuuu) ~ (h0h0h0h0h0h0h0h0h0h0h0h01lllllll) +; x0x0x0x0x0x0x0x0x0x0x0x0xutututu +; h0h0h0h0h0h0h0h0h0h0h0h01lllllll +; There's three cases here for each possible width for the ts, including one +; which has them as zeros and two which have them higher. +[lshift16] +<#0-#14 +((_{c<=65535&&!(c&((1LU<((((_1>>#{r}0)&#{iselect(x3>>(r*2+1),1431655765LU)}0) + <<#{setbitcount(x3&((2LU<<(r*2))-1))}0)|#{iselect(mingle(0,x2),x3)}0) +(((_{c<=65535&&!(c&((1LU<((((_1>>#{r}0)&#{iselect(x3>>(r*2+1),1431655765LU)}0) + <<#{setbitcount(x3&((2LU<<(r*2))-1))}0)|#{iselect(mingle(x4,x2),x3)}0) +(((#{x<=65535&&!(c&~((1LU<((((_1>>#{r}0)&#{iselect(x3>>(r*2+1),1431655765LU)}0) + <<#{setbitcount(x3&((2LU<<(r*2))-1))}0)|#{iselect(mingle(x4,x2),x3)}0) +> +; 32-bit leftshift by 1; there are 8 ways to write this. +[lshift32by1] +(((_1�)<<#1)|((_1�)<<#1))->((_1�)<<#1) +(((#1431655765&_1)<<#1)|((_1�)<<#1))->((_1�)<<#1) +(((_1�)<<#1)|((#715827882&_1)<<#1))->((_1�)<<#1) +(((#1431655765&_1)<<#1)|((#715827882&_1)<<#1))->((_1�)<<#1) +(((_1�)<<#1)|((_1�)<<#1))->((_1�)<<#1) +(((_1�)<<#1)|((#1431655765&_1)<<#1))->((_1�)<<#1) +(((#715827882&_1)<<#1)|((_1�)<<#1))->((_1�)<<#1) +(((#715827882&_1)<<#1)|((#1431655765&_1)<<#1))->((_1�)<<#1) +; Move AND inside shifts, and OR and XOR outside shifts +[andintoshift] +((_1 << #{1}2) & #{1}3)->((_1 & #{x3>>x2}0) << _2) +((_1 >> #{1}2) & #{1}3)->((_1 & #{x3<> _2) +[oroutofshift] +((_1 | #{1}2) << #{1}3)->((_1 << _3) | #{x2<> #{1}3)->((_1 >> _3) | #{x2>>x3}0) +[xoroutofshift] +((_1 ^ #{1}2) << #{1}3)->((_1 << _3) ^ #{x2<> #{1}3)->((_1 >> _3) ^ #{x2>>x3}0) +; Larger leftshifts can be created by combining smaller ones, although there +; are shortcuts that can be used and this idiom only works if they haven't +; been. Also, idioms later on can create shifts that cancel each other out, so +; the code for cancelling them is here. +[combinellshift] +((_1 << #{1}2) << #{1}3)->(_1 << #{x2+x3}0) +[combinelrshift] +((_1 << #{1}2) >> #{x>x2}3)->(_1 >> #{x3-x2}0) +((_1 << #{1}2) >> #{x==x2}3)->(_1) +((_1 << #{1}2) >> #{x(_1 << #{x2-x3}0) +[combinerlshift] +((_1 >> #{1}2) << #{x>x2}3)->(_1 << #{x3-x2}0) +((_1 >> #{1}2) << #{x==x2}3)->(_1) +((_1 >> #{1}2) << #{x(_1 >> #{x2-x3}0) +[combinerrshift] +((_1 >> #{1}2) >> #{1}3)->(_1 >> #{x2+x3}0) +[nullshift] +(_1 >> #0)->(_1) +(_1 << #0)->(_1) + +; INTERCAL logical values are 1 and 2. +[xorto1or2] +((?(_1$#1)))->((_1)+#1) +((?(_1$#2)))->(#2-(_1)) + +; Removing, combining and weakening unneeded C_ANDs +[unneededand] +(_1&#{!(c1&~x)}0)->(_1) +(#{!(c1&~x)}0&_1)->(_1) +[combineand] +((_1&#{1}2)&#{1}3)->(_1&#{x2&x3}0) +((#{1}2&_1)&#{1}3)->(_1&#{x2&x3}0) +(#{1}3&(_1&#{1}2))->(_1&#{x2&x3}0) +(#{1}3&(#{1}2&_1))->(_1&#{x2&x3}0) +[weakenand] +(_1&#{(~c1)&x}2)->(_1&#{c1&x2}0) +(#{(~c1)&x}2&_1)->(_1&#{c1&x2}0) + +; 32-bit complements + +; Complement odd bits, zero even bits +[com1z0] +(((?(_1|#1431655765))�)<<#1)->((_1�)^#2863311530) +(((?(#1431655765|_1))�)<<#1)->((_1�)^#2863311530) +((#1431655765&(?(_1|#1431655765)))<<#1)->((_1�)^#2863311530) +((#1431655765&(?(#1431655765|_1)))<<#1)->((_1�)^#2863311530) +; Complement even bits, zero odd bits +[com0z1] +((?(((_1�)<<#1)|#1431655765))�) +->((_1�)^#1431655765) +((?(((#1431655765&_1)<<#1)|#1431655765))�) +->((_1�)^#1431655765) +((?(#1431655765|((_1�)<<#1)))�) +->((_1�)^#1431655765) +((?(#1431655765|((#1431655765&_1)<<#1)))�) +->((_1�)^#1431655765) +(#1431655765&(?(((_1�)<<#1)|#1431655765))) +->((_1�)^#1431655765) +(#1431655765&(?(((#1431655765&_1)<<#1)|#1431655765))) +->((_1�)^#1431655765) +(#1431655765&(?(#1431655765|((_1�)<<#1)))) +->((_1�)^#1431655765) +(#1431655765&(?(#1431655765|((#1431655765&_1)<<#1)))) +->((_1�)^#1431655765) +; 32-bit complements, in full +[cnot5] +(((:1&#{1}2)^#{x==x2}0)|((:1&#{(x^x2)==4294967295LU}3)^#{x==x3}0))->(~32 :1) + +; Distributive laws + +; Several of these laws go towards helping finish off 32-bit C binary logical +; operations, but are useful in other places as well (especially distributions +; involving shifts). +[distribll] +((_1&_3)&(_2&_3))->((_1&_2)&_3) +((_1|_3)&(_2|_3))->((_1&_2)|_3) +((_1&_3)|(_2&_3))->((_1|_2)&_3) +((_1|_3)|(_2|_3))->((_1|_2)|_3) +((_1&_3)^(_2&_3))->((_1^_2)&_3) +((_1<<_3)&(_2<<_3))->((_1&_2)<<_3) +((_1<<_3)|(_2<<_3))->((_1|_2)<<_3) +((_1<<_3)^(_2<<_3))->((_1^_2)<<_3) +((_1>>_3)&(_2>>_3))->((_1&_2)>>_3) +((_1>>_3)|(_2>>_3))->((_1|_2)>>_3) +((_1>>_3)^(_2>>_3))->((_1^_2)>>_3) +[distribrl] +((_3&_1)&(_2&_3))->((_1&_2)&_3) +((_3|_1)&(_2|_3))->((_1&_2)|_3) +((_3&_1)|(_2&_3))->((_1|_2)&_3) +((_3|_1)|(_2|_3))->((_1|_2)|_3) +((_3&_1)^(_2&_3))->((_1^_2)&_3) +[distriblr] +((_1&_3)&(_3&_2))->((_1&_2)&_3) +((_1|_3)&(_3|_2))->((_1&_2)|_3) +((_1&_3)|(_3&_2))->((_1|_2)&_3) +((_1|_3)|(_3|_2))->((_1|_2)|_3) +((_1&_3)^(_3&_2))->((_1^_2)&_3) +[distribrr] +((_3&_1)&(_3&_2))->((_1&_2)&_3) +((_3|_1)&(_3|_2))->((_1&_2)|_3) +((_3&_1)|(_3&_2))->((_1|_2)&_3) +((_3|_1)|(_3|_2))->((_1|_2)|_3) +((_3&_1)^(_3&_2))->((_1^_2)&_3) +[distribunary] +((!_1)&(!_2))->(!(_1|_2)) + +; 32-bit C binary logical operations + +; Strangely enough, these can be done for the most part with the combined +; effect of many small optimizations (of course, that's the best way to do it). +; The only potential problem is that the distributive law isn't quite general +; enough for some cases involving constants, and for some cases where one side +; or the other is known to have no set evenbits or no set oddbits. +; Some generalised versions of the distributive law are needed here. +; Unfortunately, there are lots of binary operators here that need to be +; written both ways round. The 96 cases that follow, combined with weakenand, +; should be enough for all but the most pathological cases. +[distribhalfxoroveror1] +(((_1 ^ _2) & _3) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 ^ _2) & _3))->((_1 ^ _2) & (_3 | _4)) +(((_1 ^ _2) & _3) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 ^ _2) & _3))->((_1 ^ _2) & (_3 | _4)) +((_3 & (_1 ^ _2)) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_1 ^ _2)))->((_1 ^ _2) & (_3 | _4)) +((_3 & (_1 ^ _2)) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_1 ^ _2)))->((_1 ^ _2) & (_3 | _4)) +(((_2 ^ _1) & _3) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_2 ^ _1) & _3))->((_1 ^ _2) & (_3 | _4)) +(((_2 ^ _1) & _3) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_2 ^ _1) & _3))->((_1 ^ _2) & (_3 | _4)) +((_3 & (_2 ^ _1)) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_2 ^ _1)))->((_1 ^ _2) & (_3 | _4)) +((_3 & (_2 ^ _1)) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_2 ^ _1)))->((_1 ^ _2) & (_3 | _4)) +[distribhalfxoroveror2] +(((_1 & _3) ^ _{(c&c3)==c}2) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 & _3) ^ _{(c&c3)==c}2))->((_1 ^ _2) & (_3 | _4)) +(((_1 & _3) ^ _{(c&c3)==c}2) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 & _3) ^ _{(c&c3)==c}2))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==c}2 ^ (_1 & _3)) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_{(c&c3)==c}2 ^ (_1 & _3)))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==c}2 ^ (_1 & _3)) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_{(c&c3)==c}2 ^ (_1 & _3)))->((_1 ^ _2) & (_3 | _4)) +(((_3 & _1) ^ _{(c&c3)==c}2) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_3 & _1) ^ _{(c&c3)==c}2))->((_1 ^ _2) & (_3 | _4)) +(((_3 & _1) ^ _{(c&c3)==c}2) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_3 & _1) ^ _{(c&c3)==c}2))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==c}2 ^ (_3 & _1)) | (_1 & _{(c&c3)==0}4))->((_1 ^ _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_{(c&c3)==c}2 ^ (_3 & _1)))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==c}2 ^ (_3 & _1)) | (_{(c&c3)==0}4 & _1))->((_1 ^ _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_{(c&c3)==c}2 ^ (_3 & _1)))->((_1 ^ _2) & (_3 | _4)) +[distribhalforoveror1] +(((_1 | _2) & _3) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 | _2) & _3))->((_1 | _2) & (_3 | _4)) +(((_1 | _2) & _3) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 | _2) & _3))->((_1 | _2) & (_3 | _4)) +((_3 & (_1 | _2)) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_1 | _2)))->((_1 | _2) & (_3 | _4)) +((_3 & (_1 | _2)) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_1 | _2)))->((_1 | _2) & (_3 | _4)) +(((_2 | _1) & _3) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_2 | _1) & _3))->((_1 | _2) & (_3 | _4)) +(((_2 | _1) & _3) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_2 | _1) & _3))->((_1 | _2) & (_3 | _4)) +((_3 & (_2 | _1)) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_2 | _1)))->((_1 | _2) & (_3 | _4)) +((_3 & (_2 | _1)) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_2 | _1)))->((_1 | _2) & (_3 | _4)) +[distribhalforoveror2] +(((_1 & _3) | _{(c&c3)==c}2) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 & _3) | _{(c&c3)==c}2))->((_1 | _2) & (_3 | _4)) +(((_1 & _3) | _{(c&c3)==c}2) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 & _3) | _{(c&c3)==c}2))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==c}2 | (_1 & _3)) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_{(c&c3)==c}2 | (_1 & _3)))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==c}2 | (_1 & _3)) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_{(c&c3)==c}2 | (_1 & _3)))->((_1 | _2) & (_3 | _4)) +(((_3 & _1) | _{(c&c3)==c}2) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_3 & _1) | _{(c&c3)==c}2))->((_1 | _2) & (_3 | _4)) +(((_3 & _1) | _{(c&c3)==c}2) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_3 & _1) | _{(c&c3)==c}2))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==c}2 | (_3 & _1)) | (_1 & _{(c&c3)==0}4))->((_1 | _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_{(c&c3)==c}2 | (_3 & _1)))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==c}2 | (_3 & _1)) | (_{(c&c3)==0}4 & _1))->((_1 | _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_{(c&c3)==c}2 | (_3 & _1)))->((_1 | _2) & (_3 | _4)) +[distribhalfandoveror1] +(((_1 & _2) & _3) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 & _2) & _3))->((_1 & _2) & (_3 | _4)) +(((_1 & _2) & _3) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 & _2) & _3))->((_1 & _2) & (_3 | _4)) +((_3 & (_1 & _2)) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_1 & _2)))->((_1 & _2) & (_3 | _4)) +((_3 & (_1 & _2)) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_1 & _2)))->((_1 & _2) & (_3 | _4)) +(((_2 & _1) & _3) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_2 & _1) & _3))->((_1 & _2) & (_3 | _4)) +(((_2 & _1) & _3) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_2 & _1) & _3))->((_1 & _2) & (_3 | _4)) +((_3 & (_2 & _1)) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_3 & (_2 & _1)))->((_1 & _2) & (_3 | _4)) +((_3 & (_2 & _1)) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_3 & (_2 & _1)))->((_1 & _2) & (_3 | _4)) +[distribhalfandoveror2] +(((_1 & _3) & _2) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_1 & _3) & _2))->((_1 & _2) & (_3 | _4)) +(((_1 & _3) & _2) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_1 & _3) & _2))->((_1 & _2) & (_3 | _4)) +((_2 & (_1 & _3)) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_2 & (_1 & _3)))->((_1 & _2) & (_3 | _4)) +((_2 & (_1 & _3)) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_2 & (_1 & _3)))->((_1 & _2) & (_3 | _4)) +(((_3 & _1) & _2) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | ((_3 & _1) & _2))->((_1 & _2) & (_3 | _4)) +(((_3 & _1) & _2) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | ((_3 & _1) & _2))->((_1 & _2) & (_3 | _4)) +((_2 & (_3 & _1)) | (_1 & _{(c&c3)==0}4))->((_1 & _2) & (_3 | _4)) +((_1 & _{(c&c3)==0}4) | (_2 & (_3 & _1)))->((_1 & _2) & (_3 | _4)) +((_2 & (_3 & _1)) | (_{(c&c3)==0}4 & _1))->((_1 & _2) & (_3 | _4)) +((_{(c&c3)==0}4 & _1) | (_2 & (_3 & _1)))->((_1 & _2) & (_3 | _4)) + +; A right-shift idiom in syslib that was written in an unneccessarily complex +; way, by doing the bits separately the same way as left-shifts have to be done +; (of course, select can right-shift by any difference without much trouble); +; the next idiom is a helper for that. Previous code produced a warning when +; this idiom was used, but the optimizer has now been enhanced to the extent +; that it can deal with it without much special-casing, and therefore there's +; no way now to tell that that case is being used, so the warning has been +; removed. +; lshift32half done in the other direction; note that the large constant here +; is 0x55555554, not the all-5s number +[rshift32half] +((_1~#1431655764)$#0)->((_1�)>>#1) +; and piecing together this with selectmingle4 gives the syslib idiom, which +; optimizes through distributions over C_OR and then constant folding + +; When a 0 is on one side of a C binary logic operation, or the two sides are +; the same, simplification is often possible. The and-0 case has been dealt +; with already. +[noopor] +(_1|#0)->(_1) +(#0|_1)->(_1) +[noopxor] +(_1|#0)->(_1) +(#0|_1)->(_1) +[anditself] +(_1&_1)->(_1) +[oritself] +(_1|_1)->(_1) +[xoritself] +(_1^_1)->(#0) + +; Equality and inequality +[xortoequal] +(!(_1^_2))->(_1==_2) +[negatingequal] +(!(_1==_2))->(_1!=_2) +(!(_1!=_2))->(_1==_2) + +; Greater than and less than +[greaterthan32] +((_1~:2)~((?(:2~:2))^#2147483648))->(_1>(:2^_1)) +((_1~:2)~(#2147483648^(?(:2~:2))))->(_1>(:2^_1)) +[greaterthan16] +((_1~.2)~((?(.2~.2))^#32768))->(_1>(.2^_1)) +((_1~.2)~(#32768^(?(.2~.2))))->(_1>(.2^_1)) + +; Consistency in C logical operation nesting, when it doesn't matter +[xoroutsideand] +((_1^_2)&_2)->((_1&_2)^_2) +(_2&(_1^_2))->((_1&_2)^_2) +((_2^_1)&_2)->((_1&_2)^_2) +(_2&(_2^_1))->((_1&_2)^_2) + +; Boolean algebra, on 0s and 1s or on 1s and 2s. Unary bitwidth is irrelevant. +[booleannot] +(_{c==1}1^#1)->(!_1) +[not21] +(#2-(!(_{c==1}1)))->(_1+#1) +(#1+(!(_{c==1}1)))->(#2-_1) +((!(_{c==1}1))+#1)->(#2-_1) +[nullmingle] +(#0$_{c==1}1)->(_1) diff --git a/src/lexer.l b/src/lexer.l index 2c268a1..17f1df3 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -23,6 +23,7 @@ LICENSE TERMS along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" #include #include #include @@ -41,9 +42,7 @@ static int yywrap(void) } #endif /* yywrap */ -#ifdef YYLINENO_BY_HAND -int yylineno = 1; -#endif /* YYLINENO_BY_HAND */ +int iyylineno = 1; #ifdef MAIN YYSTYPE yylval; @@ -82,12 +81,12 @@ int lexer(void); static int myatoi(char *text); #define SETLINENO \ - {if (stbeginline == 0) stbeginline = yylineno; \ + {if (stbeginline == 0) stbeginline = iyylineno;\ else if (stbeginline < 0) stbeginline = 0;} /* AIS: Keep track of the spark/ears situation */ #define STACKSPARKEARS(a) \ - if (sparkearslev+1>=SENESTMAX*32) lose(E281, yylineno, (char*) NULL); \ + if (sparkearslev+1>=SENESTMAX*32) lose(E281, iyylineno, (char*) NULL); \ sparkearslev++; sparkearsstack[sparkearslev/32]<<=1; \ sparkearsstack[sparkearslev/32]+=a #define CLEARSPARKEARSTACK {int i=SENESTMAX; \ @@ -151,9 +150,7 @@ int getc(FILE *fp) { do { c = fgetc(fp); -#ifdef YYLINENO_BY_HAND - if( c == '\n' ) yylineno++; -#endif /* YYLINENO_BY_HAND */ + if( c == '\n' ) iyylineno++; } while (c != '\\' && isspace(c)); } @@ -175,7 +172,7 @@ int getc(FILE *fp) { *lineptr = '\0'; lineptr = linebuf; - if (yylineno >= textlinecount) + if (iyylineno >= textlinecount) { textlinecount += ALLOC_CHUNK; if (textlines) @@ -184,15 +181,13 @@ int getc(FILE *fp) else textlines = malloc(textlinecount * sizeof(char*)); if (!textlines) - lose(E666, yylineno, (char *)NULL); + lose(E666, iyylineno, (char *)NULL); } - textlines[yylineno] = malloc(1 + strlen(linebuf)); - if (!textlines[yylineno]) - lose(E666, yylineno, (char *)NULL); - strcpy(textlines[yylineno], linebuf); -#ifdef YYLINENO_BY_HAND - yylineno++; -#endif /* YYLINENO_BY_HAND */ + textlines[iyylineno] = malloc(1 + strlen(linebuf)); + if (!textlines[iyylineno]) + lose(E666, iyylineno, (char *)NULL); + strcpy(textlines[iyylineno], linebuf); + iyylineno++; return('\n'); } else @@ -329,7 +324,7 @@ ITERUM {return(AGAIN);} if (yylval.numval && yylval.numval < 100) return(OHOHSEVEN); else - lose(E017, yylineno, (char *)NULL);} + lose(E017, iyylineno, (char *)NULL);} SUB {return(SUB);} MULTIPLICATUS{W}A | BY {return(BY);} @@ -411,6 +406,9 @@ DESPERARE | GIVE{W}UP {return(GIVE_UP);} CONOR{W}ITERUM | TRY{W}AGAIN {return(TRY_AGAIN);} +WHILE {return(WHILE); /* AIS. Latin for this is needed. */} +WHILING | +LOOPING {yylval.numval = WHILE; return(GERUND);} TRYING{W}AGAIN {yylval.numval = TRY_AGAIN; return(GERUND);} GO{W}BACK | REDIRE {return(GO_BACK);} @@ -484,7 +482,6 @@ void yyerror(char *errtype) #ifdef MAIN (void) printf("lextest: lexer error: %s.\n", errtype); #else /* MAIN */ - /* lose(E017, yylineno, (char *)NULL); */ (void) errtype; #endif /* MAIN */ } diff --git a/src/lose.c b/src/lose.c index adf751d..ddbc61b 100644 --- a/src/lose.c +++ b/src/lose.c @@ -21,6 +21,7 @@ LICENSE TERMS Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /*LINTLIBRARY*/ +#include "config.h" #include #include #include diff --git a/src/lose.h b/src/lose.h index c613054..4549ece 100644 --- a/src/lose.h +++ b/src/lose.h @@ -106,7 +106,7 @@ GO BACK or GO AHEAD was executed without a choicepoint. */ #define E404 "404 I'M ALL OUT OF CHOICES!\n\ ON THE WAY TO %d\n" -/* (AIS) MAYBE, GO BACK, or GO AHEAD used without the -m option. */ +/* (AIS) WHILE, MAYBE, GO BACK, or GO AHEAD used without the -m option. */ #define E405 "405 PROGRAM REJECTED FOR MENTAL HEALTH REASONS\n\ ON THE WAY TO %d\n" /* A COME FROM statement references a non-existent line label. */ diff --git a/src/oil.y b/src/oil.y new file mode 100644 index 0000000..2eb36e6 --- /dev/null +++ b/src/oil.y @@ -0,0 +1,731 @@ +/***************************************************************************** + +NAME + oil.y -- compiler for Optimiser Idiom Language files + +LICENSE TERMS + Copyright (C) 2007 Alex Smith + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +***************************************************************************/ + +%{ + +#include "config.h" +#include +#include +#include +#include + +/* Autoconf lets us know if we have _Bool available, usually. On DJGPP there's + an occasional bug that I haven't managed to reproduce that leaves + SIZEOF_BOOL as the null string, so detect that first. */ +#if 100 - SIZEOF__BOOL - 1 == 101 +/* The bug happened, so play safe. */ + typedef int mybool; +#else +# if SIZEOF__BOOL > 0 + typedef _Bool mybool; +# else + typedef int mybool; +# endif +#endif + +/* Define strdup if it isn't available */ +#ifndef HAVE_STRDUP +char* strdup(char* s) +{ + char* t=malloc(strlen(s)+1); + if(t) strcpy(t,s); + return t; +} +#endif + +/* +#define YYDEBUG 1 +int yydebug=1; +*/ + +/* Each semantic value represents either a constraint on a node that needs to + be true for the optimization template to match, or part of the replacement + for the optimization template. */ +struct ickstype +{ + unsigned depth; /* The number of child nodes this is from the root */ + unsigned long path; /* Bits from the end of this number represent the + sequence of lvals (=0) or rvals (=1) this is from the + root; depth bits from the end are relevant, and the + bit nearest the root is least significant */ + char* condition; /* Points to a constant string; the condition to generate + on that node. Could also point to something the lexer + mallocs, but then the lexer has to keep track of being + able to free it again. If this is NULL, it means that + there isn't a condition other than maybe mustbemesh */ + char* nodetypename; /* The name of the type of node this condition matches, + or NULL for a LEXERLEAF */ + mybool usec; /* Whether to append the value of c to the condition */ + mybool mustbemesh; /* Must this node be a mesh or mesh32? */ + mybool cxneeded; /* True means calculate c and x for the node and the + condition is on those; false means append 'condition' + to the node itself to form the condition and c and x + aren't needed */ + mybool width32; /* Generate a 32-bit node? */ + unsigned long c; /* The value to append to the condition */ + int replnum; /* Number of this group for replacements */ + struct ickstype *n1;/* n1 and n2 are pointers to other conditions that */ + struct ickstype *n2;/* also have to be satisified */ +}; + +#define YYSTYPE YYSTYPE + +#define MAXOPTNAMELEN 64 + char optname[MAXOPTNAMELEN]="undefined"; + + typedef struct ickstype *YYSTYPE; + + void treedepthup(YYSTYPE, mybool); + void treefree(YYSTYPE); + void gennodepath(unsigned, unsigned long); + mybool treeshapecond(YYSTYPE, mybool); + YYSTYPE treenscheck(YYSTYPE, YYSTYPE, int); + void treecxcond(YYSTYPE); + void treerepcount(YYSTYPE, int*); + void treerepgen(YYSTYPE, YYSTYPE*, int*); + + int countgetchar(void); + int countungetc(int, FILE*); + int cgccol; + int cgcrow; + +/* #defines for chaining together template expressions; here, s is the type + of expression (e.g. select, bitwise and, unary and) that's chaining the + expressions together and n is the nonterminal that's the rval */ +#define BINARYEXPR(s,m,l,r,w) do{ \ + m=malloc(sizeof(struct ickstype)); \ + m->n1=l; \ + m->n2=r; \ + m->usec=0; \ + m->condition="->opcode==" s; \ + m->nodetypename=s; \ + m->mustbemesh=0; \ + m->cxneeded=0; \ + m->depth=0; \ + m->path=0; \ + m->replnum=0; \ + m->width32=w; \ + treedepthup(m->n1,0); \ + treedepthup(m->n2,1); \ + } while(0) + +#define UNARYEXPR(s,m,r,w) do{ \ + m=malloc(sizeof(struct ickstype)); \ + m->n1=0; \ + m->n2=r; \ + m->usec=0; \ + m->condition="->opcode==" s; \ + m->nodetypename=s; \ + m->mustbemesh=0; \ + m->cxneeded=0; \ + m->depth=0; \ + m->path=0; \ + m->replnum=0; \ + m->width32=w; \ + treedepthup(m->n2,1); \ + } while(0) + +/* Error handling and lexing */ + int yylex(void); + int yyerror(char const *); +%} + +/* Various conditions can come out from the lexer. The most common is a char, + which represents that C or INTERCAL operation in a template. Non-character + tokens are used for the various possible leaves in a template, though: + .1 A 16-bit expression (number 1, for replacements) + :1 A 32-bit expression (number 1, for replacements) + _1 An expression of any width (again, number 1 for replacements) + #1 A constant with the value 1 + #{x==1}3 A constant which equals 1 (number 3, for replacements) + Note that in the last example, the expression is written strictly in C; + for instance, + #{iselect(x,x)==1}4 + would select a constant that's a power of 2 (iselect is the C name for the + INTERCAL operation 'select'). + .{c&0xfffffffe==0}5 A 16-bit expression (number 5, for replacements) which + has been analysed to not possibly have any bits other than the least + significant set (c is here the list of all potentially set bits) + All of these come out as correctly set LEXERLEAFs. + + Expressions with identical numbers must be node-for-node identical, except + for number 0 (which is like _ in Prolog, it means 'can be anything and + disregard the value). This holds true even if they have different sigils. + Expressions can use each other's c and x values with the notation c5, x4, + and so on; replacement numbers are limited to 1 digit. + + The other things that can come out from the lexer are sparks, ears, and + parentheses (any mix, we're not fussy). */ + +%token LEXERLEAF + +%% + +input: /**/ | input optimization ; + +optimization: template '-' '>' replacement +{ + static YYSTYPE tempmem[10]; + static int replcount[10]; + /* This is where we actually generate the optimizer code. */ + /* Tree-shape and is-constant conditions */ + printf(" checknodeactbits(np);\n"); + if(treeshapecond($1,1)) printf(" if(1"); printf(")\n do\n {\n"); + /* Nodesame and cxdata conditions */ + { + int i=10; + YYSTYPE temp; + while(--i) + { + temp=treenscheck($1,0,i); + if(temp) + { + printf(" x%d=np",i); + gennodepath(temp->depth,temp->path); + printf("->constant; c%d=np",i); + gennodepath(temp->depth,temp->path); + printf("->optdata;\n"); + } + tempmem[i]=temp; + replcount[i]=0; /* we need to zero this somewhere, may as well be here */ + } + treecxcond($1); + } + /* If we reach this point in the generated code, we have an optimizer + template match. */ + printf(" OPTING(%s);\n",optname); + + /* We now need to replace np with its replacement. This is done by creating + a new nodetree, copying across tempmem'd nodes where necessary, and then + substituting one for the other. (This is an inefficient but general way + to do this.) One special case is needed; because pointers into the root + node need to continue pointing there, the temporary node tp is copied + member-for-member and then freed again. To make coding optimizations + easier, the root stays as the same width no matter what. */ + printf(" tp=newnode();\n"); + treerepcount($4,replcount); + treerepgen($4,tempmem,replcount); + printf(" nodefree(np->lval); nodefree(np->rval);\n"); + printf(" tempw=np->width; *np=*tp; np->width=tempw; free(tp);\n"); + printf(" } while(0);\n\n"); + /* Free the template and replacement now they're finished being used. */ + treefree($1); + treefree($4); +} +| '<' LEXERLEAF '-' LEXERLEAF +{ + if(!$2->mustbemesh||!$4->mustbemesh) + { + yyerror("syntax error in <#..#()->()> construct"); + free($2); free($4); + YYERROR; + } + printf(" r=%luLU; while(r<=%luLU) {\n",$2->c,$4->c); + free($2); free($4); +} +| '>' {printf(" r++;\n }\n");}; + +template: expr3 ; + +expr3: '(' expr2 ')' {$$=$2;} +| '"' expr2 '"' {$$=$2;} +| '\'' expr2 '\'' {$$=$2;} + +expr: expr3 +| LEXERLEAF ; + +expr2: expr '$' expr {BINARYEXPR("MINGLE",$$,$1,$3,1);} +| expr '~' expr {BINARYEXPR("SELECT",$$,$1,$3,1);} +| expr '~' '1' '6' expr {BINARYEXPR("SELECT",$$,$1,$5,0);} +| expr '~' '3' '2' expr {BINARYEXPR("SELECT",$$,$1,$5,1);} +| '&' expr {UNARYEXPR("AND",$$,$2,1);} +| '&' '1' '6' expr {UNARYEXPR("AND",$$,$4,0);} +| '&' '3' '2' expr {UNARYEXPR("AND",$$,$4,1);} +| 'V' expr {UNARYEXPR("OR",$$,$2,1);} +| 'V' '1' '6' expr {UNARYEXPR("OR",$$,$4,0);} +| 'V' '3' '2' expr {UNARYEXPR("OR",$$,$4,1);} +| '?' expr {UNARYEXPR("XOR",$$,$2,1);} +| '?' '1' '6' expr {UNARYEXPR("XOR",$$,$4,0);} +| '?' '3' '2' expr {UNARYEXPR("XOR",$$,$4,1);} +| '^' expr {UNARYEXPR("FIN",$$,$2,1);} +| '^' '1' '6' expr {UNARYEXPR("FIN",$$,$4,0);} +| '^' '3' '2' expr {UNARYEXPR("FIN",$$,$4,1);} +| '@' expr {UNARYEXPR("WHIRL",$$,$2,1);} +| '@' '2' expr {UNARYEXPR("WHIRL2",$$,$3,1);} +| '@' '3' expr {UNARYEXPR("WHIRL3",$$,$3,1);} +| '@' '4' expr {UNARYEXPR("WHIRL4",$$,$3,1);} +| '@' '5' expr {UNARYEXPR("WHIRL5",$$,$3,1);} +| '@' '1' '6' expr {UNARYEXPR("WHIRL",$$,$4,0);} +| '@' '2' '1' '6' expr {UNARYEXPR("WHIRL2",$$,$5,0);} +| '@' '3' '1' '6' expr {UNARYEXPR("WHIRL3",$$,$5,0);} +| '@' '4' '1' '6' expr {UNARYEXPR("WHIRL4",$$,$5,0);} +| '@' '5' '1' '6' expr {UNARYEXPR("WHIRL5",$$,$5,0);} +| '@' '3' '2' expr {UNARYEXPR("WHIRL",$$,$4,1);} +| '@' '2' '3' '2' expr {UNARYEXPR("WHIRL2",$$,$5,1);} +| '@' '3' '3' '2' expr {UNARYEXPR("WHIRL3",$$,$5,1);} +| '@' '4' '3' '2' expr {UNARYEXPR("WHIRL4",$$,$5,1);} +| '@' '5' '3' '2' expr {UNARYEXPR("WHIRL5",$$,$5,1);} +| expr '&' expr {BINARYEXPR("C_AND",$$,$1,$3,1);} +| expr '&' '1' '6' expr {BINARYEXPR("C_AND",$$,$1,$5,0);} +| expr '&' '3' '2' expr {BINARYEXPR("C_AND",$$,$1,$5,1);} +| expr '|' expr {BINARYEXPR("C_OR",$$,$1,$3,1);} +| expr '|' '1' '6' expr {BINARYEXPR("C_OR",$$,$1,$5,0);} +| expr '|' '3' '2' expr {BINARYEXPR("C_OR",$$,$1,$5,1);} +| expr '^' expr {BINARYEXPR("C_XOR",$$,$1,$3,1);} +| expr '^' '1' '6' expr {BINARYEXPR("C_XOR",$$,$1,$5,0);} +| expr '^' '3' '2' expr {BINARYEXPR("C_XOR",$$,$1,$5,1);} +| expr '+' expr {BINARYEXPR("C_PLUS",$$,$1,$3,1);} +| expr '+' '1' '6' expr {BINARYEXPR("C_PLUS",$$,$1,$5,0);} +| expr '+' '3' '2' expr {BINARYEXPR("C_PLUS",$$,$1,$5,1);} +| expr '-' expr {BINARYEXPR("C_MINUS",$$,$1,$3,1);} +| expr '-' '1' '6' expr {BINARYEXPR("C_MINUS",$$,$1,$5,0);} +| expr '-' '3' '2' expr {BINARYEXPR("C_MINUS",$$,$1,$5,1);} +| expr '*' expr {BINARYEXPR("C_TIMES",$$,$1,$3,1);} +| expr '*' '1' '6' expr {BINARYEXPR("C_TIMES",$$,$1,$5,0);} +| expr '*' '3' '2' expr {BINARYEXPR("C_TIMES",$$,$1,$5,1);} +| expr '/' expr {BINARYEXPR("C_DIVIDEBY",$$,$1,$3,1);} +| expr '/' '1' '6' expr {BINARYEXPR("C_DIVIDEBY",$$,$1,$5,0);} +| expr '/' '3' '2' expr {BINARYEXPR("C_DIVIDEBY",$$,$1,$5,1);} +| expr '%' expr {BINARYEXPR("C_MODULUS",$$,$1,$3,1);} +| expr '%' '1' '6' expr {BINARYEXPR("C_MODULUS",$$,$1,$5,0);} +| expr '%' '3' '2' expr {BINARYEXPR("C_MODULUS",$$,$1,$5,1);} +| expr '>' expr {BINARYEXPR("C_GREATER",$$,$1,$3,1);} +| expr '>' '1' '6' expr {BINARYEXPR("C_GREATER",$$,$1,$5,0);} +| expr '>' '3' '2' expr {BINARYEXPR("C_GREATER",$$,$1,$5,1);} +| expr '<' expr {BINARYEXPR("C_LESS",$$,$1,$3,1);} +| expr '<' '1' '6' expr {BINARYEXPR("C_LESS",$$,$1,$5,0);} +| expr '<' '3' '2' expr {BINARYEXPR("C_LESS",$$,$1,$5,1);} +| '~' '1' '6' expr {UNARYEXPR("C_NOT",$$,$4,0);} +| '~' '3' '2' expr {UNARYEXPR("C_NOT",$$,$4,1);} +| expr '!' '=' expr {BINARYEXPR("C_NOTEQUAL",$$,$1,$4,0);} +| expr '!' '=' '1' '6' expr {BINARYEXPR("C_NOTEQUAL",$$,$1,$6,0);} +| expr '!' '=' '3' '2' expr {BINARYEXPR("C_NOTEQUAL",$$,$1,$6,1);} +| expr '=' '=' expr {BINARYEXPR("C_ISEQUAL",$$,$1,$4,0);} +| expr '=' '=' '1' '6' expr {BINARYEXPR("C_ISEQUAL",$$,$1,$6,0);} +| expr '=' '=' '3' '2' expr {BINARYEXPR("C_ISEQUAL",$$,$1,$6,1);} +| expr '&' '&' expr {BINARYEXPR("C_LOGICALAND",$$,$1,$4,0);} +| expr '&' '&' '1' '6' expr {BINARYEXPR("C_LOGICALAND",$$,$1,$6,0);} +| expr '&' '&' '3' '2' expr {BINARYEXPR("C_LOGICALAND",$$,$1,$6,1);} +| expr '|' '|' expr {BINARYEXPR("C_LOGICALOR",$$,$1,$4,0);} +| expr '|' '|' '1' '6' expr {BINARYEXPR("C_LOGICALOR",$$,$1,$6,0);} +| expr '|' '|' '3' '2' expr {BINARYEXPR("C_LOGICALOR",$$,$1,$6,1);} +| expr '>' '>' expr {BINARYEXPR("C_RSHIFTBY",$$,$1,$4,1);} +| expr '>' '>' '1' '6' expr {BINARYEXPR("C_RSHIFTBY",$$,$1,$6,0);} +| expr '>' '>' '3' '2' expr {BINARYEXPR("C_RSHIFTBY",$$,$1,$6,1);} +| expr '<' '<' expr {BINARYEXPR("C_LSHIFTBY",$$,$1,$4,1);} +| expr '<' '<' '1' '6' expr {BINARYEXPR("C_LSHIFTBY",$$,$1,$6,0);} +| expr '<' '<' '3' '2' expr {BINARYEXPR("C_LSHIFTBY",$$,$1,$6,1);} +| '!' expr {UNARYEXPR("C_LOGICALNOT",$$,$2,0);} +| '!' '1' '6' expr {UNARYEXPR("C_LOGICALNOT",$$,$4,0);} +| '!' '3' '2' expr {UNARYEXPR("C_LOGICALNOT",$$,$4,1);} +| expr ; + +replacement: expr3; + +%% + +#define MAXTOFREE 1000 + +char* tofree[MAXTOFREE]={0}; +int tfi=0; + +int yylex(void) +{ + int c; + unsigned long acc; + + /* Whitespace is completely insignificant here, even inside && and other + two-character operators. Just to be different, though, it /is/ significant + inside constructs like .1 and #{1}2; in such cases, it isn't allowed. */ + c=countgetchar(); + while(isspace(c)) c=countgetchar(); + while(c==';'||c=='[') + { + /* Comments go from a semicolon/hybrid to the end of the line. */ + if(c==';') + { + c=countgetchar(); + while(c!='\n') c=countgetchar(); + while(isspace(c)) c=countgetchar(); + } + /* Square brackets set the name for optimizations. */ + if(c=='[') + { + int i=0; + c=countgetchar(); + while(c!=']') + { + optname[i++]=c; + c=countgetchar(); + if(i==MAXOPTNAMELEN-1) {i=0; yyerror("optimization name too long");} + } + optname[i]=0; + c=countgetchar(); + while(isspace(c)) c=countgetchar(); + } + } + if(c==EOF) return 0; + switch(c) + { + case '#': + c=countgetchar(); + if(c!='{') + { + acc=0; + while(isdigit(c)) + { + acc*=10; + acc+=(c-'0'); + c=countgetchar(); + } + yylval=malloc(sizeof(struct ickstype)); + yylval->depth=0; + yylval->path=0; + yylval->condition="->constant=="; + yylval->nodetypename=0; + yylval->usec=1; + yylval->mustbemesh=1; + yylval->cxneeded=0; + yylval->c=acc; + yylval->replnum=0; + yylval->n1=0; + yylval->n2=0; + yylval->width32=1; /* generate MESH32 not MESH; we can still AND16 it, + etc., if necessary */ + countungetc(c, stdin); + return LEXERLEAF; + } + countungetc(c, stdin); + c='#'; + /* fall through */ + case '_': + case ':': + case '.': + yylval=malloc(sizeof(struct ickstype)); + yylval->depth=0; + yylval->path=0; + yylval->condition=0; /* _ or # */ + yylval->width32=1; /* should never matter, but you never know... */ + if(c==':') yylval->condition="->width==32"; + if(c=='.') {yylval->condition="->width==16"; yylval->width32=0;} + yylval->nodetypename=0; + yylval->usec=0; + yylval->mustbemesh=c=='#'; + yylval->cxneeded=0; + c=countgetchar(); + if(c=='{') + { + /* Create a new node to hold the c/x condition */ + yylval->n1=malloc(sizeof(struct ickstype)); + yylval->n1->depth=0; + yylval->n1->path=0; + { + static char buf[512]; + int bi=0; + c=countgetchar(); + while(c!='}') + { + buf[bi++]=c; + if(bi==511) {yyerror("{quoted} string too long"); bi=0;} + c=countgetchar(); + } + buf[bi]=0; + yylval->n1->condition=tofree[tfi++]=strdup(buf); + if(tfi==MAXTOFREE) {yyerror("Too many {quoted} strings"); tfi--;} + c=countgetchar(); + } + yylval->n1->nodetypename=0; + yylval->n1->usec=0; + yylval->n1->mustbemesh=0; + yylval->n1->cxneeded=1; + yylval->n1->n1=0; + yylval->n1->n2=0; + } + else yylval->n1=0; + yylval->replnum=0; + if(yylval->n1) yylval->n1->replnum=c-'0'; else yylval->replnum=c-'0'; + yylval->n2=0; + return LEXERLEAF; + default: + return c; + } +} + +void treedepthup(YYSTYPE v, mybool i) +{ + if(!v) return; + treedepthup(v->n1,i); + treedepthup(v->n2,i); + v->depth++; + v->path<<=1; + v->path|=i; + if(v->depth>30) yyerror("Nesting too deep in template or replacement\n"); +} + +void treefree(YYSTYPE v) +{ + if(!v) return; + treefree(v->n1); + treefree(v->n2); + free(v); +} + +void gennodepath(unsigned depth, unsigned long path) +{ + while(depth--) + { + if(path&1) printf("->rval"); else printf("->lval"); + path>>=1; + } +} + +mybool treeshapecond(YYSTYPE v, mybool firstopt) +{ + if(!v) return firstopt; + /* To prevent possibly dereferencing a null pointer, check the root first */ + if(v->mustbemesh) /* it's a must-be-constant constraint */ + { + printf(firstopt?" if((np":" &&\n (np"); + gennodepath(v->depth,v->path); + printf("->opcode==MESH || np"); + gennodepath(v->depth,v->path); + printf("->opcode==MESH32)"); + firstopt=0; + } + if(v->condition&&!v->cxneeded) /* it's a tree-shape constraint */ + { + printf(firstopt?" if(np":" &&\n np"); + gennodepath(v->depth,v->path); + printf("%s",v->condition); + if(v->usec) printf("%luLU",v->c); + firstopt=0; + } + firstopt=treeshapecond(v->n1,firstopt); + return treeshapecond(v->n2,firstopt); +} + +YYSTYPE treenscheck(YYSTYPE v, YYSTYPE prev, int replnum) +{ + if(!v) return prev; + prev=treenscheck(v->n1,prev,replnum); + prev=treenscheck(v->n2,prev,replnum); + if(v->replnum!=replnum) return prev; + if(prev) + { + printf(" if(!nodessame(np"); + gennodepath(prev->depth,prev->path); + printf(",np"); + gennodepath(v->depth,v->path); + printf(")) break;\n"); + } + return v; +} + +void treecxcond(YYSTYPE v) +{ + if(!v) return; + if(v->cxneeded&&strcmp(v->condition,"1")) + { + if(v->replnum) + printf(" x=x%d; c=c%d; ",v->replnum,v->replnum); + else + { + printf(" x=np"); + gennodepath(v->depth,v->path); + printf("->constant;\n c=np"); + gennodepath(v->depth,v->path); + printf("->optdata;\n "); + } + printf("if(!(%s)) break;\n",v->condition); + } + treecxcond(v->n1); + treecxcond(v->n2); +} + +void treerepcount(YYSTYPE v, int* rc) +{ + if(!v) return; + if(!(v->nodetypename)&&v->replnum&&!(v->cxneeded)) rc[v->replnum]++; + treerepcount(v->n1, rc); + treerepcount(v->n2, rc); +} + +void treerepgen(YYSTYPE v, YYSTYPE* refs, int* rc) +{ + if(!v) return; + /* We absolutely have to generate the root node first here, because otherwise + the nodes in question won't exist. */ + if(v->nodetypename) /* Generate an intermediate node */ + { + printf(" MAYBENEWNODE(tp"); + gennodepath(v->depth,v->path); + printf(");\n tp"); + gennodepath(v->depth,v->path); + printf("->opcode=%s;\n tp",v->nodetypename); + gennodepath(v->depth,v->path); + printf("->width=%d;\n",v->width32?32:16); + /* optdata will be filled in by checknodeactbits before the next idiom is + tested; constant is irrelevant, lval and rval are NULL at present and + will be filled in by later recursions of this function, and I seriously + hope that nextslat is never filled in by an optimizer idiom. */ + } + else if(v->replnum&&!(v->cxneeded)) + { + /* Copy a node from the template. The node ought not to be allocated at + this point, so we can safely just assign to it with a new malloced + node. */ + if(refs[v->replnum]) + { + if(rc[v->replnum]>1||!refs[v->replnum]->depth) + { + /* The node actually has to be copied, either because another copy is + needed or because it's np itself that's being copied over. */ + rc[v->replnum]--; + printf(" tp"); + gennodepath(v->depth,v->path); + printf("=nodecopy(np"); + gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path); + printf(");\n"); + } + else + { + /* This can be optimized slightly by moving rather than copying, + zeroing backlinks so that the node won't be freed. */ + rc[v->replnum]--; + printf(" tp"); + gennodepath(v->depth,v->path); + printf("=np"); + gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path); + printf(";\n np"); + gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path); + printf("=0;\n"); + } + } + else yyerror("Replacement isn't in the template"); + } + else if(v->cxneeded) + { + /* Generate a constant node based on an expression (#{expr}0). */ + printf(" MAYBENEWNODE(tp"); + gennodepath(v->depth,v->path); + printf(");\n tp"); + gennodepath(v->depth,v->path); + printf("->opcode=MESH32;\n tp"); + gennodepath(v->depth,v->path); + printf("->width=32;\n tp"); + gennodepath(v->depth,v->path); + printf("->constant=(%s);\n",v->condition); + } + else if(v->mustbemesh&&!v->n1) + { + /* Generate a constant node based on a constant (#65535). */ + printf(" MAYBENEWNODE(tp"); + gennodepath(v->depth,v->path); + printf(");\n tp"); + gennodepath(v->depth,v->path); + printf("->opcode=MESH32;\n tp"); + gennodepath(v->depth,v->path); + printf("->width=32;\n tp"); + gennodepath(v->depth,v->path); + printf("->constant=(%luLU);\n",v->c); + } + else if(v->mustbemesh&&v->n1) + /* let this node's n1 handle it */ ; + else + yyerror("can't figure out how to generate a replacement node\n"); + treerepgen(v->n1,refs,rc); + treerepgen(v->n2,refs,rc); +} + +int yyerror(char const *s) +{ + fprintf(stderr,"Error at (%d:%d): \"%s\"\n",cgcrow,cgccol,s); + return 0; /* this return value is ignored anyway */ +} + +static int cgcpushback=0; + +int countgetchar(void) +{ + int c=getchar(); + if(cgcpushback) {cgcpushback=0; return c;} + cgccol++; + if(c=='\n') {cgccol=0; cgcrow++;} + return c; +} + +int countungetc(int c, FILE* f) +{ + ungetc(c,f); + cgcpushback=1; + return c; +} + +int main(void) +{ + int e; + /* Technically speaking, this string exceeds the longest permitted string + that can be written as a constant string. Compilers are unlikely to care, + though; if yours does, just break this into separate printfs. */ + printf("%s", + "/* machine-generated code; modify the corresponding .oil file\n" + " and recompile, not this one, to change this file */\n\n" + "#include \n#include \n#include \n" + "#include \n" + "#include \"sizes.h\"\n#include \"ick.h\"\n#include \"parser.h\"\n" + "#include \"fiddle.h\"\n#include \"lose.h\"\n#include \"feh.h\"\n\n" + "#define OPTING(x) if(optdebug == 2) {\\\n" + " explexpr(optdebugnode,stderr);\\\n" + " putc('\\n',stderr); } \\\n" + " if(optdebug == 3) {\\\n" + " prexpr(optdebugnode,stderr,0);\\\n" + " putc('\\n',stderr); } \\\n" + " if(optdebug) fprintf(stderr,\"[%s]\",#x);\\\n" + " if(optdebug >= 2) putc('\\n',stderr);\\\n" + " opted = 1;\n\n" + "#define MAYBENEWNODE(n) if(!(n)) (n)=newnode();\n\n" + "int optimize_pass1(node *np)\n{\n int opted=0;\n" + " unsigned long c,c1,c2,c3,c4,c5,c6,c7,c8,c9;\n" + " unsigned long x,x1,x2,x3,x4,x5,x6,x7,x8,x9,r;\n" + " int tempw;\n" + " node *tp;\n" + " if(!np) return 0;\n" + " if(np->lval) opted|=optimize_pass1(np->lval);\n" + " if(np->rval) opted|=optimize_pass1(np->rval);\n"); + cgccol=0; + cgcrow=1; + e=yyparse(); + while(tfi--) free(tofree[tfi]); + /* Disabling warnings about unused variables. gcc will optimize this right + out, and in any case the raise(SIGSEGV) will be unreachable (but will + cause a pretty recognizable error because it'll be caught by the handler + for SIGSEGV and output an internal error, with an obvious debug backtrace + if -U is used). */ + printf(" c=c1=c2=c3=c4=c5=c6=c7=c8=c9=0;\n" + " x=x1=x2=x3=x4=x5=x6=x7=x8=x9=r=0;\n" + " if(c+c1+c2+c3+c4+c5+c6+c7+c8+c9+r+\n" + " x+x1+x2+x3+x4+x5+x6+x7+x8+x9) raise(SIGSEGV);\n"); + printf(" return opted;\n}\n"); + return e; +} diff --git a/src/parser.y b/src/parser.y index 97807d7..f6520d8 100644 --- a/src/parser.y +++ b/src/parser.y @@ -1,7 +1,7 @@ /***************************************************************************** NAME - ick.y -- grammar for the INTERCAL language + parser.y -- grammar for the INTERCAL language DESCRIPTION This YACC grammar parses the INTERCAL language by designed by Don R. Woods @@ -28,6 +28,7 @@ LICENSE TERMS *****************************************************************************/ %{ +#include "config.h" #include #include #include "sizes.h" @@ -49,6 +50,7 @@ extern int stbeginline; /* line number of last seen preamble */ static int thisline; /* line number of beginning of current statement */ extern int mark112; /* AIS: Mark the tuple for W112 when it's created. */ +static int lineuid=65537; /* AIS: a line number not used anywhere else */ static tuple *splat(void); @@ -65,7 +67,7 @@ static tuple *splat(void); x->u.node = nn; x->u.target = nn2;} /* AIS : The macro above was added for ABSTAIN expr FROM. */ #define NEWFANGLED mark112 = 1; /* AIS: Added the mention of mark112 */ \ - if (traditional) lose(E111,yylineno,(char*)NULL); else + if (traditional) lose(E111,iyylineno,(char*)NULL); else #define DESTACKSE1 sparkearsstack[sparkearslev--/32] >>= 1 #define DESTACKSPARKEARS DESTACKSE1; DESTACKSE1 @@ -85,11 +87,15 @@ static tuple *splat(void); * Don't change this statement token list gratuitously! * Some code in feh2.c depends on GETS being the least * statement type and on the order of the ones following. + * When adding a new statement, also update MAXTYPES in ick.h + * and the token list in feh2.c. * AIS: Note that although GETS is the lowest statement type (with index 0 * in feh2.c), UNKNOWN (i.e. a line that causes error 000) is an even * lower statement type, with index -1. perpet.c uses indexes 1 higher. - * AIS: Added FROM, MANYFROM, TRY_AGAIN, COMPUCOME, GERUCOME, and - * three NEXT FROM cases. + * AIS: Added FROM, MANYFROM, TRY_AGAIN, COMPUCOME, GERUCOME, WHILE, and + * three NEXT FROM cases. Also added PREPROC; this is for when the parser + * acts like a preprocessor, translating an INTERCAL statement into a + * sequence of INTERCAL statements with the same net effect. * AIS: COME_FROM now merged with the label following it, * to distinguish it from COMPUCOME, in the lexer. This changes * the parser somewhat. @@ -99,7 +105,8 @@ static tuple *splat(void); %token REMEMBER ABSTAIN REINSTATE %token DISABLE ENABLE MANYFROM GIVE_UP READ_OUT WRITE_IN /* AIS: */PIN %token COME_FROM NEXTFROMLABEL -%token NEXTFROMEXPR NEXTFROMGERUND COMPUCOME GERUCOME TRY_AGAIN FROM +%token NEXTFROMEXPR NEXTFROMGERUND COMPUCOME GERUCOME +%token PREPROC WHILE TRY_AGAIN FROM /* AIS: ONCE and AGAIN added, for multithread support; also, NOSPOT added, so that I can reserve _ for future use (it's nowhere in the grammar yet) */ @@ -119,9 +126,9 @@ static tuple *splat(void); */ /* AIS: Added new tokens for optimizer output */ %token SPLATTERED MESH32 -%token C_AND C_OR C_XOR C_NOT C_NNAND C_ISNONZERO C_LSHIFT C_LSHIFT2 -%token C_LSHIFT8 C_LSHIFTIN1 C_RSHIFT C_AND1ADD1 C_2SUBAND1 C_1PLUS C_2MINUS -%token C_XORGREATER C_RSHIFTBY C_NOTEQUAL C_A +%token C_AND C_OR C_XOR C_NOT C_LOGICALNOT C_LSHIFTBY C_RSHIFTBY +%token C_NOTEQUAL C_A C_PLUS C_MINUS C_TIMES C_DIVIDEBY C_MODULUS +%token C_GREATER C_LESS C_ISEQUAL C_LOGICALAND C_LOGICALOR /* The reverse unary operators have to be in the same order as the forward unary operators. */ %token AND OR XOR FIN WHIRL WHIRL2 WHIRL3 WHIRL4 WHIRL5 @@ -132,7 +139,7 @@ static tuple *splat(void); %type subscr byexpr scalar scalar2s array initem outitem sublist %type unambig limunambig subscr1 sublist1 oparray osubscr osubscr1 %type notanlvalue nlunambig lunambig -%type perform mtperform +%type preproc perform mtperform %type please preftype %nonassoc OPENEARS OPENSPARK CLOSEEARS CLOSESPARK @@ -168,20 +175,72 @@ command : please mtperform | LABEL please OHOHSEVEN mtperform {checklabel($1); $4->label = $1; $4->exechance = $2 * $3;} | error - {lose(E017, yylineno, (char *)NULL);} + {lose(E017, iyylineno, (char *)NULL);} ; /* * AIS: added for the ONCE/AGAIN qualifiers. It copies a pointer to the tuple, * so command will set the values in the original tuple via the copy. */ -mtperform : perform +mtperform : preproc {$1->onceagainflag = onceagain_NORMAL; $$ = $1;} - | perform ONCE + | preproc ONCE {NEWFANGLED {$1->onceagainflag = onceagain_ONCE; $$ = $1;}} - | perform AGAIN + | preproc AGAIN {NEWFANGLED {$1->onceagainflag = onceagain_AGAIN; $$ = $1;}} +/* AIS: Either we do a simple 'perform', or preprocessing is needed. + I wrote all of this. The way the preprocessor works is to add a whole + load of new tuples. The tuples are written in the correct order, + except for where one of the commands referenced in the preproc is + needed; then one command from near the start is written, and swapped + into place using tupleswap. ppinit must also be called giving the + number of tuples at the end, to sort out each of the tuples. Note + that preprocs can't be nested (so no DO a WHILE b WHILE c), and that + lineuid can be used to create unreplicable numbers. preproc must also + be set by hand on all commands that you want to be immune to ABSTAIN, + etc., from outside the preproc, and $$ is set to the command that + gets the line number and can be NEXTED to and from. */ + +preproc : perform {$$ = $1;} /* the simple case */ + | perform WHILE perform +{ + if(!multithread) lose(E405, iyylineno, (char*)NULL); + NEWFANGLED{ + /* (x) DO a WHILE b + is equivalent to + #11 (l0) DO REINSTATE (l3) + #10 (l1) DO COME FROM (l2) AGAIN + #9 DO b + #8 DO COME FROM (l0) + #7 DO NOTHING + #6 DO NOTHING + #5 (l2) DO NOTHING + #4 DO GIVE UP + #3 DO COME FROM (l0) + #2 (x) DO a + #1 (l3) DON'T ABSTAIN FROM (l1) AGAIN */ + tuple* temptuple; + TARGET(temptuple, COME_FROM, lineuid+2); + temptuple->label=lineuid+1; temptuple->preproc=1; /* #10 */ + TARGET(temptuple, COME_FROM, lineuid+0); temptuple->preproc=1; /* #8 */ + ACTION(temptuple, PREPROC, 0); temptuple->preproc=1; /* #7 */ + ACTION(temptuple, PREPROC, 0); temptuple->preproc=1; /* #6 */ + ACTION(temptuple, PREPROC, 0); + temptuple->label=lineuid+2; temptuple->preproc=1; /* #5 */ + ACTION(temptuple, GIVE_UP, 0); temptuple->preproc=1; /* #4 */ + TARGET(temptuple, COME_FROM, lineuid+0); temptuple->preproc=1; /* #3 */ + TARGET(temptuple, REINSTATE, lineuid+3); temptuple->setweave=1; + temptuple->label=lineuid+0; temptuple->preproc=1; /* #11 */ + TARGET(temptuple, ABSTAIN, lineuid+1); temptuple->label=lineuid+3; /* #1 */ + temptuple->preproc=1; temptuple->setweave=-1; temptuple->exechance=-100; + politesse += 3; /* Keep the politeness checker happy */ + ppinit(11); tupleswap(10,9); tupleswap(11,2); lineuid+=4; /* #2, #9 */ + tuples[lineno-10].onceagainflag=onceagain_AGAIN; + tuples[lineno-1].onceagainflag=onceagain_AGAIN; + $$=&(tuples[lineno-2]); +}} + /* There are two (AIS: now four) forms of preamble returned by the lexer */ please : DO {GETLINENO; $$ = 1;} | DO NOT {GETLINENO; $$ = -1;} @@ -231,7 +290,6 @@ perform : lvalue GETS expr {ACTION($$, GETS, cons(GETS,$1,$3));} nextfromsused=1;} | NEXTFROMEXPR expr {NEWFANGLED {ACTION($$,NEXTFROMEXPR,$2); compucomesused=1; nextfromsused=1;}} - | BADCHAR {yyclearin; $$ = splat();} | error {yyclearin; $$ = splat();} ; @@ -311,7 +369,7 @@ constant: MESH NUMBER { /* enforce the 16-bit constant constraint */ if ((unsigned int)$2 > Max_small) - lose(E017, yylineno, (char *)NULL); + lose(E017, iyylineno, (char *)NULL); $$ = newnode(); $$->opcode = MESH; if(variableconstants) /* AIS */ @@ -429,7 +487,7 @@ lunambig: constant {$$ = $1;} if($1 == MESH) { /* enforce the 16-bit constant constraint */ if ((unsigned int)$3 > Max_small) - lose(E017, yylineno, (char *)NULL); + lose(E017, iyylineno, (char *)NULL); $$->rval->constant = intern(MESH, $3); } else { @@ -502,7 +560,7 @@ static tuple *splat(void) * which we can do with a tricky flag on the lexer (re_send_token). */ - /* fprintf(stderr,"attempting to splat at line %d....\n",yylineno); */ + /* fprintf(stderr,"attempting to splat at line %d....\n",iyylineno); */ for(i = 0,re_send_token = FALSE;;i++) { tok = lexer(); if (!tok) @@ -519,7 +577,7 @@ static tuple *splat(void) } /* fprintf(stderr,"found %d on line %d after %d other tokens.\n", - tok,yylineno,i); + tok,iyylineno,i); */ /* generate a placeholder tuple for the text line */ @@ -528,4 +586,4 @@ static tuple *splat(void) return(sp); } -/* ick.y ends here */ +/* parser.y ends here */ diff --git a/src/perpet.c b/src/perpet.c index c40910a..b1f5dc8 100644 --- a/src/perpet.c +++ b/src/perpet.c @@ -25,9 +25,12 @@ LICENSE TERMS ****************************************************************************/ /*LINTLIBRARY */ +#include "config.h" /* AIS: Generated by autoconf */ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include @@ -36,6 +39,7 @@ LICENSE TERMS #include "parser.h" #include "sizes.h" #include "lose.h" +#include "uncommon.h" #ifndef ICKINCLUDEDIR #define ICKINCLUDEDIR "/usr/local/include" @@ -50,7 +54,7 @@ LICENSE TERMS #define CC "gcc" #endif -#define ARGSTRING "bcdfghlmptuvyCFHOPUX@" +#define ARGSTRING "bcdfghlmoptuvyCFHOPUX@" #ifdef USE_YYRESTART /* function supplied by lex */ @@ -78,8 +82,8 @@ int flowoptimize; /* AIS: Do flow optimizations (in INTERCAL!). */ int coopt; /* AIS: The constant-output optimization. This should mean that INTERCAL will beat any other language at many benchmark programs (!) */ -int printfopens; /* AIS: Print messages whenever attempting to open a - file */ +extern int printfopens; /* AIS: Print messages whenever attempting to open a + file: from uncommon.c */ extern int checkforbugs;/* AIS: Try to find possible bugs in the source code */ int pickcompile; /* AIS: Compile for PIC? */ int clclex; /* AIS: 1 means use CLC-INTERCAL meanings for @, ? */ @@ -137,6 +141,29 @@ tuple *optuple = NULL; /* AIS: Tuple being optimized */ extern assoc varstores[]; /* AIS: Need to know this for PIC compilation */ +#ifndef HAVE_UNISTD_H +/* AIS: We don't have unistd.h, so we can't use getopt. Write our own version + that's less general but good enough. */ +int optind=1; +int optopt; +int getopt(int argc, char * const *argv, const char *options) +{ + if(optind>argc) return EOF; /* Out of command line */ + if(!argv[optind]) return EOF; /* Out of command line */ + while(!strcmp(argv[optind],"-")) + { + optind++; /* Go to next argument */ + if(!argv[optind]) return EOF; + } + if(*(argv[optind])!='-') return EOF; /* this arg is not an option */ + optopt=argv[optind][1]; + memmove(argv[optind]+1,argv[optind]+2,strlen(argv[optind]+1)); + if(optopt=='-') {optind++; return EOF;} /* -- means end of options */ + if(strchr(options, optopt)) return optopt; /* valid option */ + return '?'; /* invalid option */ +} +#endif + static int myfgetc(FILE* in) { char c; @@ -145,26 +172,17 @@ static int myfgetc(FILE* in) return (int)c; } -static FILE* debfopen(char* fname, char* mode) -{ - FILE* t; - if(printfopens) fprintf(stderr,"Trying to open '%s'...\n",fname); - t=fopen(fname,mode); - if(printfopens&&t) fprintf(stderr,"Success!\n"); - if(printfopens&&!t) fprintf(stderr,"Failed!\n"); - return t; -} - -static void abend(int signim) +static RETSIGTYPE abend(int signim) { - lose(E778, yylineno, (char *)NULL); + lose(E778, iyylineno, (char *)NULL); (void) signim; } static void print_usage(char *prog, char *options) { - fprintf(stderr,"Usage: %s [-%s] [ ... ]\n",prog,options); + fprintf(stderr,"Usage: %s [-%s] \n",prog,options); fprintf(stderr,"\t-b\t:reduce the probability of E774 to zero\n"); fprintf(stderr,"\t-c\t:compile INTERCAL to C, but don't compile C\n"); + fprintf(stderr,"\t-o\t:output to stdout, not to file (implies -c)\n"); fprintf(stderr,"\t-d\t:print yacc debugging information (implies -c)\n"); fprintf(stderr,"\t-t\t:traditional mode, accept only INTERCAL-72\n"); fprintf(stderr,"\t-C\t:clockface output (e.g. use IIII instead of IV)\n"); @@ -173,29 +191,42 @@ static void print_usage(char *prog, char *options) function of -O has changed). I wrote the next group of options. */ fprintf(stderr,"\t-f\t:optimize control flow in generated code " "(prevents -yp)\n"); +#ifdef HAVE_PROG_SH +# ifdef HAVE_SYS_INTERPRETER fprintf(stderr,"\t-F\t:optimize everything in generated code for\n" "\t\tspeed, regardless of how slow the compiler becomes or how\n" - "\t\tlarge the object file becomes. Implies -fO,\n" - "\t\tprevents -cdghpyH\n"); + "\t\tlarge the object file becomes. Implies -fO, " + "prevents -cdghpyH\n"); +# else + fprintf(stderr,"\t-F\t:unsupported on computers without #! support\n"); +# endif +#else + fprintf(stderr,"\t-F\t:unsupported on computers without sh or bash\n"); +#endif fprintf(stderr,"\t-h\t:print optimizer debugging information " "(implies -cO)\n"); fprintf(stderr,"\t-H\t:print verbose optimizer debugging information " "(implies -cO)\n"); fprintf(stderr,"\t-hH\t:print optimizer debugging information in a\n" "\t\tdifferent form (implies -cO)\n"); +#ifdef HAVE_UNISTD_H fprintf(stderr,"\t-y\t:run the yuk debugger on the code (prevents -fm)\n"); fprintf(stderr,"\t-p\t:run the yuk profiler on the code (prevents -fm)\n"); +#else + fprintf(stderr,"\t-y\t:unsupported on computers without unistd.h\n"); + fprintf(stderr,"\t-p\t:unsupported on computers without unistd.h\n"); +#endif fprintf(stderr,"\t-m\t:allow multithreading and backtracking " "(prevents -yp)\n"); fprintf(stderr,"\t-v\t:allow anything on the left of an assignment. This " - "is required\n\t\tif you want operand overloading. " - "(prevents -fFOP)\n"); + "is required\n\t\tif you want operand overloading to change " + "meshes.\n\t\t(prevents -fFOP)\n"); fprintf(stderr,"\t-P\t:compile PIC-INTERCAL rather than INTERCAL\n"); - fprintf(stderr,"\t-o\t:output to stdout rather than .c (implies -c)"); - fprintf(stderr,"\t-X\t:interpret ? and @ with CLC-INTERCAL meanings\n"); + fprintf(stderr,"\t-o\t:output to stdout rather than .c (implies -c)\n"); + fprintf(stderr,"\t-X\t:aim for CLC-INTERCAL compatibility\n"); fprintf(stderr,"\t-u\t:print a message whenever the compiler tries to " "open a file\n"); - fprintf(stderr,"\t-U\t:dump core on E778 rather than printing an error\n"); + fprintf(stderr,"\t-U\t:dump core on E778 after printing an error\n"); fprintf(stderr,"\t-g\t:compile to both debuggable executable and C\n"); fprintf(stderr,"\t-l\t:attempt to report likely bugs " "and nonportabilities (implies -O)\n"); @@ -212,122 +243,10 @@ int isenv(char* e) return x&&*x; } -/* AIS: This function looks for the skeleton and syslib, searching first the - path they should be in, then the current directory, then argv[0]'s - directory (if one was given). This function avoids possible buffer - overflows, instead truncating filenames (and if that manages to find them, - I'll be incredibly surprised). It also tries argv[0]/../lib and - argv[0]/../include (where they are when running without installing). */ -static FILE* findandfopen(char* file, char* guessdir, char* mode, char* argv0) -{ - char buf2[BUFSIZ], *fileiter; - int i = 0, j; - FILE* ret; - while(*guessdir&&i 2) { if (politesse == 0 || (lineno - 1) / politesse >= 5) - lose(E079, yylineno, (char *)NULL); + lose(E079, iyylineno, (char *)NULL); else if (lineno / politesse < 3) - lose(E099, yylineno, (char *)NULL); + lose(E099, iyylineno, (char *)NULL); } /* @@ -691,6 +616,9 @@ int main(int argc, char *argv[]) /* AIS: Before changing argv[0], locate coopt.sh. */ cooptsh = findandtestopen("coopt.sh", bindir, "rb", argv[0]); + /* AIS: and calculate yukcmdstr. */ + sprintf(yukcmdstr,"%s" EXEEXT " %s %s", + argv[optind],libdir,argv[0]); /* AIS: Remove the filename from argv[0], leaving only a directory. If this would leave it blank, change argv[0] to '.'. @@ -702,9 +630,9 @@ int main(int argc, char *argv[]) (void) sprintf(buf2, "%s %s%s-I%s -I%s -I%s/../include -L%s -L%s -L%s/../lib -O%c -o %s" #ifdef __DJGPP__ - ".exe -lick%s%s","", + EXEEXT " -lick%s%s","", #else - " -lick%s%s",compiler, + EXEEXT " -lick%s%s",compiler, #endif buf, yukdebug||yukprofile?" -lyuk ":" ", includedir, argv[0], argv[0], libdir, argv[0], argv[0], @@ -809,7 +737,13 @@ int main(int argc, char *argv[]) (void) fprintf(ofp, "int linetype[] = {\n"); for (tp = tuples; tp->type; tp++) - if (tp->type >= GETS && tp->type <= FROM) /* AIS: FROM added */ + if(tp->ppnewtype) /* AIS */ + (void) fprintf(ofp," %s,\n", + enablers[tp->ppnewtype - GETS]); + else if(tp->preproc) /* AIS */ + (void) fprintf(ofp," PREPROC,\n"); + else if (tp->type >= GETS && tp->type <= FROM) + /* AIS: FROM added */ (void) fprintf(ofp, " %s,\n", enablers[tp->type - GETS]); @@ -893,14 +827,15 @@ int main(int argc, char *argv[]) { int temp=nonespots; (void) fprintf(ofp, - "overop oo_onespots[%d];\n", - nonespots); + "overop* oo_onespots;\n"); while(temp--) (void) fprintf(ofp, "type32 og1spot%d(type32 t)\n{\n (void)t;\n return onespots[%d];\n}\n" "void os1spot%d(type32 val, void(*f)())\n{\n (void)f;\n assign((void*)" "(onespots+%d), ONESPOT, oneforget[%d], val);\n}\n",temp,temp,temp,temp,temp); } + else if(multithread) + (void) fprintf(ofp, "overop* oo_onespots=0;\n"); } if (ntwospots) { @@ -927,14 +862,15 @@ int main(int argc, char *argv[]) { int temp=ntwospots; (void) fprintf(ofp, - "overop oo_twospots[%d];\n", - ntwospots); + "overop* oo_twospots;\n"); while(temp--) (void) fprintf(ofp, "type32 og2spot%d(type32 t)\n{\n (void)t;\n return twospots[%d];\n}\n" "void os2spot%d(type32 val, void(*f)())\n{\n (void)f;\n assign((void*)" "(twospots+%d), TWOSPOT, twoforget[%d], val);\n}\n",temp,temp,temp,temp,temp); } + else if(multithread) + (void) fprintf(ofp, "overop* oo_twospots=0;\n"); } if (ntails) { @@ -986,10 +922,10 @@ int main(int argc, char *argv[]) /* Compiling for PIC */ /* Arrays not supported on PICs */ if(ntails || nhybrids) - lose(E256, yylineno, (char*) NULL); + lose(E256, iyylineno, (char*) NULL); /* and neither are variable constants */ if(variableconstants) - lose(E256, yylineno, (char*) NULL); + lose(E256, iyylineno, (char*) NULL); for (op = oblist; op < obdex; op++) { (void) fprintf(ofp, " /* %s %d -> %d */\n", @@ -1017,9 +953,7 @@ int main(int argc, char *argv[]) if(opoverused) /* AIS */ { int temp=nonespots; - (void) fprintf(ofp, - "overop oo_onespots[%d];\n", - nonespots); + (void) fprintf(ofp,"overop* oo_onespots;\n"); while(temp--) (void) fprintf(ofp, "type32 og1spot%d(type32 t)\n{\n (void)t;\n return onespots[%d];\n}\n" @@ -1037,9 +971,7 @@ int main(int argc, char *argv[]) if(opoverused) /* AIS */ { int temp=ntwospots; - (void) fprintf(ofp, - "overop oo_twospots[%d];\n", - ntwospots); + (void) fprintf(ofp,"overop* oo_twospots;\n"); while(temp--) (void) fprintf(ofp, "type32 og2spot%d(type32 t)\n{\n (void)t;\n return twospots[%d];\n}\n" @@ -1076,7 +1008,7 @@ int main(int argc, char *argv[]) this line so that COME FROMs can be handled consistently.*/ if(compucomesused || multithread) { - (void) fprintf(ofp, "CCF%d: longjmp(cjb,1);\n", + (void) fprintf(ofp, "CCFL: ; CCF%d: longjmp(cjb,1);\n", compucomecount); } #if 0 @@ -1101,7 +1033,7 @@ int main(int argc, char *argv[]) break; case 'J': /* # of source file lines */ - (void) fprintf(ofp, "%d", yylineno); + (void) fprintf(ofp, "%d", iyylineno); break; case 'K': /* AIS: yuk information (or not) */ @@ -1188,6 +1120,8 @@ int main(int argc, char *argv[]) if(opoverused) { int temp=nonespots; + (void) fprintf(ofp, +" oo_onespots=malloc(%d*sizeof*oo_onespots);\n",temp); while(temp--) (void) fprintf(ofp, " oo_onespots[%d].get=og1spot%d;\n oo_onespots[%d].set=os1spot%d;\n", @@ -1210,6 +1144,8 @@ int main(int argc, char *argv[]) if(opoverused) { int temp=ntwospots; + (void) fprintf(ofp, +" oo_twospots=malloc(%d*sizeof*oo_twospots);\n",temp); while(temp--) (void) fprintf(ofp, " oo_twospots[%d].get=og2spot%d;\n oo_twospots[%d].set=os2spot%d;\n", @@ -1271,26 +1207,13 @@ int main(int argc, char *argv[]) /* Note that the output must be deleted for copyright reasons (so as not to GPL a non-GPL file automatically) */ (void) system(buf2); +#ifdef HAVE_UNISTD_H dup2(oldstdin,0); /* restore stdin */ - (void) system(argv[optind]); +#endif + (void) system(yukcmdstr); (void) unlink(buf); (void) unlink(argv[optind]); } - if(coopt) /* AIS */ - { - /* The constant-output optimizer is a form of post-processor. - IMPORTANT NOTE: This MUST NOT be run if the input program - takes any input or is affected in any way by the state of - the system, as the degenerated program may be wrong. At the - moment, the only INTERCAL command that takes input is - WRITE IN. Double-oh-sevens screw this up, too. */ - if(cooptsh) - { - sprintf(buf2,"sh %s %s", cooptsh, argv[optind]); - (void) system(buf2); /* replaces the output executable if - neccesary */ - } - } #else /* we are using DJGPP */ /* OK, now sic the C compiler on the results */ if (!compile_only) @@ -1300,27 +1223,30 @@ int main(int argc, char *argv[]) command-line cap. It creates a temporary file with the arguments needed to give gcc. */ FILE* rsp; - char* tempfn="ickgcc.rsp"; /*use current dir as temp if needed*/ + /* Use current dir as temp if needed */ + char* tempfn="gcc @ickgcc.rsp"; /* Three tries are used to find a temp directory. ICKTEMP is the preferred environment variable to check; if, as expected, this isn't set, try TMPDIR (which DJGPP sets to its own temp directory, at least when running under bash), TEMP and TMP (in that order). DJGPP offers /dev/env as a method of accessing environment variables in filenames.*/ - if(isenv("TMP")) tempfn="/dev/env/TMP/ickgcc.rsp"; - if(isenv("TEMP")) tempfn="/dev/env/TEMP/ickgcc.rsp"; - if(isenv("TMPDIR")) tempfn="/dev/env/TMPDIR/ickgcc.rsp"; - if(isenv("ICKTEMP")) tempfn="/dev/env/ICKTEMP/ickgcc.rsp"; - rsp=debfopen("ickgcc.rsp","w"); + if(isenv("TMP")) tempfn="gcc @/dev/env/TMP/ickgcc.rsp"; + if(isenv("TEMP")) tempfn="gcc @/dev/env/TEMP/ickgcc.rsp"; + if(isenv("TMPDIR")) tempfn="gcc @/dev/env/TMPDIR/ickgcc.rsp"; + if(isenv("ICKTEMP")) tempfn="gcc @/dev/env/ICKTEMP/ickgcc.rsp"; + rsp=debfopen(tempfn+5,"w"); fprintf(rsp,"%s\n",buf2); fclose(rsp); - system("gcc @ickgcc.rsp"); - remove("ickgcc.rsp"); + system(tempfn); + remove(tempfn+5); if(yukdebug || yukprofile) { +#ifdef HAVE_UNISTD_H dup2(oldstdin,0); /* restore stdin */ - sprintf(buf2,"%s.exe",argv[optind]); - system(buf2); +#endif + sprintf(buf2,"%s" EXEEXT,argv[optind]); + system(yukcmdstr); remove(buf); remove(buf2); } @@ -1330,10 +1256,31 @@ int main(int argc, char *argv[]) } } #endif +#ifdef HAVE_PROG_SH +# ifdef HAVE_SYS_INTERPRETER + if(coopt) /* AIS */ + { + /* The constant-output optimizer is a form of post-processor. + IMPORTANT NOTE: This MUST NOT be run if the input program + takes any input or is affected in any way by the state of + the system, as the degenerated program may be wrong. At the + moment, the only INTERCAL command that takes input is + WRITE IN. Double-oh-sevens screw this up, too. */ + if(cooptsh) + { + sprintf(buf2,"sh %s %s", cooptsh, argv[optind]); + (void) system(buf2); /* replaces the output executable if + neccesary */ + } + } +# endif +#endif } } (void) fclose(ifp); +#ifdef HAVE_UNISTD_H (void) close(oldstdin); /* AIS */ +#endif return 0; } diff --git a/src/uncommon.c b/src/uncommon.c new file mode 100644 index 0000000..ce6fa3a --- /dev/null +++ b/src/uncommon.c @@ -0,0 +1,149 @@ +/* + * uncommon.c -- functions needed by both the compiler and debugger + * +LICENSE TERMS + Copyright (C) 2007 Alex Smith + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include "uncommon.h" + +/* Options that might affect this */ +int printfopens=0; + +FILE* debfopen(char* fname, char* mode) +{ + FILE* t; + if(printfopens) fprintf(stderr,"Trying to open '%s'...\n",fname); + t=fopen(fname,mode); + if(printfopens&&t) fprintf(stderr,"Success!\n"); + if(printfopens&&!t) fprintf(stderr,"Failed!\n"); + return t; +} + +/* This function looks for the skeleton and syslib, searching first the + path they should be in, then the current directory, then argv[0]'s + directory (if one was given). This function avoids possible buffer + overflows, instead truncating filenames (and if that manages to find them, + I'll be incredibly surprised). It also tries argv[0]/../lib and + argv[0]/../include (where they are when running without installing). */ +FILE* findandfopen(char* file, char* guessdir, char* mode, char* argv0) +{ + char buf2[BUFSIZ], *fileiter; + int i = 0, j; + FILE* ret; + while(*guessdir&&i #include #include @@ -104,6 +105,15 @@ extern int lineno; /* Keep track of error-message lines */ extern int printflow; /* from arrgghh.c; a debug option */ +int weaving=0; /* Weave newly created threads? */ + +/* Printflow debugging output */ +static void fluputs(char* s) +{ + printf("%s",s); + fflush(stdout); +} + /********************************************************************** * * This functions deal with choicepoints, which are implemented as @@ -117,24 +127,30 @@ extern int printflow; /* from arrgghh.c; a debug option */ void choicepoint(void) { ickthread* oldprev, *oldtc; + int oldweave; if(gonebackto) { /* Create a stale choicepoint */ - if(printflow) printf("(back)"); + if(printflow) fluputs("(back)"); oldtc = topchoice; topchoice = (ickthread*) malloc(sizeof(ickthread)); if(!topchoice) lose(E991, lineno, (char*) NULL); - topchoice->next = oldtc; + topchoice->choicepoint = oldtc; topchoice->stale = 1; topchoice->refcount = 1; /* At the moment, this is the only thread looking at this choicepoint */ + topchoice->dsi=topchoice; + topchoice->usesthis=0; return; } else { /* Create a new choicepoint */ - if(printflow) printf("(maybe)"); + if(printflow) fluputs("(maybe)"); oldprev = ickmt_prev; choicing = 1; + oldweave = weaving; + weaving = 0; multicome1(lineno,btjb); /* Duplicate data */ + weaving = oldweave; choicing = 0; oldprev->next = ickmt_cur; ickmt_prev->choicepoint = topchoice; @@ -155,8 +171,6 @@ void choiceahead(void) ickthread* tempthread; jmp_buf fakepc; - if(printflow) printf("(ahead)"); - if(!topchoice) lose(E404, lineno, (char*) NULL); /* That's what E404's for */ /* GO AHEAD with multithreading requires care. The choicepoint should only be removed from this thread. topchoice = topchoice->next almost works, but @@ -165,6 +179,7 @@ void choiceahead(void) /* If other threads are using the choicepoint, don't free it. */ if(topchoice->refcount > 1) { + if(printflow) fluputs("(refahead)"); topchoice->refcount--; topchoice = topchoice->choicepoint; return; @@ -175,12 +190,15 @@ void choiceahead(void) /* Freeing a stale choicepoint (which contains no data) is easy. */ if(topchoice->stale) { + if(printflow) fluputs("(destale)"); tempthread = topchoice; topchoice = topchoice->choicepoint; free(tempthread); return; } - + + if(printflow) fluputs("(ahead)"); + /* This code works by converting topchoice back to a thread and placing it just before the current thread, and then killing it. First, the data from this thread, apart from the choicepoint stack, must be saved. */ @@ -220,7 +238,12 @@ void choiceahead(void) void choiceback(void) { if(!topchoice) lose(E404, lineno, (char *) NULL); - if(topchoice->stale) {if(printflow) printf("(back=)"); choiceahead(); return;} + if(topchoice->stale) + { + if(printflow) fluputs("(back=)"); + choiceahead(); + return; + } /* That's two simple cases out of the way (at least once choiceahead's been implemented). What we need to do to backtrack is to change topchoice to a thread after the current thread (rather than before @@ -234,6 +257,7 @@ void choiceback(void) /* The Threaded INTERCAL standard states that if other threads are using the choicepoint, a GO BACK should cause the thread it's in to be killed. (Of course, if it's stale, it should just have been removed.)*/ + if(printflow) fluputs("(desplit)"); killthread(); return; } @@ -271,8 +295,10 @@ int multicome1(int errlineno, jmp_buf pc) ickmt_prev->next = newthread; newthread->next = ickmt_cur; ickmt_cur = newthread; + newthread->dsi=newthread; + newthread->usesthis=0; - if(printflow && !choicing) printf("(fork)"); + if(printflow && !choicing) fluputs("(fork)"); if(setjmp(fakepc) == 0) { @@ -289,96 +315,173 @@ int multicome1(int errlineno, jmp_buf pc) use storing the values in the 'new' thread, so the 'old' thread needs new copies that it can modify independently. */ - /* duplicate variables, forget indicators */ - i = onespotcount; - tvp = onespots; - onespots = malloc(i * sizeof *onespots); - if(!onespots) lose(E991, errlineno, (char *) NULL); - memcpy(onespots, tvp, i * sizeof *onespots); - i = twospotcount; - tvp = twospots; - twospots = malloc(i * sizeof *twospots); - if(!twospots) lose(E991, errlineno, (char *) NULL); - memcpy(twospots, tvp, i * sizeof *twospots); - i = tailcount; - tvp = tails; - tails = malloc(i * sizeof *tails); - if(!tails) lose(E991, errlineno, (char *) NULL); - memcpy(tails, tvp, i * sizeof *tails); - i = hybridcount; - tvp = hybrids; - hybrids = malloc(i * sizeof *hybrids); - if(!hybrids) lose(E991, errlineno, (char *) NULL); - memcpy(hybrids, tvp, i * sizeof *hybrids); - i = onespotcount; - tvp = oneforget; - oneforget = malloc(i * sizeof *oneforget); - if(!oneforget) lose(E991, errlineno, (char *) NULL); - memcpy(oneforget, tvp, i * sizeof *oneforget); - i = twospotcount; - tvp = twoforget; - twoforget = malloc(i * sizeof *twoforget); - if(!twoforget) lose(E991, errlineno, (char *) NULL); - memcpy(twoforget, tvp, i * sizeof *twoforget); - i = tailcount; - tvp = tailforget; - tailforget = malloc(i * sizeof *tailforget); - if(!tailforget) lose(E991, errlineno, (char *) NULL); - memcpy(tailforget, tvp, i * sizeof *tailforget); - i = hybridcount; - tvp = hyforget; - hyforget = malloc(i * sizeof *hyforget); - if(!hyforget) lose(E991, errlineno, (char *) NULL); - memcpy(hyforget, tvp, i * sizeof *hyforget); + if(!weaving) + { + /* duplicate variables, forget indicators */ + i = onespotcount; + tvp = onespots; + onespots = malloc(i * sizeof *onespots); + if(!onespots) lose(E991, errlineno, (char *) NULL); + memcpy(onespots, tvp, i * sizeof *onespots); + if(oo_onespots) + { + tvp = oo_onespots; + oo_onespots = malloc(i * sizeof *oo_onespots); + if(!oo_onespots) lose(E991, errlineno, (char *) NULL); + memcpy(oo_onespots, tvp, i * sizeof *oo_onespots); + } + i = twospotcount; + tvp = twospots; + twospots = malloc(i * sizeof *twospots); + if(!twospots) lose(E991, errlineno, (char *) NULL); + memcpy(twospots, tvp, i * sizeof *twospots); + if(oo_twospots) + { + tvp = oo_twospots; + oo_twospots = malloc(i * sizeof *oo_twospots); + if(!oo_twospots) lose(E991, errlineno, (char *) NULL); + memcpy(oo_twospots, tvp, i * sizeof *oo_twospots); + } + i = tailcount; + tvp = tails; + tails = malloc(i * sizeof *tails); + if(!tails) lose(E991, errlineno, (char *) NULL); + memcpy(tails, tvp, i * sizeof *tails); + i = hybridcount; + tvp = hybrids; + hybrids = malloc(i * sizeof *hybrids); + if(!hybrids) lose(E991, errlineno, (char *) NULL); + memcpy(hybrids, tvp, i * sizeof *hybrids); + i = onespotcount; + tvp = oneforget; + oneforget = malloc(i * sizeof *oneforget); + if(!oneforget) lose(E991, errlineno, (char *) NULL); + memcpy(oneforget, tvp, i * sizeof *oneforget); + i = twospotcount; + tvp = twoforget; + twoforget = malloc(i * sizeof *twoforget); + if(!twoforget) lose(E991, errlineno, (char *) NULL); + memcpy(twoforget, tvp, i * sizeof *twoforget); + i = tailcount; + tvp = tailforget; + tailforget = malloc(i * sizeof *tailforget); + if(!tailforget) lose(E991, errlineno, (char *) NULL); + memcpy(tailforget, tvp, i * sizeof *tailforget); + i = hybridcount; + tvp = hyforget; + hyforget = malloc(i * sizeof *hyforget); + if(!hyforget) lose(E991, errlineno, (char *) NULL); + memcpy(hyforget, tvp, i * sizeof *hyforget); + + /* duplicate data stored in arrays */ + j = tailcount; + while(j--) + { + a = tails+j; /* &(tails[j]) */ + if(!a->rank||!a->dims) continue; /* don't duplicate a deallocated array */ + tvp = a->dims; + /* Much of this code is paraphrased from the stashbox-copying code below, + which was in turn paraphrased from a section in cesspool.c I didn't + write. So any errors in this code are probably mine, but the algorithm + isn't. */ + a->dims = malloc(a->rank * sizeof(unsigned int)); + memcpy(a->dims, tvp, a->rank * sizeof(unsigned int)); + prod = !!a->rank; + i = a->rank; + while(i--) prod *= a->dims[i]; + tvp = a->data.tail; + a->data.tail = malloc(prod * sizeof(type16)); + if(!a->data.tail) lose(E991, errlineno, (char *) NULL); + memcpy(a->data.tail, tvp, prod * sizeof(type16)); + } + j = hybridcount; + while(j--) + { + a = hybrids+j; /* &(hybrids[j]) */ + if(!a->rank||!a->dims) continue; /* don't duplicate a deallocated array */ + tvp = a->dims; + /* Much of this code is paraphrased from the stashbox-copying code below, + which was in turn paraphrased from a section in cesspool.c I didn't + write. So any errors in this code are probably mine, but the algorithm + isn't. */ + a->dims = malloc(a->rank * sizeof(unsigned int)); + memcpy(a->dims, tvp, a->rank * sizeof(unsigned int)); + prod = !!a->rank; + i = a->rank; + while(i--) prod *= a->dims[i]; + tvp = a->data.hybrid; + a->data.hybrid = malloc(prod * sizeof(type32)); + if(!a->data.hybrid) lose(E991, errlineno, (char *) NULL); + memcpy(a->data.hybrid, tvp, prod * sizeof(type32)); + } + /* duplicate stashbox */ + isb2 = first; + isbprev = (stashbox*)NULL; + while(isb2) + { + isb = (stashbox*)malloc(sizeof(stashbox)); + if(!isb) lose(E991, errlineno, (char *) NULL); + memcpy(isb,isb2,sizeof(stashbox)); + if(isbprev) isbprev->next = isb; + isbprev = isb; + if(isb2==first) first = isb; /* change first only the first time round */ + if(isb->type == ONESPOT || isb->type == TWOSPOT) + { /* all copying already done */ + isb2 = isb->next; + continue; + } + /* Copy the stashed array. Much of this code is paraphrased from some + code in cesspool.c. In fact, it's the same, with a few idioms added + and variable names changed. So, although it's in this file, I can't + take the credit for it. */ + isb->save.a = (array*)malloc(sizeof(array)); + if(!isb->save.a) lose(E991, errlineno, (char *) NULL); + isb->save.a->rank = isb2->save.a->rank; + isb->save.a->dims = (unsigned int*)malloc(isb2->save.a->rank * + sizeof(unsigned int)); + if(!isb->save.a->dims) lose(E991, errlineno, (char *) NULL); + memcpy(isb->save.a->dims, isb2->save.a->dims, + isb2->save.a->rank * sizeof(unsigned int)); + prod = !!isb2->save.a->rank; /* I use this idiom often enough in the + code produced by my optimizer that I + may as well use it here. */ + i = isb2->save.a->rank; + while(i--) prod *= isb2->save.a->dims[i]; + if(isb2->type == TAIL) + { + isb->save.a->data.tail = (type16*)malloc(prod * sizeof(type16)); + if(!isb->save.a->data.tail) lose(E991, errlineno, (char *) NULL); + memcpy(isb->save.a->data.tail, isb2->save.a->data.tail, + prod * sizeof(type16)); + } + else + { + isb->save.a->data.hybrid = (type32*)malloc(prod * sizeof(type32)); + if(!isb->save.a->data.hybrid) lose(E991, errlineno, (char *) NULL); + memcpy(isb->save.a->data.hybrid, isb2->save.a->data.hybrid, + prod * sizeof(type32)); + } + isb2 = isb->next; + } + } + else /* we are weaving, reference the old current thread */ + { + ickthread* tempthread; + if(printflow) fluputs("(weave)"); + /* Sanity check to make sure that the threads are arranged correctly */ + if(newthread->next!=ickmt_cur) lose(E778, errlineno, (char *) NULL); + tempthread=newthread->next; /* the old current thread */ + while(tempthread->usesthis) tempthread=tempthread->usesthis; + newthread->dsi=tempthread->dsi; + tempthread->usesthis=newthread; + } /* duplicate NEXT stack */ tvp = next; next = malloc(MAXNEXT * sizeof *next); if(!next) lose(E991, errlineno, (char *) NULL); memcpy(next, tvp, MAXNEXT * sizeof *next); - /* duplicate data stored in arrays */ - j = tailcount; - while(j--) - { - a = tails+j; /* &(tails[j]) */ - if(!a->rank||!a->dims) continue; /* don't duplicate a deallocated array */ - tvp = a->dims; - /* Much of this code is paraphrased from the stashbox-copying code below, - which was in turn paraphrased from a section in cesspool.c I didn't - write. So any errors in this code are probably mine, but the algorithm - isn't. */ - a->dims = malloc(a->rank * sizeof(unsigned int)); - memcpy(a->dims, tvp, a->rank * sizeof(unsigned int)); - prod = !!a->rank; - i = a->rank; - while(i--) prod *= a->dims[i]; - tvp = a->data.tail; - a->data.tail = malloc(prod * sizeof(type16)); - if(!a->data.tail) lose(E991, errlineno, (char *) NULL); - memcpy(a->data.tail, tvp, prod * sizeof(type16)); - } - j = hybridcount; - while(j--) - { - a = hybrids+j; /* &(hybrids[j]) */ - if(!a->rank||!a->dims) continue; /* don't duplicate a deallocated array */ - tvp = a->dims; - /* Much of this code is paraphrased from the stashbox-copying code below, - which was in turn paraphrased from a section in cesspool.c I didn't - write. So any errors in this code are probably mine, but the algorithm - isn't. */ - a->dims = malloc(a->rank * sizeof(unsigned int)); - memcpy(a->dims, tvp, a->rank * sizeof(unsigned int)); - prod = !!a->rank; - i = a->rank; - while(i--) prod *= a->dims[i]; - tvp = a->data.hybrid; - a->data.hybrid = malloc(prod * sizeof(type32)); - if(!a->data.hybrid) lose(E991, errlineno, (char *) NULL); - memcpy(a->data.hybrid, tvp, prod * sizeof(type32)); - } - /* allow for multithreading with choicepoints on the stack */ if(!choicing && topchoice) { @@ -393,55 +496,6 @@ int multicome1(int errlineno, jmp_buf pc) past a fork correctly. */ } - /* duplicate stashbox */ - isb2 = first; - isbprev = (stashbox*)NULL; - while(isb2) - { - isb = (stashbox*)malloc(sizeof(stashbox)); - if(!isb) lose(E991, errlineno, (char *) NULL); - memcpy(isb,isb2,sizeof(stashbox)); - if(isbprev) isbprev->next = isb; - isbprev = isb; - if(isb2==first) first = isb; /* change first only the first time round */ - if(isb->type == ONESPOT || isb->type == TWOSPOT) - { /* all copying already done */ - isb2 = isb->next; - continue; - } - /* Copy the stashed array. Much of this code is paraphrased from some - code in cesspool.c. In fact, it's the same, with a few idioms added - and variable names changed. So, although it's in this file, I can't - take the credit for it. */ - isb->save.a = (array*)malloc(sizeof(array)); - if(!isb->save.a) lose(E991, errlineno, (char *) NULL); - isb->save.a->rank = isb2->save.a->rank; - isb->save.a->dims = (unsigned int*)malloc(isb2->save.a->rank * - sizeof(unsigned int)); - if(!isb->save.a->dims) lose(E991, errlineno, (char *) NULL); - memcpy(isb->save.a->dims, isb2->save.a->dims, - isb2->save.a->rank * sizeof(unsigned int)); - prod = !!isb2->save.a->rank; /* I use this idiom often enough in the - code produced by my optimizer that I - may as well use it here. */ - i = isb2->save.a->rank; - while(i--) prod *= isb2->save.a->dims[i]; - if(isb2->type == TAIL) - { - isb->save.a->data.tail = (type16*)malloc(prod * sizeof(type16)); - if(!isb->save.a->data.tail) lose(E991, errlineno, (char *) NULL); - memcpy(isb->save.a->data.tail, isb2->save.a->data.tail, - prod * sizeof(type16)); - } - else - { - isb->save.a->data.hybrid = (type32*)malloc(prod * sizeof(type32)); - if(!isb->save.a->data.hybrid) lose(E991, errlineno, (char *) NULL); - memcpy(isb->save.a->data.hybrid, isb2->save.a->data.hybrid, - prod * sizeof(type32)); - } - isb2 = isb->next; - } return 1; /* Tell the degenerated program to look for yet another COME FROM */ } @@ -467,6 +521,8 @@ void ickmtinit(void) ickmt_prev = ickmt_cur; ickmt_cur->next = ickmt_cur; topchoice = (ickthread*) NULL; /* No choicepoints */ + ickmt_cur->dsi=ickmt_cur; + ickmt_cur->usesthis=0; } /* Destroys the current thread, and switches to the next thread. @@ -477,44 +533,100 @@ void killthread(void) stashbox* isb, *isbi; int i; - if(printflow&&!choicing) printf("(kill)"); - - /* Deallocate the current thread's data */ - i=tailcount; - while(i--) - { /* free tail data */ - if(!tails[i].rank||!tails[i].dims) continue; /* already free */ - free(tails[i].dims); - free(tails[i].data.tail); - } - i=hybridcount; - while(i--) - { /* free hybrid data */ - if(!hybrids[i].rank||!hybrids[i].dims) continue; /* already free */ - free(hybrids[i].dims); - free(hybrids[i].data.hybrid); - } - free(onespots); free(twospots); free(tails); free(hybrids); - free(oneforget); free(twoforget); free(tailforget); free(hyforget); - free(next); /* Free NEXT stack */ + if(printflow&&!choicing) fluputs("(kill)"); + if(!choicing) while(topchoice) choiceahead(); /* The above line will mark each of the choicepoints as no longer being - used by this thread, and free them if neccesary. */ - isbi = first; - while(isbi) /* Free stash */ + used by this thread, and free them if neccesary. This has to be done + first while this thread's pointers are still valid due to the way that + choiceahead works. */ + + /* If this thread uses another, let the other know about the change */ + if(ickmt_cur->dsi!=ickmt_cur) { - isb=isbi->next; - if(isbi->type == TAIL || isbi->type == HYBRID) + ickthread* temp=ickmt_cur->dsi; + if(printflow) fluputs("(deweave)"); + while(!temp||temp->usesthis!=ickmt_cur) { - free(isbi->save.a->dims); - if(isbi->type == TAIL) - free(isbi->save.a->data.tail); - else - free(isbi->save.a->data.hybrid); + if(!temp) lose(E778, -1, (char *) NULL); + temp=temp->usesthis; + } + temp->usesthis=ickmt_cur->usesthis; + } + /* If this thread is holding data for others, move it somewhere safe */ + if(ickmt_cur->usesthis&&ickmt_cur->usesthis->dsi==ickmt_cur) + { + ickthread* newuses=ickmt_cur->usesthis; + ickthread* temp=ickmt_cur->usesthis; + if(printflow) fluputs("(shift)"); + while(temp) + { + temp->dsi=newuses; + temp=temp->usesthis; + } + ickmt_cur->dsi=newuses; /* so the data will be transferred later */ + } + + if(ickmt_cur->dsi==ickmt_cur) + { + /* We aren't storing data for another thread, and we have data of our own, + or dsi would point somewhere else (either naturally or because it was + changed higher up). */ + if(printflow) fluputs("(free)"); + /* Deallocate the current thread's data */ + i=tailcount; + while(i--) + { /* free tail data */ + if(!tails[i].rank||!tails[i].dims) continue; /* already free */ + free(tails[i].dims); + free(tails[i].data.tail); + } + i=hybridcount; + while(i--) + { /* free hybrid data */ + if(!hybrids[i].rank||!hybrids[i].dims) continue; /* already free */ + free(hybrids[i].dims); + free(hybrids[i].data.hybrid); + } + free(onespots); free(twospots); free(tails); free(hybrids); + free(oneforget); free(twoforget); free(tailforget); free(hyforget); + if(oo_onespots) free(oo_onespots); if(oo_twospots) free(oo_twospots); + + isbi = first; + while(isbi) /* Free stash */ + { + isb=isbi->next; + if(isbi->type == TAIL || isbi->type == HYBRID) + { + free(isbi->save.a->dims); + if(isbi->type == TAIL) + free(isbi->save.a->data.tail); + else + free(isbi->save.a->data.hybrid); + } + free(isbi); + isbi=isb; } - free(isbi); - isbi=isb; } + else + { + /* We still need to save our variables for the benefit of woven threads. */ + /* save variables */ + ickmt_cur->dsi->varforget[0] = onespots; + ickmt_cur->dsi->varforget[1] = twospots; + ickmt_cur->dsi->varforget[2] = tails; + ickmt_cur->dsi->varforget[3] = hybrids; + ickmt_cur->dsi->varforget[4] = oneforget; + ickmt_cur->dsi->varforget[5] = twoforget; + ickmt_cur->dsi->varforget[6] = tailforget; + ickmt_cur->dsi->varforget[7] = hyforget; + ickmt_cur->dsi->varforget[8] = oo_onespots; + ickmt_cur->dsi->varforget[9] = oo_twospots; + + /* save stashbox */ + ickmt_cur->dsi->sb = first; + } + free(next); /* Free NEXT stack */ ickmt_prev->next = ickmt_cur->next; if(ickmt_cur->next == ickmt_cur) @@ -565,21 +677,23 @@ void nextthread(jmp_buf pc, int errlineno, int flags) a goto seemed crystal-clear by comparison. */ /* save variables */ - ickmt_cur->varforget[0] = onespots; - ickmt_cur->varforget[1] = twospots; - ickmt_cur->varforget[2] = tails; - ickmt_cur->varforget[3] = hybrids; - ickmt_cur->varforget[4] = oneforget; - ickmt_cur->varforget[5] = twoforget; - ickmt_cur->varforget[6] = tailforget; - ickmt_cur->varforget[7] = hyforget; + ickmt_cur->dsi->varforget[0] = onespots; + ickmt_cur->dsi->varforget[1] = twospots; + ickmt_cur->dsi->varforget[2] = tails; + ickmt_cur->dsi->varforget[3] = hybrids; + ickmt_cur->dsi->varforget[4] = oneforget; + ickmt_cur->dsi->varforget[5] = twoforget; + ickmt_cur->dsi->varforget[6] = tailforget; + ickmt_cur->dsi->varforget[7] = hyforget; + ickmt_cur->dsi->varforget[8] = oo_onespots; + ickmt_cur->dsi->varforget[9] = oo_twospots; /* save NEXT stack */ ickmt_cur->nextstack = next; ickmt_cur->nextpointer = nextindex; /* save stashbox */ - ickmt_cur->sb = first; + ickmt_cur->dsi->sb = first; /* save choicepoints */ if(!choicing) ickmt_cur->choicepoint = topchoice; @@ -614,14 +728,16 @@ void nextthread(jmp_buf pc, int errlineno, int flags) if(!(flags&2)) goto returnjmp; /* load variables */ - onespots = ickmt_cur->varforget[0]; - twospots = ickmt_cur->varforget[1]; - tails = ickmt_cur->varforget[2]; - hybrids = ickmt_cur->varforget[3]; - oneforget = ickmt_cur->varforget[4]; - twoforget = ickmt_cur->varforget[5]; - tailforget = ickmt_cur->varforget[6]; - hyforget = ickmt_cur->varforget[7]; + onespots = ickmt_cur->dsi->varforget[0]; + twospots = ickmt_cur->dsi->varforget[1]; + tails = ickmt_cur->dsi->varforget[2]; + hybrids = ickmt_cur->dsi->varforget[3]; + oneforget = ickmt_cur->dsi->varforget[4]; + twoforget = ickmt_cur->dsi->varforget[5]; + tailforget = ickmt_cur->dsi->varforget[6]; + hyforget = ickmt_cur->dsi->varforget[7]; + oo_onespots = ickmt_cur->dsi->varforget[8]; + oo_twospots = ickmt_cur->dsi->varforget[9]; /* load NEXT stack */ next = ickmt_cur->nextstack; @@ -631,7 +747,7 @@ void nextthread(jmp_buf pc, int errlineno, int flags) if(!choicing) topchoice = ickmt_cur->choicepoint; /* load stashbox */ - first = ickmt_cur->sb; + first = ickmt_cur->dsi->sb; /* load comefrom information */ memcpy(cjb, ickmt_cur->cjb, sizeof(jmp_buf)); diff --git a/src/yuk.c b/src/yuk.c index 1e34fe2..07a69ea 100644 --- a/src/yuk.c +++ b/src/yuk.c @@ -24,11 +24,21 @@ LICENSE TERMS Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ****************************************************************************/ +#include "config.h" /* AIS: Generated by autoconf */ #include #include -#include +#ifdef HAVE_SYS_TIME_H +# include +# ifdef TIME_WITH_SYS_TIME +# include +# endif +#else +# include +#endif #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include @@ -38,26 +48,22 @@ LICENSE TERMS #include "lose.h" #include "sizes.h" #include "abcess.h" +#include "uncommon.h" #if YPTIMERTYPE == 4 #include #endif -/* To help out shells that only understand backslashes in filenames. */ -#ifdef YUKCOPYLOCUS -#define STRINGIZE2(s) s -#define STRINGIZE(s) STRINGIZE2(s) -#define YUKCOPYLOC STRINGIZE(YUKCOPYLOCUS) -#endif - extern signed char onewatch[]; extern signed char twowatch[]; extern type16 oneold[]; extern type32 twoold[]; +char** globalargv; +int globalargc; int yuklines = 0; int yukloop = 0; -int yukcommands = 0; /* these 3 lines because externs must be defined +int yukcommands = 0; /* these 5 lines because externs must be defined somewhere */ /* Global variable storage types: static: limited to the file @@ -156,7 +162,11 @@ void yukline(int aboff,int emitlineno) int temp; yptimer temptick; char* text=textlines[lineofaboff[aboff]]; + char copyloc[BUFSIZ+9]; + char* tempcharp; if(!yukopts) return; + if(globalargc!=3) + lose(E778,emitlineno,(char*)NULL); if(yukopts & 1) { /* profile */ temptick=YPGETTIME; @@ -317,7 +327,7 @@ void yukline(int aboff,int emitlineno) puts("p\tdisplay the values of all onespot and twospot variables"); puts("q\tabort execution"); puts("r\treinstate once all abstained commands on "); - puts("s\tstep to the next line of code"); + puts("s\texecute one command"); puts("t\tcontinue until a breakpoint, displaying all lines executed"); puts("u\texecute until just before is reached"); puts("v\tshow value of variable every time a command is printed"); @@ -327,7 +337,7 @@ void yukline(int aboff,int emitlineno) puts("z\tview variable every displayed line, and break on zero"); puts("\tview the value of a onespot or twospot variable"); puts("<\tset the value of a onespot or twospot variable"); - puts("*\tview the GNU General Public Licence"); + puts("*\tview the GNU General Public License"); puts("?\tview this help screen"); puts("@\tview this help screen"); puts("Line numbers refer to lines of source code, not line labels."); @@ -336,7 +346,11 @@ void yukline(int aboff,int emitlineno) puts("The values of variables must be input in proper INTERCAL"); puts("notation (i.e. ONE TWO THREE), and are output as butchered"); puts("Roman numerals."); - puts("You can press ^C to break an executing program."); +#ifdef __DJGPP__ + puts("You can press - to interrupt an executing program."); +#else + puts("You can press -C to interrupt an executing program."); +#endif break; case 'q': exit(0); @@ -756,7 +770,10 @@ void yukline(int aboff,int emitlineno) } break; case '*': - system("more < " YUKCOPYLOC); /* display the GNU GPL copyright */ + tempcharp=findandtestopen("COPYING.txt",globalargv[1], + "r",globalargv[2]); + sprintf(copyloc,"more < %s",tempcharp); + system(copyloc); /* display the GNU GPL copyright */ break; default: puts("Not sure what you mean. Try typing ?."); diff --git a/src/yuk.h b/src/yuk.h index 553669a..4a3d1ca 100644 --- a/src/yuk.h +++ b/src/yuk.h @@ -3,7 +3,6 @@ This file is GPL'd, and so can be freely redistributed but has absolutely no warranty. */ -#include #define YUK(t,u) yukline(t,u) #define YUKTERM yukterm() @@ -23,8 +22,11 @@ extern char *yukexplain[]; extern int yukloop; -/* Defines that change the functions used for profiling */ -#define YPTIMERTYPE 2 +/* Defines that change the functions used for profiling. */ + +/* Define the following to the timing function you want for profiling, or leave + it undef to use the value computed by config.sh. */ +#undef YPTIMERTYPE /* 0 to use clock(), 1 to use gettimeofday() and long, 2 to use gettimeofday() and long long, 3 to use gethrtime() 4 to use times() */ @@ -40,6 +42,23 @@ extern int yukloop; you get will be basically meaningless as the base information can't be accurately obtained (the resolution is slightly worse than 50ms, which is far too slow for profiling). */ +#ifndef YPTIMERTIME +# ifdef HAVE_GETHRTIME +# define YPTIMERTYPE 3 +# else +# ifdef HAVE_GETTIMEOFDAY +/* Allow for an erroneous blank value for SIZEOF_LONG_LONG_INT. */ +# if SIZEOF_LONG_LONG_INT + 0 > 0 +# define YPTIMERTYPE 2 +# else +# define YPTIMERTYPE 1 +# endif +# else +# define YPTIMERTYPE 0 +# endif +# endif +#endif + #if YPTIMERTYPE == 0 #define YPTIMERTFORMAT "lu" @@ -103,3 +122,6 @@ typedef struct yukvar_tag } yukvar; extern yukvar yukvars[]; + +extern char** globalargv; +extern int globalargc; -- 2.43.0