diff options
author | wlestes <wlestes> | 2002-10-07 15:29:46 +0000 |
---|---|---|
committer | wlestes <wlestes> | 2002-10-07 15:29:46 +0000 |
commit | eaf0fdc636c519199858f3ccefc8338c8c853adb (patch) | |
tree | 6ef44eb6378bb61f1276b21bd6723f795639769d /flex.skl | |
parent | 3fb7cd72820c27170fa1b5871228a2195da081c1 (diff) | |
download | flex-eaf0fdc636c519199858f3ccefc8338c8c853adb.tar.gz |
ok, here goes; try to handle integral typedefs in one swell foop
Diffstat (limited to 'flex.skl')
-rw-r--r-- | flex.skl | 80 |
1 files changed, 79 insertions, 1 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. */ |