]> granicus.if.org Git - fribidi/commitdiff
Simplify fribidi-types.h a bit
authorKhaled Hosny <khaledhosny@eglug.org>
Mon, 13 Nov 2017 15:14:20 +0000 (17:14 +0200)
committerKhaled Hosny <khaledhosny@eglug.org>
Wed, 15 Nov 2017 22:35:08 +0000 (00:35 +0200)
It is 2017, I think we can rely on the presence of one of these three
int types headers.

Also rename types that are not exposed in public headers to use the
standard names.

12 files changed:
.indent.pro
configure.ac
gen.tab/gen-bidi-type-tab.c
gen.tab/gen-brackets-tab.c
gen.tab/gen-brackets-type-tab.c
gen.tab/gen-joining-type-tab.c
gen.tab/gen-mirroring-tab.c
lib/fribidi-bidi-types.h
lib/fribidi-brackets.c
lib/fribidi-flags.h
lib/fribidi-joining-types.h
lib/fribidi-types.h

index 4359aac896622729625684cee343b092597d8bcf..dd9e1ac5cd5d4253ef494ed8d82ebfe714b16d93 100644 (file)
@@ -14,7 +14,3 @@
 -T FriBidiMemChunk
 -T FriBidiEnv
 -T FriBidiRun
--T fribidi_uint8
--T fribidi_uint16
--T fribidi_uint32
--T fribidi_boolean
index 8d324b3b4f52a2c3b58dfa20ea23d1f831be3e76..1d937294fa933ac1e3ffbfaece2b3b9b91a80397 100644 (file)
@@ -107,7 +107,7 @@ AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
 
 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([stdlib.h string.h strings.h inttypes.h wchar.h asm/page.h sys/times.h])
+AC_CHECK_HEADERS([stdlib.h string.h strings.h wchar.h asm/page.h sys/times.h])
 
 # Checks for typedefs and structures.
 AC_C_CONST
