From: behdad Date: Mon, 14 Jun 2004 18:43:48 +0000 (+0000) Subject: fribidi-bidi-type.[ch] merged into fribidi-bidi-types.[ch]. X-Git-Tag: FRIBIDI_0_19_1~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08dd824be4a114ed07d67c5dabc12c33fd6ba3ae;p=fribidi fribidi-bidi-type.[ch] merged into fribidi-bidi-types.[ch]. fribidi-joining-type.[ch] merged into fribidi-joining-types.[ch]. --- diff --git a/charset/fribidi-char-sets-cap-rtl.c b/charset/fribidi-char-sets-cap-rtl.c index 3f32f2f..3390d17 100644 --- a/charset/fribidi-char-sets-cap-rtl.c +++ b/charset/fribidi-char-sets-cap-rtl.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-char-sets-cap-rtl.c - CapRTL character set conversion routines * - * $Id: fribidi-char-sets-cap-rtl.c,v 1.7 2004-06-13 20:11:42 behdad Exp $ + * $Id: fribidi-char-sets-cap-rtl.c,v 1.8 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.7 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.8 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.c,v $ * * Authors: @@ -39,7 +39,7 @@ #include #include -#include +#include #include diff --git a/configure.ac b/configure.ac index 4c1fd33..ed50e63 100644 --- a/configure.ac +++ b/configure.ac @@ -3,10 +3,10 @@ ## Use autoupdate to update this file for newer versions of autoconf. ## Use autoscan to check if you need to add something to this file. ############################################################################## -## $Id: configure.ac,v 1.14 2004-06-09 20:01:00 behdad Exp $ +## $Id: configure.ac,v 1.15 2004-06-14 18:43:48 behdad Exp $ ## $Auther: behdad $ -## $Date: 2004-06-09 20:01:00 $ -## $Revision: 1.14 $ +## $Date: 2004-06-14 18:43:48 $ +## $Revision: 1.15 $ ## $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/configure.ac,v $ ############################################################################## @@ -44,7 +44,7 @@ m4_define(fribidi_version, fribidi_major_version.fribidi_minor_version.fribidi_micro_version))dnl AC_INIT([GNU FriBidi],fribidi_version(),[http://freedesktop.org/cgi-bin/bugzilla/enter_bug.cgi?product=FriBidi]) -AC_REVISION([$Id: configure.ac,v 1.14 2004-06-09 20:01:00 behdad Exp $]) +AC_REVISION([$Id: configure.ac,v 1.15 2004-06-14 18:43:48 behdad Exp $]) AC_CONFIG_SRCDIR(lib/fribidi.h) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([gnits]) @@ -152,7 +152,7 @@ fi # --disable-charsets AC_ARG_ENABLE(charsets, AC_HELP_STRING([--disable-charsets], - [exclude charset conversion routines from the library])) + [exclude charset conversion routines from library])) if test x$enable_charsets = xno; then FRIBIDI_CHARSETS=0 else @@ -161,6 +161,18 @@ fi AC_SUBST(FRIBIDI_CHARSETS) AM_CONDITIONAL(FRIBIDI_CHARSETS, test x$FRIBIDI_CHARSETS = x1) +# --disable-arabic +AC_ARG_ENABLE(arabic, + AC_HELP_STRING([--disable-arabic], + [exclude Arabic joining/shaping code from library])) +if test x$enable_arabic = xno; then + FRIBIDI_NO_ARABIC=1 +else + FRIBIDI_NO_ARABIC=0 +fi +AC_SUBST(FRIBIDI_NO_ARABIC) +AM_CONDITIONAL(FRIBIDI_NO_ARABIC, test x$FRIBIDI_NO_ARABIC = x1) + # --with[out]-glib AC_ARG_WITH(glib, AC_HELP_STRING([--with-glib=@<:@no/auto/yes@:>@], diff --git a/doc/Makefile.am b/doc/Makefile.am index cefac9c..9191fc4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -12,12 +12,6 @@ headers = inst_symbols = noinst_symbols = -include $(top_srcdir)/lib/Headers.mk -headers += $(libfribidi_la_headers) -includepath += -I$(top_builddir)/lib -I$(top_srcdir)/lib -includevpath += :$(top_builddir)/lib:$(top_srcdir)/lib -inst_symbols += $(libfribidi_la_symbols) - include $(top_srcdir)/charset/Headers.mk headers += $(libfribidi_char_sets_la_headers) includepath += -I$(top_srcdir)/charset @@ -28,8 +22,12 @@ else # !FRIBIDI_CHARSETS noinst_symbols += $(libfribidi_char_sets_la_symbols) endif # !FRIBIDI_CHARSETS -# name of the header to include in the manual -headers += fribidi.h +# The lib/Headers.mk stuff should come after all optional stuff. +include $(top_srcdir)/lib/Headers.mk +headers += $(libfribidi_la_headers) +includepath += -I$(top_builddir)/lib -I$(top_srcdir)/lib +includevpath += :$(top_builddir)/lib:$(top_srcdir)/lib +inst_symbols += $(libfribidi_la_symbols) dist_man_MANS += $(inst_symbols:=.3) dist_noinst_MANS += $(noinst_symbols:=.3) diff --git a/lib/Headers.mk b/lib/Headers.mk index 4f85346..a3d193e 100644 --- a/lib/Headers.mk +++ b/lib/Headers.mk @@ -1,14 +1,12 @@ libfribidi_la_headers = \ fribidi-begindecls.h \ fribidi-bidi.h \ - fribidi-bidi-type.h \ fribidi-bidi-types.h \ fribidi-bidi-types-list.h \ fribidi-common.h \ fribidi-enddecls.h \ fribidi-env.h \ fribidi-joining.h \ - fribidi-joining-type.h \ fribidi-joining-types.h \ fribidi-joining-types-list.h \ fribidi-mirroring.h \ @@ -16,5 +14,6 @@ libfribidi_la_headers = \ fribidi-unicode.h \ fribidi-unicode-version.h \ fribidi.h +# fribidi.h should be the last entry in the list above. libfribidi_la_symbols = $(shell cat $(top_srcdir)/lib/fribidi.def) diff --git a/lib/Makefile.am b/lib/Makefile.am index 9ae0d05..8084590 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -38,11 +38,9 @@ libfribidi_la_SOURCES = \ env.h \ fribidi.c \ fribidi-bidi.c \ - fribidi-bidi-type.c \ fribidi-bidi-types.c \ fribidi-env.c \ fribidi-joining.c \ - fribidi-joining-type.c \ fribidi-joining-types.c \ fribidi-mem.c \ fribidi-mirroring.c \ diff --git a/lib/fribidi-bidi-type.c b/lib/fribidi-bidi-type.c deleted file mode 100644 index cc22b0f..0000000 --- a/lib/fribidi-bidi-type.c +++ /dev/null @@ -1,80 +0,0 @@ -/* FriBidi - * fribidi-bidi-type.c - get character bidi type - * - * $Id: fribidi-bidi-type.c,v 1.13 2004-06-14 17:00:33 behdad Exp $ - * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.13 $ - * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.c,v $ - * - * Authors: - * Behdad Esfahbod, 2001, 2002, 2004 - * - * Copyright (C) 2004 Sharif FarsiWeb, Inc - * Copyright (C) 2001,2002 Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library, in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA - * - * For licensing issues, contact . - */ - -#include "common.h" - -#include - -enum FriBidiCharTypeLinearEnum -{ -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE, -# include "fribidi-bidi-types-list.h" -# undef _FRIBIDI_ADD_TYPE - _FRIBIDI_NUM_TYPES -}; - -#include "bidi-type.tab.i" - -/* Map FriBidiCharTypeLinearEnum to FriBidiCharType. */ -static const FriBidiCharType linear_enum_to_char_type[] = { -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) FRIBIDI_TYPE_##TYPE, -# include "fribidi-bidi-types-list.h" -# undef _FRIBIDI_ADD_TYPE -}; - -FRIBIDI_ENTRY FriBidiCharType -fribidi_get_bidi_type ( - /* input */ - FriBidiChar ch -) -{ - return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)]; -} - -FRIBIDI_ENTRY void -fribidi_get_bidi_types ( - /* input */ - const FriBidiChar *str, - FriBidiStrIndex len, - /* output */ - FriBidiCharType *type -) -{ - register FriBidiStrIndex i = len; - for (; i; i--) - *type++ = fribidi_get_bidi_type (*str++); -} - -/* Editor directions: - * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent - */ diff --git a/lib/fribidi-bidi-type.h b/lib/fribidi-bidi-type.h deleted file mode 100644 index e98722a..0000000 --- a/lib/fribidi-bidi-type.h +++ /dev/null @@ -1,72 +0,0 @@ -/* FriBidi - * fribidi-bidi-type.h - get character bidi type - * - * $Id: fribidi-bidi-type.h,v 1.6 2004-06-14 17:00:33 behdad Exp $ - * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.6 $ - * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.h,v $ - * - * Author: - * Behdad Esfahbod, 2001, 2002, 2004 - * - * Copyright (C) 2004 Sharif FarsiWeb, Inc - * Copyright (C) 2001,2002 Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library, in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA - * - * For licensing issues, contact . - */ -#ifndef _FRIBIDI_BIDI_TYPE_H -#define _FRIBIDI_BIDI_TYPE_H - -#include "fribidi-common.h" - -#include "fribidi-types.h" -#include "fribidi-bidi-types.h" - -#include "fribidi-begindecls.h" - -#define fribidi_get_bidi_type FRIBIDI_NAMESPACE(get_bidi_type) -/* fribidi_get_bidi_type - get character bidi type - * - * This function returns the bidi type of a character. There are a few macros - * defined in fribidi-bidi-types.h for querying a bidi type. - */ -FRIBIDI_ENTRY FriBidiCharType -fribidi_get_bidi_type ( - FriBidiChar ch /* input character */ -) FRIBIDI_GNUC_CONST; - -#define fribidi_get_bidi_types FRIBIDI_NAMESPACE(get_bidi_types) -/* fribidi_get_bidi_types - get bidi types for an string of characters - * - * This function finds the bidi types of an string of characters. See - * fribidi_get_bidi_type for more about the bidi types returned by this - * function. - */ - FRIBIDI_ENTRY void fribidi_get_bidi_types ( - const FriBidiChar *str, /* input string */ - FriBidiStrIndex len, /* input string length */ - FriBidiCharType *type /* output bidi types */ -); - -#include "fribidi-enddecls.h" - -#endif /* !_FRIBIDI_BIDI_TYPE_H */ -/* Editor directions: - * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent - */ diff --git a/lib/fribidi-bidi-types.c b/lib/fribidi-bidi-types.c index b54d367..86a9763 100644 --- a/lib/fribidi-bidi-types.c +++ b/lib/fribidi-bidi-types.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi-types.c - character bidi types * - * $Id: fribidi-bidi-types.c,v 1.6 2004-06-13 20:11:42 behdad Exp $ + * $Id: fribidi-bidi-types.c,v 1.7 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.6 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.7 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.c,v $ * * Authors: @@ -37,46 +37,89 @@ #include "bidi-types.h" -#ifdef DEBUG +enum FriBidiCharTypeLinearEnum +{ +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE, +# include "fribidi-bidi-types-list.h" +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_NUM_TYPES +}; -char -fribidi_char_from_bidi_type ( +#include "bidi-type.tab.i" + +/* Map FriBidiCharTypeLinearEnum to FriBidiCharType. */ +static const FriBidiCharType linear_enum_to_char_type[] = { +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) FRIBIDI_TYPE_##TYPE, +# include "fribidi-bidi-types-list.h" +# undef _FRIBIDI_ADD_TYPE +}; + +FRIBIDI_ENTRY FriBidiCharType +fribidi_get_bidi_type ( + /* input */ + FriBidiChar ch +) +{ + return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)]; +} + +FRIBIDI_ENTRY void +fribidi_get_bidi_types ( + /* input */ + const FriBidiChar *str, + const FriBidiStrIndex len, + /* output */ + FriBidiCharType *type +) +{ + register FriBidiStrIndex i = len; + for (; i; i--) + { + *type++ = linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (*str)]; + str++; + } +} + +FRIBIDI_ENTRY const char * +fribidi_bidi_type_name ( /* input */ FriBidiCharType t ) { switch (t) { -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return SYMBOL; +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return STRINGIZE(TYPE); # define _FRIBIDI_ALL_TYPES # include "fribidi-bidi-types-list.h" # undef _FRIBIDI_ALL_TYPES # undef _FRIBIDI_ADD_TYPE default: - return '?'; + return "?"; } } -#endif +#ifdef DEBUG -FRIBIDI_ENTRY const char * -fribidi_bidi_type_name ( +char +fribidi_char_from_bidi_type ( /* input */ FriBidiCharType t ) { switch (t) { -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return STRINGIZE(TYPE); +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return SYMBOL; # define _FRIBIDI_ALL_TYPES # include "fribidi-bidi-types-list.h" # undef _FRIBIDI_ALL_TYPES # undef _FRIBIDI_ADD_TYPE default: - return "?"; + return '?'; } } +#endif /* DEBUG */ + /* Editor directions: * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent */ diff --git a/lib/fribidi-bidi-types.h b/lib/fribidi-bidi-types.h index b47aa33..720eeda 100644 --- a/lib/fribidi-bidi-types.h +++ b/lib/fribidi-bidi-types.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi-types.h - character bidi types * - * $Id: fribidi-bidi-types.h,v 1.8 2004-06-13 20:11:42 behdad Exp $ + * $Id: fribidi-bidi-types.h,v 1.9 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.8 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.9 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $ * * Author: @@ -329,14 +329,38 @@ typedef fribidi_uint32 FriBidiParType; /* Functions finally */ + +#define fribidi_get_bidi_type FRIBIDI_NAMESPACE(get_bidi_type) +/* fribidi_get_bidi_type - get character bidi type + * + * This function returns the bidi type of a character. There are a few macros + * defined in fribidi-bidi-types.h for querying a bidi type. + */ +FRIBIDI_ENTRY FriBidiCharType +fribidi_get_bidi_type ( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_CONST; + +#define fribidi_get_bidi_types FRIBIDI_NAMESPACE(get_bidi_types) +/* fribidi_get_bidi_types - get bidi types for an string of characters + * + * This function finds the bidi types of an string of characters. See + * fribidi_get_bidi_type for more information about the bidi types returned + * by this function. + */ + FRIBIDI_ENTRY void fribidi_get_bidi_types ( + const FriBidiChar *str, /* input string */ + const FriBidiStrIndex len, /* input string length */ + FriBidiCharType *type /* output bidi types */ +); + #define fribidi_bidi_type_name FRIBIDI_NAMESPACE(bidi_type_name) /* fribidi_bidi_type_name - get bidi type name * * This function returns the bidi type name of a character type. The * returned string is a static string and should not be freed. */ -FRIBIDI_ENTRY const char * -fribidi_bidi_type_name ( + FRIBIDI_ENTRY const char *fribidi_bidi_type_name ( FriBidiCharType t /* input bidi type */ ) FRIBIDI_GNUC_CONST; diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c index ef4ccd6..dfb8d17 100644 --- a/lib/fribidi-bidi.c +++ b/lib/fribidi-bidi.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi.c - bidirectional algorithm * - * $Id: fribidi-bidi.c,v 1.11 2004-06-14 17:00:33 behdad Exp $ + * $Id: fribidi-bidi.c,v 1.12 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.11 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.12 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.c,v $ * * Authors: @@ -36,7 +36,7 @@ #include "common.h" #include -#include +#include #include #include #include @@ -206,8 +206,8 @@ print_bidi_string ( MSG (" Org. types : "); if (bidi_types) - for (i = 0; i < len; i++) - MSG2 ("%c", fribidi_char_from_bidi_type (BIDI_TYPE(i))); + for (i = 0; i < len; i++) + MSG2 ("%c", fribidi_char_from_bidi_type (BIDI_TYPE (i))); MSG ("\n"); } #endif /* DEBUG */ @@ -742,9 +742,9 @@ fribidi_get_par_embedding_levels ( { /* if state is on at the very first of the string, do this too. */ if (j >= 0) - { - char_type = BIDI_TYPE(j); - } + { + char_type = BIDI_TYPE (j); + } else char_type = FRIBIDI_TYPE_ON; if (!state && FRIBIDI_IS_SEPARATOR (char_type)) @@ -810,34 +810,6 @@ out: } -FRIBIDI_ENTRY void -fribidi_shape_mirroring ( - /* input */ - const FriBidiLevel *embedding_level_list, - const FriBidiStrIndex len, - /* input and output */ - FriBidiChar *str -) -{ - register FriBidiStrIndex i; - - fribidi_assert (embedding_level_list); - - if UNLIKELY - (len == 0 || !str) return; - - /* L4. Mirror all characters that are in odd levels and have mirrors. */ - for (i = len - 1; i >= 0; i--) - if (FRIBIDI_LEVEL_IS_RTL (embedding_level_list[i])) - { - FriBidiChar mirrored_ch; - - if (fribidi_get_mirror_char (str[i], &mirrored_ch)) - str[i] = mirrored_ch; - } -} - - static void bidi_string_reverse ( FriBidiChar *str, @@ -945,7 +917,7 @@ fribidi_reorder_line ( /* L3. Reorder NSMs. */ for (i = off + len - 1; i >= off; i--) if (FRIBIDI_LEVEL_IS_RTL (embedding_level_list[i]) - && BIDI_TYPE(i) == FRIBIDI_TYPE_NSM) + && BIDI_TYPE (i) == FRIBIDI_TYPE_NSM) { register FriBidiStrIndex seq_end = i; level = embedding_level_list[i]; diff --git a/lib/fribidi-bidi.h b/lib/fribidi-bidi.h index ad1f128..fedf32b 100644 --- a/lib/fribidi-bidi.h +++ b/lib/fribidi-bidi.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi.h - bidirectional algorithm * - * $Id: fribidi-bidi.h,v 1.8 2004-06-14 17:00:33 behdad Exp $ + * $Id: fribidi-bidi.h,v 1.9 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.8 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.9 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.h,v $ * * Authors: @@ -61,27 +61,12 @@ FRIBIDI_ENTRY FriBidiLevel fribidi_get_par_embedding_levels ( const FriBidiChar *str, /* input paragraph string */ const FriBidiStrIndex len, /* input string length of the paragraph */ - const FriBidiCharType *bidi_types, /* input bidi types */ + const FriBidiCharType *bidi_types, /* input bidi types */ FriBidiParType *pbase_dir, /* requested and resolved paragraph * base direction */ FriBidiLevel *embedding_level_list /* output list of embedding levels */ ) FRIBIDI_GNUC_WARN_UNUSED; -#define fribidi_shape_mirroring FRIBIDI_NAMESPACE(shape_mirroring) -/* fribidi_shape - do mirroring shaping - * - * This functions replaces mirroring characters on right-to-left embeddings in - * string str with their mirrored equivalent as returned by - * fribidi_get_mirror_char(). - */ - FRIBIDI_ENTRY void fribidi_shape_mirroring ( - const FriBidiLevel *embedding_level_list, /* input list of embedding - levels, as returned by - fribidi_get_par_embedding_levels */ - const FriBidiStrIndex len, /* input string length */ - FriBidiChar *str /* string to shape */ -); - #define fribidi_reorder_line FRIBIDI_NAMESPACE(reorder_line) /* fribidi_reorder_line - reorder a line of logical string to visual * @@ -106,8 +91,8 @@ fribidi_get_par_embedding_levels ( */ FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line ( const FriBidiLevel *embedding_level_list, /* input list of embedding levels, - as returned by - fribidi_get_par_embedding_levels */ + as returned by + fribidi_get_par_embedding_levels */ const FriBidiStrIndex len, /* input length of the line */ const FriBidiStrIndex off, /* input offset of the beginning of the line in the paragraph */ diff --git a/lib/fribidi-config.h.in b/lib/fribidi-config.h.in index 7e10261..62e60ae 100644 --- a/lib/fribidi-config.h.in +++ b/lib/fribidi-config.h.in @@ -14,6 +14,9 @@ #define FRIBIDI_INTERFACE_VERSION @FRIBIDI_INTERFACE_VERSION@ #define FRIBIDI_INTERFACE_VERSION_STRING "@FRIBIDI_INTERFACE_VERSION@" +/* Define to 1 if you don't want Arabic joining/shaping code in the library */ +#define FRIBIDI_NO_ARABIC @FRIBIDI_NO_ARABIC@ + /* Define to 1 if you want charset conversion codes in the library */ #define FRIBIDI_CHARSETS @FRIBIDI_CHARSETS@ diff --git a/lib/fribidi-joining-type.c b/lib/fribidi-joining-type.c deleted file mode 100644 index 1f25ab6..0000000 --- a/lib/fribidi-joining-type.c +++ /dev/null @@ -1,56 +0,0 @@ -/* FriBidi - * fribidi-joining-type.c - get character joining type - * - * $Id: fribidi-joining-type.c,v 1.1 2004-06-13 20:11:42 behdad Exp $ - * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.1 $ - * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-joining-type.c,v $ - * - * Authors: - * Behdad Esfahbod, 2004 - * - * Copyright (C) 2004 Sharif FarsiWeb, Inc - * Copyright (C) 2004 Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library, in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA - * - * For licensing issues, contact . - */ - -#include "common.h" - -#include -#include - -enum FriBidiJoiningTypeShortEnum -{ -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE, -# include "fribidi-joining-types-list.h" -# undef _FRIBIDI_ADD_TYPE - _FRIBIDI_NUM_TYPES -}; - -#include "joining-type.tab.i" - -FRIBIDI_ENTRY FriBidiJoiningType -fribidi_get_joining_type ( - /* input */ - FriBidiChar ch -) -{ - return FRIBIDI_GET_JOINING_TYPE (ch); -} diff --git a/lib/fribidi-joining-type.h b/lib/fribidi-joining-type.h deleted file mode 100644 index 04fcff9..0000000 --- a/lib/fribidi-joining-type.h +++ /dev/null @@ -1,59 +0,0 @@ -/* FriBidi - * fribidi-joining-type.h - get character joining type - * - * $Id: fribidi-joining-type.h,v 1.1 2004-06-13 20:11:42 behdad Exp $ - * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.1 $ - * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-joining-type.h,v $ - * - * Author: - * Behdad Esfahbod, 2004 - * - * Copyright (C) 2004 Sharif FarsiWeb, Inc - * Copyright (C) 2004 Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library, in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA - * - * For licensing issues, contact . - */ -#ifndef _FRIBIDI_JOINING_TYPE_H -#define _FRIBIDI_JOINING_TYPE_H - -#include "fribidi-common.h" - -#include "fribidi-types.h" -#include "fribidi-joining-types.h" - -#include "fribidi-begindecls.h" - -#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type) -/* fribidi_get_joining_type - get character joining type - * - * This function returns the joining type of a character. There are a few - * macros defined in fribidi-joining-types.h for querying a joining type. - */ -FRIBIDI_ENTRY FriBidiJoiningType -fribidi_get_joining_type ( - FriBidiChar ch /* input character */ -) FRIBIDI_GNUC_CONST; - -#include "fribidi-enddecls.h" - -#endif /* !_FRIBIDI_JOINING_TYPE_H */ -/* Editor directions: - * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent - */ diff --git a/lib/fribidi-joining-types.c b/lib/fribidi-joining-types.c index 5b8767b..07f6893 100644 --- a/lib/fribidi-joining-types.c +++ b/lib/fribidi-joining-types.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-joining-types.c - character joining types * - * $Id: fribidi-joining-types.c,v 1.1 2004-06-13 20:11:42 behdad Exp $ + * $Id: fribidi-joining-types.c,v 1.2 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.1 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.2 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.c,v $ * * Authors: @@ -33,46 +33,86 @@ #include "common.h" +#if !FRIBIDI_NO_ARABIC + #include #include "joining-types.h" -#ifdef DEBUG +enum FriBidiJoiningTypeShortEnum +{ +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE, +# include "fribidi-joining-types-list.h" +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_NUM_TYPES +}; -char -fribidi_char_from_joining_type ( +#include "joining-type.tab.i" + +FRIBIDI_ENTRY FriBidiJoiningType +fribidi_get_joining_type ( + /* input */ + FriBidiChar ch +) +{ + return FRIBIDI_GET_JOINING_TYPE (ch); +} + +FRIBIDI_ENTRY void +fribidi_get_joining_types ( + /* input */ + const FriBidiChar *str, + const FriBidiStrIndex len, + /* output */ + FriBidiJoiningType *type +) +{ + register FriBidiStrIndex i = len; + for (; i; i--) + { + *type++ = FRIBIDI_GET_JOINING_TYPE (*str); + str++; + } +} + +FRIBIDI_ENTRY const char * +fribidi_joining_type_name ( /* input */ FriBidiJoiningType j ) { switch (j) { -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return SYMBOL; +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE); # include "fribidi-joining-types-list.h" # undef _FRIBIDI_ADD_TYPE default: - return '?'; + return "?"; } } -#endif +#ifdef DEBUG -FRIBIDI_ENTRY const char * -fribidi_joining_type_name ( +char +fribidi_char_from_joining_type ( /* input */ FriBidiJoiningType j ) { switch (j) { -# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE); +# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return SYMBOL; # include "fribidi-joining-types-list.h" # undef _FRIBIDI_ADD_TYPE default: - return "?"; + return '?'; } } +#endif /* DEBUG */ + +#endif /* !FRIBIDI_NO_ARABIC */ + /* Editor directions: * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent */ diff --git a/lib/fribidi-joining-types.h b/lib/fribidi-joining-types.h index 7c635a2..c28786f 100644 --- a/lib/fribidi-joining-types.h +++ b/lib/fribidi-joining-types.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi-joining-types.h - character joining types * - * $Id: fribidi-joining-types.h,v 1.1 2004-06-13 20:11:42 behdad Exp $ + * $Id: fribidi-joining-types.h,v 1.2 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.1 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.2 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.h,v $ * * Author: @@ -124,14 +124,40 @@ typedef fribidi_uint8 FriBidiJoiningType; ((p) & (FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED)) +/* Functions finally */ + + +#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type) +/* fribidi_get_joining_type - get character joining type + * + * This function returns the joining type of a character. There are a few + * macros defined in fribidi-joining-types.h for querying a joining type. + */ +FRIBIDI_ENTRY FriBidiJoiningType +fribidi_get_joining_type ( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_CONST; + +#define fribidi_get_joining_types FRIBIDI_NAMESPACE(get_joining_types) +/* fribidi_get_joining_types - get joining types for an string of characters + * + * This function finds the joining types of an string of characters. See + * fribidi_get_joining_type for more information about the joining types + * returned by this function. + */ + FRIBIDI_ENTRY void fribidi_get_joining_types ( + const FriBidiChar *str, /* input string */ + const FriBidiStrIndex len, /* input string length */ + FriBidiJoiningType *type /* output bidi types */ +); + #define fribidi_joining_type_name FRIBIDI_NAMESPACE(joining_type_name) /* fribidi_joining_type_name - get joining type name * * This function returns the joining type name of a joining type. The * returned string is a static string and should not be freed. */ -FRIBIDI_ENTRY const char * -fribidi_joining_type_name ( + FRIBIDI_ENTRY const char *fribidi_joining_type_name ( FriBidiJoiningType j /* input joining type */ ) FRIBIDI_GNUC_CONST; diff --git a/lib/fribidi-mirroring.c b/lib/fribidi-mirroring.c index d197828..3dbc376 100644 --- a/lib/fribidi-mirroring.c +++ b/lib/fribidi-mirroring.c @@ -23,10 +23,10 @@ * For licensing issues, contact or write to * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran. */ -/* $Id: fribidi-mirroring.c,v 1.11 2004-06-13 20:11:42 behdad Exp $ +/* $Id: fribidi-mirroring.c,v 1.12 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-13 20:11:42 $ - * $Revision: 1.11 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.12 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.c,v $ * * Authors: @@ -55,6 +55,34 @@ fribidi_get_mirror_char ( return ch != result ? true : false; } + +FRIBIDI_ENTRY void +fribidi_shape_mirroring ( + /* input */ + const FriBidiLevel *embedding_level_list, + const FriBidiStrIndex len, + /* input and output */ + FriBidiChar *str +) +{ + register FriBidiStrIndex i; + + fribidi_assert (embedding_level_list); + + if UNLIKELY + (len == 0 || !str) return; + + /* L4. Mirror all characters that are in odd levels and have mirrors. */ + for (i = len - 1; i >= 0; i--) + if (FRIBIDI_LEVEL_IS_RTL (embedding_level_list[i])) + { + FriBidiChar mirrored_ch; + + if (fribidi_get_mirror_char (str[i], &mirrored_ch)) + str[i] = mirrored_ch; + } +} + /* Editor directions: * Local Variables: * mode: c diff --git a/lib/fribidi-mirroring.h b/lib/fribidi-mirroring.h index 2c58910..300ccae 100644 --- a/lib/fribidi-mirroring.h +++ b/lib/fribidi-mirroring.h @@ -23,10 +23,10 @@ * For licensing issues, contact or write to * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran. */ -/* $Id: fribidi-mirroring.h,v 1.7 2004-06-09 14:59:21 behdad Exp $ +/* $Id: fribidi-mirroring.h,v 1.8 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-09 14:59:21 $ - * $Revision: 1.7 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.8 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.h,v $ * * Authors: @@ -39,6 +39,7 @@ #include "fribidi-common.h" #include "fribidi-types.h" +#include "fribidi-bidi-types.h" #include "fribidi-begindecls.h" @@ -57,6 +58,21 @@ FRIBIDI_ENTRY fribidi_boolean fribidi_get_mirror_char ( FriBidiChar *mirrored_ch /* output mirrored character */ ); +#define fribidi_shape_mirroring FRIBIDI_NAMESPACE(shape_mirroring) +/* fribidi_shape_mirroring - do mirroring shaping + * + * This functions replaces mirroring characters on right-to-left embeddings in + * string with their mirrored equivalent as returned by + * fribidi_get_mirror_char(). + */ +FRIBIDI_ENTRY void fribidi_shape_mirroring ( + const FriBidiLevel *embedding_level_list, /* input list of embedding + levels, as returned by + fribidi_get_par_embedding_levels */ + const FriBidiStrIndex len, /* input string length */ + FriBidiChar *str /* string to shape */ +); + #include "fribidi-enddecls.h" #endif /* !_FRIBIDI_MIRRORING_H */ diff --git a/lib/fribidi-run.c b/lib/fribidi-run.c index f4f8319..be8a66b 100644 --- a/lib/fribidi-run.c +++ b/lib/fribidi-run.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-run.c - text run data type * - * $Id: fribidi-run.c,v 1.4 2004-06-14 17:00:33 behdad Exp $ + * $Id: fribidi-run.c,v 1.5 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.4 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.5 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-run.c,v $ * * Authors: @@ -35,7 +35,7 @@ #include "common.h" -#include +#include #include "run.h" #include "env.h" diff --git a/lib/fribidi.c b/lib/fribidi.c index 0af4c93..fa4d7a5 100644 --- a/lib/fribidi.c +++ b/lib/fribidi.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi.c - Unicode bidirectional and Arabic joining/shaping algorithms * - * $Id: fribidi.c,v 1.9 2004-06-14 17:00:33 behdad Exp $ + * $Id: fribidi.c,v 1.10 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-14 17:00:33 $ - * $Revision: 1.9 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.10 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.c,v $ * * Authors: @@ -186,8 +186,9 @@ fribidi_log2vis ( fribidi_shape (embedding_level_list, len, visual_str); - status = fribidi_reorder_line (embedding_level_list, len, 0, NULL, visual_str, - position_L_to_V_list, position_V_to_L_list); + status = + fribidi_reorder_line (embedding_level_list, len, 0, NULL, visual_str, + position_L_to_V_list, position_V_to_L_list); out: diff --git a/lib/fribidi.def b/lib/fribidi.def index 1380c7f..b80e134 100644 --- a/lib/fribidi.def +++ b/lib/fribidi.def @@ -1,15 +1,19 @@ -fribidi_get_bidi_type -fribidi_get_mirror_char -fribidi_bidi_type_name fribidi_get_par_embedding_levels fribidi_reorder_line -fribidi_shape_mirroring -fribidi_shape -fribidi_remove_bidi_marks -fribidi_log2vis +fribidi_get_bidi_type +fribidi_get_bidi_types +fribidi_bidi_type_name fribidi_debug_status fribidi_set_debug fribidi_mirroring_status fribidi_set_mirroring fribidi_reorder_nsm_status fribidi_set_reorder_nsm +fribidi_get_joining_type +fribidi_get_joining_types +fribidi_joining_type_name +fribidi_get_mirror_char +fribidi_shape_mirroring +fribidi_shape +fribidi_remove_bidi_marks +fribidi_log2vis diff --git a/lib/fribidi.h b/lib/fribidi.h index 160884b..6dd5bfa 100644 --- a/lib/fribidi.h +++ b/lib/fribidi.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi.h - Unicode bidirectional and Arabic joining/shaping algorithms * - * $Id: fribidi.h,v 1.5 2004-06-09 20:01:00 behdad Exp $ + * $Id: fribidi.h,v 1.6 2004-06-14 18:43:53 behdad Exp $ * $Author: behdad $ - * $Date: 2004-06-09 20:01:00 $ - * $Revision: 1.5 $ + * $Date: 2004-06-14 18:43:53 $ + * $Revision: 1.6 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.h,v $ * * Author: @@ -35,9 +35,13 @@ #include "fribidi-unicode.h" #include "fribidi-types.h" #include "fribidi-env.h" -#include "fribidi-bidi-type.h" -#include "fribidi-bidi.h" #include "fribidi-mirroring.h" +#include "fribidi-bidi-types.h" +#include "fribidi-bidi.h" +#if !FRIBIDI_NO_ARABIC +#include "fribidi-joining-types.h" +#include "fribidi-joining.h" +#endif /* !FRIBIDI_NO_ARABIC */ #if FRIBIDI_CHARSETS # include "fribidi-char-sets.h" #endif /* FRIBIDI_CHARSETS */