diff options
-rw-r--r-- | flex.skl | 80 | ||||
-rw-r--r-- | flexdef.h | 65 |
2 files changed, 80 insertions, 65 deletions
@@ -33,6 +33,9 @@ m4_changecom #define YY_FLEX_VERSION VERSION /* First, we deal with platform-specific or compiler-specific issues. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif /* begin standard C headers. */ %push @@ -41,10 +44,85 @@ m4_changecom #include <string.h> #include <errno.h> #include <stdlib.h> + +/* We try to get some modern integral types defined */ +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +/* sometimes, inttypes.h doesn't do everything that we would have +hoped, so we make sure we have what we need. We try to avoid +redefinition warnings though. The idea is that if we have int8_t then +we probably have the other int*_t types. The logic is similar with +uint*_t types. */ + +#ifndef HAVE_INT8_T + +/* Exact integral types. */ + +/* Signed. */ + +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 /* ! HAVE_INT8_T */ + +#ifndef HAVE_UINT8_T + +/* 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 +__extension__ typedef unsigned long long int uint64_t; +#endif +#endif /* ! HAVE_UINT8_T */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + %pop %if-tables-serialization -#include <stdint.h> #include <netinet/in.h> %endif /* end standard C headers. */ @@ -48,73 +48,10 @@ #ifdef HAVE_LIMITS_H #include <limits.h> #endif -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#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 - -/* 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 -__extension__ typedef unsigned long long int uint64_t; -#endif -#endif /* ! HAVE_INTTYPES_H_WITH_UINTMAX */ - - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif + #ifdef HAVE_UNISTD_H #include <unistd.h> #endif |