diff options
author | behdad <behdad> | 2001-03-28 02:43:21 +0000 |
---|---|---|
committer | behdad <behdad> | 2001-03-28 02:43:21 +0000 |
commit | d4721836cdc90eafd3d0c03c10ff50d5fcf99a5c (patch) | |
tree | fd2ba11fdb568aa52b22425fa76b5701b11ec0ba | |
parent | d30a0e26fe88731aef3959fa9158cce818078de6 (diff) |
MEM_OPTIMIZED option, fribidi_tables.i target and some more small changes
-rw-r--r-- | ChangeLog | 71 | ||||
-rw-r--r-- | Makefile.am | 113 | ||||
-rw-r--r-- | TODO | 11 | ||||
-rwxr-xr-x | conformance/dotest | 2 | ||||
-rwxr-xr-x | conformance/findbad | 2 | ||||
-rwxr-xr-x | conformance/test | 12 | ||||
-rw-r--r-- | conformance/test_gen_explicit.c (renamed from conformance/test_gen.c) | 2 | ||||
-rw-r--r-- | conformance/test_gen_rand.c | 5 | ||||
-rw-r--r-- | fribidi.c | 156 | ||||
-rw-r--r-- | fribidi.h | 26 | ||||
-rw-r--r-- | fribidi_benchmark.c | 17 | ||||
-rw-r--r-- | fribidi_char_sets.c | 2 | ||||
-rw-r--r-- | fribidi_char_sets_cap_rtl.c | 46 | ||||
-rw-r--r-- | fribidi_char_sets_cap_rtl.h | 2 | ||||
-rw-r--r-- | fribidi_get_type.c | 22 | ||||
-rw-r--r-- | fribidi_main.c | 86 | ||||
-rw-r--r-- | fribidi_tables.i | 110 | ||||
-rw-r--r-- | fribidi_types.c | 37 | ||||
-rw-r--r-- | fribidi_types.h | 42 | ||||
-rw-r--r-- | fribidi_utils.c | 6 | ||||
-rwxr-xr-x | run.tests | 4 | ||||
-rw-r--r-- | tests/test-CapRTL | 2 | ||||
-rw-r--r-- | tests/test-CapRTL.reference | 2 | ||||
-rw-r--r-- | tests/test-explicit | 2 | ||||
-rw-r--r-- | tests/test-explicit.reference | 22 | ||||
-rwxr-xr-x | unidata/CreateGetType.pl | 6 |
26 files changed, 515 insertions, 293 deletions
@@ -1,22 +1,64 @@ -2001-03-27 Roozbeh Pournader <roozbeh@sharif.edu> +2001-03-28 Behdad Esfahbod <behdad@bamdad.org> + * Makefile.am: New target "fribidi_tables.i" defined to download + "unidata/BidiMirroring.txt" and "unidata/PropList.txt" if not + available, and call "unidata/CreateGetType.pl" if needed to update + "fribidi_tables.i". + + * fribidi_types.h, fribidi_types.c, fribidi_get_type.c, + unidata/CreateGetType.pl: Define symbol MEM_OPTIMIZED added to + make Dov happy :-), if MEM_OPTIMIZED defined, fribidi_tables.i + entries will be guint8 instead of gint to free 27KB extra memory + that was used to make fribidi use bitmasks, the overhead will be + three array lookups instead of two, in fribidi_get_type(). + + * fribidi_main.c: Options --verbose and --basedir added. + Options --test and --caprtl updated. + + * conformance/test_gen.c: File name changed to + conformance/test_gen_explicit.c + + * run.tests: Make to work with "make test" and "make check" when + making from other directories. + + * fribidi.c: Rule L1 ("Reset the embedding levels") moved from + fribidi_log2vis() to fribidi_analyse_string(), to affect + fribidi_log2vis_get_embedding_levels() too. New functions + fribidi_mirroring_status() and fribidi_set_mirroring() added to + turn on or off mirroring (Rule L3). Changed to warn about too long + strings only if at least one of position_L_to_V_list or + position_V_to_L_list is asked. + + * fribidi.h: Updated to reflect new functions in fribidi.c, + #include "config.h" removed, and added to each .c file that use it, + because config.h should not be included by other apps/libs. + + * fribidi.c, fribidi_main.c, fribidi_benchmark.c: #included "config.h", + Now, --version options shows the options that library is compiled + with (DEBUG, MEM_OPTIMIZED, USE_SIMPLE_MALLOC, FRIBIDI_USE_MINI_GLIB). + + * fribidi_types.h, fribidi.c, fribidi.h, fribidi_utils.c: TypeDefined + FriBidiStrIndex as guint16 and used for the type of + position_L_to_V_list and postition_V_to_L_list arrays. + +2001-03-27 Roozbeh Pournader <roozbeh@sharif.edu> * fribidi.h: Removed definition of PACKAGE and VERSION. #included "config.h" - * Makefile.am: make "make dist" work. + * Makefile.am: Make "make dist" work. -2001-03-26 Behdad Esfahbod <behdad@bamdad.org> +2001-03-27 Behdad Esfahbod <behdad@bamdad.org> * fribidi.c, fribidi_types.h: Some bugs introduced in the last changes removed, "Resolving weak types" rewritten, no known - conformance bugs. Defined macros for external use, changed their + conformance bugs. Defined macros for external use, changed their name to have a prefix of FRIBIDI_. * fribidi.c, fribidi.h: Function fribidi_remove_explicits() added to remove the explicit marks from a fribidi string. * fribidi.c: Fixed a bug that caused position_l_to_v and - position_v_to_l not to calculated correctly. + position_v_to_l not to calculated correctly. - * fribidi.h: Define symbols PACKAGE and VERSION manually, autoconf + * fribidi.h: Defined symbols PACKAGE and VERSION manually, autoconf should set them, but I don't know how to. * fribidi_char_sets.c, fribidi_char_sets.h, fribidi_char_sets_*: @@ -30,15 +72,17 @@ * fribidi_main.c: API revised, many new options added, Default charset changed to UTF-8 - Option --test simulates the old defaults (--charset CapRTL) + Option --caprtl simulates the old style (same as --charset CapRTL) + Option --test simulates the old test_fribidi (same as --fill + --showinput --clean) Option --clean now works for all charsets. Option --fill implementated. - Options --version, --showinput, --ltov, --vtol, --levels, - --changes, --novisual, --charsetdesc added. + Options --version, --showinput, --ltov, --vtol, --levels, --changes, + --novisual, --charsetdesc added. Now use the charset conventions, lots of code removed. - * test_fribidi.c: got removed. `fribidi --showinput --fill --clean' - should be used instead. + * test_fribidi.c: Got removed! `fribidi --test' should be used + instead. * fribidi_benchmark: Explicit support added, now benchmarks with two strings, one without explicit marks and one with them. @@ -47,12 +91,11 @@ tests/test-explicit, tests/test-explicit.reference, tests/test-hebrew, tests/test-hebrew.reference: New test datas added, for better testing of weak types and explicit support. Test - outputs updated for the new CapRTL character set. Test output fot + outputs updated for the new CapRTL character set. Test output for test-hebrew added. * Makefile.in, Makefile.am: Updated to use fribidi instead of - test_fribidi for test targets. New source files added to - libfribidi_la_SOURCES. + test_fribidi for test targets. New files added. * TODO: Some done tasks removed, some new tasks added! diff --git a/Makefile.am b/Makefile.am index d365b3b..66210e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,53 +4,52 @@ INCLUDES = $(GLIB_CFLAGS) lib_LTLIBRARIES = libfribidi.la -libfribidi_la_SOURCES = \ - fribidi.c \ - fribidi_tables.i \ - fribidi_types.c \ - fribidi_char_sets.c \ - fribidi_char_sets_utf8.c \ - fribidi_char_sets_cap_rtl.c \ - fribidi_char_sets_iso8859_6.c \ - fribidi_char_sets_iso8859_8.c \ - fribidi_char_sets_cp1255.c \ - fribidi_char_sets_cp1256.c \ - fribidi_char_sets_isiri_3342.c \ - fribidi_get_type.c \ - fribidi_utils.c +libfribidi_la_SOURCES = \ + fribidi.c \ + fribidi_tables.i \ + fribidi_types.c \ + fribidi_get_type.c \ + fribidi_utils.c \ + fribidi_char_sets.c \ + fribidi_char_sets_utf8.c \ + fribidi_char_sets_cap_rtl.c \ + fribidi_char_sets_iso8859_6.c \ + fribidi_char_sets_iso8859_8.c \ + fribidi_char_sets_cp1255.c \ + fribidi_char_sets_cp1256.c \ + fribidi_char_sets_isiri_3342.c libfribidi_la_LIBADD = $(GLIB_LIBS) libfribidiincdir = $(includedir)/fribidi libfribidiincdir = $(includedir)/fribidi -libfribidiinc_HEADERS = \ - fribidi.h \ - fribidi_char_sets_utf8.h \ - fribidi_char_sets_cap_rtl.h \ - fribidi_char_sets_iso8859_6.h \ - fribidi_char_sets_iso8859_8.h \ - fribidi_char_sets_cp1255.h \ - fribidi_char_sets_cp1256.h \ - fribidi_char_sets_isiri_3342.h \ - fribidi_char_sets.h \ - fribidi_types.h - -EXTRA_DIST = \ - unidata/CreateGetType.pl \ - tests/test-CapRTL \ - tests/test-explicit \ - tests/test-hebrew \ - tests/test-CapRTL.reference \ - tests/test-explicit.reference \ - tests/test-hebrew.reference \ - run.tests \ - ANNOUNCE \ - acinclude.m4 \ - fribidi_mini_glib.h \ - fribidi_mini_glib.c \ - Makefile.noglib - +libfribidiinc_HEADERS = \ + fribidi.h \ + fribidi_types.h \ + fribidi_char_sets.h \ + fribidi_char_sets_cap_rtl.h \ + fribidi_char_sets_cp1255.h \ + fribidi_char_sets_cp1256.h \ + fribidi_char_sets_isiri_3342.h \ + fribidi_char_sets_iso8859_6.h \ + fribidi_char_sets_iso8859_8.h \ + fribidi_char_sets_utf8.h + +EXTRA_DIST = \ + run.tests \ + ANNOUNCE \ + acinclude.m4 \ + fribidi_mini_glib.h \ + fribidi_mini_glib.c \ + Makefile.noglib \ + unidata/CreateGetType.pl \ + tests/test-CapRTL \ + tests/test-CapRTL.reference \ + tests/test-explicit \ + tests/test-explicit.reference \ + tests/test-hebrew \ + tests/test-hebrew.reference fribidi_benchmark_SOURCES = fribidi_benchmark.c fribidi_benchmark_LDADD = libfribidi.la $(GLIB_LIBS) @@ -59,19 +58,39 @@ bin_PROGRAMS = fribidi fribidi_SOURCES = fribidi_main.c fribidi_LDADD = libfribidi.la $(GLIB_LIBS) -tests/test-CapRTL.reference: fribidi tests/test-CapRTL - mkdir -p tests - ./fribidi --fill --showinput --charset CapRTL $(top_srcdir)/tests/test-CapRTL > \ +unidata/BidiMirroring.txt: + cd $(top_srcdir)/unidata && \ + if ! test -f BididMirroring.txt ; then \ + wget http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt ; \ + fi + +unidata/PropList.txt: + cd $(top_srcdir)/unidata && \ + if ! test -f PropList.txt ; then \ + wget http://www.unicode.org/Public/UNIDATA/PropList.txt ; \ + fi + +fribidi_tables.i: unidata/CreateGetType.pl \ + unidata/BidiMirroring.txt unidata/PropList.txt + cd $(top_srcdir)/unidata && \ + ./CreateGetType.pl > ../fribidi_tables.i + +tests/test-CapRTL.reference: fribidi tests/test-CapRTL + ./fribidi --test --charset CapRTL $(top_srcdir)/tests/test-CapRTL > \ $(top_srcdir)/tests/test-CapRTL.reference -tests/test-explicit.reference: fribidi tests/test-explicit - ./fribidi --fill --showinput --charset CapRTL $(top_srcdir)/tests/test-explicit > \ +tests/test-explicit.reference: fribidi tests/test-explicit + ./fribidi --test --charset CapRTL $(top_srcdir)/tests/test-explicit > \ $(top_srcdir)/tests/test-explicit.reference tests/test-hebrew.reference: fribidi tests/test-hebrew - ./fribidi --fill --showinput --charset ISO8859-8 $(top_srcdir)/tests/test-hebrew > \ + ./fribidi --test --charset ISO8859-8 $(top_srcdir)/tests/test-hebrew > \ $(top_srcdir)/tests/test-hebrew.reference +test.reference : tests/test-CapRTL.reference \ + tests/test-explicit.reference \ + tests/test-hebrew.reference + test: fribidi $(top_srcdir)/run.tests @@ -1,9 +1,14 @@ Implementation issues: +* Currently one need to run "bootstrap" two times, to generate "config.h" + containing "PACKAGE" and "VERSION" defined, (to roozbeh: would you please + have a look). + * Set autoconf to use fribidi_mini_glib, to compile with DEBUG, and other - define symbols. + define symbols, and it can set FriBidiStrIndex to be guint32 instead of + guint16, define FRIBIDI_MAX_STRING_LENGTH based on sizeof(FriBidiStrIndex). -* Design better APIs to do reorder based on available levels, remove +* Design better apis to do reorder based on available levels, remove explicit marks then calculate position maps, .... * Design some tests for each character set. @@ -11,8 +16,6 @@ Implementation issues: * Charset convertors and fribidi_analyse change API to allocate mem if NULL is passed to them. -* Define FRIBIDI_MEM_OPTIMIZED option. - BiDi algorithms issues: * Handle the L3 rule. diff --git a/conformance/dotest b/conformance/dotest index f8bf62d..927a8e6 100755 --- a/conformance/dotest +++ b/conformance/dotest @@ -13,4 +13,4 @@ fi $path/$generator $1 | sed 's|\\\\||g' > $path/test.in shift -cat $path/test.in | $path/test -clean $@ +$path/test $@ $path/test.in diff --git a/conformance/findbad b/conformance/findbad index 4848a53..d1decc9 100755 --- a/conformance/findbad +++ b/conformance/findbad @@ -8,4 +8,4 @@ trap 'echo; rm -f $path/test.{in,out,ref} &> /dev/null ; exit' INT while ! test "`$path/dotest $1`"; do echo -n .; done shift -cat $path/test.in | $path/test -clean $@ +$path/test $@ $path/test.in diff --git a/conformance/test b/conformance/test index 77480fe..66156b5 100755 --- a/conformance/test +++ b/conformance/test @@ -1,7 +1,6 @@ #!/bin/sh # Test ../fribidi with reference/bidiref, using stdin, and diff the outputs. -# use -debug switch to see the debug info into stderr. -# use -clean to remove explicit marks before doing diff. +# use --debug switch to see the debug info into stderr. path=`dirname $(which $0)` @@ -11,7 +10,7 @@ if ! test -f "$path/../fribidi"; then fi if ! test -f "$path/reference/bidiref"; then - if test -z "`echo -n | $path/../fribidi -debug 2>&1`"; then + if test -z "`echo -n | $path/../fribidi --debug 2>&1`"; then debug="-DDEBUGGING" else debug="" @@ -23,13 +22,12 @@ convertsub () { refline="`echo \"$refline\" | sed s/$1/$2/g`" } +p1="--clean" +p2="-clean" while [ -n "$1" ]; do - if test "$1" = "-debug"; then + if test "$1" = "--debug"; then p1=$p1" --debug" p2=$p2" -verbose" - elif test "$1" = "-clean"; then - p1=$p1" --clean" - p2=$p2" -clean" else par=$par" $1" fi diff --git a/conformance/test_gen.c b/conformance/test_gen_explicit.c index 7e84b3b..6950adb 100644 --- a/conformance/test_gen.c +++ b/conformance/test_gen_explicit.c @@ -1,4 +1,4 @@ -/* Generate fully random tests. */ +/* Generate random test datas, best for explicit support test. */ #include <stdlib.h> #include <stdio.h> #include <time.h> diff --git a/conformance/test_gen_rand.c b/conformance/test_gen_rand.c index 0e6c8e8..15a5a69 100644 --- a/conformance/test_gen_rand.c +++ b/conformance/test_gen_rand.c @@ -1,5 +1,6 @@ -/* Generate random test data for explicit bidi tests. */ -/* First command line parameter is the lenght of test in bytes, default is 10.*/ +/* Generate random test data for CapRTL character set. */ +/* A sequence of fully random characters. */ +/* First command line parameter is the length of test in bytes, default is 10.*/ #include <stdlib.h> #include <stdio.h> #include <time.h> @@ -18,6 +18,7 @@ * Boston, MA 02111-1307, USA. */ #include "fribidi.h" +#include "config.h" #ifdef DEBUG #include <stdio.h> #endif @@ -73,8 +74,7 @@ level_info; static gboolean fribidi_debug = FALSE; #endif -int -fribidi_set_debug (gboolean debug) +gboolean fribidi_set_debug (gboolean debug) { #ifdef DEBUG return fribidi_debug = debug; @@ -107,12 +107,12 @@ bidi_string_reverse (FriBidiChar * str, gint len) } static void -int16_array_reverse (guint16 * arr, gint len) +index_array_reverse (FriBidiStrIndex * arr, gint len) { gint i; for (i = 0; i < len / 2; i++) { - guint16 tmp = arr[i]; + FriBidiStrIndex tmp = arr[i]; arr[i] = arr[len - 1 - i]; arr[len - 1 - i] = tmp; } @@ -988,6 +988,54 @@ fribidi_analyse_string ( /* input */ } #endif + DBG ("Reset the embedding levels.\n"); + { + gint j, k, state, pos; + TypeLink *p, *q, *list, *list_end; + + /* L1. Reset the embedding levels of some chars. */ + init_list (&list, &list_end); + q = list_end; + state = 1; + pos = len - 1; + for (j = len - 1; j >= 0; j--) + { + k = fribidi_get_type (str[j]); + if (!state && FRIBIDI_IS_SEPARATOR (k)) + { + state = 1; + pos = j; + } + else + if (state + && !(j && FRIBIDI_IS_EXPLICIT_OR_SEPARATOR_OR_BN_OR_WS (k))) + { + /* if state is on at the very first of string, do this too. */ + if (!j) + j--; + state = 0; + p = new_type_link (); + p->prev = p->next = 0; + p->pos = j + 1; + p->len = pos - j; + p->type = base_dir; + p->level = base_level; + move_element_before (p, q); + q = p; + } + } + override_list (type_rl_list, list); + } + +#ifdef DEBUG + if (fribidi_debug) + { + print_types_re (type_rl_list); + print_resolved_levels (type_rl_list); + print_resolved_types (type_rl_list); + } +#endif + *ptype_rl_list = type_rl_list; *pmax_level = max_level; *pbase_dir = base_dir; @@ -995,7 +1043,7 @@ fribidi_analyse_string ( /* input */ /*====================================================================== // Frees up the rl_list, must be called after each call to - fribidi_analyse_string(), after the list is not needed anymore. +// fribidi_analyse_string(), after the list is not needed anymore. //----------------------------------------------------------------------*/ void free_rl_list (TypeLink * type_rl_list) @@ -1019,6 +1067,19 @@ free_rl_list (TypeLink * type_rl_list) #endif } +static gboolean mirroring = TRUE; + +gboolean fribidi_mirroring_status (void) +{ + return mirroring; +} + +void +fribidi_set_mirroring (gboolean mirror) +{ + mirroring = mirror; +} + /*====================================================================== // Here starts the exposed front end functions. //----------------------------------------------------------------------*/ @@ -1048,8 +1109,8 @@ fribidi_log2vis ( /* input */ FriBidiChar * str, gint len, FriBidiCharType * pbase_dir, /* output */ FriBidiChar * visual_str, - guint16 * position_L_to_V_list, - guint16 * position_V_to_L_list, + FriBidiStrIndex * position_L_to_V_list, + FriBidiStrIndex * position_V_to_L_list, guint8 * embedding_level_list) { TypeLink *type_rl_list, *pp = NULL; @@ -1064,13 +1125,13 @@ fribidi_log2vis ( /* input */ if (position_L_to_V_list && !position_V_to_L_list) { private_V_to_L = TRUE; - position_V_to_L_list = g_new (guint16, len + 1); + position_V_to_L_list = g_new (FriBidiStrIndex, len + 1); } - if (len > FRIBIDI_MAX_STRING_LENGTH) + if (len > FRIBIDI_MAX_STRING_LENGTH && position_V_to_L_list) { #ifdef DEBUG - fprintf (stderr, "%s cannot handle strings > %d chars\n", + fprintf (stderr, "%s: cannot handle strings > %d characters\n", PACKAGE, FRIBIDI_MAX_STRING_LENGTH); #endif return; @@ -1081,54 +1142,9 @@ fribidi_log2vis ( /* input */ /* 7. Reordering resolved levels */ DBG ("Reordering resolved levels.\n"); - { gint level_idx; - gint i, j, k, state, pos; - TypeLink *p, *q, *list, *list_end; - - DBG ("Reset the embedding levels.\n"); - /* L1. Reset the embedding levels of some chars. */ - init_list (&list, &list_end); - q = list_end; - state = 1; - pos = len - 1; - for (j = len - 1; j >= 0; j--) - { - k = fribidi_get_type (str[j]); - if (!state && FRIBIDI_IS_SEPARATOR (k)) - { - state = 1; - pos = j; - } - else - if (state - && !(j && FRIBIDI_IS_EXPLICIT_OR_SEPARATOR_OR_BN_OR_WS (k))) - { - /* if state is on at the very first of string, do this too. */ - if (!j) - j--; - state = 0; - p = new_type_link (); - p->prev = p->next = 0; - p->pos = j + 1; - p->len = pos - j; - p->type = *pbase_dir; - p->level = FRIBIDI_DIR_TO_LEVEL (p->type); - move_element_before (p, q); - q = p; - } - } - override_list (type_rl_list, list); - -#ifdef DEBUG - if (fribidi_debug) - { - print_types_re (type_rl_list); - print_resolved_levels (type_rl_list); - print_resolved_types (type_rl_list); - } -#endif + gint i, j; /* TBD: L3 */ @@ -1157,7 +1173,7 @@ fribidi_log2vis ( /* input */ if (visual_str || position_V_to_L_list) { - if (visual_str) + if (mirroring && visual_str) /* L4. Mirror all characters that are in odd levels and have mirrors. */ for (pp = type_rl_list->next; pp->next; pp = pp->next) { @@ -1194,7 +1210,7 @@ fribidi_log2vis ( /* input */ if (visual_str) bidi_string_reverse (visual_str + pos, len); if (position_V_to_L_list) - int16_array_reverse (position_V_to_L_list + pos, len); + index_array_reverse (position_V_to_L_list + pos, len); } } } @@ -1247,3 +1263,27 @@ fribidi_log2vis_get_embedding_levels ( free_rl_list (type_rl_list); } + +guchar *fribidi_version_info = + "Copyright (C) 2001 FriBidi Project.\n" + PACKAGE " comes with NO WARRANTY, to the extent permitted by law.\n" + "You may redistribute copies of " PACKAGE " under the terms of\n" + "the GNU General Public License.\n" + "For more information about these matters, see the files named COPYING.\n" +#if (defined(MEM_OPTIMIZED) || defined(DEBUG) || defined(USE_SIMPLE_MALLOC) \ + || defined(FRIBIDI_USE_MINI_GLIB)) + "This " PACKAGE " is compiled with following options:\n" +#if (defined(MEM_OPTIMIZED)) + "MEM_OPTIMIZED\n" +#endif +#if (defined(DEBUG)) + "DEBUG\n" +#endif +#if (defined(USE_SIMPLE_MALLOC)) + "USE_SIMPLE_MALLOC\n" +#endif +#if (defined(FRIBIDI_USE_MINI_GLIB)) + "FRIBIDI_USE_MINI_GLIB\n" +#endif +#endif + ; @@ -20,13 +20,9 @@ #ifndef FRIBIDI_H #define FRIBIDI_H -#include "config.h" - #include "fribidi_types.h" #include "fribidi_char_sets.h" -int fribidi_set_debug (gboolean debug); - FriBidiCharType fribidi_get_type (FriBidiChar uch); gboolean fribidi_get_mirror_char ( /* Input */ @@ -39,8 +35,8 @@ void fribidi_log2vis ( /* input */ gint len, FriBidiCharType * pbase_dir, /* output */ FriBidiChar * visual_str, - guint16 * position_L_to_V_list, - guint16 * position_V_to_L_list, + FriBidiStrIndex * position_L_to_V_list, + FriBidiStrIndex * position_V_to_L_list, guint8 * embedding_level_list); void fribidi_log2vis_get_embedding_levels ( /* input */ @@ -56,6 +52,19 @@ void fribidi_log2vis_get_embedding_levels ( /* input */ //----------------------------------------------------------------------*/ gint fribidi_remove_explicits (FriBidiChar * str, gint length); +/*====================================================================== +// fribidi_mirroring_status() returns whether mirroring is on or off, +// default is on. +//----------------------------------------------------------------------*/ +gboolean fribidi_mirroring_status (void); + +void fribidi_set_mirroring (gboolean mirror); + +/*====================================================================== +// fribidi_set_denug() turn on or off debugging, default is off. +//----------------------------------------------------------------------*/ +gboolean fribidi_set_debug (gboolean debug); + /* fribidi_utils.c */ /*====================================================================== @@ -106,7 +115,8 @@ void fribidi_map_range (gint span[2], int len, gboolean is_v2l_map, - guint16 * position_map, guint8 * embedding_level_list, + FriBidiStrIndex * position_map, + guint8 * embedding_level_list, /* output */ int *num_mapped_spans, int spans[3][2]); @@ -173,7 +183,7 @@ void fribidi_xpos_resolve (gint x_pos, gint len, guint8 * embedding_level_list, FriBidiCharType base_dir, - guint16 * vis2log, gint16 * char_widths, + FriBidiStrIndex * vis2log, gint16 * char_widths, /* output */ gint * res_log_pos, gint * res_vis_pos, diff --git a/fribidi_benchmark.c b/fribidi_benchmark.c index a5bcd6e..8cbf15f 100644 --- a/fribidi_benchmark.c +++ b/fribidi_benchmark.c @@ -21,8 +21,12 @@ #include <stdlib.h> #include <sys/times.h> #include "fribidi.h" +#include "config.h" #define appname "fribidi_benchmark" +#define appversion VERSION + +extern guchar *fribidi_version_info; #define MAX_STR_LEN 1000 @@ -55,7 +59,7 @@ die (gchar * fmt, ...) "here_L is_o_o_o _R ab one_o _r 123,987_LT_oHE_R t_o oNE:" \ double -utime () +utime (void) { struct tms tb; times (&tb); @@ -67,7 +71,7 @@ benchmark (guchar * S_, FriBidiCharSet char_set, gint niter) { gint len, i; FriBidiChar us[MAX_STR_LEN], out_us[MAX_STR_LEN]; - guint16 positionLtoV[MAX_STR_LEN], positionVtoL[MAX_STR_LEN]; + FriBidiStrIndex positionLtoV[MAX_STR_LEN], positionVtoL[MAX_STR_LEN]; guint8 embedding_list[MAX_STR_LEN]; FriBidiCharType base; double time0, time1; @@ -136,14 +140,7 @@ main (int argc, char *argv[]) } CASE2 ("-V", "--version") { - printf - ("%s %s\n" - "Copyright (C) 2001 FriBidi Project.\n" - "%s comes with NO WARRANTY, to the extent permitted by law.\n" - "You may redistribute copies of %s under the terms of\n" - "the GNU General Public License.\n" - "For more information about these matters, see the files name COPYING.\n", - appname, VERSION, appname, appname); + printf (appname " " appversion "\n%s", fribidi_version_info); exit (0); } CASE2 ("-n", "--niter") diff --git a/fribidi_char_sets.c b/fribidi_char_sets.c index 86f7c4b..8668a85 100644 --- a/fribidi_char_sets.c +++ b/fribidi_char_sets.c @@ -36,7 +36,7 @@ typedef struct /* Charset's title. */ guchar *title; /* Comments, if any. */ - guchar *(*desc) (); + guchar *(*desc) (void); /* Some charsets like CapRTL may need to change some fribidis tables, by calling this function, they can do this changes. */ gboolean (*enter) (void); diff --git a/fribidi_char_sets_cap_rtl.c b/fribidi_char_sets_cap_rtl.c index 55fd12d..b7c3616 100644 --- a/fribidi_char_sets_cap_rtl.c +++ b/fribidi_char_sets_cap_rtl.c @@ -157,7 +157,7 @@ fribidi_unicode_to_cap_rtl (FriBidiChar * us, gint length, guchar * s) } guchar * -fribidi_char_set_desc_cap_rtl () +fribidi_char_set_desc_cap_rtl (void) { return "CapRTL is a character set for testing with the reference\n" \ @@ -209,29 +209,29 @@ fribidi_char_set_desc_cap_rtl () " * _L LRO\n" " * _R RLO\n" " * __ `_' itself\n" "\n"; } -#define WS FRIBIDI_TYPE_WS -#define BS FRIBIDI_TYPE_BS -#define EO FRIBIDI_TYPE_EO -#define CTL FRIBIDI_TYPE_CTL -#define LRE FRIBIDI_TYPE_LRE -#define RLE FRIBIDI_TYPE_RLE -#define ES FRIBIDI_TYPE_ES -#define LRO FRIBIDI_TYPE_LRO -#define RLO FRIBIDI_TYPE_RLO -#define AL FRIBIDI_TYPE_AL -#define SS FRIBIDI_TYPE_SS -#define ET FRIBIDI_TYPE_ET -#define NSM FRIBIDI_TYPE_NSM -#define LTR FRIBIDI_TYPE_LTR -#define ON FRIBIDI_TYPE_ON -#define AN FRIBIDI_TYPE_AN -#define BN FRIBIDI_TYPE_BN -#define RTL FRIBIDI_TYPE_RTL -#define CS FRIBIDI_TYPE_CS -#define PDF FRIBIDI_TYPE_PDF -#define EN FRIBIDI_TYPE_EN +#define WS FRIBIDI_PROP_TYPE_WS +#define BS FRIBIDI_PROP_TYPE_BS +#define EO FRIBIDI_PROP_TYPE_EO +#define CTL FRIBIDI_PROP_TYPE_CTL +#define LRE FRIBIDI_PROP_TYPE_LRE +#define RLE FRIBIDI_PROP_TYPE_RLE +#define ES FRIBIDI_PROP_TYPE_ES +#define LRO FRIBIDI_PROP_TYPE_LRO +#define RLO FRIBIDI_PROP_TYPE_RLO +#define AL FRIBIDI_PROP_TYPE_AL +#define SS FRIBIDI_PROP_TYPE_SS +#define ET FRIBIDI_PROP_TYPE_ET +#define NSM FRIBIDI_PROP_TYPE_NSM +#define LTR FRIBIDI_PROP_TYPE_LTR +#define ON FRIBIDI_PROP_TYPE_ON +#define AN FRIBIDI_PROP_TYPE_AN +#define BN FRIBIDI_PROP_TYPE_BN +#define RTL FRIBIDI_PROP_TYPE_RTL +#define CS FRIBIDI_PROP_TYPE_CS +#define PDF FRIBIDI_PROP_TYPE_PDF +#define EN FRIBIDI_PROP_TYPE_EN -FriBidiCharType FriBidiPropertyBlockCapRTL[256] = { +FriBidiPropCharType FriBidiPropertyBlockCapRTL[256] = { /* CapRTL charset table. */ ON, ON, ON, ON, LTR, RTL, ON, ON, ON, ON, ON, ON, ON, BS, RLO, RLE, /*00-0f */ LRO, LRE, PDF, WS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, /*10-1f */ diff --git a/fribidi_char_sets_cap_rtl.h b/fribidi_char_sets_cap_rtl.h index 1844b68..ff03d1c 100644 --- a/fribidi_char_sets_cap_rtl.h +++ b/fribidi_char_sets_cap_rtl.h @@ -24,7 +24,7 @@ #define fribidi_char_set_name_cap_rtl "CapRTL" #define fribidi_char_set_title_cap_rtl "CapRTL (Test)" -guchar *fribidi_char_set_desc_cap_rtl (); +guchar *fribidi_char_set_desc_cap_rtl (void); gboolean fribidi_char_set_enter_cap_rtl (void); gboolean fribidi_char_set_leave_cap_rtl (void); diff --git a/fribidi_get_type.c b/fribidi_get_type.c index ab67263..e09436e 100644 --- a/fribidi_get_type.c +++ b/fribidi_get_type.c @@ -22,15 +22,24 @@ #include "fribidi.h" #include "fribidi_tables.i" +#ifdef MEM_OPTIMIZED +extern FriBidiCharType prop_to_type[]; +#endif + /*====================================================================== // fribidi_get_type() returns the bidi type of a character. //----------------------------------------------------------------------*/ -FriBidiCharType fribidi_get_type (FriBidiChar uch) +FriBidiCharType +fribidi_get_type (FriBidiChar uch) { int i = uch % 256, j = uch / 256; - FriBidiCharType *block = FriBidiPropertyBlocks[j]; + FriBidiPropCharType *block = FriBidiPropertyBlocks[j]; if (block) +#ifdef MEM_OPTIMIZED + return prop_to_type[block[i]]; +#else return block[i]; +#endif else { switch (j) @@ -67,11 +76,10 @@ FriBidiCharType fribidi_get_type (FriBidiChar uch) } } -gboolean -fribidi_get_mirror_char ( /* Input */ - FriBidiChar ch, - /* Output */ - FriBidiChar * mirrored_ch) +gboolean fribidi_get_mirror_char ( /* Input */ + FriBidiChar ch, + /* Output */ + FriBidiChar * mirrored_ch) { int pos, step; gboolean found = FALSE; diff --git a/fribidi_main.c b/fribidi_main.c index 68008d9..bc6e18d 100644 --- a/fribidi_main.c +++ b/fribidi_main.c @@ -26,8 +26,12 @@ #include <stdlib.h> #include <stdarg.h> #include "fribidi.h" +#include "config.h" #define appname "fribidi" +#define appversion VERSION + +extern guchar *fribidi_version_info; #define MAX_STR_LEN 65000 @@ -48,8 +52,8 @@ main (int argc, char *argv[]) { int argp; FILE *IN; - gboolean do_pad, do_fill, do_clean, file_found, show_input; - gboolean show_visual, show_ltov, show_vtol, show_levels, show_changes; + gboolean do_pad, do_fill, do_clean, file_found, show_input, show_visual; + gboolean show_basedir, show_ltov, show_vtol, show_levels, show_changes; gint char_set, text_width; guchar *bol_text, *eol_text; FriBidiCharType input_base_direction; @@ -61,6 +65,7 @@ main (int argc, char *argv[]) do_clean = FALSE; show_input = FALSE; show_visual = TRUE; + show_basedir = FALSE; show_ltov = FALSE; show_vtol = FALSE; show_levels = FALSE; @@ -98,11 +103,14 @@ main (int argc, char *argv[]) "\n" " -h, --help Display this information and exit\n" " -V, --version Display version information and exit\n" + " -v, --verbose Verbose mode, same as --basedir --ltov --vtol \\\n" + " --levels --changes\n" " -d, --debug Output debug info\n" - " -t, --test Set default character set to CapRTL, turn on padding\n" + " -P, --caprtl Old style: Set character set to CapRTL\n" + " -t, --test Test %s, same as --clean --fill --showinput\n" " --showinput Output the input string too\n" " -C, --charset CS Specify character set, default is %s\n" - " --charsetdesc CS Show descreptions for character set CS, if any and exit\n" + " --charsetdesc CS Show descreptions for character set CS and exit\n" " -p, --nopad Do not right justify RTL lines\n" " -f, --fill Fill lines up to margin\n" " -W, --width W Screem width for padding, default is %d\n" @@ -110,48 +118,50 @@ main (int argc, char *argv[]) " -E, --eol EOL Output string EOL after the visual string\n" " -R, --rtl Force base direction to RTL\n" " -L, --ltr Force base direction to LTR\n" - " -c, --clean Remove explicit format codes in visual string\n" + " -c, --clean Remove explicit format codes in visual string \\\n" " output, currently does not affect other outputs\n" + " --basedir Output Base Direction\n" " --ltov Output Logical to Visual position map\n" " --vtol Output Visual to Logical position map\n" " --levels Output Embedding Levels\n" " --changes Output information about changes between\n" - " logical and visual string (start, length)\n" - " --novisual Do not output the visual string, to be used\n" - " with --ltov, --vtol, --levels, --changes\n" + " logical and visual string (start, length) \\\n" + " --novisual Do not output the visual string, to be used with \\\n" + " --basedir, --ltov, --vtol, --levels, --changes\n" " Options affect only subsequent arguments\n" + " All string indexes are zero based\n" "\n" "Output:\n" " For each line of input, output something like this:\n" - " [BOL][input-str` => '][[padding space]visual-str]\n" + " [BOL][input-str` => '][[padding space]visual-str][\\n base-dir]\n" " [\\n ltov-map][\\n vtol-map][\\n levels][\\n changes][EOL]\n" "\n" - "Available character sets are:\n", appname, appname, + "Available character sets:\n", appname, appname, appname, fribidi_char_set_name (char_set), text_width); for (i = 1; i <= FRIBIDI_CHAR_SETS_NUM; i++) - printf (" * %-23s%-4s%s", fribidi_char_set_title (i), - (fribidi_char_set_desc (i) ? "X" : ""), - (i & 1 ? "" : "\n")); - if (FRIBIDI_CHAR_SETS_NUM & 1) - printf ("\n"); + printf (" * %-10s: %-25s%1s\n", + fribidi_char_set_name (i), fribidi_char_set_title (i), + (fribidi_char_set_desc (i) ? "X" : "")); printf - (" X: Character set has descreptions, use --charsetdesc to see\n"); + (" X: Character set has descriptions, use --charsetdesc to see\n"); printf ("\nReport bugs online at <http://fribidi.sourceforge.net/bugs.php>.\n"); exit (0); } CASE2 ("-V", "--version") { - printf - ("%s %s\n" - "Copyright (C) 2001 FriBidi Project.\n" - "%s comes with NO WARRANTY, to the extent permitted by law.\n" - "You may redistribute copies of %s under the terms of\n" - "the GNU General Public License.\n" - "For more information about these matters, see the files name COPYING.\n", - appname, VERSION, appname, appname); + printf (appname " " appversion "\n%s", fribidi_version_info); exit (0); } + CASE2 ("-v", "--verbose") + { + show_basedir = TRUE; + show_ltov = TRUE; + show_vtol = TRUE; + show_levels = TRUE; + show_changes = TRUE; + continue; + } CASE2 ("-p", "--nopad") { do_pad = FALSE; @@ -197,6 +207,11 @@ main (int argc, char *argv[]) show_input = TRUE; continue; } + CASE ("--basedir") + { + show_basedir = TRUE; + continue; + } CASE ("--ltov") { show_ltov = TRUE; @@ -230,10 +245,16 @@ main (int argc, char *argv[]) PACKAGE); continue; } - CASE2 ("-t", "--test") + CASE2 ("-P", "--caprtl") { char_set = FRIBIDI_CHARSET_CAP_RTL; - do_pad = TRUE; + continue; + } + CASE2 ("-t", "--test") + { + do_fill = TRUE; + show_input = TRUE; + do_clean = TRUE; continue; } CASE2 ("-C", "--charset") @@ -322,16 +343,16 @@ main (int argc, char *argv[]) len = fribidi_charset_to_unicode (char_set, S_, logical); { - guint16 *ltov, *vtol; + FriBidiStrIndex *ltov, *vtol; guint8 *levels; gint new_len; if (show_ltov) - ltov = g_new (guint16, len + 1); + ltov = g_new (FriBidiStrIndex, len + 1); else ltov = NULL; if (show_vtol) - vtol = g_new (guint16, len + 1); + vtol = g_new (FriBidiStrIndex, len + 1); else vtol = NULL; if (show_levels) @@ -391,6 +412,13 @@ main (int argc, char *argv[]) nl_found = "\n"; } + if (show_basedir) + { + printf (nl_found); + printf ("Base direction: %s", + (FRIBIDI_DIR_TO_LEVEL (base) ? "R" : "L")); + nl_found = "\n"; + } if (show_ltov) { gint i; diff --git a/fribidi_tables.i b/fribidi_tables.i index 10f5a64..f3f7028 100644 --- a/fribidi_tables.i +++ b/fribidi_tables.i @@ -5,30 +5,30 @@ #include "fribidi.h" -#define WS FRIBIDI_TYPE_WS -#define BS FRIBIDI_TYPE_BS -#define EO FRIBIDI_TYPE_EO -#define CTL FRIBIDI_TYPE_CTL -#define LRE FRIBIDI_TYPE_LRE -#define RLE FRIBIDI_TYPE_RLE -#define ES FRIBIDI_TYPE_ES -#define LRO FRIBIDI_TYPE_LRO -#define RLO FRIBIDI_TYPE_RLO -#define AL FRIBIDI_TYPE_AL -#define SS FRIBIDI_TYPE_SS -#define ET FRIBIDI_TYPE_ET -#define NSM FRIBIDI_TYPE_NSM -#define LTR FRIBIDI_TYPE_LTR -#define ON FRIBIDI_TYPE_ON -#define AN FRIBIDI_TYPE_AN -#define BN FRIBIDI_TYPE_BN -#define RTL FRIBIDI_TYPE_RTL -#define CS FRIBIDI_TYPE_CS -#define PDF FRIBIDI_TYPE_PDF -#define EN FRIBIDI_TYPE_EN +#define WS FRIBIDI_PROP_TYPE_WS +#define BS FRIBIDI_PROP_TYPE_BS +#define EO FRIBIDI_PROP_TYPE_EO +#define CTL FRIBIDI_PROP_TYPE_CTL +#define LRE FRIBIDI_PROP_TYPE_LRE +#define RLE FRIBIDI_PROP_TYPE_RLE +#define ES FRIBIDI_PROP_TYPE_ES +#define LRO FRIBIDI_PROP_TYPE_LRO +#define RLO FRIBIDI_PROP_TYPE_RLO +#define AL FRIBIDI_PROP_TYPE_AL +#define SS FRIBIDI_PROP_TYPE_SS +#define ET FRIBIDI_PROP_TYPE_ET +#define NSM FRIBIDI_PROP_TYPE_NSM +#define LTR FRIBIDI_PROP_TYPE_LTR +#define ON FRIBIDI_PROP_TYPE_ON +#define AN FRIBIDI_PROP_TYPE_AN +#define BN FRIBIDI_PROP_TYPE_BN +#define RTL FRIBIDI_PROP_TYPE_RTL +#define CS FRIBIDI_PROP_TYPE_CS +#define PDF FRIBIDI_PROP_TYPE_PDF +#define EN FRIBIDI_PROP_TYPE_EN -FriBidiCharType FriBidiPropertyBlock0000[256] = { +FriBidiPropCharType FriBidiPropertyBlock0000[256] = { BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,SS ,BS ,SS ,WS ,BS ,BN ,BN , BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BN ,BS ,BS ,BS ,SS , WS ,ON ,ON ,ET ,ET ,ET ,ON ,ON ,ON ,ON ,ON ,ET ,CS ,ET ,CS ,ES , @@ -47,7 +47,7 @@ FriBidiCharType FriBidiPropertyBlock0000[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,ON ,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0100[256] = { +FriBidiPropCharType FriBidiPropertyBlock0100[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -66,7 +66,7 @@ FriBidiCharType FriBidiPropertyBlock0100[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0200[256] = { +FriBidiPropCharType FriBidiPropertyBlock0200[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -85,7 +85,7 @@ FriBidiCharType FriBidiPropertyBlock0200[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0300[256] = { +FriBidiPropCharType FriBidiPropertyBlock0300[256] = { NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, @@ -104,7 +104,7 @@ FriBidiCharType FriBidiPropertyBlock0300[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0400[256] = { +FriBidiPropCharType FriBidiPropertyBlock0400[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -123,7 +123,7 @@ FriBidiCharType FriBidiPropertyBlock0400[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0500[256] = { +FriBidiPropCharType FriBidiPropertyBlock0500[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -142,7 +142,7 @@ FriBidiCharType FriBidiPropertyBlock0500[256] = { RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL, }; -FriBidiCharType FriBidiPropertyBlock0600[256] = { +FriBidiPropCharType FriBidiPropertyBlock0600[256] = { CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS , CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,CS ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , @@ -161,7 +161,7 @@ FriBidiCharType FriBidiPropertyBlock0600[256] = { EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,AL ,AL ,AL ,AL ,AL ,AL , }; -FriBidiCharType FriBidiPropertyBlock0700[256] = { +FriBidiPropCharType FriBidiPropertyBlock0700[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,BN , AL ,NSM,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , @@ -180,7 +180,7 @@ FriBidiCharType FriBidiPropertyBlock0700[256] = { NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, }; -FriBidiCharType FriBidiPropertyBlock0900[256] = { +FriBidiPropCharType FriBidiPropertyBlock0900[256] = { NSM,NSM,NSM,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -199,7 +199,7 @@ FriBidiCharType FriBidiPropertyBlock0900[256] = { LTR,LTR,ET ,ET ,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0a00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0a00[256] = { NSM,NSM,NSM,NSM,NSM,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -218,7 +218,7 @@ FriBidiCharType FriBidiPropertyBlock0a00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0b00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0b00[256] = { NSM,NSM,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -237,7 +237,7 @@ FriBidiCharType FriBidiPropertyBlock0b00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0c00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0c00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -256,7 +256,7 @@ FriBidiCharType FriBidiPropertyBlock0c00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0d00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0d00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -275,7 +275,7 @@ FriBidiCharType FriBidiPropertyBlock0d00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0e00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0e00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -294,7 +294,7 @@ FriBidiCharType FriBidiPropertyBlock0e00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock0f00[256] = { +FriBidiPropCharType FriBidiPropertyBlock0f00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,NSM,NSM,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -313,7 +313,7 @@ FriBidiCharType FriBidiPropertyBlock0f00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock1000[256] = { +FriBidiPropCharType FriBidiPropertyBlock1000[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,NSM,NSM,NSM, @@ -332,7 +332,7 @@ FriBidiCharType FriBidiPropertyBlock1000[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock1600[256] = { +FriBidiPropCharType FriBidiPropertyBlock1600[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -351,7 +351,7 @@ FriBidiCharType FriBidiPropertyBlock1600[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock1700[256] = { +FriBidiPropCharType FriBidiPropertyBlock1700[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -370,7 +370,7 @@ FriBidiCharType FriBidiPropertyBlock1700[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlock1800[256] = { +FriBidiPropCharType FriBidiPropertyBlock1800[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,BN ,BN ,BN ,BN ,BN , LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -389,7 +389,7 @@ FriBidiCharType FriBidiPropertyBlock1800[256] = { NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, }; -FriBidiCharType FriBidiPropertyBlock1f00[256] = { +FriBidiPropCharType FriBidiPropertyBlock1f00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -408,7 +408,7 @@ FriBidiCharType FriBidiPropertyBlock1f00[256] = { ON ,ON ,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlock2000[256] = { +FriBidiPropCharType FriBidiPropertyBlock2000[256] = { WS ,WS ,WS ,WS ,WS ,WS ,WS ,WS ,WS ,WS ,WS ,BN ,BN ,BN ,LTR,RTL, ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,WS ,BS ,LRE,RLE,PDF,LRO,RLO,WS , @@ -427,7 +427,7 @@ FriBidiCharType FriBidiPropertyBlock2000[256] = { NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, }; -FriBidiCharType FriBidiPropertyBlock2100[256] = { +FriBidiPropCharType FriBidiPropertyBlock2100[256] = { ON ,ON ,LTR,ON ,ON ,ON ,ON ,LTR,ON ,ON ,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,ON ,LTR,ON ,ON ,ON ,LTR,LTR,LTR,LTR,LTR,ON ,ON , ON ,ON ,ON ,ON ,LTR,ON ,LTR,ON ,LTR,ON ,LTR,LTR,LTR,LTR,ET ,LTR, @@ -446,7 +446,7 @@ FriBidiCharType FriBidiPropertyBlock2100[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlock2200[256] = { +FriBidiPropCharType FriBidiPropertyBlock2200[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ET ,ET ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , @@ -465,7 +465,7 @@ FriBidiCharType FriBidiPropertyBlock2200[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlock2300[256] = { +FriBidiPropCharType FriBidiPropertyBlock2300[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , @@ -484,7 +484,7 @@ FriBidiCharType FriBidiPropertyBlock2300[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlock2400[256] = { +FriBidiPropCharType FriBidiPropertyBlock2400[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , @@ -503,7 +503,7 @@ FriBidiCharType FriBidiPropertyBlock2400[256] = { EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN , }; -FriBidiCharType FriBidiPropertyBlock2500[256] = { +FriBidiPropCharType FriBidiPropertyBlock2500[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , @@ -522,7 +522,7 @@ FriBidiCharType FriBidiPropertyBlock2500[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlock3000[256] = { +FriBidiPropCharType FriBidiPropertyBlock3000[256] = { WS ,ON ,ON ,ON ,ON ,LTR,LTR,LTR,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , ON ,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,NSM,NSM,NSM,NSM,NSM,NSM, @@ -541,7 +541,7 @@ FriBidiCharType FriBidiPropertyBlock3000[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,ON ,LTR,LTR,LTR,LTR, }; -FriBidiCharType FriBidiPropertyBlocka400[256] = { +FriBidiPropCharType FriBidiPropertyBlocka400[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -560,7 +560,7 @@ FriBidiCharType FriBidiPropertyBlocka400[256] = { ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON ,ON , }; -FriBidiCharType FriBidiPropertyBlockfb00[256] = { +FriBidiPropCharType FriBidiPropertyBlockfb00[256] = { LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,RTL,NSM,RTL, RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,ET ,RTL,RTL,RTL,RTL,RTL,RTL, @@ -579,7 +579,7 @@ FriBidiCharType FriBidiPropertyBlockfb00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , }; -FriBidiCharType FriBidiPropertyBlockfc00[256] = { +FriBidiPropCharType FriBidiPropertyBlockfc00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , @@ -598,7 +598,7 @@ FriBidiCharType FriBidiPropertyBlockfc00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , }; -FriBidiCharType FriBidiPropertyBlockfd00[256] = { +FriBidiPropCharType FriBidiPropertyBlockfd00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , @@ -617,7 +617,7 @@ FriBidiCharType FriBidiPropertyBlockfd00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL , }; -FriBidiCharType FriBidiPropertyBlockfe00[256] = { +FriBidiPropCharType FriBidiPropertyBlockfe00[256] = { NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM,NSM, @@ -636,7 +636,7 @@ FriBidiCharType FriBidiPropertyBlockfe00[256] = { AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,AL ,BN , }; -FriBidiCharType FriBidiPropertyBlockff00[256] = { +FriBidiPropCharType FriBidiPropertyBlockff00[256] = { ON ,ON ,ON ,ET ,ET ,ET ,ON ,ON ,ON ,ON ,ON ,ET ,CS ,ET ,CS ,ES , EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,EN ,CS ,ON ,ON ,ON ,ON ,ON , ON ,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, @@ -657,7 +657,7 @@ FriBidiCharType FriBidiPropertyBlockff00[256] = { /* 33 blocks defined */ -FriBidiCharType *FriBidiPropertyBlocks[256] = { +FriBidiPropCharType *FriBidiPropertyBlocks[256] = { FriBidiPropertyBlock0000, FriBidiPropertyBlock0100, FriBidiPropertyBlock0200, diff --git a/fribidi_types.c b/fribidi_types.c index 7915450..360a9d0 100644 --- a/fribidi_types.c +++ b/fribidi_types.c @@ -17,9 +17,10 @@ * Boston, MA 02111-1307, USA. */ -#include "fribidi_types.h" +#include "fribidi.h" -guchar fribidi_char_from_type (FriBidiCharType c) +guchar +fribidi_char_from_type (FriBidiCharType c) { switch (c) { @@ -107,3 +108,35 @@ fribidi_type_name (FriBidiCharType c) } #undef _FRIBIDI_CASE }; + +#ifdef MEM_OPTIMIZED +/* If MEM_OPTIMIZED defined, map fribidi_prop_types to fribidi_types, + it has the overhead of one more array lookup in fribidi_get_type(), + the order of types here should be the same as + "typedef enum FriBidiPropCharType in fribidi_types.h */ +FriBidiCharType prop_to_type[] = { + FRIBIDI_TYPE_LTR, /* Strong left to right */ + FRIBIDI_TYPE_RTL, /* Right to left characters */ + FRIBIDI_TYPE_AL, /* Arabic characters */ + FRIBIDI_TYPE_LRE, /* Left-To-Right embedding */ + FRIBIDI_TYPE_RLE, /* Right-To-Left embedding */ + FRIBIDI_TYPE_LRO, /* Left-To-Right override */ + FRIBIDI_TYPE_RLO, /* Right-To-Left override */ + FRIBIDI_TYPE_PDF, /* Pop directional override */ + FRIBIDI_TYPE_EN, /* European digit */ + FRIBIDI_TYPE_AN, /* Arabic digit */ + FRIBIDI_TYPE_ES, /* European number separator */ + FRIBIDI_TYPE_ET, /* European number terminator */ + FRIBIDI_TYPE_CS, /* Common Separator */ + FRIBIDI_TYPE_NSM, /* Non spacing mark */ + FRIBIDI_TYPE_BN, /* Boundary neutral */ + FRIBIDI_TYPE_BS, /* Block separator */ + FRIBIDI_TYPE_SS, /* Segment separator */ + FRIBIDI_TYPE_WS, /* Whitespace */ + FRIBIDI_TYPE_ON, /* Other Neutral */ + FRIBIDI_TYPE_WL, /* Weak left to right */ + FRIBIDI_TYPE_WR, /* Weak right to left */ + FRIBIDI_TYPE_SOT, /* Start of text */ + FRIBIDI_TYPE_EOT, /* End of text */ +}; +#endif diff --git a/fribidi_types.h b/fribidi_types.h index ff136b4..f4a00d3 100644 --- a/fribidi_types.h +++ b/fribidi_types.h @@ -28,6 +28,8 @@ typedef guint32 FriBidiChar; +typedef guint16 FriBidiStrIndex; + /* Define some bit masks, that character types are based on, each one has only one bit on. */ typedef enum @@ -222,6 +224,46 @@ guchar fribidi_char_from_type (FriBidiCharType c); guchar *fribidi_type_name (FriBidiCharType c); + +/* Define character types that fribidi_tables.i uses. if MEM_OPTIMIZED + defined, then define them to be 0, 1, 2, ... and then in + fribidi_get_type.c map them on FriBidiCharType-s, else define them to + be equal to FribidiCharType-s */ +#ifdef MEM_OPTIMIZED +#define _FRIBIDI_PROP(type) FRIBIDI_PROP_TYPE_##type +typedef guint8 FriBidiPropCharType; +#else +#define _FRIBIDI_PROP(type) FRIBIDI_PROP_TYPE_##type = FRIBIDI_TYPE_##type +typedef FriBidiCharType FriBidiPropCharType; +#endif +enum +{ + _FRIBIDI_PROP (LTR), /* Strong left to right */ + _FRIBIDI_PROP (RTL), /* Right to left characters */ + _FRIBIDI_PROP (AL), /* Arabic characters */ + _FRIBIDI_PROP (LRE), /* Left-To-Right embedding */ + _FRIBIDI_PROP (RLE), /* Right-To-Left embedding */ + _FRIBIDI_PROP (LRO), /* Left-To-Right override */ + _FRIBIDI_PROP (RLO), /* Right-To-Left override */ + _FRIBIDI_PROP (PDF), /* Pop directional override */ + _FRIBIDI_PROP (EN), /* European digit */ + _FRIBIDI_PROP (AN), /* Arabic digit */ + _FRIBIDI_PROP (ES), /* European number separator */ + _FRIBIDI_PROP (ET), /* European number terminator */ + _FRIBIDI_PROP (CS), /* Common Separator */ + _FRIBIDI_PROP (NSM), /* Non spacing mark */ + _FRIBIDI_PROP (BN), /* Boundary neutral */ + _FRIBIDI_PROP (BS), /* Block separator */ + _FRIBIDI_PROP (SS), /* Segment separator */ + _FRIBIDI_PROP (WS), /* Whitespace */ + _FRIBIDI_PROP (ON), /* Other Neutral */ + _FRIBIDI_PROP (WL), /* Weak left to right */ + _FRIBIDI_PROP (WR), /* Weak right to left */ + _FRIBIDI_PROP (SOT), /* Start of text */ + _FRIBIDI_PROP (EOT), /* End of text */ +}; +#undef _FRIBIDI_PROP + /* The following type is used by fribidi_utils */ typedef struct { diff --git a/fribidi_utils.c b/fribidi_utils.c index 1cfce9d..824c9e2 100644 --- a/fribidi_utils.c +++ b/fribidi_utils.c @@ -60,7 +60,7 @@ void fribidi_map_range (gint in_span[2], /* Start and end span */ int len, gboolean is_v2l_map, /* Needed for embedding_level */ - guint16 * position_map, guint8 * embedding_level_list, + FriBidiStrIndex * position_map, guint8 * embedding_level_list, /* output */ int *num_mapped_spans, int mapped_spans[3][2]) { @@ -196,7 +196,7 @@ fribidi_xpos_resolve (gint x_pos, gint len, guint8 * embedding_level_list, FriBidiCharType base_dir, - guint16 * vis2log, gint16 * char_widths, + FriBidiStrIndex * vis2log, gint16 * char_widths, /* output */ gint * res_log_pos, gint * res_vis_pos, @@ -320,7 +320,7 @@ fribidi_is_char_rtl (guint8 * embedding_level_list, void fribidi_runs_log2vis ( /* input */ GList * logical_runs, /* List of FriBidiRunType */ - gint len, guint16 * log2vis, FriBidiCharType base_dir, + gint len, FriBidiStrIndex * log2vis, FriBidiCharType base_dir, /* output */ GList ** visual_runs) { @@ -13,7 +13,7 @@ fi path=`dirname $(which $0)` -if ! test -f "$path/fribidi"; then +if ! test -f "./fribidi"; then echo "run.tests: you must make fribidi first" exit 1 fi @@ -22,7 +22,7 @@ TEST () { test="$1" charset="$2" echo "=== Running test $test" - $path/fribidi --showinput --clean --fill --charset "$charset" \ + ./fribidi --showinput --clean --fill --charset "$charset" \ "$path/tests/$test" > "$test.output" if diff "$test.output" "$path/tests/$test.reference"; then diff --git a/tests/test-CapRTL b/tests/test-CapRTL index 4a0db2b..4ccc094 100644 --- a/tests/test-CapRTL +++ b/tests/test-CapRTL @@ -23,4 +23,4 @@ CHANGE -10% A TEST FOR WEAK TYPES: 123+,456 ANOTHER FOR WEAK TYPES: A123,456 MORE WEAK TYPES: hooloo123,456 - +and TEST|L1 ||too diff --git a/tests/test-CapRTL.reference b/tests/test-CapRTL.reference index f39cc8b..3e740bd 100644 --- a/tests/test-CapRTL.reference +++ b/tests/test-CapRTL.reference @@ -23,4 +23,4 @@ CHANGE -10% => %10- EGNAHC A TEST FOR WEAK TYPES: 123+,456 => 456,123+ :SEPYT KAEW ROF TSET A ANOTHER FOR WEAK TYPES: A123,456 => 123,456A :SEPYT KAEW ROF REHTONA MORE WEAK TYPES: hooloo123,456 => hooloo123,456 :SEPYT KAEW EROM - => +and TEST|L1 ||too => and TSET|1L ||too diff --git a/tests/test-explicit b/tests/test-explicit index 59ce019..ec9bb2e 100644 --- a/tests/test-explicit +++ b/tests/test-explicit @@ -8,4 +8,4 @@ And _r 123,987_LTHE_R next_o oNE: _R_r and the last _LONE_o IS THE _rbest _lONE and A REAL BIG_l_o BUG! -a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rbug +a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rbug diff --git a/tests/test-explicit.reference b/tests/test-explicit.reference index ebcae07..1d4b7b8 100644 --- a/tests/test-explicit.reference +++ b/tests/test-explicit.reference @@ -1,11 +1,11 @@ -this is _LJUST_o => this is _LJUST_o -a _lsimple _RteST_o th_oat => a _lsimple _R_oTSet th_oat -HAS A _LPDF missing => PDF missing_L A SAH -AnD hOw_L AbOuT, 123,987 tHiS_o => _ow_L AbOuT, 123,987 tHiSOh DnA -a GOOD - _L_oTEST. => a TSET_o_L - DOOG. -here_L is_o_o_o _R a good one_o => here_L is_o_o_o _Reno doog a _o -And _r 123,987_LTHE_R next_o oNE: => 987_LTHE_R_otxen oNE:,123 _r ndA -_R_r and the last _LONE_o IS => _R_rSI and the last _LONE_o -THE _rbest _lONE and => best _lENO and_r EHT -A REAL BIG_l_o BUG! => !GUB _o_lGIB LAER A -a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rbug => a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rgub +this is _LJUST_o => this is JUST +a _lsimple _RteST_o th_oat => a simple TSet that +HAS A _LPDF missing => PDF missing A SAH +AnD hOw_L AbOuT, 123,987 tHiS_o => w AbOuT, 123,987 tHiSOh DnA +a GOOD - _L_oTEST. => a TSET - DOOG. +here_L is_o_o_o _R a good one_o => here is eno doog a +And _r 123,987_LTHE_R next_o oNE: => 987THEtxen oNE:,123 ndA +_R_r and the last _LONE_o IS => SI and the last ONE +THE _rbest _lONE and => best ENO and EHT +A REAL BIG_l_o BUG! => !GUB GIB LAER A +a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rbug => a gub diff --git a/unidata/CreateGetType.pl b/unidata/CreateGetType.pl index 28aad0e..e4fd563 100755 --- a/unidata/CreateGetType.pl +++ b/unidata/CreateGetType.pl @@ -207,7 +207,7 @@ sub split_entity { sub create_block { my ($block,$name, $ranges) = @_; my($title) = <<__; -FriBidiCharType ${name}\[256\] = { +FriBidiPropCharType ${name}\[256\] = { __ my $result; my $last_type=$ranges->[0]->[2]; @@ -258,13 +258,13 @@ sub create_c_file { __ for my $type (keys %type_names) { - $c_file .= "#define $type_names{$type}->[0] FRIBIDI_TYPE_$type_names{$type}->[0]\n"; + $c_file .= "#define $type_names{$type}->[0] FRIBIDI_PROP_TYPE_$type_names{$type}->[0]\n"; } $c_file .= "\n\n"; my $i = 0; my $block_array = <<__; -FriBidiCharType *FriBidiPropertyBlocks[256] = { +FriBidiPropCharType *FriBidiPropertyBlocks[256] = { __ my %seen_blocks; |