]> thyrsus.com Git - intercal.git/commitdiff
Fix permute.i test failure, and clean up build system and boolean detection
authorAlex Smith <ais523@bham.ac.uk>
Mon, 27 Sep 2010 10:28:09 +0000 (11:28 +0100)
committerAlex Smith <ais523@bham.ac.uk>
Mon, 27 Sep 2010 10:28:09 +0000 (11:28 +0100)
The cause of the bug was that "bool" referred to a different type in libick.a
and in compiled programs, which could be caused by, e.g., different compilers
(entirely plausible in cross-compiling) or a different header environment
(what actually happened was a missing config.h, as that isn't installed). The
fix used here was to change abcess.h from immutable to a generated file,
containing the boolean types actually used to build C-INTERCAL and requiring
their use for the eventually generated programs, preventing the type mismatch.
This fails if C-INTERCAL is built with a compiler that supports booleans, and
run with a $CC that doesn't, but at least it now fails noisly in that case
rather than silently, with nothing but a mysterious regression check failure
in permute.i.

As part of this, config.h was cleaned up; configuration #defines now
consistently use the values 1 or undef, rather than /**/ or undef sometimes,
and 1 or undef other times; this is needed to AC_SUBST the values into
abcess.h correctly, but is useful cleanup in any case.

README
buildaux/Makefile.am
configure.ac
src/abcess.h [deleted file]
src/abcessh.in [new file with mode: 0644]
src/ick_bool.h

diff --git a/README b/README
index 812d3ab8969041de5532443f0a6a64292f025510..a1ab97300d10a799b06917c460db14eea07bd9f3 100644 (file)
--- a/README
+++ b/README
@@ -44,7 +44,7 @@ The files included are:
 |doc/chipspec.txt       | plans for an INTERCAL-based microprocessor
 |doc/ick.1              | man page for ick
 |doc/convickt.1         | man page for convickt
-|src/abcess.h           | interface to functions linked with programs
+|src/abcessh.in         | template interface to functions linked with programs
 |src/arrgghh.c          | option argument parsing for generated programs
 |src/bin2c.c            | creates C code representations of binary files
 |src/cesspool.c         | the INTERCAL runtime support code
index 6238a6c0dcf8e3305eddbae8e1ad445416b48b0e..aa791f4fb1e28cba1be1936ca0dcefe26f2f8f86 100644 (file)
@@ -42,8 +42,6 @@ ick_lose.h : src/ick_lose.h
        $(LN_S) -f `test -f 'src/ick_lose.h' || echo '$(srcdir)/'`src/ick_lose.h ick_lose.h
 fiddle.h : src/fiddle.h
        $(LN_S) -f `test -f 'src/fiddle.h' || echo '$(srcdir)/'`src/fiddle.h fiddle.h
-abcess.h : src/abcess.h
-       $(LN_S) -f `test -f 'src/abcess.h' || echo '$(srcdir)/'`src/abcess.h abcess.h
 ick_bool.h : src/ick_bool.h
        $(LN_S) -f `test -f 'src/ick_bool.h' || echo '$(srcdir)/'`src/ick_bool.h ick_bool.h
 yuk.h : src/yuk.h
@@ -55,7 +53,7 @@ AM_YFLAGS = -d
 # installed.
 BUILT_SOURCES = parser.h ick-wrap.c pickwrap.c syslib.i syslib3.3i syslib4.4i \
                 syslib5.5i syslib6.6i syslib7.7i floatlib.i ecto_b98.c \
-               ick_ec.h fiddle.h abcess.h ick_bool.h ick_lose.h yuk.h
+               ick_ec.h fiddle.h ick_bool.h ick_lose.h yuk.h
 noinst_LIBRARIES = libidiot.a
 libidiot_a_SOURCES = src/idiotism.oil
 libidiot.a: src/idiotism.oil oil$(EXEEXT) src/oil.h src/sizes.h src/ick.h \
@@ -108,9 +106,9 @@ latin1.o: bin2c$(EXEEXT_FOR_BUILD) src/latin1.bin
        ./bin2c$(EXEEXT_FOR_BUILD) ick_clc_cset_latin1 < `test -f 'src/latin1.bin' || echo '$(srcdir)/'`src/latin1.bin > latin1.c
        $(COMPILE) -c latin1.c
 
-ickinclude_HEADERS = src/ick_ec.h src/fiddle.h src/abcess.h src/ick_lose.h \
-                     src/yuk.h src/ick_bool.h
-nodist_ickinclude_HEADERS = config.h
+ickinclude_HEADERS = src/ick_ec.h src/fiddle.h src/ick_lose.h src/yuk.h \
+                     src/ick_bool.h
+nodist_ickinclude_HEADERS = config.h abcess.h
 dist_ickdata_DATA = src/atari.bin src/baudot.bin src/ebcdic.bin src/latin1.bin \
                     src/ick-wrap.c src/pickwrap.c COPYING
 # These necessary pit files are in nodist_ here because they're in EXTRA_DIST
@@ -128,7 +126,7 @@ splint: $(ick_SOURCES) parser.h
        @echo "Running splint on ick..."
        -(for x in $(ick_SOURCES); do echo $(top_srcdir)/$$x; done) | xargs splint $(SPLINTOPTS) -exportlocal -redef
 
-EXTRA_DIST = pit etc BUGS src/abcess.h src/feh.h src/fiddle.h src/ick_ec.h \
+EXTRA_DIST = pit etc BUGS src/abcessh.in src/feh.h src/fiddle.h src/ick_ec.h \
              src/ick.h src/ick_lose.h src/oil.h src/pick1.h src/pick2.h \
              src/sizes.h src/uncommon.h src/yuk.h src/parser.y src/lexer.l \
              doc/Makefile doc/fdl-1-2.txi doc/fix83.pl doc/fixtoc.pl \
@@ -159,7 +157,7 @@ dist-hook:
 CLEANFILES = oilout*.c parser.y lexer.l ick-wrap.c pickwrap.c \
              atari.c baudot.c ebcdic.c latin1.c ick.dvi \
              syslib.i syslib3.3i syslib4.4i syslib5.5i \
-             syslib6.6i syslib7.7i ick_ec.h fiddle.h abcess.h \
+             syslib6.6i syslib7.7i ick_ec.h fiddle.h \
              ick_lose.h yuk.h floatlib.i ecto_b98.c ick_bool.h
 # Distclean deletes the Makefile and thus requires reconfiguring,
 # and therefore this is a safe moment to delete the build tree
@@ -220,4 +218,4 @@ $(top_srcdir)/buildaux/bconfigh.in: $(top_srcdir)/buildaux/buildconfig.ac
        cd $(top_srcdir)/buildaux && $(AUTOHEADER) buildconfig.ac
        rm -f stamp-h1
        touch $@
-CONFIG_STATUS_DEPENDENCIES=$(top_srcdir)/buildaux/buildconfig $(top_srcdir)/buildaux/bconfigh.in
+CONFIG_STATUS_DEPENDENCIES=$(top_srcdir)/buildaux/buildconfig $(top_srcdir)/buildaux/bconfigh.in $(top_srcdir)/src/abcessh.in
index 4f2cf619b42a6edc3326d30fcf6b4e27584ffaa2..f49061942ac207b16ed91553cfea754306701703 100644 (file)
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
 dnl Yes, that is a valid email address. If your mailer doesn't support nested
 dnl comments, then get a better mailer.
 AC_INIT([C-INTERCAL],[0.29],[[ais523(524\)x\((525)y)@bham.ac.uk]],[ick])
-AC_CONFIG_SRCDIR([src/abcess.h])
+AC_CONFIG_SRCDIR([src/perpet.c])
 AC_CONFIG_HEADER([config.h:buildaux/configh.in])
 AC_CONFIG_AUX_DIR([buildaux])
 AM_INIT_AUTOMAKE([foreign dist-bzip2 dist-lzma tar-pax check-news
@@ -32,14 +32,19 @@ dnl Checks for libraries.
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_STDBOOL
+if test "x$ac_cv_header_stdbool_h" == "xyes"
+then
+HAVE_STDBOOL_H=1
+fi
 AC_CHECK_HEADERS([sys/time.h unistd.h stdarg.h])
 AC_CHECK_HEADERS([stdint.h],[HAVE_STDINT_H=1])
 AC_SUBST(HAVE_STDINT_H)
+AC_SUBST(HAVE_STDBOOL_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.
+dnl check for long long AC_CHECK_SIZEOF is used to test for a nonzero
+dnl result.
 AC_C_CONST
 AC_C_VOLATILE
 AC_CHECK_SIZEOF([long long int],[0])
@@ -57,6 +62,7 @@ AC_TYPE_UINT32_T
 # actual use in code) dislike mixing _Bool and varargs.
 if test "x$ac_cv_type__Bool" == "xyes"
 then
+HAVE__BOOL=1
 AC_MSG_CHECKING([[whether booleans can be passed via varargs]])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <stdlib.h>
@@ -90,14 +96,16 @@ test(12345,match,12345);
 test(23456,nomatch,1234);
 exit(0);
 ]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
-AC_DEFINE([BOOL_VARARGS_BROKEN],[],dnl
-[Define if _Bool works but cannot be passed via varargs.])
+AC_DEFINE([BOOL_VARARGS_BROKEN],[1],dnl
+[Define to 1 if _Bool works but cannot be passed via varargs.])
 ],[AC_MSG_RESULT([[unknown in a cross-compile, assuming no]])
-AC_DEFINE([BOOL_VARARGS_BROKEN],[],dnl
-[Define if _Bool works but cannot be passed via varargs.])
+AC_DEFINE([BOOL_VARARGS_BROKEN],[1],dnl
+[Define to 1 if _Bool works but cannot be passed via varargs.])
 ])
 fi
 
+AC_SUBST(HAVE__BOOL)
+
 AC_MSG_CHECKING([[whether yyrestart() is needed]])
 # Write a lex program that will cause an error if yyrestart exists.
 echo '%%
@@ -105,12 +113,12 @@ echo '%%
 float yyrestart(int, ...);' | $LEX
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "${LEX_OUTPUT_ROOT}.c"
 ]], [[exit(0);]])],[AC_MSG_RESULT(no)],[AC_DEFINE([NEED_YYRESTART],dnl
-[],[Define if yyrestart() is necessary to yyparse a new file.])
+[1],[Define to 1 if yyrestart() is necessary to yyparse a new file.])
 AC_MSG_RESULT(yes)])
 rm -f ${LEX_OUTPUT_ROOT}.c
 
 if test "$interpval" != "no"; then
