+
+# include <gettext.h>
+# define _(Msgid) gettext (Msgid)
+# define N_(Msgid) (Msgid)
+
+
+/*-----------.
+| Booleans. |
+`-----------*/
+
+# include <stdbool.h>
+
+
+
+/*-------------.
+| Assertions. |
+`-------------*/
+
+/* In the past, Bison defined aver to simply invoke abort in the case of
+ a failed assertion. The rationale was that <assert.h>'s assertions
+ were too heavyweight and could be disabled too easily. See
+ discussions at
+ <http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00080.html>
+ <http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00111.html>.
+
+ However, normal assert output can be helpful during development and
+ in bug reports from users. Moreover, it's not clear now that
+ <assert.h>'s assertions are significantly heavyweight. Finally, if
+ users want to experiment with disabling assertions, it's debatable
+ whether it's our responsibility to stop them. See discussion
+ starting at
+ <http://lists.gnu.org/archive/html/bison-patches/2009-09/msg00013.html>.
+
+ For now, we use assert but we call it aver throughout Bison in case
+ we later wish to try another scheme.
+*/
+# include <assert.h>
+# define aver assert
+
+
+/*-----------.
+| Obstacks. |
+`-----------*/
+
+# define obstack_chunk_alloc xmalloc
+# define obstack_chunk_free free
+# include <obstack.h>
+
+# define obstack_sgrow(Obs, Str) \
+ obstack_grow (Obs, Str, strlen (Str))
+
+# define obstack_fgrow1(Obs, Format, Arg1) \
+ do { \
+ char buf[4096]; \
+ sprintf (buf, Format, Arg1); \
+ obstack_grow (Obs, buf, strlen (buf)); \
+ } while (0)
+
+# define obstack_fgrow2(Obs, Format, Arg1, Arg2) \
+ do { \
+ char buf[4096]; \
+ sprintf (buf, Format, Arg1, Arg2); \
+ obstack_grow (Obs, buf, strlen (buf)); \
+ } while (0)
+
+# define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3) \
+ do { \
+ char buf[4096]; \
+ sprintf (buf, Format, Arg1, Arg2, Arg3); \
+ obstack_grow (Obs, buf, strlen (buf)); \
+ } while (0)
+
+# define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4) \
+ do { \
+ char buf[4096]; \
+ sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4); \
+ obstack_grow (Obs, buf, strlen (buf)); \
+ } while (0)
+
+
+/* Output Str escaped for our postprocessing (i.e., escape M4 special
+ characters).
+
+ For instance "[foo]" -> "@{foo@}", "$$" -> "$][$][". */
+
+# define obstack_escape(Obs, Str) \
+ do { \
+ char const *p; \
+ for (p = Str; *p; p++) \
+ switch (*p) \
+ { \
+ case '$': obstack_sgrow (Obs, "$]["); break; \
+ case '@': obstack_sgrow (Obs, "@@" ); break; \
+ case '[': obstack_sgrow (Obs, "@{" ); break; \
+ case ']': obstack_sgrow (Obs, "@}" ); break; \
+ default: obstack_1grow (Obs, *p ); break; \
+ } \
+ } while (0)
+
+
+
+
+/*-----------------------------------------.
+| Extensions to use for the output files. |
+`-----------------------------------------*/
+
+# ifndef OUTPUT_EXT
+# define OUTPUT_EXT ".output"
+# endif
+
+# ifndef TAB_EXT
+# define TAB_EXT ".tab"
+# endif
+
+
+
+/*---------------------.
+| Free a linked list. |
+`---------------------*/
+
+# define LIST_FREE(Type, List) \
+ do { \
+ Type *_node, *_next; \
+ for (_node = List; _node; _node = _next) \
+ { \
+ _next = _node->next; \
+ free (_node); \
+ } \
+ } while (0)
+
+
+/*---------------------------------------------.
+| Debugging memory allocation (must be last). |
+`---------------------------------------------*/
+
+# if WITH_DMALLOC
+# define DMALLOC_FUNC_CHECK
+# include <dmalloc.h>
+# endif /* WITH_DMALLOC */
+
+#endif /* ! BISON_SYSTEM_H */