From a0503e35ec32aff2fdce67feae7690c09b92e951 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 29 Apr 1998 18:59:22 -0400 Subject: [PATCH] Ready for new release, 0.18. --- Makefile | 2 +- NEWS | 23 +++++++++++++++++++++++ doc/intercal.mm | 30 ++++++++++++++++++++++++++++-- intercal.lsm | 6 +++--- src/Makefile | 16 ++++++++++++---- src/abcess.h | 7 +++++++ src/cesspool.c | 28 ++++++++++++++++++++++++++++ src/feh.c | 22 ++++++++++++++++------ src/lexer.l | 3 +++ src/numerals.c | 6 ++++++ src/perpetrate.c | 5 ++++- 11 files changed, 131 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index ab12568..2a8aa52 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Utility productions for the INTERCAL distribution # -VERSION = 0.17 +VERSION = 0.18 tgz: intercal-$(VERSION).tar.gz tar: intercal-$(VERSION).tar diff --git a/NEWS b/NEWS index 22a2b4b..95ce3ff 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,28 @@ NEW IN THIS RELEASE + Release 0.18 (by Eric S. Raymond) 04 April 1998 + +(The following changes are due to John Cowan ) + +1. The source code is now POSIXly correct. By making the POSIX +variable in the Makefile undefined, you can restore the use of +, but otherwise is now used. + +2. Latin-1 (ISO 8859-1) is now the standard input charset of C-INTERCAL. +This means that the change operator (0xA2) has returned as an alternative to +big money ($). Furthermore, the quid (0xA3) and zlotnik (0xA4) are also +acceptable. For those using Latin-9 (ISO 8859-15), the euro (0xA4) will also +work. ("Euro", like "ampersand", cannot be sillified further.) +New names have been added to intercal.mm. + +3. A fortiori, input of Volap\"uk digits may now be in Latin-1 or TeX format. + +4. Yacc is now deprecated in favor of bison; some old yaccs don't do proper +error recovery, and lines like "DO ~ ERROR" failed at compile time. + +5. Some minor portability bugs on systems where ptr_diff is not the same +as int were removed by casting expressions of the form (ptr - ptr) to int. + Release 0.17 (by Eric S. Raymond) 27 Feb 1998 Incorporates a minor bug fix by Jeff Uphoff . diff --git a/doc/intercal.mm b/doc/intercal.mm index d6d967a..cc237c3 100644 --- a/doc/intercal.mm +++ b/doc/intercal.mm @@ -60,7 +60,7 @@ and James M. Lyon\fR Redistribution encouraged under GPL\} .sp .ce 1 -(This version distributed with C-INTERCAL 0.16) +(This version distributed with C-INTERCAL 0.18) .AE .MT 4 .nr % 0 @@ -304,7 +304,7 @@ and \fBselect\fR, which are represented by a change (\*(ct) and a sqiggle [sic] (~), respectively. .if '\*c'y' \{\ (In C-INTERCAL's ASCII environment, EBCDIC \*(ct is replaced by a big -money ($).) \} +money ($), but \*(ct can be used if encoded in Latin-1 as \e0xA2.) \} .P The interleave operator takes two 16-bit values and produces a 32-bit result by alternating the bits of the operands. Thus, #65535\*(ct#0 has the 32-bit @@ -3020,6 +3020,19 @@ $ big money \fIbinary mingle (ASCII)\fR \*(no hookworm ^ shark (or simply sharkfin) \o"#*\(sq" blotch +.if '\*c'y' \{\ +\*(de bunghole +\*(rg name grabber +\*(mu andrew cross +\*(di norwegian minus +\*(co text grabber +\*(sc swash +\*(*m microscope +\*(+- interworm +\*(no half turn +0xA3 quid binary mingle +0xA4 zlotnik binary mingle +\} .TE \} .el \{\ .TS @@ -3066,6 +3079,19 @@ $ big money binary mingle \*(no hookworm ^ shark (or simply sharkfin) unary logical XOR (TriINTERCAL) \o"#*\(sq" blotch +.if '\*c'y' \{\ +\*(de bunghole +\*(rg name grabber +\*(mu andrew cross +\*(di norwegian minus +\*(co text grabber +\*(sc swash +\*(*m microscope +\*(+- interworm +\*(no half turn +0xA3 quid binary mingle +0xA4 zlotnik binary mingle +\} .TE \} .ce 1 Table 2 (top view). INTERCAL character set. diff --git a/intercal.lsm b/intercal.lsm index 09e3b2f..445ae46 100644 --- a/intercal.lsm +++ b/intercal.lsm @@ -1,7 +1,7 @@ Begin3 Title: intercal -Version: 0.17 -Entered-date: 27FEB98 +Version: 0.18 +Entered-date: 04APR98 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 @@ -10,7 +10,7 @@ Keywords: language, compiler, retrocomputing, geek humor Author: esr@snark.thyrsus.com (Eric S. Raymond) Maintained-by: esr@snark.thyrsus.com (Eric S. Raymond) Primary-site: locke.ccil.org /pub/esr - 166K intercal-0.17.tar.gz + 166K intercal-0.18.tar.gz Platforms: All Copying-policy: GPL End diff --git a/src/Makefile b/src/Makefile index 7fe38ea..5580aff 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,8 +8,9 @@ # all over creation behind your back. # (/dev/null may be another good choice :-)) -DVMT=~/WWW/intercal-0.17 +DVMT=~/WWW/intercal-0.18 #DVMT=/usr/local +DVMT=/intercal-0.18 BINDIR = $(DVMT)/bin INCDIR = $(DVMT)/lib @@ -20,8 +21,16 @@ LIBDIR = $(DVMT)/lib YDEBUG = -vlt DEBUG = -g -DDEBUG # DEBUG = -O + +# This version (0.18) is POSIX-compliant. You should only set the POSIX +# variable to null if you *need* to use the old support; +# otherwise, the ANSI-compliant library will be used. + +# POSIX = +POSIX = -D_POSIX_SOURCE + CFLAGS = -I. $(DEBUG) -DICKINCLUDEDIR=\"$(INCDIR)\" \ - -DICKLIBDIR=\"$(LIBDIR)\" -DYYDEBUG + -DICKLIBDIR=\"$(LIBDIR)\" -DYYDEBUG $(POSIX) LDFLAGS = CC = gcc -Wall -W @@ -30,8 +39,7 @@ CC = gcc -Wall -W #LEX = lex LEX = flex -# You can use either yacc or bison -#YACC = yacc +# You should use bison, because some yaccs won't work correctly YACC = bison -y CSOURCES = ick.y lexer.l feh.c lose.c fiddle.c perpetrate.c diff --git a/src/abcess.h b/src/abcess.h index 8b1984b..f0ab2ef 100644 --- a/src/abcess.h +++ b/src/abcess.h @@ -36,8 +36,15 @@ 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); + +#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); extern void stash(unsigned int type, unsigned int index, void *from); extern void retrieve(void *to, int type, unsigned int index, bool forget); diff --git a/src/cesspool.c b/src/cesspool.c index b4c5d52..33355aa 100644 --- a/src/cesspool.c +++ b/src/cesspool.c @@ -24,7 +24,13 @@ LICENSE TERMS /* LINTLIBRARY */ #include #include + +#ifdef _POSIX_SOURCE +#include +#else #include +#endif + #include "sizes.h" #include "abcess.h" #include "lose.h" @@ -360,21 +366,33 @@ unsigned int assign(char *dest, unsigned int type, bool forget, /********************************************************************** * * The following functions implement the INTERCAL array model + * If _POSIX_SOURCE is defined, stdarg is used, otherwise varargs. * *********************************************************************/ + +#ifdef _POSIX_SOURCE +char *aref(unsigned int type, ...) +#else char *aref(va_alist) va_dcl +#endif /* return a pointer to the array location specified by args */ { +#ifndef _POSIX_SOURCE unsigned int type; +#endif array *a; unsigned int v; va_list ap; int address = 0; unsigned int i; +#ifdef _POSIX_SOURCE + va_start(ap, type); +#else va_start(ap); type = va_arg(ap, unsigned int); +#endif a = va_arg(ap, array*); if (va_arg(ap, unsigned int) != a->rank) @@ -395,18 +413,28 @@ char *aref(va_alist) va_dcl return (char*)&a->data.hybrid[address]; } +#ifdef _POSIX_SOURCE +void resize(unsigned int type, ...) +#else void resize(va_alist) va_dcl +#endif /* resize an array to the given shape */ { +#ifndef _POSIX_SOURCE unsigned int type; +#endif array *a; bool forget; unsigned int i, r, v; va_list ap; int prod = 1; +#ifdef _POSIX_SOURCE + va_start(ap, type); +#else va_start(ap); type = va_arg(ap, unsigned int); +#endif a = va_arg(ap, array*); forget = va_arg(ap, bool); diff --git a/src/feh.c b/src/feh.c index f2a77b4..f029ed1 100644 --- a/src/feh.c +++ b/src/feh.c @@ -720,7 +720,7 @@ static void emit_guard(tuple *tn, FILE *fp) (void) fprintf(fp, " if ("); if (tn->exechance < 100) (void) fprintf(fp, "roll(%d) && ", tn->exechance); - (void) fprintf(fp, "!abstained[%d]) {\n", tn - tuples); + (void) fprintf(fp, "!abstained[%d]) {\n", (int)(tn - tuples)); } void emit(tuple *tn, FILE *fp) @@ -799,7 +799,7 @@ void emit(tuple *tn, FILE *fp) case NEXT: (void) fprintf(fp, "\tpushnext(%d); goto L%d; N%d:;\n", - tn - tuples + 1, tn->u.target, tn - tuples + 1); + (int)(tn - tuples + 1), tn->u.target, (int)(tn - tuples + 1)); break; case RESUME: @@ -861,8 +861,13 @@ void emit(tuple *tn, FILE *fp) { (void) fprintf(fp, "\n\tfor (i = 0; i < (int)(sizeof(linetype)/sizeof(int)); i++)\n"); - (void) fprintf(fp, - "\t if (linetype[i] == %s)\n", enablers[np->constant-GETS]); + if (np->constant == ABSTAIN || 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 { + (void) fprintf(fp, + "\t if (linetype[i] == %s)\n", enablers[np->constant-GETS]); + } (void) fprintf(fp, "\t\tabstained[i] = FALSE;\n"); } @@ -875,8 +880,13 @@ void emit(tuple *tn, FILE *fp) { (void) fprintf(fp, "\n\tfor (i = 0; i < (int)(sizeof(linetype)/sizeof(int)); i++)\n"); - (void) fprintf(fp, - "\t if (linetype[i] == %s)\n", enablers[np->constant-GETS]); + if (np->constant == ABSTAIN || 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 { + (void) fprintf(fp, + "\t if (linetype[i] == %s)\n", enablers[np->constant-GETS]); + } (void) fprintf(fp, "\t\tabstained[i] = TRUE;\n"); } diff --git a/src/lexer.l b/src/lexer.l index 67b6ee2..70117d9 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -196,6 +196,9 @@ D [0-9][\ \t\n0-9]* \# {return(MESH);} \$ {return(MINGLE);} +\xA2 {return(MINGLE);} +\xA3 {return(MINGLE);} +\xA4 {return(MINGLE);} \~ {return(SELECT);} \& {yylval.numval = AND; return(UNARY);} diff --git a/src/numerals.c b/src/numerals.c index 6dbdd96..5034b6c 100644 --- a/src/numerals.c +++ b/src/numerals.c @@ -14,6 +14,9 @@ * Nahuatl, Tagalog, Sanskrit, Basque, Georgian, Kwakiutl, and * Volap\"uk are now supported in addition to English. * + * As of release 0.18, Volap\"uk digits can be entered in either TeX or + * Latin-1 format. + * LICENSE TERMS Copyright (C) 1996 Eric S. Raymond @@ -129,9 +132,12 @@ static numeral numerals[] = { "FOL", 4 }, { "LUL", 5 }, { "M\\\"AL", 6 }, + { "M\0xC4L", 6 }, /* Latin-1 support */ { "VEL", 7 }, { "J\\\"OL", 8 }, + { "J\0xD6L", 8 }, /* Latin-1 support */ { "Z\\\"UL", 9 }, + { "Z\0xDCL", 9 }, /* Latin-1 support */ }; /* numeral.c ends here */ diff --git a/src/perpetrate.c b/src/perpetrate.c index 03849fb..7be7907 100644 --- a/src/perpetrate.c +++ b/src/perpetrate.c @@ -55,6 +55,9 @@ extern void yyrestart(FILE*); /* function created by yacc */ extern int yyparse(void); +/* getopt declaration */ +int getopt(int, char**, char*); + /* compilation options */ bool compile_only; /* just compile into C, don't run the linker */ bool traditional; /* insist on strict INTERCAL-72 conformance */ @@ -477,7 +480,7 @@ int main(int argc, char *argv[]) if (tp->type == NEXT) (void) fprintf(ofp, "\tcase %d: goto N%d; break;\n", - tp-tuples+1, tp-tuples+1); + (int)(tp-tuples+1), (int)(tp-tuples+1)); (void) fprintf(ofp, " }"); } break; -- 2.43.0