diff options
author | behdad <behdad> | 2004-06-04 09:41:11 +0000 |
---|---|---|
committer | behdad <behdad> | 2004-06-04 09:41:11 +0000 |
commit | 526172111aaf46da0f28ed57917179779d1a266b (patch) | |
tree | 5e7ffa2c9cad7189accefbda9621653a37281e97 | |
parent | a6b4f96acbd71fd8cc05e136a9bcb2ffc594b2a1 (diff) | |
download | fribidi-526172111aaf46da0f28ed57917179779d1a266b.tar.gz |
Cleaning up here and there. Last lingers before adding joining.
-rw-r--r-- | Makefile.am | 49 | ||||
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | bin/fribidi-main.c | 12 | ||||
-rwxr-xr-x | bootstrap | 130 | ||||
-rw-r--r-- | charset/fribidi-char-sets-cap-rtl.c | 12 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | doc/Makefile.am | 18 | ||||
-rw-r--r-- | gen.tab/.cvsignore | 4 | ||||
-rw-r--r-- | gen.tab/Makefile.am | 1 | ||||
-rw-r--r-- | gen.tab/gen-bidi-type-tab.c | 20 | ||||
-rw-r--r-- | lib/Headers.mk | 2 | ||||
-rw-r--r-- | lib/fribidi-bidi-type.c | 17 | ||||
-rw-r--r-- | lib/fribidi-bidi-type.h | 23 | ||||
-rw-r--r-- | lib/fribidi-bidi-types-list.h | 39 | ||||
-rw-r--r-- | lib/fribidi-bidi-types.c | 10 | ||||
-rw-r--r-- | lib/fribidi-bidi-types.h | 17 | ||||
-rw-r--r-- | lib/fribidi-bidi.c | 297 | ||||
-rw-r--r-- | lib/fribidi-bidi.h | 28 | ||||
-rw-r--r-- | lib/fribidi-common.h | 8 | ||||
-rw-r--r-- | lib/fribidi-config.h.in | 3 | ||||
-rw-r--r-- | lib/fribidi.def | 28 |
21 files changed, 430 insertions, 306 deletions
diff --git a/Makefile.am b/Makefile.am index ab53114..9f008a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,16 +1,18 @@ ## -*- Automake -*- ## Process this file with automake to produce Makefile.in ############################################################################## -## $Id: Makefile.am,v 1.6 2004-05-31 18:43:26 behdad Exp $ +## $Id: Makefile.am,v 1.7 2004-06-04 09:41:11 behdad Exp $ ## $Author: behdad $ -## $Date: 2004-05-31 18:43:26 $ -## $Revision: 1.6 $ +## $Date: 2004-06-04 09:41:11 $ +## $Revision: 1.7 $ ## $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/Makefile.am,v $ ############################################################################## ## The order of subdirs is important, don't change without a reason. SUBDIRS = gen.tab charset lib bin doc test +EXTRA_DIST = bootstrap ChangeLog.old + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = @PACKAGE@.pc @@ -22,37 +24,52 @@ MAINTAINERCLEANFILES = \ $(srcdir)/config.guess \ $(srcdir)/config.h.in \ $(srcdir)/config.sub \ - $(srcdir)/configure \ $(srcdir)/configure.scan \ $(srcdir)/depcomp \ $(srcdir)/install-sh \ $(srcdir)/ltmain.sh \ $(srcdir)/missing \ `find "$(srcdir)" -type f -name Makefile.in -print` \ - `find "$(srcdir)" -type f -name "*~" -print` + `find "$(srcdir)" -type f -name "*~" -print` \ + `$(srcdir)/bootstrap --write-configure` +# The last line above is a horrible hack. +# GNU Coding Standards recommends that `make maintainer-clean' should not +# remove the configure script. +# We instead make configure call bootstrap. BUILT_SOURCES = lib/fribidi-unicode-version.h lib/fribidi-unicode-version.h: (cd lib && $(MAKE) $(AM_MAKEFLAGS) fribidi-unicode-version.h) -# Indent all C source and header files - -.PHONY: indent +# Indent all C source and header files, using indent(1): indent: $(srcdir)/.indent.pro cd "$(srcdir)" && \ find . -type f -mindepth 2 -name "*.[ch]" -print | \ - xargs ./missing --run indent + xargs ./missing --run indent +.PHONY: indent -# Creating ChangeLog from CVS log, with cvs2cl: +# Creating ChangeLog from CVS log, using cvs2cl(1): MAINTAINERCLEANFILES += ChangeLog ChangeLog.bak -EXTRA_DIST = ChangeLog +EXTRA_DIST += ChangeLog + +ChangeLog: $(srcdir)/ChangeLog + +$(srcdir)/ChangeLog: + @if test -d "$(srcdir)/CVS"; then \ + (cd "$(srcdir)" && \ + ./missing --run cvs2cl --stdout --utc --FSF -U AUTHORS) > $@.tmp \ + && echo "For older changes see ChangeLog.old" >> $@.tmp && mv $@.tmp $@ \ + || ($(RM) $@.tmp; \ + echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ + (test -f $@ || echo cvs2cl is required to generate this file >> $@)); \ + else \ + test -f $@ || \ + (echo A CVS checkout and cvs2cl is required to generate ChangeLog >&2 && \ + echo A CVS checkout and cvs2cl is required to generate this file >> $@); \ + fi -ChangeLog: - if test -d "$(srcdir)/CVS"; then \ - cd "$(srcdir)" && \ - ./missing --run cvs2cl --stdout --utc --FSF -U AUTHORS; \ - fi > $@ +.PHONY: ChangeLog $(srcdir)/ChangeLog @@ -7,7 +7,7 @@ Implementation issues: * Update all files headers/footers. For c/h files, lib/fribidi-mirroring.[ch] is always the reference. -* Show BidiTypes enum in manual. +* Show BidiTypes enum in manual and gdb. * Update CapRTL with new Unicode reference code. @@ -40,7 +40,8 @@ Implementation issues: * Use gengetopt. * Add FriBidiEnv functionality at compile time. Also, ifdef out the memory - cleanup stuff if asked to fail on memory allocation failure (xmalloc). + cleanup stuff if asked to fail on memory allocation failure (xmalloc). When + this is done, FRIBIDI_GNUC_WARN_UNUSEDS can be turned off conditionally. * Fix cvs2cl bug with spacing around author names read with -U option. Then fix spacing in AUTHORS. @@ -48,8 +49,6 @@ Implementation issues: * Use `-' before any command for installing a man page, so that make will ignore any errors. -* Should fail if cannot build ChangeLog, right? - * Clean up README and NEWS, and check all files' headers. Write gen.tab/README. @@ -66,8 +65,6 @@ Implementation issues: From GNU Coding Standards: -* make maintainer-clean should not clean configure system. - * The distribution should contain a file named `README' which gives the name of the package, and a general description of what it does. It is also good to explain the purpose of each of the first-level subdirectories in the diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c index aaf6711..0b31089 100644 --- a/bin/fribidi-main.c +++ b/bin/fribidi-main.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-main.c - command line program for libfribidi * - * $Id: fribidi-main.c,v 1.6 2004-05-31 18:43:26 behdad Exp $ + * $Id: fribidi-main.c,v 1.7 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:43:26 $ - * $Revision: 1.6 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.7 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bin/fribidi-main.c,v $ * * Authors: @@ -253,8 +253,10 @@ main ( {"clean", 0, (int *) (void *) &do_clean, true}, {"ltr", 0, (int *) (void *) &input_base_direction, FRIBIDI_TYPE_LTR}, {"rtl", 0, (int *) (void *) &input_base_direction, FRIBIDI_TYPE_RTL}, - {"wltr", 0, (int *) (void *) &input_base_direction, FRIBIDI_TYPE_WLTR}, - {"wrtl", 0, (int *) (void *) &input_base_direction, FRIBIDI_TYPE_WRTL}, + {"wltr", 0, (int *) (void *) &input_base_direction, + FRIBIDI_TYPE_WLTR}, + {"wrtl", 0, (int *) (void *) &input_base_direction, + FRIBIDI_TYPE_WRTL}, {"basedir", 0, (int *) (void *) &show_basedir, true}, {"ltov", 0, (int *) (void *) &show_ltov, true}, {"vtol", 0, (int *) (void *) &show_vtol, true}, @@ -1,60 +1,98 @@ #! /bin/sh ############################################################################## -# $Id: bootstrap,v 1.2 2004-05-12 07:06:21 behdad Exp $ +# $Id: bootstrap,v 1.3 2004-06-04 09:41:11 behdad Exp $ # $Author: behdad -# $Date: 2004-05-12 07:06:21 $ -# $Revision: 1.2 $ +# $Date: 2004-06-04 09:41:11 $ +# $Revision: 1.3 $ # $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bootstrap,v $ ############################################################################## # -*- Bootstrap -*- # Run this file to produce a configure script. -DEFAULTARGS="--force --install --autoreconf=auto" +DEFAULT_BOOTSTRAPFLAGS="--force --install --autoreconf=auto" +DEFAULT_CONFIGUREFLAGS="--enable-maintainer-mode --enable-compile-warnings" -for arg in $DEFAULTARGS $* +OLDDIR=`pwd` + +# move to source dir +DIR=`echo $0 | sed 's,[^/]*$,,'` +test -n "$DIR" && cd "$DIR" + +if test "$1" = --write-configure; then + test -f configure && \ + ((echo '#! /bin/sh + DIR=`echo $0 | sed "s,[^/]*\$,,"` + exec ${DIR}bootstrap --configure -- "$@"' > configure \ + && chmod a+x configure) || \ + echo Failed writing to configure >&2) + + exit $? +fi + +# check if we are invoked as configure, or bootstrap +BASE=`echo $0 | sed 's,.*/,,'` +if test "$BASE" = "configure"; then + CONFIG=--config + EXTRA_CONFIGUREFLAGS=$@ +else # bootstrap + EXTRA_BOOTSTRAPFLAGS=$* +fi + +for arg in $DEFAULT_BOOTSTRAPFLAGS $BOOTSTRAPFLAGS $EXTRA_BOOTSTRAPFLAGS do +if test -n "$DASHDASHFLAGS"; then + DASHDASHFLAGS="$DASHDASHFLAGS $arg" +else case $arg in - -h | --help) + -h|--h|--he|--hel|--help) HELP=--help ;; - -V | --version) + -V|--vers|--versi|--versio|--version) VERSION=--version ;; - -v | --verbose) + -v|--verb|--verbo|--verbos|--verbose) VERBOSE=--verbose ;; - -d | --debug) + -d|--de|--deb|--debu|--debug) DEBUG=--debug ;; - -W | --warning | --warnings=yes) - WARNINGS=--warnings=all ;; - --no-warning | --warnings=no) - WARNINGS= ;; - --warning=*) - WARNINGS=$arg ;; - -f | --force | --force=yes | --force-missing) + -W|--w|--wa|--war|--warn|--warni|--warnin|--warning|--warnings|--warnings=yes|--warnings=all) + WARNS=--warnings=all ;; + --no-w|--no-wa|--no-war|--no-warn|--no-warni|--no-warnin|--no-warning|--no-warnings|--warn=no|--warning=no|--warnings=no) + WARNS=--warnings=none ;; + --w=*|--wa=*|--war=*|--warn=*|--warni=*|--warnin=*|--warning=*|--warnings=*) + WARNS=$arg ;; + -f|--f|--fo|--for|--forc|--force|--forced|--force=yes|--force-missing) FORCE=--force ;; - --no-force | --force=no) + --no-f|--no-fo|--no-for|--no-forc|--no-force|--no-forced|--force=no) FORCE=--no-force ;; - -i | --install | --install=yes | -a | --add-missing) + -i|--i|--in|--ins|--inst|--insta|--instal|--install|--install=yes|-a|--add-missing) INSTALL=--install ;; - --no-install | --install=no) + --no-i|--no-in|--no-ins|--no-inst|--no-insta|--no-instal|--no-install|--install=no) INSTALL= ;; - -s | --symlink | --symlink=yes | --no-copy | --copy=no) + -s|--s|--sy|--sym|--syml|--symli|--symlin|--symlink|--symlink=yes|--no-copy|--copy=no) SYMLINK=--symlink ;; - --no-symlink | --symlink=no | --copy | --copy=yes) + --no-s|--no-sy|--no-sym|--no-syml|--no-symli|--no-symlin|--no-symlink|--symlink=no|--copy|--copy=yes) SYMLINK= ;; - -m | --make | --make=yes) - MAKE=--make ;; - --no-make | --make=no) + -m|--m|--ma|--mak|--make|--make=yes) + MAKE=--make + CONFIG=--configure ;; + --no-m|--no-ma|--no-mak|--no-make|--make=no) MAKE= ;; - -n | --dry-run) + -c|--c|--co|--con|--conf|--confi|--config|--configu|--configur|--configure|--configure=yes) + CONFIG=--configure ;; + --no-c|--no-co|--no-con|--no-conf|--no-confi|--no-config|--no-configu|--no-configur|--no-configure|--configure=no) + CONFIG= ;; + -n|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run) DRYRUN=echo ;; - --autoreconf=auto) + --auto|--autoreconf=auto) AUTORECONF=auto ;; - --autoreconf | --autoreconf=yes) + --autoreconf|--autoreconf=yes) AUTORECONF=yes ;; - --no-autoreconf | --autoreconf=no) + --no-autoreconf|--autoreconf=no) AUTORECONF= ;; + --) + DASHDASHFLAGS=" " ;; *) echo Ignoring unknown parameter $arg esac +fi done test -z "$SYMLINK" && COPY=--copy @@ -73,39 +111,49 @@ if test "$AUTORECONF" = auto; then fi if test -n "$AUTORECONF"; then - $DRYRUN autoreconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $INSTALL $SYMLINK $MAKE $WARNINGS - exit $? -fi + $DRYRUN autoreconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $INSTALL $SYMLINK $MAKE $WARNS $AUTORECONFFLAGS || exit $? +else # add files 'config.guess', 'config.sub', 'ltconfig', 'ltmain.sh' -$DRYRUN libtoolize $HELP $VERSION --automake $COPY $DEBUG $FORCE || exit 1 +test -f Makefile.am && MY_LIBTOOLIZEFLAGS=--automake + +$DRYRUN libtoolize $HELP $VERSION $COPY $DEBUG $FORCE $MY_LIBTOOLIZEFLAGS $LIBTOOLIZEFLAGS || exit $? # generate 'aclocal.m4' if test -f configure.ac -o configure.in; then - $DRYRUN aclocal $HELP $VERSION $VERBOSE $FORCE || exit 1 + $DRYRUN aclocal $HELP $VERSION $VERBOSE $FORCE $ACLOCALFLAGS || exit $? fi # generate 'config.h.in' if test -f configure.ac -o configure.in; then - $DRYRUN autoheader $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNINGS || exit 1 + $DRYRUN autoheader $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOHEADERFLAGS || exit $? fi # generate Makefile.in's from Makefile.am's if test -f Makefile.am; then - $DRYRUN automake $HELP $VERSION $VERBOSE $ADDMISSING $COPY $FORCE $WARNINGS || exit 1 + $DRYRUN automake $HELP $VERSION $VERBOSE $ADDMISSING $COPY $FORCE $WARNS $AUTOMAKEFLAGS || exit $? fi # generate configure from configure.ac if test -f configure.ac -o -f configure.in; then - $DRYRUN autoconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNINGS || exit 1 + $DRYRUN autoconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOCONFFLAGS || exit $? fi -if test -n "$MAKE"; then - if test -f ./configure; then - $DRYRUN ./configure $HELP $VERSION \ - --enable-maintainer-mode --enable-compile-warnings || exit 1 +fi # !AUTOCONF + +# move to build dir +cd $OLDDIR + +# configure +if test -n "$CONFIG"; then + if test -f ${DIR}configure; then + $DRYRUN ${DIR}configure $HELP $VERSION $DEFAULT_CONFIGUREFLAGS $CONFIGUREFLAGS $DASHDASHFLAGS $EXTRA_CONFIGUREFLAGS || exit $? fi +fi + +# make +if test -n "$MAKE"; then if test -f Makefile; then - $DRYRUN make || exit 1 + $DRYRUN make $MAKEFLAGS || exit $? fi fi diff --git a/charset/fribidi-char-sets-cap-rtl.c b/charset/fribidi-char-sets-cap-rtl.c index 86cce9c..f4ecee1 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.5 2004-05-31 18:43:26 behdad Exp $ + * $Id: fribidi-char-sets-cap-rtl.c,v 1.6 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:43:26 $ - * $Revision: 1.5 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.6 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.c,v $ * * Authors: @@ -50,7 +50,7 @@ enum MyFriBidiTypeEnum # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_TYPE_##TYPE, # include "fribidi-bidi-types-list.h" # undef _FRIBIDI_ADD_TYPE - MY_NUM_TYPES + _FRIBIDI_NUM_TYPES }; @@ -76,8 +76,8 @@ init_cap_rtl ( void ) { - int request[MY_NUM_TYPES]; - FriBidiCharType to_type[MY_NUM_TYPES]; + int request[_FRIBIDI_NUM_TYPES]; + FriBidiCharType to_type[_FRIBIDI_NUM_TYPES]; int num_types = 0, j, count = 0; FriBidiCharType i; diff --git a/configure.ac b/configure.ac index bb7e47a..4377ed1 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.11 2004-05-31 18:43:26 behdad Exp $ +## $Id: configure.ac,v 1.12 2004-06-04 09:41:11 behdad Exp $ ## $Auther: behdad $ -## $Date: 2004-05-31 18:43:26 $ -## $Revision: 1.11 $ +## $Date: 2004-06-04 09:41:11 $ +## $Revision: 1.12 $ ## $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.11 2004-05-31 18:43:26 behdad Exp $]) +AC_REVISION([$Id: configure.ac,v 1.12 2004-06-04 09:41:11 behdad Exp $]) AC_CONFIG_SRCDIR(lib/fribidi.h) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([gnits]) @@ -110,6 +110,7 @@ AC_C_CONST AC_C_INLINE AC_C_STRINGIZE AC_CHECK_SIZEOF(int) +AC_SUBST(SIZEOF_INT) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(wchar_t) diff --git a/doc/Makefile.am b/doc/Makefile.am index 2b3dc0b..1eb004a 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -46,20 +46,22 @@ C2MANFLAGS = $(includepath) \ VPATH += $(includevpath) +x: + @echo $(headers) + c2man.stamp: $(headers) @$(RM) $@.tmp @touch $@.tmp - ($(LN_S) $^ . || cp $^ .) - $(top_srcdir)/missing --run c2man -T n $(C2MANFLAGS) $(headers) \ + @($(LN_S) $^ . || cp $^ .) + @echo Running c2man + @$(top_srcdir)/missing --run c2man -T n $(C2MANFLAGS) $(headers) \ || true - $(RM) $(headers) + @$(RM) $(headers) @mv $@.tmp $@ $(man3): c2man.stamp - @if test -f $@; then \ - touch $@; \ - else \ + @if ! test -f $@; then \ $(RM) $<; \ - $(MAKE) $(AM_MAKEFLAGS) $< || touch $<; \ - touch $@; \ + $(MAKE) $(AM_MAKEFLAGS) $<;\ fi + @touch $@ diff --git a/gen.tab/.cvsignore b/gen.tab/.cvsignore index 49b78fb..d153fc6 100644 --- a/gen.tab/.cvsignore +++ b/gen.tab/.cvsignore @@ -1,3 +1,3 @@ -gen-bidi-type-table -gen-mirroring-table +gen-bidi-type-tab +gen-mirroring-tab gen-unicode-version diff --git a/gen.tab/Makefile.am b/gen.tab/Makefile.am index c0eab3c..dc263df 100644 --- a/gen.tab/Makefile.am +++ b/gen.tab/Makefile.am @@ -112,3 +112,4 @@ fribidi-unicode-version.h: DISTCLEANFILES += $(UNICODE_VERSION_VARIANTS) +.DELETE_ON_ERROR: diff --git a/gen.tab/gen-bidi-type-tab.c b/gen.tab/gen-bidi-type-tab.c index 6690c34..bd9fe60 100644 --- a/gen.tab/gen-bidi-type-tab.c +++ b/gen.tab/gen-bidi-type-tab.c @@ -1,10 +1,10 @@ /* FriBidi * gen-bidi-type-tab.c - generate bidi-type.tab.i for libfribidi * - * $Id: gen-bidi-type-tab.c,v 1.9 2004-05-31 18:43:26 behdad Exp $ + * $Id: gen-bidi-type-tab.c,v 1.10 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:43:26 $ - * $Revision: 1.9 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.10 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-bidi-type-tab.c,v $ * * Author: @@ -97,7 +97,7 @@ enum FriBidiCharTypeLinearEnumOffsetOne { # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE, # define _FRIBIDI_ADD_ALIAS(TYPE1,TYPE2) TYPE1 = TYPE2, -# include <bidi-types-list.h> +# include <fribidi-bidi-types-list.h> # undef _FRIBIDI_ADD_ALIAS # undef _FRIBIDI_ADD_TYPE NUM_TYPES @@ -112,7 +112,7 @@ type_names[] = { # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) {STRINGIZE(TYPE), TYPE}, # define _FRIBIDI_ADD_ALIAS(TYPE1,TYPE2) _FRIBIDI_ADD_TYPE(TYPE1, SYMBOL) -# include <bidi-types-list.h> +# include <fribidi-bidi-types-list.h> # undef _FRIBIDI_ADD_ALIAS # undef _FRIBIDI_ADD_TYPE }; @@ -170,7 +170,7 @@ init_tab_unicode_data_txt ( { register FriBidiChar c; - clear_tab(); + clear_tab (); for (c = 0x0590; c < 0x0600; c++) table[c] = RTL; @@ -208,10 +208,10 @@ init_tab_unicode_data_txt ( } static void -init_tab_derived_bidi_class_txt( +init_tab_derived_bidi_class_txt ( ) { - clear_tab(); + clear_tab (); } static void @@ -222,7 +222,7 @@ read_unicode_data_txt ( char tp[10]; unsigned long c, l; - init_tab_unicode_data_txt(); + init_tab_unicode_data_txt (); l = 0; while (fgets (s, sizeof s, f)) @@ -250,7 +250,7 @@ read_derived_bidi_class_txt ( char tp[10]; unsigned long c, c2, l; - init_tab_derived_bidi_class_txt(); + init_tab_derived_bidi_class_txt (); l = 0; while (fgets (s, sizeof s, f)) diff --git a/lib/Headers.mk b/lib/Headers.mk index 42450e5..0c33d5d 100644 --- a/lib/Headers.mk +++ b/lib/Headers.mk @@ -14,4 +14,4 @@ libfribidi_la_headers = \ fribidi-unicode-version.h \ fribidi.h -include $(top_srcdir)/lib/fribidi.def +libfribidi_la_symbols := $(shell cat "$(top_srcdir)/lib/fribidi.def") diff --git a/lib/fribidi-bidi-type.c b/lib/fribidi-bidi-type.c index 22362bb..6ca72ca 100644 --- a/lib/fribidi-bidi-type.c +++ b/lib/fribidi-bidi-type.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi-type.c - get character bidi type * - * $Id: fribidi-bidi-type.c,v 1.8 2004-05-31 18:43:26 behdad Exp $ + * $Id: fribidi-bidi-type.c,v 1.9 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:43:26 $ - * $Revision: 1.8 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.9 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.c,v $ * * Authors: @@ -43,7 +43,7 @@ enum FriBidiCharTypeLinearEnum # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE, # include "fribidi-bidi-types-list.h" # undef _FRIBIDI_ADD_TYPE - NUM_TYPES + _FRIBIDI_NUM_TYPES }; #include "bidi-type.tab.i" @@ -86,6 +86,15 @@ fribidi_get_type ( return fribidi_get_bidi_type (ch); } +/* The following is only defined for binary compatibility */ +FriBidiCharType +fribidi_get_type_internal ( + FriBidiChar ch +) +{ + return fribidi_get_bidi_type (ch); +} + FRIBIDI_ENTRY void fribidi_get_bidi_types ( /* input */ diff --git a/lib/fribidi-bidi-type.h b/lib/fribidi-bidi-type.h index 79e07d4..49322ef 100644 --- a/lib/fribidi-bidi-type.h +++ b/lib/fribidi-bidi-type.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi-type.h - get character bidi type * - * $Id: fribidi-bidi-type.h,v 1.2 2004-05-03 22:05:19 behdad Exp $ + * $Id: fribidi-bidi-type.h,v 1.3 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-03 22:05:19 $ - * $Revision: 1.2 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.3 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.h,v $ * * Author: @@ -50,9 +50,15 @@ fribidi_get_bidi_type ( FriBidiChar ch /* input character */ ) FRIBIDI_GNUC_CONST; -/* fribidi_get_type is the old name of fribidi_get_bidi_type */ +/* fribidi_get_type is the old name of fribidi_get_bidi_type. deprecated.*/ #define fribidi_get_type FRIBIDI_NAMESPACE(get_type) - FriBidiCharType fribidi_get_type ( + FRIBIDI_ENTRY FriBidiCharType fribidi_get_type ( + FriBidiChar ch +) + FRIBIDI_GNUC_CONST FRIBIDI_GNUC_DEPRECATED; + +#define fribidi_get_type_internal FRIBIDI_NAMESPACE(get_type_internal) + FRIBIDI_ENTRY FriBidiCharType fribidi_get_type_internal ( FriBidiChar ch ) FRIBIDI_GNUC_CONST FRIBIDI_GNUC_DEPRECATED; @@ -68,14 +74,13 @@ fribidi_get_bidi_type ( FriBidiCharType *type /* output bidi types */ ); -/* fribidi_get_types is the old name of fribidi_get_bidi_types */ +/* fribidi_get_types is the old name of fribidi_get_bidi_types. deprecated. */ #define fribidi_get_types FRIBIDI_NAMESPACE(get_types) - void fribidi_get_bidi_types ( + FRIBIDI_ENTRY void fribidi_get_types ( const FriBidiChar *str, FriBidiStrIndex len, FriBidiCharType *type -) - FRIBIDI_GNUC_CONST FRIBIDI_GNUC_DEPRECATED; +) FRIBIDI_GNUC_DEPRECATED; #include "fribidi-enddecls.h" diff --git a/lib/fribidi-bidi-types-list.h b/lib/fribidi-bidi-types-list.h index 25f7069..ead39e7 100644 --- a/lib/fribidi-bidi-types-list.h +++ b/lib/fribidi-bidi-types-list.h @@ -2,10 +2,10 @@ /* FriBidi * fribidi-bidi-types-list.h - list of bidi types * - * $Id: fribidi-bidi-types-list.h,v 1.1 2004-05-31 18:43:26 behdad Exp $ + * $Id: fribidi-bidi-types-list.h,v 1.2 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:43:26 $ - * $Revision: 1.1 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.2 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types-list.h,v $ * * Author: @@ -40,7 +40,7 @@ # define _FRIBIDI_ADD_ALIAS(x1,x2) #endif -#if !_FRIBIDI_PAR_TYPES +#if !defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES) /* Bidi types from the standard. */ /* The order of these types is important. Don't change. */ _FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right letter */ @@ -63,7 +63,7 @@ _FRIBIDI_ADD_TYPE (LRO, '+') /* Left-to-Right Override */ _FRIBIDI_ADD_TYPE (RLO, '+') /* Right-to-Left Override */ _FRIBIDI_ADD_TYPE (PDF, '-') /* Pop Directional Flag */ -#ifdef _FRIBIDI_ADD_ALIAS +#if defined(_FRIBIDI_ADD_ALIAS) /* The followings are just aliases to types, but with the name that appears in * the Unicode database. */ _FRIBIDI_ADD_ALIAS (L, LTR) @@ -72,18 +72,29 @@ _FRIBIDI_ADD_ALIAS (B, BS) _FRIBIDI_ADD_ALIAS (S, SS) #endif /* _FRIBIDI_ADD_ALIAS */ -#ifdef _FRIBIDI_SENTINEL_TYPE -_FRIBIDI_ADD_TYPE (SENTINEL, '$') /* Sentinel */ -#endif /* _FRIBIDI_SENTINEL_TYPES */ -#endif /* !_FRIBIDI_PAR_TYPES */ +#if defined(_FRIBIDI_SENTINEL_TYPE) || defined(_FRIBIDI_ALL_TYPES) +_FRIBIDI_ADD_TYPE (SENTINEL, '$') /* SENTINEL */ +#endif /* _FRIBIDI_SENTINEL_TYPES || _FRIBIDI_ALL_TYPES*/ +#endif /* !_FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES */ -#if _FRIBIDI_PAR_TYPES +#if defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES) +# if !defined(_FRIBIDI_ALL_TYPES) _FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right paragraph */ _FRIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left paragraph */ -_FRIBIDI_ADD_TYPE (WLTR, 'l') /* Weak left to right paragraph */ -_FRIBIDI_ADD_TYPE (WRTL, 'r') /* Weak right to left paragraph */ -_FRIBIDI_ADD_TYPE (ON, 'n') /* Direction-neutral paragraph */ -#endif /* _FRIBIDI_PAR_TYPES */ +_FRIBIDI_ADD_TYPE (ON, 'n') /* directiOn-Neutral paragraph */ +# endif /* !_FRIBIDI_ALL_TYPES */ +_FRIBIDI_ADD_TYPE (WLTR, 'l') /* Weak Left To Right paragraph */ +_FRIBIDI_ADD_TYPE (WRTL, 'r') /* Weak Right To Left paragraph */ +#endif /* _FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES*/ + +#if defined(_FRIBIDI_ENUM_TYPES) +typedef enum { +# define _FRIBIDI_ADD_TYPE _FRIBIDI_ENUM_ADD_TYPE +# include "fribidi-bidi-types-list.h" +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_TYPES_MAX +} _FRIBIDI_ENUM_TYPES +#endif /* _FRIBIDI_ENUM_TYPES */ #ifndef __C2MAN__ /* *INDENT-ON* */ diff --git a/lib/fribidi-bidi-types.c b/lib/fribidi-bidi-types.c index 8ec0c91..ca5478b 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.4 2004-05-31 18:39:39 behdad Exp $ + * $Id: fribidi-bidi-types.c,v 1.5 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:39:39 $ - * $Revision: 1.4 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.5 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.c,v $ * * Authors: @@ -48,7 +48,9 @@ fribidi_char_from_bidi_type ( switch (t) { # 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 '?'; @@ -66,7 +68,9 @@ fribidi_bidi_type_name ( switch (t) { # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return #TYPE; +# define _FRIBIDI_ALL_TYPES # include "fribidi-bidi-types-list.h" +# undef _FRIBIDI_ALL_TYPES # undef _FRIBIDI_ADD_TYPE default: return "?"; diff --git a/lib/fribidi-bidi-types.h b/lib/fribidi-bidi-types.h index 161dcbe..58ed648 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.3 2004-05-03 22:05:19 behdad Exp $ + * $Id: fribidi-bidi-types.h,v 1.4 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-03 22:05:19 $ - * $Revision: 1.3 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.4 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $ * * Author: @@ -160,6 +160,7 @@ typedef FriBidiMaskType FriBidiCharType; /* Weak right to left */ #define FRIBIDI_TYPE_WRTL ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_RTL ) + /* Just for compatibility */ #define FRIBIDI_TYPE_WL FRIBIDI_TYPE_WLTR #define FRIBIDI_TYPE_WR FRIBIDI_TYPE_WRTL @@ -188,11 +189,11 @@ typedef FriBidiMaskType FriBidiCharType; /* Return the direction of the level number, FRIBIDI_TYPE_LTR for even and FRIBIDI_TYPE_RTL for odds. */ -#define FRIBIDI_LEVEL_TO_DIR(lev) (FRIBIDI_TYPE_LTR | (lev & 1)) +#define FRIBIDI_LEVEL_TO_DIR(lev) (FRIBIDI_TYPE_LTR | ((lev) & 1)) /* Return the minimum level of the direction, 0 for FRIBIDI_TYPE_LTR and 1 for FRIBIDI_TYPE_RTL and FRIBIDI_TYPE_AL. */ -#define FRIBIDI_DIR_TO_LEVEL(dir) ((FriBidiLevel)(dir & 1)) +#define FRIBIDI_DIR_TO_LEVEL(dir) ((FriBidiLevel)((dir) & 1)) /* Is right to left? */ #define FRIBIDI_IS_RTL(p) ((p) & FRIBIDI_MASK_RTL) @@ -267,6 +268,12 @@ typedef FriBidiMaskType FriBidiCharType; (FRIBIDI_IS_OVERRIDE(p) ? FRIBIDI_LEVEL_TO_DIR(FRIBIDI_DIR_TO_LEVEL(p)) \ : FRIBIDI_TYPE_ON) +/* Weaken type for paragraph fallback purposes: + * LTR->WLTR, RTL->WRTL. */ +#define FRIBIDI_WEAK_PARAGRAPH(p) (FRIBIDI_TYPE_WLTR | ((p) & 1)) + + +/* Functions finally */ /* fribidi_type_name is the old name of fribidi_bidi_type_name */ #define fribidi_type_name fribidi_bidi_type_name diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c index 09041cb..8ab41af 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.7 2004-05-31 18:39:39 behdad Exp $ + * $Id: fribidi-bidi.c,v 1.8 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:39:39 $ - * $Revision: 1.7 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.8 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.c,v $ * * Authors: @@ -118,98 +118,6 @@ compact_neutrals ( } } -/*========================================================================= - * define macros for push and pop the status in to / out of the stack - *-------------------------------------------------------------------------*/ - -/* There's some little points in pushing and poping into the status stack: - 1. when the embedding level is not valid (more than - FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61), you must reject it, and not to push - into the stack, but when you see a PDF, you must find the matching code, - and if it was pushed in the stack, pop it, it means you must pop if and - only if you have pushed the matching code, the over_pushed var counts the - number of rejected codes yet. - 2. there's a more confusing point too, when the embedding level is exactly - FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL-1=60, an LRO or LRE must be rejected - because the new level would be FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL+1=62, that - is invalid, but an RLO or RLE must be accepted because the new level is - FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61, that is valid, so the rejected codes - may be not continuous in the logical order, in fact there is at most two - continuous intervals of codes, with a RLO or RLE between them. To support - this case, the first_interval var counts the number of rejected codes in - the first interval, when it is 0, means that there is only one interval yet. -*/ - -/* a. If this new level would be valid, then this embedding code is valid. - Remember (push) the current embedding level and override status. - Reset current level to this new level, and reset the override status to - new_override. - b. If the new level would not be valid, then this code is invalid. Don't - change the current level or override status. -*/ -#define PUSH_STATUS \ - FRIBIDI_BEGIN_STMT \ - if LIKELY(new_level <= FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL) \ - { \ - if UNLIKELY(level == FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL - 1) \ - first_interval = over_pushed; \ - status_stack[stack_size].level = level; \ - status_stack[stack_size].override = override; \ - stack_size++; \ - level = new_level; \ - override = new_override; \ - } else \ - over_pushed++; \ - FRIBIDI_END_STMT - -/* If there was a valid matching code, restore (pop) the last remembered - (pushed) embedding level and directional override. -*/ -#define POP_STATUS \ - FRIBIDI_BEGIN_STMT \ - if (stack_size) \ - { \ - if UNLIKELY(over_pushed > first_interval) \ - over_pushed--; \ - else \ - { \ - if LIKELY(over_pushed == first_interval) \ - first_interval = 0; \ - stack_size--; \ - level = status_stack[stack_size].level; \ - override = status_stack[stack_size].override; \ - } \ - } \ - FRIBIDI_END_STMT - -/*========================================================================== - * There was no support for sor and eor in the absence of Explicit Embedding - * Levels, so define macros, to support them, with as less change as needed. - *--------------------------------------------------------------------------*/ - -/* Return the type of previous run or the SOR, if already at the start of - a level run. */ -#define PREV_TYPE_OR_SOR(pp) \ - ( \ - RL_LEVEL(pp->prev) == RL_LEVEL(pp) ? \ - RL_TYPE(pp->prev) : \ - FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->prev), RL_LEVEL(pp))) \ - ) - -/* Return the type of next run or the EOR, if already at the end of - a level run. */ -#define NEXT_TYPE_OR_EOR(pp) \ - ( \ - RL_LEVEL(pp->next) == RL_LEVEL(pp) ? \ - RL_TYPE(pp->next) : \ - FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->next), RL_LEVEL(pp))) \ - ) - - -/* Return the embedding direction of a link. */ -#define FRIBIDI_EMBEDDING_DIRECTION(list) \ - FRIBIDI_LEVEL_TO_DIR(RL_LEVEL(list)) - #if DEBUG /*====================================================================== * For debugging, define some functions for printing the types and the @@ -307,8 +215,98 @@ print_bidi_string ( } #endif /* DEBUG */ + +/*========================================================================= + * define macros for push and pop the status in to / out of the stack + *-------------------------------------------------------------------------*/ + +/* There's some little points in pushing and poping into the status stack: + 1. when the embedding level is not valid (more than + FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61), you must reject it, and not to push + into the stack, but when you see a PDF, you must find the matching code, + and if it was pushed in the stack, pop it, it means you must pop if and + only if you have pushed the matching code, the over_pushed var counts the + number of rejected codes yet. + 2. there's a more confusing point too, when the embedding level is exactly + FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL-1=60, an LRO or LRE must be rejected + because the new level would be FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL+1=62, that + is invalid, but an RLO or RLE must be accepted because the new level is + FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61, that is valid, so the rejected codes + may be not continuous in the logical order, in fact there is at most two + continuous intervals of codes, with a RLO or RLE between them. To support + this case, the first_interval var counts the number of rejected codes in + the first interval, when it is 0, means that there is only one interval yet. +*/ + +/* a. If this new level would be valid, then this embedding code is valid. + Remember (push) the current embedding level and override status. + Reset current level to this new level, and reset the override status to + new_override. + b. If the new level would not be valid, then this code is invalid. Don't + change the current level or override status. +*/ +#define PUSH_STATUS \ + FRIBIDI_BEGIN_STMT \ + if LIKELY(new_level <= FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL) \ + { \ + if UNLIKELY(level == FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL - 1) \ + first_interval = over_pushed; \ + status_stack[stack_size].level = level; \ + status_stack[stack_size].override = override; \ + stack_size++; \ + level = new_level; \ + override = new_override; \ + } else \ + over_pushed++; \ + FRIBIDI_END_STMT + +/* If there was a valid matching code, restore (pop) the last remembered + (pushed) embedding level and directional override. +*/ +#define POP_STATUS \ + FRIBIDI_BEGIN_STMT \ + if (stack_size) \ + { \ + if UNLIKELY(over_pushed > first_interval) \ + over_pushed--; \ + else \ + { \ + if LIKELY(over_pushed == first_interval) \ + first_interval = 0; \ + stack_size--; \ + level = status_stack[stack_size].level; \ + override = status_stack[stack_size].override; \ + } \ + } \ + FRIBIDI_END_STMT + + +/* Return the type of previous run or the SOR, if already at the start of + a level run. */ +#define PREV_TYPE_OR_SOR(pp) \ + ( \ + RL_LEVEL(pp->prev) == RL_LEVEL(pp) ? \ + RL_TYPE(pp->prev) : \ + FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->prev), RL_LEVEL(pp))) \ + ) + +/* Return the type of next run or the EOR, if already at the end of + a level run. */ +#define NEXT_TYPE_OR_EOR(pp) \ + ( \ + RL_LEVEL(pp->next) == RL_LEVEL(pp) ? \ + RL_TYPE(pp->next) : \ + FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->next), RL_LEVEL(pp))) \ + ) + + +/* Return the embedding direction of a link. */ +#define FRIBIDI_EMBEDDING_DIRECTION(list) \ + FRIBIDI_LEVEL_TO_DIR(RL_LEVEL(list)) + + static fribidi_boolean -fribidi_analyse_string ( +fribidi_get_embedding_levels_internal ( const FriBidiChar *str, FriBidiStrIndex len, FriBidiCharType *pbase_dir, @@ -319,7 +317,7 @@ fribidi_analyse_string ( /*====================================================================== * This function should follow the Unicode specification closely! *----------------------------------------------------------------------*/ - static fribidi_boolean fribidi_analyse_string ( + static fribidi_boolean fribidi_get_embedding_levels_internal ( /* input */ const FriBidiChar *str, FriBidiStrIndex len, @@ -335,12 +333,10 @@ fribidi_analyse_string ( FriBidiRun *main_run_list = NULL, *explicits_list = NULL, *pp; fribidi_boolean status = false; - DBG ("entering fribidi_analyse_string"); + DBG ("entering fribidi_get_embedding_levels_internal"); fribidi_assert (str); fribidi_assert (pbase_dir); - fribidi_assert (pmain_run_list); - fribidi_assert (pmax_level); /* Determinate character types */ DBG (" determine character types"); @@ -361,20 +357,17 @@ fribidi_analyse_string ( /* Find base level */ DBG (" finding the base level"); - if (FRIBIDI_IS_STRONG (*pbase_dir)) - base_level = FRIBIDI_DIR_TO_LEVEL (*pbase_dir); - /* P2. P3. Search for first strong character and use its direction as - base direction */ - else + /* If no strong base_dir was found, resort to the weak direction + that was passed on input. */ + base_level = FRIBIDI_DIR_TO_LEVEL (*pbase_dir); + if (!FRIBIDI_IS_STRONG (*pbase_dir)) + /* P2. P3. Search for first strong character and use its direction as + base direction */ { - /* If no strong base_dir was found, resort to the weak direction - that was passed on input. */ - base_level = FRIBIDI_DIR_TO_LEVEL (*pbase_dir); - base_dir = FRIBIDI_TYPE_ON; for_run_list (pp, main_run_list) if (FRIBIDI_IS_LETTER (RL_TYPE (pp))) { base_level = FRIBIDI_DIR_TO_LEVEL (RL_TYPE (pp)); - base_dir = FRIBIDI_LEVEL_TO_DIR (base_level); + *pbase_dir = FRIBIDI_LEVEL_TO_DIR (base_level); break; } } @@ -525,7 +518,7 @@ fribidi_analyse_string ( for_run_list (pp, main_run_list) { - FriBidiCharType prev_type, this_type, next_type; + register FriBidiCharType prev_type, this_type, next_type; prev_type = PREV_TYPE_OR_SOR (pp); this_type = RL_TYPE (pp); @@ -576,7 +569,7 @@ fribidi_analyse_string ( for_run_list (pp, main_run_list) { - FriBidiCharType prev_type, this_type, next_type; + register FriBidiCharType prev_type, this_type, next_type; prev_type = PREV_TYPE_OR_SOR (pp); this_type = RL_TYPE (pp); @@ -698,8 +691,8 @@ fribidi_analyse_string ( if (FRIBIDI_IS_NUMBER (this_type)) RL_LEVEL (pp) = (level + 2) & ~1; else - RL_LEVEL (pp) = (level ^ FRIBIDI_DIR_TO_LEVEL (this_type)) + - (level & 1); + RL_LEVEL (pp) = + level + ((level & 1) ^ FRIBIDI_DIR_TO_LEVEL (this_type)); if (RL_LEVEL (pp) > max_level) max_level = RL_LEVEL (pp); @@ -802,11 +795,17 @@ fribidi_analyse_string ( # endif /* DEBUG */ status = true; - *pmain_run_list = main_run_list; - *pmax_level = max_level; - *pbase_dir = base_dir; + if (pmain_run_list) + *pmain_run_list = main_run_list; + else + { + free_run_list (main_run_list); + main_run_list = NULL; + } + if (pmax_level) + *pmax_level = max_level; - DBG ("leaving fribidi_analyse_string"); + DBG ("leaving fribidi_get_embedding_levels_internal"); out: if UNLIKELY (explicits_list) free_run_list (explicits_list); @@ -867,7 +866,7 @@ fribidi_remove_bidi_marks ( DBG ("entering fribidi_remove_bidi_marks"); - /* If to_this is to not null, we must have from_this as well. If it is + /* If to_this is to not NULL, we must have from_this as well. If it is not given by the caller, we have to make a private instance of it. */ if (position_to_this_list && !position_from_this_list) { @@ -949,9 +948,9 @@ fribidi_log2vis ( } if UNLIKELY - (!fribidi_analyse_string (str, len, pbase_dir, - /* output */ - &main_run_list, &max_level)) + (!fribidi_get_embedding_levels_internal (str, len, pbase_dir, + /* output */ + &main_run_list, &max_level)) { status = false; goto out; @@ -1010,30 +1009,29 @@ fribidi_log2vis ( DBG (" fill the embedding levels array, done"); } - /* Reorder both the outstring and the order array */ - if (visual_str || position_V_to_L_list) + if (fribidi_mirroring_status () && visual_str) { - if (fribidi_mirroring_status () && visual_str) - { - /* L4. Mirror all characters that are in odd levels and have mirrors. */ - DBG (" mirroring"); - for_run_list (pp, main_run_list) + /* L4. Mirror all characters that are in odd levels and have mirrors. */ + DBG (" mirroring"); + for_run_list (pp, main_run_list) + { + if (pp->level & 1) { - if (pp->level & 1) + FriBidiStrIndex i; + for (i = RL_POS (pp); i < RL_POS (pp) + RL_LEN (pp); i++) { - FriBidiStrIndex i; - for (i = RL_POS (pp); i < RL_POS (pp) + RL_LEN (pp); i++) - { - FriBidiChar mirrored_ch; - if (fribidi_get_mirror_char - (visual_str[i], &mirrored_ch)) - visual_str[i] = mirrored_ch; - } + FriBidiChar mirrored_ch; + if (fribidi_get_mirror_char (visual_str[i], &mirrored_ch)) + visual_str[i] = mirrored_ch; } } - DBG (" mirroring, done"); - } + } + DBG (" mirroring, done"); + } + /* Reorder both the outstring and the order array */ + if (visual_str || position_V_to_L_list) + { if (fribidi_reorder_nsm_status ()) { /* L3. Reorder NSMs. */ @@ -1132,7 +1130,7 @@ out: } FRIBIDI_ENTRY fribidi_boolean -fribidi_log2vis_get_embedding_levels ( +fribidi_get_embedding_levels ( /* input */ const FriBidiChar *str, FriBidiStrIndex len, @@ -1143,10 +1141,10 @@ fribidi_log2vis_get_embedding_levels ( ) { FriBidiRun *main_run_list, *pp; - FriBidiLevel max_level; fribidi_boolean status = true; + register FriBidiStrIndex pos; - DBG ("entering fribidi_log2vis_get_embedding_levels()"); + DBG ("entering fribidi_get_embedding_levels()"); fribidi_assert (str); fribidi_assert (pbase_dir); @@ -1155,23 +1153,24 @@ fribidi_log2vis_get_embedding_levels ( (len == 0) goto out; if UNLIKELY - (!fribidi_analyse_string (str, len, pbase_dir, - /* output */ - &main_run_list, &max_level)) + (!fribidi_get_embedding_levels_internal (str, len, pbase_dir, + /* output */ + &main_run_list, NULL)) { status = false; goto out; } + pos = 0; for_run_list (pp, main_run_list) { - register FriBidiStrIndex i, pos = pp->pos, len = pp->len; + register FriBidiStrIndex l; register FriBidiLevel level = pp->level; - for (i = 0; i < len; i++) + for (l = pp->len; l; l--) embedding_level_list[pos++] = level; } - DBG ("leaving fribidi_log2vis_get_embedding_levels()"); + DBG ("leaving fribidi_get_embedding_levels()"); out: free_run_list (main_run_list); diff --git a/lib/fribidi-bidi.h b/lib/fribidi-bidi.h index ceaca2a..7537e99 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.3 2004-05-22 10:35:31 behdad Exp $ + * $Id: fribidi-bidi.h,v 1.4 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-22 10:35:31 $ - * $Revision: 1.3 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.4 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.h,v $ * * Authors: @@ -69,8 +69,8 @@ fribidi_log2vis ( FriBidiLevel *embedding_level_list /* output list of embedding levels */ ) FRIBIDI_GNUC_WARN_UNUSED; -#define fribidi_log2vis_get_embedding_levels FRIBIDI_NAMESPACE(log2vis_get_embedding_levels) -/* fribidi_log2vis_get_embedding_levels - get bidi embedding levels +#define fribidi_get_embedding_levels FRIBIDI_NAMESPACE(get_embedding_levels) +/* fribidi_get_embedding_levels - get bidi embedding levels * * This function finds the bidi embedding levels of a single paragraph, * as defined by the Unicode Bidirectional Algorithm. @@ -78,7 +78,7 @@ fribidi_log2vis ( * Returns: Non-zero if it was successful, or zero if any error occured * (memory allocation failure most probably). */ - FRIBIDI_ENTRY fribidi_boolean fribidi_log2vis_get_embedding_levels ( + FRIBIDI_ENTRY fribidi_boolean fribidi_get_embedding_levels ( const FriBidiChar *str, /* input logical string */ FriBidiStrIndex len, /* input string length */ FriBidiCharType *pbase_dir, /* requested and resolved paragraph @@ -86,6 +86,22 @@ fribidi_log2vis ( 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 + * strint str with their mirrored equivalent as returned by + * fribidi_get_mirror_char(). + * + * Returns: Non-zero if it was successful, or zero if any error occured + * (memory allocation failure most probably). + */ + FRIBIDI_ENTRY fribidi_boolean fribidi_shape_mirroring ( + const FriBidiChar *str, /* string to shape */ + FriBidiStrIndex len, /* input string length */ + FriBidiLevel *embedding_level_list /* input list of embedding levels */ +) FRIBIDI_GNUC_WARN_UNUSED; + #define fribidi_remove_bidi_marks FRIBIDI_NAMESPACE(remove_bidi_marks) /* fribidi_remove_bidi_marks - remove bidi marks out an string * diff --git a/lib/fribidi-common.h b/lib/fribidi-common.h index 24c0f44..b774dee 100644 --- a/lib/fribidi-common.h +++ b/lib/fribidi-common.h @@ -1,10 +1,10 @@ /* FriBidi * fribidi-common.h - common include for library headers * - * $Id: fribidi-common.h,v 1.7 2004-05-31 18:39:39 behdad Exp $ + * $Id: fribidi-common.h,v 1.8 2004-06-04 09:41:11 behdad Exp $ * $Author: behdad $ - * $Date: 2004-05-31 18:39:39 $ - * $Revision: 1.7 $ + * $Date: 2004-06-04 09:41:11 $ + * $Revision: 1.8 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-common.h,v $ * * Author: @@ -78,7 +78,7 @@ # define FRIBIDI_GNUC_WARN_UNUSED # define FRIBIDI_GNUC_MALLOC # define FRIBIDI_GNUC_HIDDEN -# endif /* __GNUC__ <= 2 */ +# endif /* __GNUC__ <= 2 */ #else /* !FRIBIDI_USE_GLIB */ # define FRIBIDI_GNUC_CONST # define FRIBIDI_GNUC_DEPRECATED diff --git a/lib/fribidi-config.h.in b/lib/fribidi-config.h.in index 53416b5..7e10261 100644 --- a/lib/fribidi-config.h.in +++ b/lib/fribidi-config.h.in @@ -20,4 +20,7 @@ /* Define to 1 if you want to use glib */ #define FRIBIDI_USE_GLIB @FRIBIDI_USE_GLIB@ +/* The size of a `int', as computed by sizeof. */ +#define FRIBIDI_SIZEOF_INT @SIZEOF_INT@ + #endif /* FRIBIDI_CONFIG_H */ diff --git a/lib/fribidi.def b/lib/fribidi.def index dcd72c0..8cca5ac 100644 --- a/lib/fribidi.def +++ b/lib/fribidi.def @@ -1,13 +1,15 @@ -libfribidi_la_symbols = \ - fribidi_get_bidi_type \ - fribidi_get_bidi_types \ - fribidi_log2vis \ - fribidi_log2vis_get_embedding_levels \ - fribidi_remove_bidi_marks \ - fribidi_get_mirror_char \ - fribidi_debug_status \ - fribidi_set_debug \ - fribidi_mirroring_status \ - fribidi_set_mirroring \ - fribidi_reorder_nsm_status \ - fribidi_set_reorder_nsm +fribidi_bidi_type_name +fribidi_get_bidi_type +fribidi_get_bidi_types +fribidi_get_type +fribidi_get_types +fribidi_log2vis +fribidi_get_embedding_levels +fribidi_remove_bidi_marks +fribidi_get_mirror_char +fribidi_debug_status +fribidi_set_debug +fribidi_mirroring_status +fribidi_set_mirroring +fribidi_reorder_nsm_status +fribidi_set_reorder_nsm |