diff options
-rw-r--r-- | flexdef.h | 61 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | misc.c | 13 | ||||
-rw-r--r-- | scanopt.c | 1 |
4 files changed, 56 insertions, 25 deletions
@@ -34,38 +34,73 @@ #ifndef FLEXDEF_H #define FLEXDEF_H 1 +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef STDC_HEADERS #include <stdio.h> +#include <stdlib.h> +#include <setjmp.h> +#include <ctype.h> +#include <string.h> +#endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif -#include <ctype.h> -#include <limits.h> -#include <setjmp.h> - -#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 <string.h> +/* 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 <strings.h> +__extension__ +typedef unsigned long long int uint64_t; #endif +#endif /* ! HAVE_INTTYPES_H_WITH_UINTMAX */ #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif - #ifdef HAVE_MALLOC_H #include <malloc.h> #endif - -#ifdef STDC_HEADERS -#include <stdlib.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> #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 <locale.h> +#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 @@ -31,17 +31,13 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ -#include <config.h> -#ifdef ENABLE_NLS -#include <locale.h> -#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 **)); @@ -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)); } @@ -31,6 +31,7 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ +#include "flexdef.h" #include "scanopt.h" |