-AC_DEFINE([HAVE_SYS_INTERPRETER], [], [Define if #! works on your system.])
+AC_DEFINE([HAVE_SYS_INTERPRETER], [1], [Define to 1 if #! works on your system.])
 fi
 AC_DEFINE_UNQUOTED([EXEEXT],"$EXEEXT",[Extension to use on executable files.])
 
@@ -126,7 +134,7 @@ INCLUDE_HIDDEN_FROM_AUTOMAKE="include"
 AC_SUBST(PACKAGE_VERSION)
 AC_SUBST(INCLUDE_HIDDEN_FROM_AUTOMAKE)
 
-AC_CONFIG_FILES([Makefile:buildaux/Makefile.in coopt.sh:src/cooptsh.in host.mak:buildaux/hostmak.in])
+AC_CONFIG_FILES([Makefile:buildaux/Makefile.in coopt.sh:src/cooptsh.in host.mak:buildaux/hostmak.in abcess.h:src/abcessh.in])
 AC_OUTPUT()
 # After the output, chmod coopt.sh to be executable.
 chmod a+x coopt.sh
@@ -193,4 +201,3 @@ mv config.status config.status.save
 (env -i "PATH=$PATH" $srcdir/buildaux/buildconfig "$BUILD_MACHINE_ARG" "$BUILD_CC_ARG" "$BUILD_CFLAGS_ARG" "$BUILD_LDFLAGS_ARG" "$BUILD_LIBS_ARG" "$BUILD_CPPFLAGS_ARG" "$BUILD_CPP_ARG")
 mv config.status config.status.build
 mv config.status.save config.status
-
diff --git a/src/abcess.h b/src/abcess.h
deleted file mode 100644 (file)
index e5dbb3f..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/* 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. */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <setjmp.h>
-
-/*
- * Duplicates contents of ick_bool.h.  Someday maybe we'll install this
- * and avoid such grottiness.
- */
-/*@-redef@*/
-#ifndef __bool_true_false_are_defined
-# ifdef HAVE_STDBOOL_H
-#  include <stdbool.h>
-# else
-#  ifndef HAVE__BOOL
-#   ifdef HAVE_STDINT_H
-#    include <stdint.h>
-typedef int_fast8_t bool;
-#   else
-typedef int bool;
-#   endif
-#  else
-typedef _Bool bool;
-#  endif
-#  define true 1
-#  define false 0
-#  define __bool_true_false_are_defined 1
-# endif
-#endif
-/*@=redef@*/
-
-#define ICK_ABCESS_H_INCLUDED
-
-#define ick_ONESPOT    0
-#define ick_TWOSPOT    1
-#define ick_TAIL       2
-#define ick_HYBRID     3
-
-#define ick_MAXNEXT 80 /* AIS: Moved from cesspool.c */
-
-/* the following two types must both promote to unsigned int in expressions */
-
-typedef unsigned short ick_type16;
-typedef unsigned int   ick_type32;
-
-typedef struct ick_array_t
-{
-  unsigned int rank;
-  size_t *dims;
-  union
-  {
-    ick_type16 *tail;
-    ick_type32 *hybrid;
-  } data;
-} ick_array;
-
-
-/* AIS: For operand overloading, a more complicated data type is needed. */
-typedef struct ick_overop_t
-{
-  ick_type32 (*get)(ick_type32);
-  void (*set)(ick_type32, void(*)());
-} ick_overop;
-
-/* AIS: Moved from cesspool.c */
-typedef struct ick_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 */
-  {
-    ick_type16 onespot;
-    ick_type32 twospot;
-    ick_array  *a;
-  } save;
-  /*@null@*/ /*@dependent@*/ struct ick_stashbox_t *ick_next;  /* pointer to next-older ick_stashbox */
-  ick_overop overloadinfo; /* AIS: overloading info is stashed too, in a
-                           non-overloaded program (ignored otherwise) */
-} ick_stashbox;
-
-/* AIS: files to take input and output from */
-/*@null@*/ extern FILE* ick_cesspoolin;
-/*@null@*/ extern FILE* ick_cesspoolout;
-
-/* defined in cesspool.c */
-extern void ick_pushnext(unsigned n);
-extern unsigned int ick_popnext(unsigned n);
-extern unsigned int ick_resume(unsigned n);
-extern unsigned int ick_pin(void);
-extern void ick_clockface(bool mode);
-extern void ick_setclcsemantics(bool mode); /* AIS */
-extern void ick_pout(unsigned int val);
-extern void ick_binin(unsigned int type, ick_array *a, bool forget);
-extern void ick_binout(unsigned int type, const ick_array *a);
-extern unsigned int ick_assign(char *dest, unsigned int type, bool forget,
-                          unsigned int value);
-
-/* AIS: yuk, unravel and ick_ec need these */
-extern unsigned* ick_next;
-/*@null@*/ extern jmp_buf* ick_next_jmpbufs;
-extern int ick_nextindex;
-extern /*@null@*/ ick_stashbox *ick_first;
-
-/* AIS: Implement the +ick_mystery command line option. */
-extern unsigned long ick_mysteryc;
-extern int ick_mystery;
-#define ick_MYSTERYLINE if(ick_mystery && ick_mysteryc++ > 4000000000LU) exit(42);
-
-/* AIS: More command-line options */
-extern int ick_wimp_mode;
-extern int ick_instapipe;
-
-/* AIS: Handle multiple COME FROMs aiming at the same line */
-extern int ick_multicome0(int errlineno, jmp_buf pc);
-
-#ifdef HAVE_STDARG_H
-/*@dependent@*/ extern void *ick_aref(unsigned int type, ...);
-extern void ick_resize(unsigned int type, ...);
-#else
-/*@dependent@*/ extern void *ick_aref();
-extern void ick_resize();
-#endif
-
-extern void ick_stashinit(void);
-/* AIS: Added mentions of oo. This is set to 0 in a non-overloaded program. */
-extern void ick_stash(unsigned int type, unsigned int index, void *from, ick_overop* oo);
-extern void ick_retrieve(void *to, unsigned int type, unsigned int index,
-                        bool forget, ick_overop* oo);
-extern unsigned int ick_roll(unsigned int n);
-
-/* AIS: Lose with IE277 */
-extern ick_type32 ick_ieg277(ick_type32);
-extern void ick_ies277(ick_type32, void(*)());
-
-/* defined in arrgghh.c */
-extern void ick_parseargs(int argc, char **argv);
-extern int ick_printflow;
-
-/* AIS: For the CREATE statement */
-typedef struct ick_tag_createdata ick_createdata;
-struct ick_tag_createdata
-{
-  int width;           /* 16 or 32 (maybe 0 will be allowed at some point) */
-  int isarray;         /* this and the previous determine what vartype it is */
-  unsigned short varnumber;
-                       /* 0 if not a variable, the var's number if it is */
-  ick_overop accessors;/* how to get and set this lvalue, or {0,0} */
-  unsigned long value; /* current value of the var or expression */
-};
-extern void ick_registercreation(const char*,unsigned long);
-extern unsigned long ick_jicmatch(const char*);
-
-/* AIS: Multithreading types and defines */
-#if MULTITHREAD != 0
-typedef struct tag_ickthread ickthread;
-/*@refcounted@*/ struct tag_ickthread
-{
-  void* varforget[10]; /* holds all four variable types, and forgetting data */
-  unsigned* nextstack;
-  int nextpointer;
-  jmp_buf pc; /* program counter */
-  ick_stashbox* sb; /* holds all stash data */
-  /*@partial@*/ /*@dependent@*/ ickthread* ick_next;
-  /*@null@*/ /*@partial@*/ /*@dependent@*/ 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 ick_ccfc;  /* number of comefroms currently active */
-  long ick_skipto; /* compucome line number */
-  jmp_buf ick_cjb; /* keeps track of compucomes */
-  /*@partial@*/ /*@dependent@*/ ickthread* dsi; /* which thread's varforget and sb to use */
-  /*@null@*/ /*@dependent@*/ ickthread* usesthis; /* for garbage collection purposes */
-};
-/*@partial@*/ /*@dependent@*/ extern ickthread* ickmt_cur; /* current thread */
-/*@partial@*/ /*@dependent@*/ 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(ick_printflow) fprintf(stderr,"[%d:%lx]",ick_lineno, \
-                                            (unsigned long)ickmt_cur); \
-  if(setjmp(ick_cjb) == 0)                                             \
-    nextthread(ick_cjb, ick_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 ick_oldabstain;
-extern int gonebackto;
-extern int ick_ccfc;
-extern long ick_skipto;
-extern jmp_buf btjb;
-extern jmp_buf ick_cjb;
-
-#define MULTICOME multicome1
-#else
-#define MULTICOME ick_multicome0
-#endif /* MULTITHREAD */
-
-/* AIS: Used by the debugger, multithread code, external calls */
-#if (MULTITHREAD != 0) || (YUKDEBUG != 0) || defined(ICK_EC)
-extern ick_type16* ick_onespots;
-extern bool* ick_oneforget;
-extern ick_type32* ick_twospots;
-extern bool* ick_twoforget;
-extern ick_array* ick_tails;
-extern bool* ick_tailforget;
-extern ick_array* ick_hybrids;
-extern bool* ick_hyforget;
-#if (MULTITHREAD != 0) || defined(ICK_EC)
-/*@null@*/ extern ick_overop* ick_oo_onespots;
-/*@null@*/ extern ick_overop* ick_oo_twospots;
-#endif
-#endif
-
-/* abcess.h ends here */
diff --git a/src/abcessh.in b/src/abcessh.in
new file mode 100644 (file)
index 0000000..9f0fba4
--- /dev/null
@@ -0,0 +1,263 @@
+/* abcess.h -- functions used by compiled INTERCAL programs  -*- c -*- */
+/* This file is generated from abcessh.in */
+
+/* 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. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <setjmp.h>
+
+/* We use the +1 trick here, as it works whether the values substituted in are
+   the null string, 0, or positive. */
+#ifndef HAVE_STDBOOL_H
+# define HAVE_STDBOOL_H @HAVE_STDBOOL_H@ + 1
+# if HAVE_STDBOOL_H == 1
+#  undef HAVE_STDBOOL_H
+# endif
+#endif
+#ifndef HAVE__BOOL
+# define HAVE__BOOL @HAVE__BOOL@ + 1
+# if HAVE__BOOL == 1
+#  undef HAVE__BOOL
+# endif
+#endif
+#ifndef HAVE_STDINT_H
+# define HAVE_STDINT_H @HAVE_STDINT_H@ + 1
+# if HAVE_STDINT_H == 1
+#  undef HAVE_STDINT_H
+# endif
+#endif
+
+/*
+ * Duplicates contents of ick_bool.h.  Someday maybe we'll install this
+ * and avoid such grottiness.
+ */
+/*@-redef@*/
+#ifndef __bool_true_false_are_defined
+# if HAVE_STDBOOL_H >= 1
+#  include <stdbool.h>
+# else
+#  ifndef HAVE__BOOL >= 1
+#   ifdef HAVE_STDINT_H >= 1
+#    include <stdint.h>
+typedef int_fast8_t bool;
+#   else
+typedef int bool;
+#   endif
+#  else
+typedef _Bool bool;
+#  endif
+#  define true 1
+#  define false 0
+#  define __bool_true_false_are_defined 1
+# endif
+#endif
+/*@=redef@*/
+
+#define ICK_ABCESS_H_INCLUDED
+
+#define ick_ONESPOT    0
+#define ick_TWOSPOT    1
+#define ick_TAIL       2
+#define ick_HYBRID     3
+
+#define ick_MAXNEXT 80 /* AIS: Moved from cesspool.c */
+
+/* the following two types must both promote to unsigned int in expressions */
+
+typedef unsigned short ick_type16;
+typedef unsigned int   ick_type32;
+
+typedef struct ick_array_t
+{
+  unsigned int rank;
+  size_t *dims;
+  union
+  {
+    ick_type16 *tail;
+    ick_type32 *hybrid;
+  } data;
+} ick_array;
+
+
+/* AIS: For operand overloading, a more complicated data type is needed. */
+typedef struct ick_overop_t
+{
+  ick_type32 (*get)(ick_type32);
+  void (*set)(ick_type32, void(*)());
+} ick_overop;
+
+/* AIS: Moved from cesspool.c */
+typedef struct ick_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 */
+  {
+    ick_type16 onespot;
+    ick_type32 twospot;
+    ick_array  *a;
+  } save;
+  /*@null@*/ /*@dependent@*/ struct ick_stashbox_t *ick_next;  /* pointer to next-older ick_stashbox */
+  ick_overop overloadinfo; /* AIS: overloading info is stashed too, in a
+                           non-overloaded program (ignored otherwise) */
+} ick_stashbox;
+
+/* AIS: files to take input and output from */
+/*@null@*/ extern FILE* ick_cesspoolin;
+/*@null@*/ extern FILE* ick_cesspoolout;
+
+/* defined in cesspool.c */
+extern void ick_pushnext(unsigned n);
+extern unsigned int ick_popnext(unsigned n);
+extern unsigned int ick_resume(unsigned n);
+extern unsigned int ick_pin(void);
+extern void ick_clockface(bool mode);
+extern void ick_setclcsemantics(bool mode); /* AIS */
+extern void ick_pout(unsigned int val);
+extern void ick_binin(unsigned int type, ick_array *a, bool forget);
+extern void ick_binout(unsigned int type, const ick_array *a);
+extern unsigned int ick_assign(char *dest, unsigned int type, bool forget,
+                          unsigned int value);
+
+/* AIS: yuk, unravel and ick_ec need these */
+extern unsigned* ick_next;
+/*@null@*/ extern jmp_buf* ick_next_jmpbufs;
+extern int ick_nextindex;
+extern /*@null@*/ ick_stashbox *ick_first;
+
+/* AIS: Implement the +ick_mystery command line option. */
+extern unsigned long ick_mysteryc;
+extern int ick_mystery;
+#define ick_MYSTERYLINE if(ick_mystery && ick_mysteryc++ > 4000000000LU) exit(42);
+
+/* AIS: More command-line options */
+extern int ick_wimp_mode;
+extern int ick_instapipe;
+
+/* AIS: Handle multiple COME FROMs aiming at the same line */
+extern int ick_multicome0(int errlineno, jmp_buf pc);
+
+#ifdef HAVE_STDARG_H
+/*@dependent@*/ extern void *ick_aref(unsigned int type, ...);
+extern void ick_resize(unsigned int type, ...);
+#else
+/*@dependent@*/ extern void *ick_aref();
+extern void ick_resize();
+#endif
+
+extern void ick_stashinit(void);
+/* AIS: Added mentions of oo. This is set to 0 in a non-overloaded program. */
+extern void ick_stash(unsigned int type, unsigned int index, void *from, ick_overop* oo);
+extern void ick_retrieve(void *to, unsigned int type, unsigned int index,
+                        bool forget, ick_overop* oo);
+extern unsigned int ick_roll(unsigned int n);
+
+/* AIS: Lose with IE277 */
+extern ick_type32 ick_ieg277(ick_type32);
+extern void ick_ies277(ick_type32, void(*)());
+
+/* defined in arrgghh.c */
+extern void ick_parseargs(int argc, char **argv);
+extern int ick_printflow;
+
+/* AIS: For the CREATE statement */
+typedef struct ick_tag_createdata ick_createdata;
+struct ick_tag_createdata
+{
+  int width;           /* 16 or 32 (maybe 0 will be allowed at some point) */
+  int isarray;         /* this and the previous determine what vartype it is */
+  unsigned short varnumber;
+                       /* 0 if not a variable, the var's number if it is */
+  ick_overop accessors;/* how to get and set this lvalue, or {0,0} */
+  unsigned long value; /* current value of the var or expression */
+};
+extern void ick_registercreation(const char*,unsigned long);
+extern unsigned long ick_jicmatch(const char*);
+
+/* AIS: Multithreading types and defines */
+#if MULTITHREAD != 0
+typedef struct tag_ickthread ickthread;
+/*@refcounted@*/ struct tag_ickthread
+{
+  void* varforget[10]; /* holds all four variable types, and forgetting data */
+  unsigned* nextstack;
+  int nextpointer;
+  jmp_buf pc; /* program counter */
+  ick_stashbox* sb; /* holds all stash data */
+  /*@partial@*/ /*@dependent@*/ ickthread* ick_next;
+  /*@null@*/ /*@partial@*/ /*@dependent@*/ 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 ick_ccfc;  /* number of comefroms currently active */
+  long ick_skipto; /* compucome line number */
+  jmp_buf ick_cjb; /* keeps track of compucomes */
+  /*@partial@*/ /*@dependent@*/ ickthread* dsi; /* which thread's varforget and sb to use */
+  /*@null@*/ /*@dependent@*/ ickthread* usesthis; /* for garbage collection purposes */
+};
+/*@partial@*/ /*@dependent@*/ extern ickthread* ickmt_cur; /* current thread */
+/*@partial@*/ /*@dependent@*/ 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(ick_printflow) fprintf(stderr,"[%d:%lx]",ick_lineno, \
+                                            (unsigned long)ickmt_cur); \
+  if(setjmp(ick_cjb) == 0)                                             \
+    nextthread(ick_cjb, ick_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 ick_oldabstain;
+extern int gonebackto;
+extern int ick_ccfc;
+extern long ick_skipto;
+extern jmp_buf btjb;
+extern jmp_buf ick_cjb;
+
+#define MULTICOME multicome1
+#else
+#define MULTICOME ick_multicome0
+#endif /* MULTITHREAD */
+
+/* AIS: Used by the debugger, multithread code, external calls */
+#if (MULTITHREAD != 0) || (YUKDEBUG != 0) || defined(ICK_EC)
+extern ick_type16* ick_onespots;
+extern bool* ick_oneforget;
+extern ick_type32* ick_twospots;
+extern bool* ick_twoforget;
+extern ick_array* ick_tails;
+extern bool* ick_tailforget;
+extern ick_array* ick_hybrids;
+extern bool* ick_hyforget;
+#if (MULTITHREAD != 0) || defined(ICK_EC)
+/*@null@*/ extern ick_overop* ick_oo_onespots;
+/*@null@*/ extern ick_overop* ick_oo_twospots;
+#endif
+#endif
+
+/* abcess.h ends here */
index a9ec63c075c1027fcb88b39b5c89f4ccef83d5c2..ae9de789d23f6977713f564ef0ba589f471f85bd 100644 (file)
@@ -7,11 +7,11 @@
 
 /*@-redef@ -incondefs*/
 #ifndef __bool_true_false_are_defined
-# ifdef HAVE_STDBOOL_H
+# if HAVE_STDBOOL_H >= 1
 #  include <stdbool.h>
 # else
-#  ifndef HAVE__BOOL
-#   ifdef HAVE_STDINT_H
+#  if !defined(HAVE__BOOL) || HAVE__BOOL < 1
+#   if HAVE_STDINT_H >= 1
 #    include <stdint.h>
 typedef int_fast8_t bool;
 #   else