summaryrefslogtreecommitdiff
path: root/src/flexint.h
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2016-01-22 13:51:30 -0800
committerManoj Srivastava <srivasta@debian.org>2016-01-22 13:51:30 -0800
commitf753f2b7b6d97014110dbe418861353a2f3f445d (patch)
tree7f248ce2f59fbb79cab24b4727955e37e9a5ab81 /src/flexint.h
parent306163051847aaaabe7ae0f4cfc7d23f15923f3a (diff)
parenta646b6cd438dc4bd957c6c6afd89b5e8e59468fe (diff)
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@debian.org> # Conflicts: # INSTALL # Makefile.in # aclocal.m4 # build-aux/compile # build-aux/config.guess # build-aux/config.sub # build-aux/depcomp # build-aux/install-sh # build-aux/mdate-sh # build-aux/texinfo.tex # configure # doc/Makefile.in # doc/flex.1 # doc/flex.info # doc/flex.info-1 # doc/flex.info-2 # doc/flex.pdf # doc/stamp-vti # doc/version.texi # examples/Makefile.in # examples/fastwc/Makefile.in # examples/manual/Makefile.in # src/config.h.in # tests/Makefile.in # tests/test-bison-nr/Makefile.am # tests/test-bison-yylloc/Makefile.am # tests/test-bison-yylval/Makefile.am # tools/Makefile.in
Diffstat (limited to 'src/flexint.h')
-rw-r--r--src/flexint.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/flexint.h b/src/flexint.h
new file mode 100644
index 0000000..f9fa80c
--- /dev/null
+++ b/src/flexint.h
@@ -0,0 +1,63 @@
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_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
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */