Permalink
Browse files

Simplify fribidi-types.h a bit

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.
  • Loading branch information...
khaledhosny committed Nov 13, 2017
1 parent c8e9c5d commit 90325b276006f2cf344c77f00db541437345cff9
View
@@ -14,7 +14,3 @@
-T FriBidiMemChunk
-T FriBidiEnv
-T FriBidiRun
-T fribidi_uint8
-T fribidi_uint16
-T fribidi_uint32
-T fribidi_boolean
View
@@ -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
@@ -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,
View
@@ -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,
@@ -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,
@@ -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,
@@ -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,
View
@@ -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
View
@@ -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
View
@@ -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
@@ -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
View
@@ -33,87 +33,31 @@
#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;

0 comments on commit 90325b2

Please sign in to comment.