X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/55b9634155b80271df2b90a95d5f529e2371be28..d39d93b8346e2ab72e2927a1fabab0feaa4d00d2:/src/system.h diff --git a/src/system.h b/src/system.h index fbb298bc..bad5b770 100644 --- a/src/system.h +++ b/src/system.h @@ -73,6 +73,26 @@ extern int errno; # define PARAMS(p) () #endif +# include "xalloc.h" + +/*---------------------. +| Missing prototypes. | +`---------------------*/ + +#if !HAVE_DECL_STPCPY +char *stpcpy PARAMS ((char *dest, const char *src)); +#endif + +#if !HAVE_DECL_STRNDUP +char *strndup PARAMS ((const char *s, size_t size)); +#endif + +#if !HAVE_DECL_STRNLEN +size_t strnlen PARAMS ((const char *s, size_t maxlen)); +#endif + + + /*-----------------. | GCC extensions. | `-----------------*/ @@ -106,10 +126,12 @@ extern int errno; # include # define _(Text) gettext (Text) #else -# undef bindtextdomain +# undef bindtextdomain # define bindtextdomain(Domain, Directory) -# undef textdomain +# undef textdomain # define textdomain(Domain) +# undef ngettext +# define ngettext(Singular, Plural, Num) Plural # define _(Text) Text #endif #define N_(Text) Text @@ -123,8 +145,6 @@ extern int errno; # define LOCALEDIR "/usr/local/share/locale" #endif -#endif /* BISON_SYSTEM_H */ - /*-----------. | Booleans. | @@ -141,12 +161,12 @@ typedef int bool; | Obstacks. | `-----------*/ -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free -#include "obstack.h" +# define obstack_chunk_alloc xmalloc +# define obstack_chunk_free free +# include "obstack.h" -#define obstack_grow_literal_string(Obs, Str) \ - obstack_grow (Obs, Str, sizeof (Str) - 1) +#define obstack_sgrow(Obs, Str) \ + obstack_grow (Obs, Str, strlen (Str)) #define obstack_fgrow1(Obs, Format, Arg1) \ do { \ @@ -169,6 +189,13 @@ do { \ 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) + /*---------------------------------. | Machine-dependencies for Bison. | @@ -202,8 +229,8 @@ do { \ /* VMS. */ # define EXT_TAB "_tab" # define EXT_OUTPUT ".output" -# define EXT_STYPE_H "_stype.h" -# define EXT_GUARD_C "_guard.c" +# define EXT_STYPE_H "_stype" +# define EXT_GUARD_C "_guard" #else /* ! VMS */ # ifdef MSDOS /* MS DOS. */ @@ -215,8 +242,8 @@ do { \ /* Standard. */ # define EXT_TAB ".tab" # define EXT_OUTPUT ".output" -# define EXT_STYPE_H ".stype.h" -# define EXT_GUARD_C ".guard.c" +# define EXT_STYPE_H ".stype" +# define EXT_GUARD_C ".guard" # endif /* ! MSDOS */ #endif /* ! VMS */ @@ -237,3 +264,15 @@ do { \ # define BISON_HAIRY "c:/usr/local/lib/bison.hairy" # endif #endif + + +/*---------------------------------. +| Debugging the memory allocator. | +`---------------------------------*/ + +# if WITH_DMALLOC +# define DMALLOC_FUNC_CHECK +# include +# endif /* WITH_DMALLOC */ + +#endif /* BISON_SYSTEM_H */