diff options
-rw-r--r-- | bin/Makefile.am | 5 | ||||
-rw-r--r-- | bin/fribidi-benchmark.c | 4 | ||||
-rw-r--r-- | bin/fribidi-main.c | 12 | ||||
-rw-r--r-- | charset/Makefile.am | 3 | ||||
-rw-r--r-- | charset/fribidi-char-sets.c | 11 | ||||
-rw-r--r-- | configure.ac | 14 | ||||
-rw-r--r-- | fribidi-vs-unicode/Makefile.am | 4 | ||||
-rw-r--r-- | fribidi.pc.in | 1 | ||||
-rw-r--r-- | gen.tab/Makefile.am | 5 | ||||
-rw-r--r-- | lib/Makefile.am | 4 | ||||
-rw-r--r-- | lib/common.h | 57 | ||||
-rw-r--r-- | lib/fribidi-common.h | 67 | ||||
-rw-r--r-- | lib/fribidi-config.h.in | 3 | ||||
-rw-r--r-- | lib/fribidi-types.h | 20 | ||||
-rw-r--r-- | lib/fribidi.c | 5 |
15 files changed, 74 insertions, 141 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am index fd495ad..7aab22e 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -14,10 +14,9 @@ fribidi_benchmark_SOURCES = fribidi-benchmark.c $(getopt_SOURCES) AM_CPPFLAGS = \ -I$(top_builddir)/lib \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/charset \ - $(MISC_CFLAGS) + -I$(top_srcdir)/charset -LDADD = $(top_builddir)/lib/libfribidi.la $(MISC_LIBS) +LDADD = $(top_builddir)/lib/libfribidi.la if FRIBIDI_CHARSETS else # !FRIBIDI_CHARSETS diff --git a/bin/fribidi-benchmark.c b/bin/fribidi-benchmark.c index 233239b..151262b 100644 --- a/bin/fribidi-benchmark.c +++ b/bin/fribidi-benchmark.c @@ -218,7 +218,7 @@ benchmark ( { /* Create a bidi string */ base = FRIBIDI_PAR_ON; -FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS +FRIBIDI_BEGIN_IGNORE_DEPRECATIONS if (!fribidi_log2vis (us, len, &base, /* output */ out_us, positionVtoL, positionLtoV, @@ -226,7 +226,7 @@ FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS die2 ("something failed in fribidi_log2vis.\n" "perhaps memory allocation failure.", NULL); -FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS +FRIBIDI_END_IGNORE_DEPRECATIONS } /* stop timer */ diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c index 084518d..ac0b97f 100644 --- a/bin/fribidi-main.c +++ b/bin/fribidi-main.c @@ -344,10 +344,10 @@ main ( if (!char_set_num) die2 ("unrecognized character set `%s'\n", char_set); -FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS +FRIBIDI_BEGIN_IGNORE_DEPRECATIONS fribidi_set_mirroring (do_mirror); fribidi_set_reorder_nsm (do_reorder_nsm); -FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS +FRIBIDI_END_IGNORE_DEPRECATIONS exit_val = 0; file_found = false; while (optind < argc || !file_found) @@ -427,11 +427,11 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS /* Create a bidi string. */ base = input_base_direction; -FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS +FRIBIDI_BEGIN_IGNORE_DEPRECATIONS log2vis = fribidi_log2vis (logical, len, &base, /* output */ visual, ltov, vtol, levels); -FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS +FRIBIDI_END_IGNORE_DEPRECATIONS if (log2vis) { @@ -439,12 +439,12 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS printf ("%-*s => ", padding_width, S_); /* Remove explicit marks, if asked for. */ -FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS +FRIBIDI_BEGIN_IGNORE_DEPRECATIONS if (do_clean) len = fribidi_remove_bidi_marks (visual, len, ltov, vtol, levels); -FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS +FRIBIDI_END_IGNORE_DEPRECATIONS if (show_visual) { diff --git a/charset/Makefile.am b/charset/Makefile.am index 6caf121..3709c1d 100644 --- a/charset/Makefile.am +++ b/charset/Makefile.am @@ -2,8 +2,7 @@ noinst_LTLIBRARIES = libfribidi-char-sets.la AM_CPPFLAGS = \ -I$(top_builddir)/lib \ - -I$(top_srcdir)/lib \ - $(MISC_CFLAGS) + -I$(top_srcdir)/lib pkginclude_HEADERS = diff --git a/charset/fribidi-char-sets.c b/charset/fribidi-char-sets.c index f7156b4..5a9e21e 100644 --- a/charset/fribidi-char-sets.c +++ b/charset/fribidi-char-sets.c @@ -113,12 +113,8 @@ static FriBidiCharSetHandler char_sets[FRIBIDI_CHAR_SETS_NUM + 1] = { # undef _FRIBIDI_ADD_CHAR_SET_ONE2ONE }; -#if FRIBIDI_USE_GLIB+0 -# include <glib/gstrfuncs.h> -# define fribidi_strcasecmp g_ascii_strcasecmp -#else /* !FRIBIDI_USE_GLIB */ static char -toupper ( +fribidi_toupper ( /* input */ char c ) @@ -133,14 +129,13 @@ fribidi_strcasecmp ( const char *s2 ) { - while (*s1 && toupper (*s1) == toupper (*s2)) + while (*s1 && fribidi_toupper (*s1) == fribidi_toupper (*s2)) { s1++; s2++; } - return toupper (*s1) - toupper (*s2); + return fribidi_toupper (*s1) - fribidi_toupper (*s2); } -#endif /* !FRIBIDI_USE_GLIB */ FRIBIDI_ENTRY FriBidiCharSet fribidi_parse_charset ( diff --git a/configure.ac b/configure.ac index c98380c..8d324b3 100644 --- a/configure.ac +++ b/configure.ac @@ -173,8 +173,6 @@ AC_ARG_WITH(glib, [use Glib @<:@default=auto@:>@])) GLIB_PACKAGE=glib-2.0 GLIB_MINVERSION=2.4 -GLIB_LIBS= -GLIB_CFLAGS= if test x$with_glib = xyes; then PKG_CHECK_MODULES(GLIB,$GLIB_PACKAGE >= $GLIB_MINVERSION) FRIBIDI_USE_GLIB=1 @@ -187,20 +185,8 @@ else FRIBIDI_USE_GLIB=0) fi fi -if test x$FRIBIDI_USE_GLIB = x0; then - GLIB_PACKAGE= -fi -AC_SUBST(FRIBIDI_USE_GLIB) AM_CONDITIONAL(FRIBIDI_USE_GLIB, test x$FRIBIDI_USE_GLIB = x1) - -MISC_CFLAGS="$GLIB_CFLAGS" -MISC_LIBS="$GLIB_LIBS" -MISC_PACKAGES="$GLIB_PACKAGE" -AC_SUBST(MISC_CFLAGS) -AC_SUBST(MISC_LIBS) -AC_SUBST(MISC_PACKAGES) - # Generate output AC_CONFIG_FILES([fribidi.pc lib/fribidi-config.h diff --git a/fribidi-vs-unicode/Makefile.am b/fribidi-vs-unicode/Makefile.am index 22e4931..e24cc53 100644 --- a/fribidi-vs-unicode/Makefile.am +++ b/fribidi-vs-unicode/Makefile.am @@ -10,8 +10,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/lib \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/charset \ - $(MISC_CFLAGS) -LDADD = $(top_builddir)/lib/libfribidi.la $(MISC_LIBS) + $(GLIB_CFLAGS) +LDADD = $(top_builddir)/lib/libfribidi.la $(GLIB_LIBS) if FRIBIDI_USE_GLIB check_PROGRAMS = test test-character diff --git a/fribidi.pc.in b/fribidi.pc.in index 7988fca..bb3a51c 100644 --- a/fribidi.pc.in +++ b/fribidi.pc.in @@ -7,7 +7,6 @@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: Unicode Bidirectional Algorithm Library -Requires: @MISC_PACKAGES@ Version: @VERSION@ Libs: -L${libdir} -lfribidi Cflags: -I${includedir}/@PACKAGE@ diff --git a/gen.tab/Makefile.am b/gen.tab/Makefile.am index 3d6fb59..7bc3acf 100644 --- a/gen.tab/Makefile.am +++ b/gen.tab/Makefile.am @@ -21,10 +21,7 @@ DISTCLEANFILES = AM_CPPFLAGS = \ -I$(top_builddir)/lib \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/charset \ - $(MISC_CFLAGS) - -LDADD = $(MISC_LIBS) + -I$(top_srcdir)/charset VPATH += \ $(builddir)/unidata \ diff --git a/lib/Makefile.am b/lib/Makefile.am index fd15292..11411d1 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,10 +2,10 @@ EXTRA_DIST = fribidi.def lib_LTLIBRARIES = libfribidi.la -AM_CPPFLAGS = $(MISC_CFLAGS) +AM_CPPFLAGS = libfribidi_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION_INFO) -libfribidi_la_LIBADD = $(MISC_LIBS) +libfribidi_la_LIBADD = libfribidi_la_DEPENDENCIES = if OS_WIN32 diff --git a/lib/common.h b/lib/common.h index 739e647..d8395c3 100644 --- a/lib/common.h +++ b/lib/common.h @@ -45,45 +45,6 @@ # define FRIBIDI_PRIVATESPACE(SYMBOL) FRIBIDI_PRIVATESPACE0(_,FRIBIDI_NAMESPACE(_##SYMBOL##__internal__)) #endif /* !FRIBIDI_PRIVATESPACE */ -#if FRIBIDI_USE_GLIB+0 -# ifndef SIZEOF_LONG -# define SIZEOF_LONG GLIB_SIZEOF_LONG -# endif /* !SIZEOF_LONG */ -# ifndef SIZEOF_VOID_P -# define SIZEOF_VOID_P GLIB_SIZEOF_VOID_P -# endif /* !SIZEOF_VOID_P */ -# ifndef __FRIBIDI_DOC -# include <glib.h> -# endif /* !__FRIBIDI_DOC */ -# ifndef fribidi_malloc -# define fribidi_malloc g_try_malloc -# define fribidi_free g_free -# endif /* !fribidi_malloc */ -# ifndef fribidi_assert -# ifndef __FRIBIDI_DOC -# include <glib.h> -# endif /* !__FRIBIDI_DOC */ -# define fribidi_assert g_assert -# endif /* !fribidi_assert */ -# ifndef __FRIBIDI_DOC -# include <glib.h> -# endif /* !__FRIBIDI_DOC */ -# ifndef FRIBIDI_BEGIN_STMT -# define FRIBIDI_BEGIN_STMT G_STMT_START { -# define FRIBIDI_END_STMT } G_STMT_END -# endif /* !FRIBIDI_BEGIN_STMT */ -# ifndef LIKELY -# define LIKELY G_LIKELY -# define UNLIKELY G_UNLIKELY -# endif /* !LIKELY */ -# ifndef false -# define false FALSE -# endif /* !false */ -# ifndef true -# define true TRUE -# endif /* !true */ -#endif /* FRIBIDI_USE_GLIB */ - #ifndef false # define false (0) # endif /* !false */ @@ -155,8 +116,22 @@ /* LIKEYLY and UNLIKELY are used to give a hint on branch prediction to the * compiler. */ #ifndef LIKELY -# define LIKELY -# define UNLIKELY +# if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +# define FRIBIDI_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int fribidi_bool_var; \ + if (expr) \ + fribidi_bool_var = 1; \ + else \ + fribidi_bool_var = 0; \ + fribidi_bool_var; \ + }) +# define LIKELY(expr) (__builtin_expect (FRIBIDI_BOOLEAN_EXPR(expr), 1)) +# define UNLIKELY(expr) (__builtin_expect (FRIBIDI_BOOLEAN_EXPR(expr), 0)) +# else +# define LIKELY +# define UNLIKELY +# endif /* _GNUC_ */ #endif /* !LIKELY */ #ifndef FRIBIDI_EMPTY_STMT diff --git a/lib/fribidi-common.h b/lib/fribidi-common.h index 6fb3680..0dc9c5b 100644 --- a/lib/fribidi-common.h +++ b/lib/fribidi-common.h @@ -56,37 +56,48 @@ # define FRIBIDI_ENTRY /* empty */ #endif /* !FRIBIDI_ENTRY */ -#if FRIBIDI_USE_GLIB+0 -# ifndef __FRIBIDI_DOC -# include <glib.h> -# endif /* !__FRIBIDI_DOC */ -# define FRIBIDI_BEGIN_DECLS G_BEGIN_DECLS -# define FRIBIDI_END_DECLS G_END_DECLS -# define FRIBIDI_GNUC_CONST G_GNUC_CONST -# define FRIBIDI_GNUC_DEPRECATED G_GNUC_DEPRECATED -# define FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS -# define FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS -# if __GNUC__ > 2 -# define FRIBIDI_GNUC_WARN_UNUSED \ - __attribute__((__warn_unused_result__)) -# define FRIBIDI_GNUC_MALLOC \ - __attribute__((__malloc__)) -# define FRIBIDI_GNUC_HIDDEN \ - __attribute__((__visibility__ ("hidden"))) -# else /* __GNUC__ <= 2 */ -# define FRIBIDI_GNUC_WARN_UNUSED -# define FRIBIDI_GNUC_MALLOC -# define FRIBIDI_GNUC_HIDDEN -# endif /* __GNUC__ <= 2 */ -#else /* !FRIBIDI_USE_GLIB */ -# define FRIBIDI_GNUC_CONST -# define FRIBIDI_GNUC_DEPRECATED -# define FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS -# define FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS +#ifdef __ICC +#define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("warning (push)") \ + _Pragma ("warning (disable:1478)") +#define FRIBIDI_END_IGNORE_DEPRECATIONS \ + _Pragma ("warning (pop)") +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#define FRIBIDI_END_IGNORE_DEPRECATIONS \ + _Pragma ("GCC diagnostic pop") +#elif defined (_MSC_VER) && (_MSC_VER >= 1500) +#define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \ + __pragma (warning (push)) \ + __pragma (warning (disable : 4996)) +#define FRIBIDI_END_IGNORE_DEPRECATIONS \ + __pragma (warning (pop)) +#elif defined (__clang__) +#define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#define FRIBIDI_END_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic pop") +#else +#define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS +#define FRIBIDI_END_IGNORE_DEPRECATIONS +#endif + +#if defined(__GNUC__) && (__GNUC__ > 2) +# define FRIBIDI_GNUC_WARN_UNUSED __attribute__((__warn_unused_result__)) +# define FRIBIDI_GNUC_MALLOC __attribute__((__malloc__)) +# define FRIBIDI_GNUC_HIDDEN __attribute__((__visibility__ ("hidden"))) +# define FRIBIDI_GNUC_CONST __attribute__((__const__)) +# define FRIBIDI_GNUC_DEPRECATED __attribute__((__unused__)) +#else /* __GNUC__ */ # define FRIBIDI_GNUC_WARN_UNUSED # define FRIBIDI_GNUC_MALLOC # define FRIBIDI_GNUC_HIDDEN -#endif /* !FRIBIDI_USE_GLIB */ +# define FRIBIDI_GNUC_CONST +# define FRIBIDI_GNUC_DEPRECATED +#endif /* __GNUC__ */ /* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations, * so that C++ compilers don't mangle their names. Use FRIBIDI_END_DECLS at diff --git a/lib/fribidi-config.h.in b/lib/fribidi-config.h.in index 7e10261..4587b65 100644 --- a/lib/fribidi-config.h.in +++ b/lib/fribidi-config.h.in @@ -17,9 +17,6 @@ /* Define to 1 if you want charset conversion codes in the library */ #define FRIBIDI_CHARSETS @FRIBIDI_CHARSETS@ -/* Define to 1 if you want to use glib */ -#define FRIBIDI_USE_GLIB @FRIBIDI_USE_GLIB@ - /* The size of a `int', as computed by sizeof. */ #define FRIBIDI_SIZEOF_INT @SIZEOF_INT@ diff --git a/lib/fribidi-types.h b/lib/fribidi-types.h index 9b66aea..1288fb4 100644 --- a/lib/fribidi-types.h +++ b/lib/fribidi-types.h @@ -38,19 +38,6 @@ #include "fribidi-begindecls.h" -#if FRIBIDI_USE_GLIB+0 -# ifndef __FRIBIDI_DOC -# include <glib.h> -# endif /* !__FRIBIDI_DOC */ -# define FRIBIDI_INT8_LOCAL gint8 -# define FRIBIDI_INT16_LOCAL gint16 -# define FRIBIDI_INT32_LOCAL gint32 -# define FRIBIDI_UINT8_LOCAL guint8 -# define FRIBIDI_UINT16_LOCAL guint16 -# define FRIBIDI_UINT32_LOCAL guint32 -# define FRIBIDI_BOOLEAN_LOCAL gboolean -# define FRIBIDI_UNICHAR_LOCAL gunichar -#else /* !FRIBIDI_USE_GLIB */ # if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H) # ifndef __FRIBIDI_DOC # if HAVE_INTTYPES_H @@ -96,7 +83,6 @@ # else /* SIZEOF_WCHAR_T < 4 */ # define FRIBIDI_UNICHAR_LOCAL fribidi_uint32 # endif /* SIZEOF_WCHAR_T < 4 */ -#endif /* !FRIBIDI_USE_GLIB */ #if FRIBIDI_INT_TYPES+0 #else @@ -140,12 +126,6 @@ typedef struct _FriBracketTypeStruct FriBidiBracketType; #define FRIBIDI_NO_BRACKET { 0, 0 } -#ifndef FRIBIDI_MAX_STRING_LENGTH -# define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \ - 0x7FFF : (sizeof (FriBidiStrIndex) == 1 ? \ - 0x7F : 0x7FFFFFFFL)) -#endif - /* A few macros for working with bits */ #define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0) diff --git a/lib/fribidi.c b/lib/fribidi.c index 0ce3a1f..6e77b4e 100644 --- a/lib/fribidi.c +++ b/lib/fribidi.c @@ -82,11 +82,6 @@ const char *fribidi_version_info = #else " --disable-charsets" #endif /* !FRIBIDI_CHARSETS */ -#if FRIBIDI_USE_GLIB+0 - " --with-glib" -#else /* !FRIBIDI_USE_GLIB */ - " --without-glib" -#endif /* !FRIBIDI_USE_GLIB */ ".\n\n" "Copyright (C) 2004 Sharif FarsiWeb, Inc.\n" "Copyright (C) 2001, 2002, 2004, 2005 Behdad Esfahbod\n" |