From: Will Estes Date: Thu, 29 Aug 2002 20:30:24 +0000 (+0000) Subject: #include fixes; we've factored out all the system include files and put them in flexdef.h X-Git-Tag: flex-2-5-17~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75e418c498ca2c604eeb784829e33a7865843d53;p=flex #include fixes; we've factored out all the system include files and put them in flexdef.h --- diff --git a/flexdef.h b/flexdef.h index 6a47bac..e23b627 100644 --- a/flexdef.h +++ b/flexdef.h @@ -34,38 +34,73 @@ #ifndef FLEXDEF_H #define FLEXDEF_H 1 +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef STDC_HEADERS #include +#include +#include +#include +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif #ifdef HAVE_STDINT_H #include #endif -#include -#include -#include - -#ifdef HAVE_CONFIG_H -#include "config.h" +#ifndef HAVE_INTTYPES_H_WITH_UINTMAX +/* Exact integral types. */ + +/* Signed. */ + +#ifndef __int8_t_defined +# define __int8_t_defined +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +# if __WORDSIZE == 64 +typedef long int int64_t; +# else +__extension__ +typedef long long int int64_t; +# endif #endif -#ifdef HAVE_STRING_H -#include +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +#if __WORDSIZE == 64 +typedef unsigned long int uint64_t; #else -#include +__extension__ +typedef unsigned long long int uint64_t; #endif +#endif /* ! HAVE_INTTYPES_H_WITH_UINTMAX */ #ifdef HAVE_SYS_TYPES_H #include #endif - #ifdef HAVE_MALLOC_H #include #endif - -#ifdef STDC_HEADERS -#include +#ifdef HAVE_UNISTD_H +#include #endif +/* We use gettext. So, when we write strings which should be translated, we mark them with _() */ +#ifdef ENABLE_NLS +#ifdef HAVE_LOCALE_H +#include +#endif /* HAVE_LOCALE_H */ #include "gettext.h" #define _(String) gettext (String) +#else +#define _(STRING) STRING +#endif /* ENABLE_NLS */ /* Always be prepared to generate an 8-bit scanner. */ #define CSIZE 256 diff --git a/main.c b/main.c index 523634a..15f98b7 100644 --- a/main.c +++ b/main.c @@ -31,17 +31,13 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ -#include -#ifdef ENABLE_NLS -#include -#endif /* ENABLE_NLS */ + #include "flexdef.h" #include "version.h" #include "options.h" static char flex_version[] = FLEX_VERSION; - /* declare functions that have forward references */ void flexinit PROTO ((int, char **)); diff --git a/misc.c b/misc.c index 7fe6cde..05599c0 100644 --- a/misc.c +++ b/misc.c @@ -31,7 +31,6 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ - #include "flexdef.h" /* Append "#define defname value\n" to the running buffer. */ @@ -43,8 +42,8 @@ void action_define (defname, value) char *cpy; if ((int) strlen (defname) > MAXLINE / 2) { - format_pinpoint_message (_ - ("name \"%s\" ridiculously long"), + format_pinpoint_message ( + _("name \"%s\" ridiculously long"), defname); return; } @@ -97,8 +96,8 @@ void *allocate_array (size, element_size) mem = flex_alloc (num_bytes); if (!mem) - flexfatal (_ - ("memory allocation failed in allocate_array()")); + flexfatal ( + _("memory allocation failed in allocate_array()")); return mem; } @@ -177,8 +176,8 @@ void check_char (c) readable_form (c)); if (c >= csize) - lerrsf (_ - ("scanner requires -8 flag to use the character %s"), + lerrsf ( + _("scanner requires -8 flag to use the character %s"), readable_form (c)); } diff --git a/scanopt.c b/scanopt.c index 9fb6e70..cc7f631 100644 --- a/scanopt.c +++ b/scanopt.c @@ -31,6 +31,7 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ +#include "flexdef.h" #include "scanopt.h"