index a29a3f845be27674d2cd2bc6850e0c2f844a433e..c113ba305502b93fff274ed950067b5ea6d5b326 100644 (file)
@@ -324,9 +324,9 @@ gen_bidi_type_tab (
          FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
          FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
 
-  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
-         "#define PACKTAB_UINT16 fribidi_uint16\n"
-         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+  printf ("#define PACKTAB_UINT8 uint8_t\n"
+         "#define PACKTAB_UINT16 uint16_t\n"
+         "#define PACKTAB_UINT32 uint32_t\n\n");
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, 1, LTR, max_depth, 3, names,
index f9616d40c4420506f01eff2f063804fb48287495..810ed3fbd6fdd9d44df13f3d37ac00607e6cc976 100644 (file)
@@ -292,13 +292,13 @@ gen_brackets_tab (
          FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
          FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
 
-  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
-         "#define PACKTAB_UINT16 fribidi_uint16\n"
-         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+  printf ("#define PACKTAB_UINT8 uint8_t\n"
+         "#define PACKTAB_UINT16 uint16_t\n"
+         "#define PACKTAB_UINT32 uint32_t\n\n");
 
   key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
-  key_type = key_bytes == 1 ? "fribidi_int8" : key_bytes == 2 ?
-    "fribidi_int16" : "fribidi_int32";
+  key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
+    "int16_t" : "int32_t";
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
index 6c7334cf9d57ed8b3ef37877fc88291814078b52..8111ade4a929bdc68f7a73ac1a25aa8b32868475 100644 (file)
@@ -191,13 +191,13 @@ gen_brackets_tab (
          FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
          FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
 
-  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
-         "#define PACKTAB_UINT16 fribidi_uint16\n"
-         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+  printf ("#define PACKTAB_UINT8 uint8_t\n"
+         "#define PACKTAB_UINT16 uint16_t\n"
+         "#define PACKTAB_UINT32 uint32_t\n\n");
 
   key_bytes = 1;
-  key_type = key_bytes == 1 ? "fribidi_int8" : key_bytes == 2 ?
-    "fribidi_int16" : "fribidi_int32";
+  key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
+    "int16_t" : "int32_t";
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
index 8a3f0248689a8a483741de018c70eae38bfc0452..037b455c163aac29c4097a5cd561b05c92c88b2b 100644 (file)
@@ -319,9 +319,9 @@ gen_joining_type_tab (
          FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
          data_file_type[1]);
 
-  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
-         "#define PACKTAB_UINT16 fribidi_uint16\n"
-         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+  printf ("#define PACKTAB_UINT8 uint8_t\n"
+         "#define PACKTAB_UINT16 uint16_t\n"
+         "#define PACKTAB_UINT32 uint32_t\n\n");
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, 1, U, max_depth, 1, names,
index f577e688275de54ea7387ff6c3d64a6e0898411f..7a042efd7736a7d60ea84169552294795a40191d 100644 (file)
@@ -200,13 +200,13 @@ gen_mirroring_tab (
          FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
          FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
 
-  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
-         "#define PACKTAB_UINT16 fribidi_uint16\n"
-         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+  printf ("#define PACKTAB_UINT8 uint8_t\n"
+         "#define PACKTAB_UINT16 uint16_t\n"
+         "#define PACKTAB_UINT32 uint32_t\n\n");
 
   key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
-  key_type = key_bytes == 1 ? "fribidi_int8" : key_bytes == 2 ?
-    "fribidi_int16" : "fribidi_int32";
+  key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
+    "int16_t" : "int32_t";
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
index bff0021f5ece870e542dac2281a5b87256495a4e..be2890c97c40d841c11123c57dc587969c82c46b 100644 (file)
@@ -209,7 +209,7 @@ typedef enum
 
 #else
 
-typedef fribidi_uint32 FriBidiCharType;
+typedef uint32_t FriBidiCharType;
 # define FRIBIDI_TYPE_LTR      FRIBIDI_TYPE_LTR_VAL
 # define FRIBIDI_TYPE_RTL      FRIBIDI_TYPE_RTL_VAL
 # define FRIBIDI_TYPE_AL       FRIBIDI_TYPE_AL_VAL
@@ -234,7 +234,7 @@ typedef fribidi_uint32 FriBidiCharType;
 # define FRIBIDI_TYPE_FSI      FRIBIDI_TYPE_PDF_FSI
 # define FRIBIDI_TYPE_PDI      FRIBIDI_TYPE_PDF_PDI
 
-typedef fribidi_uint32 FriBidiParType;
+typedef uint32_t FriBidiParType;
 # define FRIBIDI_PAR_LTR       FRIBIDI_TYPE_LTR_VAL
 # define FRIBIDI_PAR_RTL       FRIBIDI_TYPE_RTL_VAL
 # define FRIBIDI_PAR_ON                FRIBIDI_TYPE_ON_VAL
index b7b1342f91b0529de0338d04a151fd546dfc945e..94185ffb6d0a0b3a7f11914a2b7061ad484adc40 100644 (file)
@@ -46,7 +46,7 @@ fribidi_get_bracket (
 )
 {
   FriBidiBracketType bracket_type;
-  register fribidi_uint8 char_type;
+  register uint8_t char_type;
 
   /* The bracket type from the table may be:
         0 - Not a bracket
index f69b8de4f3b178b45caf4e5bdb9c047202de8863..31558a4681d2b67f3a83c05bbd9e9e881dcd083a 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "fribidi-begindecls.h"
 
-typedef fribidi_uint32 FriBidiFlags;
+typedef uint32_t FriBidiFlags;
 
 /* 
  * Define option flags that various functions use. Each mask has
index 6597d8a5bb59197008a63d9564b3b797fbe99d77..ac4d22d9ba747c962307a683025491565458507e 100644 (file)
@@ -95,12 +95,12 @@ enum _FriBidiJoiningTypeEnum
 #ifdef __FRIBIDI_DOC
 typedef enum _FriBidiJoiningTypeEnum FriBidiJoiningType;
 #else /* !__FRIBIDI_DOC */
-typedef fribidi_uint8 FriBidiJoiningType;
+typedef uint8_t FriBidiJoiningType;
 #endif /* !__FRIBIDI_DOC */
 
 /* FriBidiArabicProp is essentially the same type as FriBidiJoiningType, but
  * not limited to the few values returned by fribidi_get_joining_type. */
-typedef fribidi_uint8 FriBidiArabicProp;
+typedef uint8_t FriBidiArabicProp;
 
 /*
  * The equivalent of JoiningType values for ArabicProp
index f95742a3c2e27ae9d055faf315a5ccf85424357a..de144c4e0f867205b883960ace0a01fc9d00af9f 100644 (file)
 #ifndef _FRIBIDI_TYPES_H
 #define _FRIBIDI_TYPES_H
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "fribidi-common.h"
 
 #include "fribidi-begindecls.h"
 
 
-# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
-#  ifndef __FRIBIDI_DOC
-#   if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#   elif HAVE_STDINT_H
-#    include <stdint.h>
-#   endif /* !HAVE_STDINT_H */
-#  endif /* !__FRIBIDI_DOC */
-#  define FRIBIDI_INT8_LOCAL           int8_t
-#  define FRIBIDI_INT16_LOCAL          int16_t
-#  define FRIBIDI_INT32_LOCAL          int32_t
-#  define FRIBIDI_UINT8_LOCAL          uint8_t
-#  define FRIBIDI_UINT16_LOCAL         uint16_t
-#  define FRIBIDI_UINT32_LOCAL         uint32_t
-# else /* no int types */
-#  define FRIBIDI_INT8_LOCAL           signed char
-#  define FRIBIDI_UINT8_LOCAL          unsigned char
-#  if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
-#   define FRIBIDI_INT16_LOCAL         signed short
-#   define FRIBIDI_UINT16_LOCAL                unsigned short
-#   define FRIBIDI_INT32_LOCAL         signed int
-#   define FRIBIDI_UINT32_LOCAL                unsigned int
-#  else        /* SIZEOF_INT < 4 */
-#   define FRIBIDI_INT16_LOCAL         signed int
-#   define FRIBIDI_UINT16_LOCAL                unsigned int
-#   define FRIBIDI_INT32_LOCAL         signed long
-#   define FRIBIDI_UINT32_LOCAL                unsigned long
-#  endif /* SIZEOF_INT < 4 */
-# endif        /* no int types */
-# define FRIBIDI_BOOLEAN_LOCAL         int
-# if SIZEOF_WCHAR_T >= 4
-#  ifndef __FRIBIDI_DOC
-#   if STDC_HEADERS
-#    include <stdlib.h>
-#    include <stddef.h>
-#   else /* !STDC_HEADERS */
-#    if HAVE_STDLIB_H
-#     include <stdlib.h>
-#    endif /* !HAVE_STDLIB_H */
-#   endif /* !STDC_HEADERS */
-#  endif /* !__FRIBIDI_DOC */
-#  define FRIBIDI_UNICHAR_LOCAL                wchar_t
-# else /* SIZEOF_WCHAR_T < 4 */
-#  define FRIBIDI_UNICHAR_LOCAL                fribidi_uint32
-# endif        /* SIZEOF_WCHAR_T < 4 */
-
-#if FRIBIDI_INT_TYPES+0
-#else
-# define FRIBIDI_INT8  FRIBIDI_INT8_LOCAL
-# define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL
-# define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL
-# define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL
-# define FRIBIDI_UINT16        FRIBIDI_UINT16_LOCAL
-# define FRIBIDI_UINT32        FRIBIDI_UINT32_LOCAL
-#endif /* !FRIBIDI_INT_TYPES */
-#ifndef FRIBIDI_BOOLEAN
-# define FRIBIDI_BOOLEAN       FRIBIDI_BOOLEAN_LOCAL
-#endif /* !FRIBIDI_BOOLEAN */
-#ifndef FRIBIDI_UNICHAR
-# define FRIBIDI_UNICHAR FRIBIDI_UNICHAR_LOCAL
-#endif /* !FRIBIDI_UNICHAR */
-#ifndef FRIBIDI_STR_INDEX
-# define FRIBIDI_STR_INDEX int
-#endif /* FRIBIDI_STR_INDEX */
-
-
-typedef FRIBIDI_INT8 fribidi_int8;
-typedef FRIBIDI_INT16 fribidi_int16;
-typedef FRIBIDI_INT32 fribidi_int32;
-typedef FRIBIDI_UINT8 fribidi_uint8;
-typedef FRIBIDI_UINT16 fribidi_uint16;
-typedef FRIBIDI_UINT32 fribidi_uint32;
-typedef FRIBIDI_BOOLEAN fribidi_boolean;
-
-typedef FRIBIDI_UNICHAR FriBidiChar;
-typedef FRIBIDI_STR_INDEX FriBidiStrIndex;
+#ifndef __FRIBIDI_DOC
+# if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
+     defined (_sgi) || defined (__sun) || defined (sun) || \
+     defined (__digital__) || defined (__HP_cc)
+#  include <inttypes.h>
+# elif defined (_AIX)
+#  include <sys/inttypes.h>
+# else
+#  include <stdint.h>
+# endif
+#endif
+
+typedef int fribidi_boolean;
+
+typedef uint32_t FriBidiChar;
+typedef int FriBidiStrIndex;
 
 /* The MSB is used to indicate an opening bracket */
 typedef FriBidiChar FriBidiBracketType;