/*
* Hide difference between compilers with the C99 bool type and those without.
* The main reason this is desirable is so splint can do more rigorous checking
- * on bools.
+ * on bools. This also allows for compilers that define _Bool but not true or
+ * false, etc.
*/
/*@-redef@ -incondefs*/
-#ifdef __STDC_VERSION__
-#if __STDC_VERSION__ >= 199901L
-#include <stdbool.h>
-#endif
-#endif
-#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;
-#define true 1
-#define false 0
-#define __bool_true_false_are_defined 1
+# endif
+# else
+typedef _Bool bool
+# endif
+# define true 1
+# define false 0
+# define __bool_true_false_are_defined 1
#endif
/*@=redef =incondefs@*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-
-/* 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 ick_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
+#include "ick_bool.h"
/* Define strdup if it isn't available */
#ifndef HAVE_STRDUP
there isn't a condition other than maybe mustbemesh */
const 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
+ bool usec; /* Whether to append the value of c to the condition */
+ bool mustbemesh; /* Must this node be a mesh or mesh32? */
+ bool 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? */
- mybool ublo; /* Is this a UBLO (if set, generate conditions
+ bool width32; /* Generate a 32-bit node? */
+ bool ublo; /* Is this a UBLO (if set, generate conditions
to check width)? */
unsigned long c; /* The value to append to the condition */
int replnum; /* Number of this group for replacements */
void splitend(void);
void splitstart(void);
-void treedepthup(YYSTYPE, mybool);
+void treedepthup(YYSTYPE, bool);
void treefree(YYSTYPE);
void gennodepath(unsigned, unsigned long);
-mybool treeshapecond(YYSTYPE, mybool);
+bool treeshapecond(YYSTYPE, bool);
YYSTYPE treenscheck(YYSTYPE, YYSTYPE, int);
void treecxcond(YYSTYPE);
void treerepcount(YYSTYPE, int*);
#define SPLITMAX 20
int splitcount=SPLITMAX;
int filenumber=0;
-mybool inloop=0;
+bool inloop=0;
%}
/* Various conditions can come out from the lexer. The most common is a char,
}
}
-void treedepthup(YYSTYPE v, mybool i)
+void treedepthup(YYSTYPE v, bool i)
{
if(!v) return;
treedepthup(v->n1,i);
}
}
-mybool treeshapecond(YYSTYPE v, mybool firstopt)
+bool treeshapecond(YYSTYPE v, bool firstopt)
{
if(!v) return firstopt;
/* To prevent possibly dereferencing a null pointer, check the root ick_first */