]> granicus.if.org Git - flex/commitdiff
#include fixes; we've factored out all the system include files and put them in flexdef.h
authorWill Estes <wlestes@users.sourceforge.net>
Thu, 29 Aug 2002 20:30:24 +0000 (20:30 +0000)
committerWill Estes <wlestes@users.sourceforge.net>
Thu, 29 Aug 2002 20:30:24 +0000 (20:30 +0000)
flexdef.h
main.c
misc.c
scanopt.c

index 6a47bacda7bd1aab6043a8e16ade2c4f363f5677..e23b627b162fce75ce64100a7cccddf1a7741020 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
 #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
diff --git a/main.c b/main.c
index 523634afe83db919387a5fbe212b0ae04ad174f3..15f98b76bd0ba063dfc04b82fe4994afe5167cc8 100644 (file)
--- a/main.c
+++ b/main.c
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 \f
-#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 **));
diff --git a/misc.c b/misc.c
index 7fe6cde77aca8eef8fc093e1ddf4b9e857e0e4ba..05599c0203196124d7664e71c3538c8da815bf1d 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -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));
 }
 
index 9fb6e7014f680b62d2791354e421879029a37605..cc7f63198122e0fb42c5267319c468e750fdfb19 100644 (file)
--- a/scanopt.c
+++ b/scanopt.c
@@ -31,6 +31,7 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 \f
+#include "flexdef.h"
 #include "scanopt.h"