From 67165cf7c1215202050970836c51613fcefa9478 Mon Sep 17 00:00:00 2001 From: Will Estes Date: Thu, 10 Oct 2002 15:34:31 +0000 Subject: [PATCH] redo integral types again; add flexint.h; change dependencies caused by adding flexint.h; remove autoconf wrapper around cunistd; restore netinet/in.h includes; remove unneded feature checks in configure.in --- Makefile.am | 40 ++++++++++++++++--------------- configure.in | 3 +-- flex.skl | 65 ++++----------------------------------------------- flexdef.h | 11 ++++----- flexint.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 87 deletions(-) create mode 100644 flexint.h diff --git a/Makefile.am b/Makefile.am index d849e03..0a8c9e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,6 +75,7 @@ libfl_a_SOURCES = \ noinst_HEADERS = \ flexdef.h \ + flexint.h \ version.h \ options.h \ scanopt.h \ @@ -125,7 +126,7 @@ localedir = $(datadir)/locale AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I@includedir@ -I$(top_srcdir)/intl LIBS = @LIBINTL@ @LIBS@ -skel.c: flex.skl mkskel.sh +skel.c: flex.skl mkskel.sh flexint.h tables_shared.h $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` $(srcdir)/flex.skl | $(SHELL) $(srcdir)/mkskel.sh >skel.c $(man_MANS): $(srcdir)/main.c @@ -135,27 +136,28 @@ $(man_MANS): $(srcdir)/main.c # Explicitly describe dependencies. # You can recreate this with `gcc -I. -MM *.c' -buf.o: buf.c flexdef.h -ccl.o: ccl.c flexdef.h -dfa.o: dfa.c flexdef.h tables.h tables_shared.h -ecs.o: ecs.c flexdef.h -gen.o: gen.c flexdef.h tables.h tables_shared.h +buf.o: buf.c flexdef.h flexint.h +ccl.o: ccl.c flexdef.h flexint.h +dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h +ecs.o: ecs.c flexdef.h flexint.h +gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h libmain.o: libmain.c libyywrap.o: libyywrap.c -main.o: main.c flexdef.h version.h options.h scanopt.h tables.h \ +main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \ + tables.h tables_shared.h +misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h +nfa.o: nfa.c flexdef.h flexint.h +options.o: options.c options.h scanopt.h flexdef.h flexint.h +parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h +scan.o: scan.c flexdef.h flexint.h parse.h +scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h +skel.o: skel.c flexdef.h flexint.h +sym.o: sym.c flexdef.h flexint.h +tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h +tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \ tables_shared.h -misc.o: misc.c flexdef.h tables.h tables_shared.h -nfa.o: nfa.c flexdef.h -options.o: options.c options.h scanopt.h flexdef.h -parse.o: parse.c flexdef.h tables.h tables_shared.h -scan.o: scan.c flexdef.h parse.h -scanopt.o: scanopt.c flexdef.h scanopt.h -skel.o: skel.c flexdef.h -sym.o: sym.c flexdef.h -tables.o: tables.c flexdef.h tables.h tables_shared.h -tables_shared.o: tables_shared.c flexdef.h tables.h tables_shared.h -tblcmp.o: tblcmp.c flexdef.h -yylex.o: yylex.c flexdef.h parse.h +tblcmp.o: tblcmp.c flexdef.h flexint.h +yylex.o: yylex.c flexdef.h flexint.h parse.h # Create a tags file. tags: diff --git a/configure.in b/configure.in index 07cc8a3..f0e3daa 100644 --- a/configure.in +++ b/configure.in @@ -62,13 +62,12 @@ dnl checks for libraries dnl checks for header files AC_HEADER_STDC -AC_CHECK_HEADERS(sys/types.h unistd.h stdbool.h) +AC_CHECK_HEADERS(unistd.h stdbool.h netinet/in.h) AC_CHECK_HEADERS(cunistd) dnl checks for types AC_TYPE_SIZE_T -AC_CHECK_TYPES([int8_t, uint8_t]) dnl checks for functions diff --git a/flex.skl b/flex.skl index e232769..1ed8770 100644 --- a/flex.skl +++ b/flex.skl @@ -43,64 +43,6 @@ m4_changecom #include #include #include - -/* We try to get some modern integral types defined */ - -/* 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 - -/* 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 - -/* 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 @@ -108,6 +50,11 @@ __extension__ typedef unsigned long long int uint64_t; %endif /* end standard C headers. */ +%push +%c-or-c++ +m4_include(`flexint.h') +%pop + %push %c++-only /* begin standard C++ headers. */ @@ -559,9 +506,7 @@ static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG )); %pop %push %c++-only -#ifdef HAVE_CUNISTD #include -#endif %pop #endif /* !YY_NO_UNISTD_H */ diff --git a/flexdef.h b/flexdef.h index 3dab6c4..814a885 100644 --- a/flexdef.h +++ b/flexdef.h @@ -49,12 +49,7 @@ #ifdef HAVE_LIMITS_H #include #endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_INTTYPES_H -#include -#endif +#include "flexint.h" #ifdef HAVE_UNISTD_H #include #endif @@ -128,6 +123,10 @@ #define unspecified -1 +#ifdef HAVE_NETINET_IN_H +#include +#endif + /* Special chk[] values marking the slots taking by end-of-buffer and action * numbers. */ diff --git a/flexint.h b/flexint.h new file mode 100644 index 0000000..011305c --- /dev/null +++ b/flexint.h @@ -0,0 +1,66 @@ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901 +#include +#else +/* Exact integral types. */ + +/* Signed. */ + +#define int8_t signed char +#define int16_t short int +#define int32_t int + +# if __WORDSIZE == 64 || defined __arch64__ +#define int64_t long int +# else +#define int64_t long long int +# endif + +/* Unsigned. */ + +#define uint8_t unsigned char +#define uint16_t unsigned short int +#define uint32_t unsigned int + +#if __WORDSIZE == 64 || defined __arch64__ +#define uint64_t unsigned long int +#else +#define uint64_t unsigned long long int +#endif + +/* 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 /* not C99 system */ + +#endif /* ! FLEXINT_H */ -- 2.40.0