]> granicus.if.org Git - fribidi/commitdiff
First joining stuff checked in. Generate joining table using my beloved
authorbehdad <behdad>
Sun, 13 Jun 2004 20:11:41 +0000 (20:11 +0000)
committerbehdad <behdad>
Sun, 13 Jun 2004 20:11:41 +0000 (20:11 +0000)
packtab, in gen-joining-type-tab.c.  Defined FriBidiJoiningType type and wrote
accompanying functions and macros.

32 files changed:
.indent.pro
TODO
charset/Makefile.am
charset/fribidi-char-sets-cap-rtl.c
doc/Makefile.am
gen.tab/Makefile.am
gen.tab/gen-bidi-type-tab.c
gen.tab/gen-joining-type-tab.c [new file with mode: 0644]
gen.tab/gen-mirroring-tab.c
gen.tab/gen-unicode-version.c
gen.tab/packtab.c
gen.tab/packtab.h
lib/Headers.mk
lib/Makefile.am
lib/common.h
lib/debug.h
lib/env.h
lib/fribidi-bidi-type.c
lib/fribidi-bidi-types-list.h
lib/fribidi-bidi-types.c
lib/fribidi-bidi-types.h
lib/fribidi-joining-type.c [new file with mode: 0644]
lib/fribidi-joining-type.h [new file with mode: 0644]
lib/fribidi-joining-types-list.h [new file with mode: 0644]
lib/fribidi-joining-types.c [new file with mode: 0644]
lib/fribidi-joining-types.h [new file with mode: 0644]
lib/fribidi-joining.c [new file with mode: 0644]
lib/fribidi-joining.h [new file with mode: 0644]
lib/fribidi-mirroring.c
lib/fribidi.def
lib/joining-types.h [new file with mode: 0644]
lib/run.h

index f4bfeeaf3343e0ae4545ec4e1c2970ea6bbe3e6b..10fbf870dc10c339330149cbd827b47ad9e7c68d 100644 (file)
@@ -3,10 +3,11 @@
 -bfde
 -T FILE
 -T FriBidiChar
+-T FriBidiLevel
 -T FriBidiStrIndex
 -T FriBidiCharType
 -T FriBidiParType
--T FriBidiLevel
+-T FriBidiJoiningType
 -T FriBidiCharSet
 -T FriBidiCharSetHandler
 -T FriBidiMemChunk
diff --git a/TODO b/TODO
index 32c677355ed261ed5a3edc4db3a35ae8e60ef616..e0c4c938b55b4142b1f4607e5e31e57f2ae0fc10 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,24 +1,19 @@
 Implementation issues:
 
-* Better bootstrap script: steal from GNOME autogen.sh.
+* Still better bootstrap script: steal from GNOME autogen.sh.
 
 * Test ./configure without pkg-config installed.
 
 * Update all files headers/footers.  For c/h files, lib/fribidi-mirroring.[ch]
   is always the reference.
 
-* Show BidiTypes enum in manual and gdb.
-
 * Update CapRTL with new Unicode reference code.
 
-* Revise reorder API, in fribidi_main.c reorder after line break.
+* In fribidi_main.c reorder after line break.
 
 * Add an option to fribidi_main.c to assume two consecutive returns as
   paragraph separators.
 
-* Design better apis to do reorder based on available levels, remove
-  explicit marks then calculate position maps, ....
-
 * Add more tests.  For:
   - Checking that not removing explicit marks in analyze is not changing the
     output in anyway.
@@ -31,6 +26,10 @@ Implementation issues:
 * indent:  support function attributes and _PARAMS like things.  Also
   FRIBIDI_BEGIN_DECLS, and LIKELY.
 
+* Cleanup gen.tab/gen-*.c files.
+
+* Override pkgincludedir and append interface version.
+
 * c2man:  parse Author and Copyright from the whole file.
 
 * Write texinfo documentation.
@@ -46,12 +45,13 @@ Implementation issues:
 * Fix cvs2cl bug with spacing around author names read with -U option.  Then
   fix spacing in AUTHORS.
 
-* Use `-' before any command for installing a man page, so that make will
-  ignore any errors.
+* Generate HTML and DVI documentation.
 
 * Clean up README and NEWS, and check all files' headers.  Write
   gen.tab/README.
 
+* Rewrite fribidi.spec.in
+
 * Add make rules for lib/$(BUILT_SOURCES) to depend on gen.tab/ stuff.
 
 * When called in interactive mode, fribidi cmd-line should greet, write
@@ -65,6 +65,8 @@ Implementation issues:
 
 * Replace Arabic Yeh with Persian Yeh in Hafez piece in test/*.
 
+* Replace test/run.tests with something better.
+
 From GNU Coding Standards:
 
 * The distribution should contain a file named `README' which gives the name
index 707abd94cc8e081ad232e97cd01be45d509f60a2..67d48d22d9ac4a42714f2eb7dc9038bc695c7225 100644 (file)
@@ -22,13 +22,19 @@ libfribidi_char_sets_la_LDFLAGS += -static
 endif # !FRIBIDI_CHARSETS
 
 libfribidi_char_sets_la_SOURCES = \
+       fribidi-char-sets.c \
        fribidi-char-sets-cap-rtl.c \
        fribidi-char-sets-cp1255.c \
        fribidi-char-sets-cp1256.c \
-       fribidi-char-sets.c \
        fribidi-char-sets-iso8859-6.c \
        fribidi-char-sets-iso8859-8.c \
-       fribidi-char-sets-utf8.c
+       fribidi-char-sets-utf8.c \
+       fribidi-char-sets-cap-rtl.h \
+       fribidi-char-sets-cp1255.h \
+       fribidi-char-sets-cp1256.h \
+       fribidi-char-sets-iso8859-6.h \
+       fribidi-char-sets-iso8859-8.h \
+       fribidi-char-sets-utf8.h
 
 $(top_builddir)/config.h: $(top_srcdir)/config.h.in
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
index f4ecee17219d3c9c05f79c6dd4e4c1e325dc9385..3f32f2fe929026c85d0b4d8654692aa7bd0aebfd 100644 (file)
@@ -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.6 2004-06-04 09:41:11 behdad Exp $
+ * $Id: fribidi-char-sets-cap-rtl.c,v 1.7 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-04 09:41:11 $
- * $Revision: 1.6 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.7 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.c,v $
  *
  * Authors:
@@ -291,7 +291,7 @@ fribidi_char_set_desc_cap_rtl (
       i += sprintf (s + i, /*l - i, */ "  * 0x%02x %c%c %-3s ", j,
                    j < 0x20 ? '^' : ' ',
                    j < 0x20 ? j + '@' : j < 0x7f ? j : ' ',
-                   fribidi_type_name (CapRTLCharTypes[j]));
+                   fribidi_bidi_type_name (CapRTLCharTypes[j]));
     }
   i += sprintf (s + i,         /*l - i, */
                "\n\n"
index b587edd13f7484c95ec609571e534fe437a57853..cefac9ceee33e6c2386dca4157ac30a1577e0bdf 100644 (file)
@@ -6,16 +6,16 @@ MAINTAINERCLEANFILES =
 
 # man3
 
-includepath = -I$(top_builddir)
-includevpath = $(top_builddir)
-headers = 
+includepath =
+includevpath =
+headers =
 inst_symbols =
 noinst_symbols =
 
 include $(top_srcdir)/lib/Headers.mk
 headers += $(libfribidi_la_headers)
-includepath += -I$(top_srcdir)/lib -I$(top_builddir)/lib
-includevpath += :$(top_srcdir)/lib:$(top_builddir)/lib
+includepath += -I$(top_builddir)/lib -I$(top_srcdir)/lib
+includevpath += :$(top_builddir)/lib:$(top_srcdir)/lib
 inst_symbols += $(libfribidi_la_symbols)
 
 include $(top_srcdir)/charset/Headers.mk
index 99354ad5798b2afe87e8bc53b7ec4739805442d3..8515b68edcf2050b48ae82f18da2c6f69277b4e4 100644 (file)
@@ -1,9 +1,11 @@
 EXTRA_PROGRAMS = \
                gen-bidi-type-tab \
+               gen-joining-type-tab \
                gen-mirroring-tab \
                gen-unicode-version
 
 gen_bidi_type_tab_SOURCES = gen-bidi-type-tab.c packtab.c packtab.h
+gen_joining_type_tab_SOURCES = gen-joining-type-tab.c packtab.c packtab.h
 gen_mirroring_tab_SOURCES = gen-mirroring-tab.c packtab.c packtab.h
 gen_unicode_version_SOURCES = gen-unicode-version.c
 
@@ -25,91 +27,67 @@ VPATH += \
                $(srcdir)/unidata/extracted \
                $(top_builddir)/lib
 
+COMPRESSION = 4
+
 # generate bidi-type.tab.i
 
 gen_bidi_type_tab = gen-bidi-type-tab$(EXEEXT)
 
-COMPRESSION = 4
-
-BIDI_TYPE_TAB_VARIANTS = \
-               UnicodeData_bidi-type.tab.i \
-               DerivedBidiClass_bidi-type.tab.i
-
-UnicodeData_bidi-type.tab.i: \
-               UnicodeData.txt \
+derived_bidi-type.tab.i: \
+               DerivedBidiClass.txt \
                fribidi-unicode-version.h \
                $(gen_bidi_type_tab_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
+       ./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
+       || ($(RM) $@ && false)
 
-DerivedBidiClass_bidi-type.tab.i: \
-               DerivedBidiClass.txt \
+bidi-type.tab.i: \
+               UnicodeData.txt \
                fribidi-unicode-version.h \
                $(gen_bidi_type_tab_SOURCES)
-
-$(BIDI_TYPE_TAB_VARIANTS):
        $(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
-       (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
-       ./$(gen_bidi_type_tab) $(COMPRESSION) \
-        $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
+       ./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
+       || ($(RM) $@ && false)
+
+DISTCLEANFILES += derived_bidi-type.tab.i
+
+# generate joining-type.tab.i
 
-bidi-type.tab.i:
-       @for x in $(BIDI_TYPE_TAB_VARIANTS); do \
-          if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x bidi-type.tab.i; then \
-            break; \
-          fi; \
-        done; \
-        test -f bidi-type.tab.i || (echo Could not build $@; false)
+gen_joining_type_tab = gen-joining-type-tab$(EXEEXT)
 
-DISTCLEANFILES += $(BIDI_TYPE_TAB_VARIANTS)
+joining-type.tab.i: \
+               UnicodeData.txt \
+               ArabicShaping.txt \
+               fribidi-unicode-version.h \
+               $(gen_joining_type_tab_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) $(gen_joining_type_tab)
+       ./$(gen_joining_type_tab) $(COMPRESSION) $^ > $@ \
+       || ($(RM) $@ && false)
 
 # generate mirroring.tab.i
 
 gen_mirroring_tab = gen-mirroring-tab$(EXEEXT)
 
-MIRRORING_TAB_VARIANTS = \
-               BidiMirroring_mirroring.tab.i
-
-BidiMirroring_mirroring.tab.i: \
+mirroring.tab.i: \
                BidiMirroring.txt \
                fribidi-unicode-version.h \
                $(gen_mirroring_tab_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) $(gen_mirroring_tab)
-       (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
-       ./$(gen_mirroring_tab) $(COMPRESSION) \
-        $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
-
-mirroring.tab.i:
-       @for x in $(MIRRORING_TAB_VARIANTS); do \
-          if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x mirroring.tab.i; then \
-            break; \
-          fi; \
-        done; \
-        test -f mirroring.tab.i || (echo Could not build $@; false)
-
-DISTCLEANFILES += $(MIRRORING_TAB_VARIANTS)
+       ./$(gen_mirroring_tab) $(COMPRESSION) $^ > $@ \
+       || ($(RM) $@ && false)
 
 # generate fribidi-unicode-version.h
 
 gen_unicode_version = gen-unicode-version$(EXEEXT)
 
-UNICODE_VERSION_VARIANTS = \
-               ReadMe_fribidi-unicode-version.h
-
-ReadMe_fribidi-unicode-version.h: \
+fribidi-unicode-version.h: \
                ReadMe.txt \
                $(gen_unicode_version_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) $(gen_unicode_version)
-       (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
-       ./$(gen_unicode_version) \
-        $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
-
-fribidi-unicode-version.h:
-       @for x in $(UNICODE_VERSION_VARIANTS); do \
-          if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x fribidi-unicode-version.h; then \
-            break; \
-          fi; \
-        done; \
-        test -f fribidi-unicode-version.h || (echo Could not build $@; false)
-
-DISTCLEANFILES += $(UNICODE_VERSION_VARIANTS)
+       ./$(gen_unicode_version) $< > $@ \
+       || ($(RM) $@ && false)
+
+# generate all generators:
+gen: $(EXTRA_PROGRAMS)
 
 .DELETE_ON_ERROR:
index 3832c4a6e56c8010a6acb990e50d356f5d5c634e..15d341bdde367abcef1e84a4d210b8954a0cdda2 100644 (file)
@@ -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.11 2004-06-09 20:01:00 behdad Exp $
+ * $Id: gen-bidi-type-tab.c,v 1.12 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 20:01:00 $
- * $Revision: 1.11 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.12 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-bidi-type-tab.c,v $
  *
  * Author:
@@ -61,7 +61,7 @@
 
 static void
 die (
-  char *msg
+  const char *msg
 )
 {
   fprintf (stderr, appname ": %s\n", msg);
@@ -70,8 +70,8 @@ die (
 
 static void
 die2 (
-  char *fmt,
-  char *p
+  const char *fmt,
+  const char *p
 )
 {
   fprintf (stderr, appname ": ");
@@ -82,9 +82,9 @@ die2 (
 
 static void
 die3 (
-  char *fmt,
+  const char *fmt,
   unsigned long l,
-  char *p
+  const char *p
 )
 {
   fprintf (stderr, appname ": ");
@@ -105,7 +105,7 @@ enum FriBidiCharTypeLinearEnumOffsetOne
 
 struct
 {
-  char *name;
+  const char *name;
   int key;
 }
 type_names[] =
@@ -119,11 +119,11 @@ type_names[] =
 
 #define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
 
-static char *names[type_names_count];
+static const char *names[type_names_count];
 
 static char
 get_type (
-  char *s
+  const char *s
 )
 {
   int i;
@@ -131,7 +131,7 @@ get_type (
   for (i = 0; i < type_names_count; i++)
     if (!strcmp (s, type_names[i].name))
       return type_names[i].key;
-  die2 ("type name `%s' not found", s);
+  die2 ("bidi type name `%s' not found", s);
   return 0;
 }
 
@@ -139,7 +139,8 @@ get_type (
 #define macro_name "FRIBIDI_GET_BIDI_TYPE"
 
 static signed int table[FRIBIDI_UNICODE_CHARS];
-static char s[4000];
+static char buf[4000];
+static char tp[sizeof (buf)];
 
 static void
 init (
@@ -159,7 +160,6 @@ clear_tab (
 {
   register FriBidiChar c;
 
-  /* default types for reserved and noncharacter code points */
   for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
     table[c] = LTR;
 }
@@ -219,18 +219,21 @@ read_unicode_data_txt (
   FILE *f
 )
 {
-  char tp[10];
   unsigned long c, l;
 
   init_tab_unicode_data_txt ();
 
   l = 0;
-  while (fgets (s, sizeof s, f))
+  while (fgets (buf, sizeof buf, f))
     {
       int i;
+      const char *s = buf;
 
       l++;
 
+      while (*s == ' ')
+       s++;
+
       if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
        continue;
 
@@ -247,27 +250,30 @@ read_derived_bidi_class_txt (
   FILE *f
 )
 {
-  char tp[10];
   unsigned long c, c2, l;
 
   init_tab_derived_bidi_class_txt ();
 
   l = 0;
-  while (fgets (s, sizeof s, f))
+  while (fgets (buf, sizeof buf, f))
     {
       int i;
       register char typ;
+      const char *s = buf;
 
       l++;
 
+      while (*s == ' ')
+       s++;
+
       if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
        continue;
 
-      i = sscanf (s, "%lx ; %s", &c, tp);
+      i = sscanf (s, "%lx ; %[^; ]", &c, tp);
       if (i == 2)
        c2 = c;
       else
-       i = sscanf (s, "%lx..%lx ; %s", &c, &c2, tp) - 1;
+       i = sscanf (s, "%lx..%lx ; %[^; ]", &c, &c2, tp) - 1;
 
       if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
        die3 ("invalid input at line %ld: %s", l, s);
@@ -280,8 +286,8 @@ read_derived_bidi_class_txt (
 
 static void
 read_data (
-  char *data_file_type,
-  char *data_file_name
+  const char *data_file_type,
+  const char *data_file_name
 )
 {
   FILE *f;
@@ -303,7 +309,7 @@ read_data (
 static void
 gen_bidi_type_tab (
   int max_depth,
-  char *data_file_type
+  const char *data_file_type
 )
 {
   fprintf (stderr, "Generating output, it may take up to a few minutes\n");
@@ -329,17 +335,16 @@ gen_bidi_type_tab (
 int
 main (
   int argc,
-  char **argv
+  const char **argv
 )
 {
-  if (argc != 4)
-    die ("usage:\n  " appname " max-depth data-file-type data-file-name\n"
-        "where data-file-type is one of these:\n"
-        "  * UnicodeData.txt\n" "  * DerivedBidiClass.txt");
+  const char *data_file_type = "UnicodeData.txt";
+  if (argc < 3)
+    die2 ("usage:\n  " appname " max-depth /path/to/%s [junk...]",
+         data_file_type);
   {
     int max_depth = atoi (argv[1]);
-    char *data_file_type = argv[2];
-    char *data_file_name = argv[3];
+    const char *data_file_name = argv[2];
 
     if (max_depth < 2)
       die ("invalid depth");
diff --git a/gen.tab/gen-joining-type-tab.c b/gen.tab/gen-joining-type-tab.c
new file mode 100644 (file)
index 0000000..7af6e57
--- /dev/null
@@ -0,0 +1,355 @@
+/* FriBidi
+ * gen-joining-type-tab.c - generate joining-type.tab.i for libfribidi
+ *
+ * $Id: gen-joining-type-tab.c,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-joining-type-tab.c,v $
+ *
+ * Author:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ * 
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+
+#include <common.h>
+
+#include <fribidi-unicode.h>
+
+#include <stdio.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#include "packtab.h"
+
+#define appname "gen-joining-type-tab"
+#define outputname "joining-type.tab.i"
+
+static void
+die (
+  const char *msg
+)
+{
+  fprintf (stderr, appname ": %s\n", msg);
+  exit (1);
+}
+
+static void
+die2 (
+  const char *fmt,
+  const char *p
+)
+{
+  fprintf (stderr, appname ": ");
+  fprintf (stderr, fmt, p);
+  fprintf (stderr, "\n");
+  exit (1);
+}
+
+static void
+die3 (
+  const char *fmt,
+  const char *p,
+  const char *q
+)
+{
+  fprintf (stderr, appname ": ");
+  fprintf (stderr, fmt, p, q);
+  fprintf (stderr, "\n");
+  exit (1);
+}
+
+static void
+die3l (
+  const char *fmt,
+  unsigned long l,
+  const char *p
+)
+{
+  fprintf (stderr, appname ": ");
+  fprintf (stderr, fmt, l, p);
+  fprintf (stderr, "\n");
+  exit (1);
+}
+
+enum FriBidiJoiningLinearEnumOffsetOne
+{
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
+# include <fribidi-joining-types-list.h>
+# undef _FRIBIDI_ADD_TYPE
+  NUM_TYPES
+};
+
+struct
+{
+  const char *name;
+  int key;
+}
+type_names[] =
+{
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) {STRINGIZE(TYPE), TYPE},
+# include <fribidi-joining-types-list.h>
+# undef _FRIBIDI_ADD_TYPE
+};
+
+#define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
+
+static const char *names[type_names_count];
+
+static char
+get_type (
+  const char *s
+)
+{
+  int i;
+
+  for (i = 0; i < type_names_count; i++)
+    if (!strcmp (s, type_names[i].name))
+      return type_names[i].key;
+  die2 ("joining type name `%s' not found", s);
+  return -1;
+}
+
+static const char *ignored_bidi_types[] = {
+  "BN",
+  "LRE",
+  "RLE",
+  "LRO",
+  "RLO",
+  "PDF",
+  NULL
+};
+
+static const char *transparent_general_categories[] = {
+  "Mn",
+  "Cf",
+  NULL
+};
+
+static const char *
+type_is (
+  const char *s,
+  const char *type_list[]
+)
+{
+  for (; type_list[0]; type_list++)
+    if (!strcmp (s, type_list[0]))
+      return type_list[0];
+  return NULL;
+}
+
+#define table_name "Joi"
+#define macro_name "FRIBIDI_GET_JOINING_TYPE"
+
+static signed int table[FRIBIDI_UNICODE_CHARS];
+static char buf[4000];
+static char tp[sizeof (buf)], tp_gen[sizeof (buf)], tp_bidi[sizeof (buf)];
+
+static void
+clear_tab (
+)
+{
+  register FriBidiChar c;
+
+  for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
+    table[c] = U;
+}
+
+static void
+init (
+)
+{
+  register int i;
+
+  for (i = 0; i < type_names_count; i++)
+    names[i] = 0;
+  for (i = type_names_count - 1; i >= 0; i--)
+    names[type_names[i].key] = type_names[i].name;
+
+  clear_tab ();
+}
+
+static void
+read_unicode_data_txt (
+  FILE *f
+)
+{
+  unsigned long c, l;
+
+  l = 0;
+  while (fgets (buf, sizeof buf, f))
+    {
+      int i;
+      const char *s = buf;
+
+      l++;
+
+      while (*s == ' ')
+       s++;
+
+      if (*s == '#' || *s == '\0' || *s == '\n')
+       continue;
+
+      i = sscanf (s, "%lx;%*[^;];%[^; ];%*[^;];%[^; ]", &c, tp_gen, tp_bidi);
+      if (i != 3 || c >= FRIBIDI_UNICODE_CHARS)
+       die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
+
+      if (type_is (tp_bidi, ignored_bidi_types))
+       table[c] = G;
+      if (type_is (tp_gen, transparent_general_categories))
+       table[c] = T;
+    }
+}
+
+static void
+read_arabic_shaping_txt (
+  FILE *f
+)
+{
+  unsigned long c, c2, l;
+
+  l = 0;
+  while (fgets (buf, sizeof buf, f))
+    {
+      int i;
+      register char typ;
+      const char *s = buf;
+
+      l++;
+
+      while (*s == ' ')
+       s++;
+
+      if (*s == '#' || *s == '\0' || *s == '\n')
+       continue;
+
+      i = sscanf (s, "%lx ; %*[^;]; %[^; ]", &c, tp);
+      if (i == 2)
+       c2 = c;
+      else
+       i = sscanf (s, "%lx..%lx ; %*[^;]; %[^; ]", &c, &c2, tp) - 1;
+
+      if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
+       die3l ("ArabicShaping.txt: invalid input at line %ld: %s", l, s);
+
+      typ = get_type (tp);
+      for (; c <= c2; c++)
+       table[c] = typ;
+    }
+}
+
+static void
+read_data (
+  const char *data_file_type[],
+  const char *data_file_name[]
+)
+{
+  FILE *f;
+
+  for (; data_file_name[0] && data_file_type[0];
+       data_file_name++, data_file_type++)
+    {
+      fprintf (stderr, "Reading `%s'\n", data_file_name[0]);
+      if (!(f = fopen (data_file_name[0], "rt")))
+       die2 ("error: cannot open `%s' for reading", data_file_name[0]);
+
+      if (!strcmp (data_file_type[0], "UnicodeData.txt"))
+       read_unicode_data_txt (f);
+      else if (!strcmp (data_file_type[0], "ArabicShaping.txt"))
+       read_arabic_shaping_txt (f);
+      else
+       die2 ("error: unknown data-file type %s", data_file_type[0]);
+
+      fclose (f);
+    }
+
+}
+
+static void
+gen_joining_type_tab (
+  int max_depth,
+  const char *data_file_type[]
+)
+{
+  fprintf (stderr, "Generating output, it may take up to a few minutes\n");
+  printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
+         FRIBIDI_VERSION ")\n" " * from the files %s, %s of Unicode version "
+         FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
+         data_file_type[1]);
+
+  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
+         "#define PACKTAB_UINT16 fribidi_uint16\n"
+         "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+
+  if (!pack_table
+      (table, FRIBIDI_UNICODE_CHARS, 1, U, max_depth, 1, names,
+       "unsigned char", table_name, macro_name, stdout))
+    die ("error: insufficient memory, decrease max_depth");
+
+  printf ("#undef PACKTAB_UINT8\n"
+         "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
+
+  printf ("/* End of generated " outputname " */\n");
+}
+
+int
+main (
+  int argc,
+  const char **argv
+)
+{
+  const char *data_file_type[] =
+    { "UnicodeData.txt", "ArabicShaping.txt", NULL };
+  if (argc < 4)
+    die3 ("usage:\n  " appname " max-depth /path/to/%s /path/to/%s [junk...]",
+         data_file_type[0], data_file_type[1]);
+  {
+    int max_depth = atoi (argv[1]);
+    const char *data_file_name[] = { NULL, NULL, NULL };
+    data_file_name[0] = argv[2];
+    data_file_name[1] = argv[3];
+
+    if (max_depth < 2)
+      die ("invalid depth");
+
+    init ();
+    read_data (data_file_type, data_file_name);
+    gen_joining_type_tab (max_depth, data_file_type);
+  }
+
+  return 0;
+}
index 9656468c28cc0bfb9da47d6bd30800e3fa74cc26..1913ccb31e798f92b9a8de6cbc0c08d47f0b3d80 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * gen-mirroring-tab.c - generate bidi-mirroring.i for libfribidi
  *
- * $Id: gen-mirroring-tab.c,v 1.8 2004-06-09 20:01:00 behdad Exp $
+ * $Id: gen-mirroring-tab.c,v 1.9 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 20:01:00 $
- * $Revision: 1.8 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.9 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-mirroring-tab.c,v $
  *
  * Author:
@@ -61,7 +61,7 @@
 
 static void
 die (
-  char *msg
+  const char *msg
 )
 {
   fprintf (stderr, appname ": %s\n", msg);
@@ -70,8 +70,8 @@ die (
 
 static void
 die2 (
-  char *fmt,
-  char *p
+  const char *fmt,
+  const char *p
 )
 {
   fprintf (stderr, appname ": ");
@@ -82,7 +82,7 @@ die2 (
 
 static void
 die4 (
-  char *fmt,
+  const char *fmt,
   unsigned long l,
   unsigned long p,
   unsigned long q
@@ -95,10 +95,10 @@ die4 (
 }
 
 #define table_name "Mir"
-#define macro_name "FRIBIDI_GET_MIRRORING_DELTA"
+#define macro_name "FRIBIDI_GET_MIRRORING"
 
 static signed int table[FRIBIDI_UNICODE_CHARS];
-static char s[4000];
+static char buf[4000];
 static signed long max_dist;
 
 static void
@@ -119,7 +119,7 @@ clear_tab (
 }
 
 static void
-init_tab_bidi_mirroring_txt (
+init_tab_mirroring_txt (
 )
 {
   clear_tab ();
@@ -132,15 +132,21 @@ read_bidi_mirroring_txt (
 {
   unsigned long l;
 
+  init_tab_mirroring_txt ();
+
   l = 0;
-  while (fgets (s, sizeof s, f))
+  while (fgets (buf, sizeof buf, f))
     {
       unsigned long i, j;
       signed long dist;
       int k;
+      const char *s = buf;
 
       l++;
 
+      while (*s == ' ')
+       s++;
+
       if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
        continue;
 
@@ -159,8 +165,8 @@ read_bidi_mirroring_txt (
 
 static void
 read_data (
-  char *data_file_type,
-  char *data_file_name
+  const char *data_file_type,
+  const char *data_file_name
 )
 {
   FILE *f;
@@ -180,11 +186,11 @@ read_data (
 static void
 gen_mirroring_tab (
   int max_depth,
-  char *data_file_type
+  const char *data_file_type
 )
 {
   int key_bytes;
-  char *key_type;
+  const char *key_type;
 
   fprintf (stderr, "Generating output, it may take up to a few minutes\n");
   printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
@@ -201,28 +207,30 @@ gen_mirroring_tab (
 
   if (!pack_table
       (table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
-       key_type, table_name, macro_name, stdout))
+       key_type, table_name, macro_name "_DELTA", stdout))
     die ("error: insufficient memory, decrease max_depth");
 
   printf ("#undef PACKTAB_UINT8\n"
          "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
 
+  printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");
+
   printf ("/* End of generated " outputname " */\n");
 }
 
 int
 main (
   int argc,
-  char **argv
+  const char **argv
 )
 {
-  if (argc != 4)
-    die ("usage:\n  " appname " max-depth data-file-type data-file-name\n"
-        "where data-file-type is one of these:\n" "  * BidiMirroring.txt");
+  const char *data_file_type = "BidiMirroring.txt";
+  if (argc < 3)
+    die2 ("usage:\n  " appname " max-depth /path/to/%s [junk...]",
+         data_file_type);
   {
     int max_depth = atoi (argv[1]);
-    char *data_file_type = argv[2];
-    char *data_file_name = argv[3];
+    const char *data_file_name = argv[2];
 
     if (max_depth < 2)
       die ("invalid depth");
index 5ef6ee6741dd2c49da354b5448c767c7cab6a8a8..1935212ebc07af6933545dacfe9381d8f823e0fc 100644 (file)
@@ -1,17 +1,17 @@
 /* FriBidi
  * gen-unicode-version.c - generate fribidi-unicode-version.h for libfribidi
  *
- * $Id: gen-unicode-version.c,v 1.5 2004-05-31 18:43:26 behdad Exp $
+ * $Id: gen-unicode-version.c,v 1.6 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-05-31 18:43:26 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.6 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-unicode-version.c,v $
  *
  * Author:
  *   Behdad Esfahbod, 2001, 2002, 2004
  *
  * Copyright (C) 2004 Sharif FarsiWeb, Inc
- * Copyright (C) 2001,2002,2004 Behdad Esfahbod
+ * Copyright (C) 2004 Behdad Esfahbod
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -59,7 +59,7 @@
 
 static void
 die (
-  char *msg
+  const char *msg
 )
 {
   fprintf (stderr, appname ": %s\n", msg);
@@ -68,8 +68,8 @@ die (
 
 static void
 die2 (
-  char *fmt,
-  char *p
+  const char *fmt,
+  const char *p
 )
 {
   fprintf (stderr, appname ": ");
@@ -80,6 +80,7 @@ die2 (
 
 int version_major, version_minor, version_micro;
 char unicode_version[100];
+char buf[4000];
 
 static void
 init (
@@ -94,13 +95,12 @@ read_read_me_txt (
   FILE *f
 )
 {
-  char s[200];
-  char *p;
+  const char *s;
 
-  while (fgets (s, sizeof s, f))
-    if ((p = strstr (s, "Version")))
+  while (fgets (buf, sizeof buf, f))
+    if ((s = strstr (buf, "Version")))
       {
-       sscanf (p, "Version %d.%d.%d", &version_major, &version_minor,
+       sscanf (s, "Version %d.%d.%d", &version_major, &version_minor,
                &version_micro);
        sprintf (unicode_version, "%d.%d.%d", version_major, version_minor,
                 version_micro);
@@ -111,8 +111,8 @@ read_read_me_txt (
 
 static void
 read_data (
-  char *data_file_type,
-  char *data_file_name
+  const char *data_file_type,
+  const char *data_file_name
 )
 {
   FILE *f;
@@ -131,7 +131,7 @@ read_data (
 
 static void
 gen_unicode_version (
-  char *data_file_type
+  const char *data_file_type
 )
 {
   fprintf (stderr, "Generating output\n");
@@ -158,15 +158,15 @@ gen_unicode_version (
 int
 main (
   int argc,
-  char **argv
+  const char **argv
 )
 {
-  if (argc != 3)
-    die ("usage:\n  " appname " data-file-type data-file-name\n"
-        "where data-file-type is one of these:\n" "  * ReadMe.txt");
+  const char *data_file_type = "ReadMe.txt";
+
+  if (argc < 2)
+    die2 ("usage:\n  " appname " /path/to/%s [junk...]", data_file_type);
   {
-    char *data_file_type = argv[1];
-    char *data_file_name = argv[2];
+    const char *data_file_name = argv[1];
 
     init ();
     read_data (data_file_type, data_file_name);
index 45f762a6c68b6fee3d952fcf5bb2e5801403d64a..d8ffd4930e267c0aa8f1bcf3cc17166b4fff5842 100644 (file)
@@ -136,8 +136,7 @@ compare (
   return 0;
 }
 
-static int lev, p[22], nn;
-static int best_lev, best_p[22];
+static int lev, best_lev, p[22], best_p[22], nn;
 static long c[22], best_c[22], s, best_s;
 static long t[22], best_t[22], clusters[22], best_cluster[22];
 
@@ -366,16 +365,17 @@ write_source (
   else
     fprintf (f, "%d", def_key);
   fprintf (f, " : ");
-  j = 1;
+  j = 0;
   for (i = best_lev - 1; i >= 0; i--)
     {
-      fprintf (f, " \\\n\t%sLev%d[(x)", table_name, i);
-      if (j != 1)
-       fprintf (f, "/%d", j);
+      fprintf (f, " \\\n\t%sLev%d[((x)", table_name, i);
+      if (j != 0)
+       fprintf (f, " >> %d", j);
       if (i)
-       fprintf (f, "%%%ld +", pow[best_p[best_lev - 1 - i]]);
-      j *= best_cluster[best_lev - 1 - i];
+       fprintf (f, " & 0x%02lx) +", pow[best_p[best_lev - 1 - i]] - 1);
+      j += best_p[best_lev - 1 - i];
     }
+  fprintf (f, ")");
   for (i = 0; i < best_lev; i++)
     fprintf (f, "]");
   fprintf (f, ")\n\n");
index 45741a71ee8780d97f57d175f92f28870cb88bf4..7cab9be318ede7e8fb5d4d73b314d274eb7ab2dd 100644 (file)
@@ -27,7 +27,7 @@ extern "C"
 {
 #endif
 
-#define packtab_version 2
+#define packtab_version 3
 
   int pack_table (
   const signed int *base,
index 0c33d5d4889113d3bfa08874074b64e0b954b680..4f85346915454fe95818ec248f19ab2e83654a88 100644 (file)
@@ -5,13 +5,16 @@ libfribidi_la_headers = \
                fribidi-bidi-types.h \
                fribidi-bidi-types-list.h \
                fribidi-common.h \
-               fribidi-config.h \
                fribidi-enddecls.h \
                fribidi-env.h \
+               fribidi-joining.h \
+               fribidi-joining-type.h \
+               fribidi-joining-types.h \
+               fribidi-joining-types-list.h \
                fribidi-mirroring.h \
                fribidi-types.h \
                fribidi-unicode.h \
                fribidi-unicode-version.h \
                fribidi.h
 
-libfribidi_la_symbols := $(shell cat "$(top_srcdir)/lib/fribidi.def")
+libfribidi_la_symbols = $(shell cat $(top_srcdir)/lib/fribidi.def)
index bd3dbe3f84a63c4ddfbf441032ff062d7576cad9..9ae0d053bda110cfab661e23e018ffd537060790 100644 (file)
@@ -1,3 +1,5 @@
+EXTRA_DIST = fribidi.def
+
 lib_LTLIBRARIES = libfribidi.la
 
 AM_CPPFLAGS = $(MISC_CFLAGS)
@@ -26,11 +28,11 @@ $(top_builddir)/charset/libfribidi-char-sets.la:
 endif # FRIBIDI_CHARSETS
 
 include Headers.mk
-pkginclude_HEADERS = $(libfribidi_la_headers)
+pkginclude_HEADERS = $(libfribidi_la_headers) fribidi-config.h
 
 libfribidi_la_SOURCES =        \
-               bidi-types.h \
                bidi-type.tab.i \
+               bidi-types.h \
                common.h \
                debug.h \
                env.h \
@@ -39,22 +41,35 @@ libfribidi_la_SOURCES =     \
                fribidi-bidi-type.c \
                fribidi-bidi-types.c \
                fribidi-env.c \
+               fribidi-joining.c \
+               fribidi-joining-type.c \
+               fribidi-joining-types.c \
                fribidi-mem.c \
                fribidi-mirroring.c \
                fribidi-run.c \
+               joining-type.tab.i \
+               joining-types.h \
                mem.h \
                mirroring.tab.i \
                run.h
 
 BUILT_SOURCES= \
+               fribidi-unicode-version.h \
                bidi-type.tab.i \
-               mirroring.tab.i \
-               fribidi-unicode-version.h
+               joining-type.tab.i \
+               mirroring.tab.i
 
 $(BUILT_SOURCES):
-       (cd $(top_builddir)/gen.tab && \
-        $(MAKE) $(AM_MAKEFLAGS) $@) && \
-       mv $(top_builddir)/gen.tab/$@ .
+       @(cd $(top_builddir)/gen.tab && \
+       $(MAKE) $(AM_MAKEFLAGS) $@) && \
+       (test -f $@ || mv $(top_builddir)/gen.tab/$@ .)
+
+# re-generate all built sources:
+gen:
+       @(cd $(top_builddir)/gen.tab && \
+       $(MAKE) $(AM_MAKEFLAGS) $@) && \
+       $(RM) $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) $(BUILT_SOURCES)
 
 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
 
index e0882f69725e26fcc0cc548ea01a608883767174..43c160ae008bbcc5ec6337a36d5050ff36901783 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * common.h - common include for library sources
  *
- * $Id: common.h,v 1.12 2004-06-09 14:59:21 behdad Exp $
+ * $Id: common.h,v 1.13 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.12 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.13 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/common.h,v $
  *
  * Author:
 # define FRIBIDI_EMPTY_STMT FRIBIDI_BEGIN_STMT (void) 0; FRIBIDI_END_STMT
 #endif /* !FRIBIDI_EMPTY_STMT */
 
+#if HAVE_STRINGIZE
+# define STRINGIZE(symbol) #symbol
+#else /* !HAVE_STRINGIZE */
+# define STRINGIZE(symbol) "(no stringize operator available)"
+#endif /* !HAVE_STRINGIZE */
+
 /* As per recommendation of GNU Coding Standards. */
 #define _GNU_SOURCE
 
index 07e0d73a3e7f07e4baefb14af73ffb19cb353cf5..a39c8b1d1b6dfea01c833255bd6d7fa1e4e5a93a 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * debug.h - debug-only interfaces
  *
- * $Id: debug.h,v 1.6 2004-06-09 14:59:21 behdad Exp $
+ * $Id: debug.h,v 1.7 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.6 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.7 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/debug.h,v $
  *
  * Author:
 #if DEBUG
 
 /* These definitions should only be used in DEBUG mode: */
-#if HAVE_STRINGIZE
-# define STRINGIZE(symbol) #symbol
-#else /* !HAVE_STRINGIZE */
-# define STRINGIZE(symbol)
-#endif /* !HAVE_STRINGIZE */
 #ifndef __LINE__
 # define __LINE__ 0
 #endif /* !__LINE__ */
index 7e8ab695e292743064b0e876c20ddcd1446c5a54..71b58288b451eb342e853e23689e76b451212b80 100644 (file)
--- a/lib/env.h
+++ b/lib/env.h
@@ -1,10 +1,10 @@
 /* FriBidi
  * env.h - private state variables
  *
- * $Id: env.h,v 1.2 2004-05-03 22:05:19 behdad Exp $
+ * $Id: env.h,v 1.3 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-05-03 22:05:19 $
- * $Revision: 1.2 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.3 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/env.h,v $
  *
  * Author:
@@ -40,6 +40,7 @@
 #include <fribidi-bidi-types.h>
 
 #include "mem.h"
+#include "run.h"
 
 #include <fribidi-begindecls.h>
 
index 74756260b210caac4f2a50c730420055a160473a..00d124f7c31704f83fc74a7c0569d9358d61f484 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi-type.c - get character bidi type
  *
- * $Id: fribidi-bidi-type.c,v 1.11 2004-06-09 20:01:00 behdad Exp $
+ * $Id: fribidi-bidi-type.c,v 1.12 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 20:01:00 $
- * $Revision: 1.11 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.12 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.c,v $
  *
  * Authors:
@@ -34,9 +34,6 @@
 #include "common.h"
 
 #include <fribidi-bidi-type.h>
-#include <fribidi-unicode.h>
-
-#include "bidi-types.h"
 
 enum FriBidiCharTypeLinearEnum
 {
index 9221b393dfa983d7fbdc4d85476eca2263df6bbc..4dc151bee5fd3eea7f8acdae8116298273e34fd4 100644 (file)
@@ -2,10 +2,10 @@
 /* FriBidi
  * fribidi-bidi-types-list.h - list of bidi types
  *
- * $Id: fribidi-bidi-types-list.h,v 1.4 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-bidi-types-list.h,v 1.5 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.4 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.5 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types-list.h,v $
  *
  * Author:
@@ -54,7 +54,7 @@ _FRIBIDI_ADD_TYPE (NSM, '`')  /* Non Spacing Mark */
 _FRIBIDI_ADD_TYPE (BN, 'b')    /* Boundary Neutral */
 _FRIBIDI_ADD_TYPE (BS, 'B')    /* Block Separator */
 _FRIBIDI_ADD_TYPE (SS, 'S')    /* Segment Separator */
-_FRIBIDI_ADD_TYPE (WS, '_')    /* White-Space */
+_FRIBIDI_ADD_TYPE (WS, '_')    /* WhiteSpace */
 _FRIBIDI_ADD_TYPE (ON, 'n')    /* Other Neutral */
 _FRIBIDI_ADD_TYPE (LRE, '+')   /* Left-to-Right Embedding */
 _FRIBIDI_ADD_TYPE (RLE, '+')   /* Right-to-Left Embedding */
index ca5478b825a340c64328c073f42da9748219009c..b54d3676b3c3706f68bb431df66bf143aca9d7b6 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi-types.c - character bidi types
  *
- * $Id: fribidi-bidi-types.c,v 1.5 2004-06-04 09:41:11 behdad Exp $
+ * $Id: fribidi-bidi-types.c,v 1.6 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-04 09:41:11 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.6 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.c,v $
  *
  * Authors:
@@ -67,7 +67,7 @@ fribidi_bidi_type_name (
 {
   switch (t)
     {
-#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return #TYPE;
+#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return STRINGIZE(TYPE);
 #   define _FRIBIDI_ALL_TYPES
 #   include "fribidi-bidi-types-list.h"
 #   undef _FRIBIDI_ALL_TYPES
index b0420ef8d6e80de674357667632d1ee718df1c61..b47aa3396cbba9c5c7136c55d4b48a42a0879b1f 100644 (file)
@@ -1,10 +1,10 @@
 /* FriBidi
  * fribidi-bidi-types.h - character bidi types
  *
- * $Id: fribidi-bidi-types.h,v 1.7 2004-06-09 20:01:00 behdad Exp $
+ * $Id: fribidi-bidi-types.h,v 1.8 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 20:01:00 $
- * $Revision: 1.7 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.8 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $
  *
  * Author:
 
 typedef signed char FriBidiLevel;
 
-typedef struct _FriBidiRun FriBidiRun;
-
 /* 
- * Define some bit masks, that character types are based on, each one has
- * only one bit on.
+ * Define bit masks that bidi types are based on, each mask has
+ * only one bit set.
  */
 
-/* Do not use enum, because 16bit processors do not allow 32bit enum values. */
-
 #define FRIBIDI_MASK_RTL       0x00000001L     /* Is right to left */
 #define FRIBIDI_MASK_ARABIC    0x00000002L     /* Is arabic */
 
@@ -58,22 +54,22 @@ typedef struct _FriBidiRun FriBidiRun;
 #define FRIBIDI_MASK_WEAK      0x00000020L     /* Is weak */
 #define FRIBIDI_MASK_NEUTRAL   0x00000040L     /* Is neutral */
 #define FRIBIDI_MASK_SENTINEL  0x00000080L     /* Is sentinel */
-/* Sentinels are not valid chars, just identify the start and end of strings. */
+/* Sentinels are not valid chars, just identify the start/end of strings. */
 
 /* Each char can be only one of the five following. */
 #define FRIBIDI_MASK_LETTER    0x00000100L     /* Is letter: L, R, AL */
 #define FRIBIDI_MASK_NUMBER    0x00000200L     /* Is number: EN, AN */
-#define FRIBIDI_MASK_NUMSEPTER 0x00000400L     /* Is number separator or terminator: ES, ET, CS */
+#define FRIBIDI_MASK_NUMSEPTER 0x00000400L     /* Is separator or terminator: ES, ET, CS */
 #define FRIBIDI_MASK_SPACE     0x00000800L     /* Is space: BN, BS, SS, WS */
 #define FRIBIDI_MASK_EXPLICIT  0x00001000L     /* Is expilict mark: LRE, RLE, LRO, RLO, PDF */
 
-/* Can be on only if FRIBIDI_MASK_SPACE is also on. */
-#define FRIBIDI_MASK_SEPARATOR 0x00002000L     /* Is test separator: BS, SS */
-/* Can be on only if FRIBIDI_MASK_EXPLICIT is also on. */
+/* Can be set only if FRIBIDI_MASK_SPACE is also set. */
+#define FRIBIDI_MASK_SEPARATOR 0x00002000L     /* Is text separator: BS, SS */
+/* Can be set only if FRIBIDI_MASK_EXPLICIT is also set. */
 #define FRIBIDI_MASK_OVERRIDE  0x00004000L     /* Is explicit override: LRO, RLO */
 
-/* The following must be to make types pairwise different, some of them can
  be removed but are here because of efficiency (make queries faster). */
+/* The following exist to make types pairwise different, some of them can
* be removed but are here because of efficiency (make queries faster). */
 
 #define FRIBIDI_MASK_ES                0x00010000L
 #define FRIBIDI_MASK_ET                0x00020000L
@@ -94,76 +90,75 @@ typedef struct _FriBidiRun FriBidiRun;
  * Define values for FriBidiCharType
  */
 
-/* Strong left to right */
-#define FRIBIDI_TYPE_LTR_VAL   ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER )
-/* Right to left characters */
-#define FRIBIDI_TYPE_RTL_VAL   ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
-                               + FRIBIDI_MASK_RTL)
-/* Arabic characters */
-#define FRIBIDI_TYPE_AL_VAL    ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_LETTER \
-                               + FRIBIDI_MASK_RTL + FRIBIDI_MASK_ARABIC )
-/* Left-To-Right embedding */
-#define FRIBIDI_TYPE_LRE_VAL   (FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT)
-/* Right-To-Left embedding */
-#define FRIBIDI_TYPE_RLE_VAL   ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
-                               + FRIBIDI_MASK_RTL )
-/* Left-To-Right override */
-#define FRIBIDI_TYPE_LRO_VAL   ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
-                               + FRIBIDI_MASK_OVERRIDE )
-/* Right-To-Left override */
-#define FRIBIDI_TYPE_RLO_VAL   ( FRIBIDI_MASK_STRONG + FRIBIDI_MASK_EXPLICIT \
-                               + FRIBIDI_MASK_RTL + FRIBIDI_MASK_OVERRIDE )
-
-/* Pop directional override */
-#define FRIBIDI_TYPE_PDF_VAL   ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_EXPLICIT )
-/* European digit */
-#define FRIBIDI_TYPE_EN_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER )
-/* Arabic digit */
-#define FRIBIDI_TYPE_AN_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMBER \
-                               + FRIBIDI_MASK_ARABIC )
-/* European number separator */
-#define FRIBIDI_TYPE_ES_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
-                               + FRIBIDI_MASK_ES )
-/* European number terminator */
-#define FRIBIDI_TYPE_ET_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
-                               + FRIBIDI_MASK_ET )
+/* Left-To-Right letter */
+#define FRIBIDI_TYPE_LTR_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER )
+/* Right-To-Left letter */
+#define FRIBIDI_TYPE_RTL_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \
+                               | FRIBIDI_MASK_RTL)
+/* Arabic Letter */
+#define FRIBIDI_TYPE_AL_VAL    ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \
+                               | FRIBIDI_MASK_RTL | FRIBIDI_MASK_ARABIC )
+/* Left-to-Right Embedding */
+#define FRIBIDI_TYPE_LRE_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT)
+/* Right-to-Left Embedding */
+#define FRIBIDI_TYPE_RLE_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
+                               | FRIBIDI_MASK_RTL )
+/* Left-to-Right Override */
+#define FRIBIDI_TYPE_LRO_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
+                               | FRIBIDI_MASK_OVERRIDE )
+/* Right-to-Left Override */
+#define FRIBIDI_TYPE_RLO_VAL   ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
+                               | FRIBIDI_MASK_RTL | FRIBIDI_MASK_OVERRIDE )
+
+/* Pop Directional Flag*/
+#define FRIBIDI_TYPE_PDF_VAL   ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_EXPLICIT )
+/* European Numeral */
+#define FRIBIDI_TYPE_EN_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER )
+/* Arabic Numeral */
+#define FRIBIDI_TYPE_AN_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER \
+                               | FRIBIDI_MASK_ARABIC )
+/* European number Separator */
+#define FRIBIDI_TYPE_ES_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
+                               | FRIBIDI_MASK_ES )
+/* European number Terminator */
+#define FRIBIDI_TYPE_ET_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
+                               | FRIBIDI_MASK_ET )
 /* Common Separator */
-#define FRIBIDI_TYPE_CS_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NUMSEPTER \
-                               + FRIBIDI_MASK_CS )
-/* Non spacing mark */
-#define FRIBIDI_TYPE_NSM_VAL   ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_NSM )
-/* Boundary neutral */
-#define FRIBIDI_TYPE_BN_VAL    ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_SPACE \
-                               + FRIBIDI_MASK_BN )
-
-/* Block separator */
-#define FRIBIDI_TYPE_BS_VAL    ( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
-                               + FRIBIDI_MASK_SEPARATOR + FRIBIDI_MASK_BS )
-/* Segment separator */
-#define FRIBIDI_TYPE_SS_VAL    ( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
-                               + FRIBIDI_MASK_SEPARATOR + FRIBIDI_MASK_SS )
-/* Whitespace */
-#define FRIBIDI_TYPE_WS_VAL    ( FRIBIDI_MASK_NEUTRAL + FRIBIDI_MASK_SPACE \
-                               + FRIBIDI_MASK_WS )
+#define FRIBIDI_TYPE_CS_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
+                               | FRIBIDI_MASK_CS )
+/* Non Spacing Mark */
+#define FRIBIDI_TYPE_NSM_VAL   ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NSM )
+/* Boundary Neutral */
+#define FRIBIDI_TYPE_BN_VAL    ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_SPACE \
+                               | FRIBIDI_MASK_BN )
+
+/* Block Separator */
+#define FRIBIDI_TYPE_BS_VAL    ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
+                               | FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_BS )
+/* Segment Separator */
+#define FRIBIDI_TYPE_SS_VAL    ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
+                               | FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_SS )
+/* WhiteSpace */
+#define FRIBIDI_TYPE_WS_VAL    ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
+                               | FRIBIDI_MASK_WS )
 /* Other Neutral */
 #define FRIBIDI_TYPE_ON_VAL    ( FRIBIDI_MASK_NEUTRAL )
 
 
 /* The following are used in specifying paragraph direction only. */
 
-/* Weak left to right */
+/* Weak Left-To-Right */
 #define FRIBIDI_TYPE_WLTR_VAL  ( FRIBIDI_MASK_WEAK )
-/* Weak right to left */
-#define FRIBIDI_TYPE_WRTL_VAL  ( FRIBIDI_MASK_WEAK + FRIBIDI_MASK_RTL )
+/* Weak Right-To-Left */
+#define FRIBIDI_TYPE_WRTL_VAL  ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_RTL )
 
-/* Start or end of text (run list).  Only used internally */
+/* start or end of text (run list) SENTINEL.  Only used internally */
 #define FRIBIDI_TYPE_SENTINEL  ( FRIBIDI_MASK_SENTINEL )
 
 /* Private types for applications.  More private types can be obtained by
  * summing up from this one. */
 #define FRIBIDI_TYPE_PRIVATE   ( FRIBIDI_MASK_PRIVATE )
 
-/* Define values for FriBidiCharType. */
 
 /* Define Enums only if sizeof(int) == 4 (UTF-32), and not compiling C++.
  * The problem with C++ is that then casts between int32 and enum will fail!
@@ -334,9 +329,6 @@ typedef fribidi_uint32 FriBidiParType;
 
 /* Functions finally */
 
-/* fribidi_type_name is the old name of fribidi_bidi_type_name */
-#define fribidi_type_name fribidi_bidi_type_name
-
 #define fribidi_bidi_type_name FRIBIDI_NAMESPACE(bidi_type_name)
 /* fribidi_bidi_type_name - get bidi type name
  *
diff --git a/lib/fribidi-joining-type.c b/lib/fribidi-joining-type.c
new file mode 100644 (file)
index 0000000..1f25ab6
--- /dev/null
@@ -0,0 +1,56 @@
+/* FriBidi
+ * fribidi-joining-type.c - get character joining type
+ *
+ * $Id: fribidi-joining-type.c,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-joining-type.c,v $
+ *
+ * Authors:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ * 
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+
+#include "common.h"
+
+#include <fribidi-joining-type.h>
+#include <fribidi-joining-types.h>
+
+enum FriBidiJoiningTypeShortEnum
+{
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE,
+# include "fribidi-joining-types-list.h"
+# undef _FRIBIDI_ADD_TYPE
+  _FRIBIDI_NUM_TYPES
+};
+
+#include "joining-type.tab.i"
+
+FRIBIDI_ENTRY FriBidiJoiningType
+fribidi_get_joining_type (
+  /* input */
+  FriBidiChar ch
+)
+{
+  return FRIBIDI_GET_JOINING_TYPE (ch);
+}
diff --git a/lib/fribidi-joining-type.h b/lib/fribidi-joining-type.h
new file mode 100644 (file)
index 0000000..04fcff9
--- /dev/null
@@ -0,0 +1,59 @@
+/* FriBidi
+ * fribidi-joining-type.h - get character joining type
+ *
+ * $Id: fribidi-joining-type.h,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-joining-type.h,v $
+ *
+ * Author:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ * 
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+#ifndef _FRIBIDI_JOINING_TYPE_H
+#define _FRIBIDI_JOINING_TYPE_H
+
+#include "fribidi-common.h"
+
+#include "fribidi-types.h"
+#include "fribidi-joining-types.h"
+
+#include "fribidi-begindecls.h"
+
+#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type)
+/* fribidi_get_joining_type - get character joining type
+ *
+ * This function returns the joining type of a character.  There are a few
+ * macros defined in fribidi-joining-types.h for querying a joining type.
+ */
+FRIBIDI_ENTRY FriBidiJoiningType
+fribidi_get_joining_type (
+  FriBidiChar ch               /* input character */
+) FRIBIDI_GNUC_CONST;
+
+#include "fribidi-enddecls.h"
+
+#endif /* !_FRIBIDI_JOINING_TYPE_H */
+/* Editor directions:
+ * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
+ */
diff --git a/lib/fribidi-joining-types-list.h b/lib/fribidi-joining-types-list.h
new file mode 100644 (file)
index 0000000..031c77e
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef __FRIBIDI_DOC
+/* FriBidi
+ * fribidi-joining-types-list.h - list of joining types
+ *
+ * $Id: fribidi-joining-types-list.h,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types-list.h,v $
+ *
+ * Author:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc.
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ *
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+/* *INDENT-OFF* */
+#endif /* !__FRIBIDI_DOC */
+#ifndef _FRIBIDI_ADD_TYPE
+# define _FRIBIDI_ADD_TYPE(x,y)
+#endif
+
+_FRIBIDI_ADD_TYPE (U, '|')     /* nUn-joining, e.g. Full Stop */
+_FRIBIDI_ADD_TYPE (R, '>')     /* Right-joining, e.g. Arabic Letter Dal */
+_FRIBIDI_ADD_TYPE (D, '+')     /* Dual-joining, e.g. Arabic Letter Ain */
+_FRIBIDI_ADD_TYPE (C, '-')     /* join-Causing, e.g. Tatweel, ZWJ */
+_FRIBIDI_ADD_TYPE (T, '^')     /* Transparent, e.g. Arabic Fatha */
+_FRIBIDI_ADD_TYPE (L, '<')     /* Left-joining, i.e. fictional */
+_FRIBIDI_ADD_TYPE (G, '~')     /* iGnored, e.g. LRE, RLE, ZWNBSP */
+
+#ifndef __FRIBIDI_DOC
+/* *INDENT-ON* */
+#endif /* !__FRIBIDI_DOC */
diff --git a/lib/fribidi-joining-types.c b/lib/fribidi-joining-types.c
new file mode 100644 (file)
index 0000000..5b8767b
--- /dev/null
@@ -0,0 +1,78 @@
+/* FriBidi
+ * fribidi-joining-types.c - character joining types
+ *
+ * $Id: fribidi-joining-types.c,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.c,v $
+ *
+ * Authors:
+ *   Behdad Esfahbod, 2001, 2002, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc.
+ * Copyright (C) 2001,2002 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ *
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+
+#include "common.h"
+
+#include <fribidi-joining-types.h>
+
+#include "joining-types.h"
+
+#ifdef DEBUG
+
+char
+fribidi_char_from_joining_type (
+  /* input */
+  FriBidiJoiningType j
+)
+{
+  switch (j)
+    {
+#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return SYMBOL;
+#   include "fribidi-joining-types-list.h"
+#   undef _FRIBIDI_ADD_TYPE
+    default:
+      return '?';
+    }
+}
+
+#endif
+
+FRIBIDI_ENTRY const char *
+fribidi_joining_type_name (
+  /* input */
+  FriBidiJoiningType j
+)
+{
+  switch (j)
+    {
+#   define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE);
+#   include "fribidi-joining-types-list.h"
+#   undef _FRIBIDI_ADD_TYPE
+    default:
+      return "?";
+    }
+}
+
+/* Editor directions:
+ * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
+ */
diff --git a/lib/fribidi-joining-types.h b/lib/fribidi-joining-types.h
new file mode 100644 (file)
index 0000000..7c635a2
--- /dev/null
@@ -0,0 +1,143 @@
+/* FriBidi
+ * fribidi-joining-types.h - character joining types
+ *
+ * $Id: fribidi-joining-types.h,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.h,v $
+ *
+ * Author:
+ *   Behdad Esfahbod, 2001, 2002, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc.
+ * Copyright (C) 2001,2002 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ *
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+#ifndef _FRIBIDI_JOINING_TYPES_H
+#define _FRIBIDI_JOINING_TYPES_H
+
+#include "fribidi-common.h"
+
+#include "fribidi-types.h"
+
+#include "fribidi-begindecls.h"
+
+/* 
+ * Define bit masks that joining types are based on, each mask has
+ * only one bit set.
+ */
+
+#define FRIBIDI_MASK_JOINS_RIGHT       0x01    /* May join to right */
+#define FRIBIDI_MASK_JOINS_LEFT                0x02    /* May join to right */
+#define FRIBIDI_MASK_ARAB_SHAPES       0x04    /* May Arabic shape */
+#define FRIBIDI_MASK_TRANSPARENT       0x10    /* Is transparent */
+#define FRIBIDI_MASK_IGNORED           0x20    /* Is ignored */
+#define FRIBIDI_MASK_LIGATURED         0x40    /* Is ligatured */
+
+/*
+ * Define values for FriBidiJoiningType
+ */
+
+/* nUn-joining */
+#define FRIBIDI_JOINING_TYPE_U_VAL     ( 0 )
+
+/* Right-joining */
+#define FRIBIDI_JOINING_TYPE_R_VAL     \
+       ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_ARAB_SHAPES )
+
+/* Dual-joining */
+#define FRIBIDI_JOINING_TYPE_D_VAL     \
+       ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
+       | FRIBIDI_MASK_ARAB_SHAPES )
+
+/* join-Causing */
+#define FRIBIDI_JOINING_TYPE_C_VAL     \
+       ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT )
+
+/* Left-joining */
+#define FRIBIDI_JOINING_TYPE_L_VAL     \
+       ( FRIBIDI_MASK_JOINS_LEFT | FRIBIDI_MASK_ARAB_SHAPES )
+
+/* Transparent */
+#define FRIBIDI_JOINING_TYPE_T_VAL     \
+       ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_ARAB_SHAPES )
+
+/* iGnored */
+#define FRIBIDI_JOINING_TYPE_G_VAL     ( FRIBIDI_MASK_IGNORED )
+
+
+enum _FriBidiJoiningTypeEnum
+{
+# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
+       FRIBIDI_JOINING_TYPE_##TYPE = FRIBIDI_JOINING_TYPE_##TYPE##_VAL,
+# include "fribidi-joining-types-list.h"
+# undef _FRIBIDI_ADD_TYPE
+  _FRIBIDI_JOINING_TYPE_JUNK   /* Don't use this */
+};
+
+#ifdef __FRIBIDI_DOC
+typedef enum _FriBidiJoiningTypeEnum FriBidiJoiningType;
+#else /* !__FRIBIDI_DOC */
+typedef fribidi_uint8 FriBidiJoiningType;
+#endif /* !__FRIBIDI_DOC */
+
+
+/*
+ * Defining macros for needed queries, It is fully dependent on the 
+ * implementation of FriBidiJoiningType.
+ */
+
+/* Joins to right? */
+#define FRIBIDI_JOINS_RIGHT(p) ((p) & FRIBIDI_MASK_JOINS_RIGHT)
+
+/* Joins to left? */
+#define FRIBIDI_JOINS_LEFT(p)  ((p) & FRIBIDI_MASK_JOINS_LEFT)
+
+/* Joins to left? */
+#define FRIBIDI_ARAB_SHAPES(p) ((p) & FRIBIDI_MASK_ARAB_SHAPES)
+
+/* Is transparent in joining? */
+#define FRIBIDI_IS_JOIN_TRANSPARENT(p) ((p) & FRIBIDI_MASK_TRANSPARENT)
+
+/* Is ignored in joining? */
+#define FRIBIDI_IS_JOIN_IGNORED(p)     ((p) & FRIBIDI_MASK_IGNORED)
+
+/* Is skipped in joining? */
+#define FRIBIDI_IS_JOIN_SKIPPED(p)     \
+       ((p) & (FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED))
+
+
+#define fribidi_joining_type_name FRIBIDI_NAMESPACE(joining_type_name)
+/* fribidi_joining_type_name - get joining type name
+ *
+ * This function returns the joining type name of a joining type.  The
+ * returned string is a static string and should not be freed.
+ */
+FRIBIDI_ENTRY const char *
+fribidi_joining_type_name (
+  FriBidiJoiningType j         /* input joining type */
+) FRIBIDI_GNUC_CONST;
+
+#include "fribidi-enddecls.h"
+
+#endif /* !_FRIBIDI_JOINING_TYPES_H */
+/* Editor directions:
+ * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
+ */
diff --git a/lib/fribidi-joining.c b/lib/fribidi-joining.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/fribidi-joining.h b/lib/fribidi-joining.h
new file mode 100644 (file)
index 0000000..77a762c
--- /dev/null
@@ -0,0 +1,50 @@
+/* FriBidi
+ * fribidi-joining.h - Arabic joining algorithm
+ *
+ * $Id: fribidi-joining.h,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining.h,v $
+ *
+ * Authors:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ * 
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+#ifndef _FRIBIDI_JOINING_H
+#define _FRIBIDI_JOINING_H
+
+#include "fribidi-common.h"
+
+#include "fribidi-types.h"
+#include "fribidi-joining-types.h"
+
+#include "fribidi-begindecls.h"
+
+
+
+#include "fribidi-enddecls.h"
+
+#endif /* !_FRIBIDI_JOINING_H */
+/* Editor directions:
+ * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
+ */
index eaf1f440762de16d50bb3f9e3d19471ee14623b1..d197828fcc0f59aa69b85257f0dd9b0986d7b5bf 100644 (file)
  * For licensing issues, contact <license@farsiweb.info> or write to
  * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
  */
-/* $Id: fribidi-mirroring.c,v 1.10 2004-06-09 20:01:00 behdad Exp $
+/* $Id: fribidi-mirroring.c,v 1.11 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-09 20:01:00 $
- * $Revision: 1.10 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.11 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.c,v $
  *
  * Authors:
@@ -49,10 +49,10 @@ fribidi_get_mirror_char (
 )
 {
   register FriBidiChar result;
-  result = FRIBIDI_GET_MIRRORING_DELTA (ch);
+  result = FRIBIDI_GET_MIRRORING (ch);
   if (mirrored_ch)
-    *mirrored_ch = ch + result;
-  return result ? true : false;
+    *mirrored_ch = result;
+  return ch != result ? true : false;
 }
 
 /* Editor directions:
index 309ed5b3ba48054235fbe9162dfdb1cc72c1628a..1380c7f3f3ba1a6add5271e7795994c322d81e39 100644 (file)
@@ -1,9 +1,12 @@
-fribidi_bidi_type_name
 fribidi_get_bidi_type
-fribidi_log2vis
+fribidi_get_mirror_char
+fribidi_bidi_type_name
 fribidi_get_par_embedding_levels
+fribidi_reorder_line
+fribidi_shape_mirroring
+fribidi_shape
 fribidi_remove_bidi_marks
-fribidi_get_mirror_char
+fribidi_log2vis
 fribidi_debug_status
 fribidi_set_debug
 fribidi_mirroring_status
diff --git a/lib/joining-types.h b/lib/joining-types.h
new file mode 100644 (file)
index 0000000..446ebfd
--- /dev/null
@@ -0,0 +1,58 @@
+/* FriBidi
+ * joining-types.h - define internal joining types
+ *
+ * $Id: joining-types.h,v 1.1 2004-06-13 20:11:42 behdad Exp $
+ * $Author: behdad $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.1 $
+ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/joining-types.h,v $
+ *
+ * Author:
+ *   Behdad Esfahbod, 2004
+ *
+ * Copyright (C) 2004 Sharif FarsiWeb, Inc.
+ * Copyright (C) 2004 Behdad Esfahbod
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library, in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA
+ *
+ * For licensing issues, contact <license@farsiweb.info>.
+ */
+#ifndef _JOINING_TYPES_H
+#define _JOINING_TYPES_H
+
+#include "common.h"
+
+#include <fribidi-types.h>
+#include <fribidi-joining-types.h>
+
+#include <fribidi-begindecls.h>
+
+#if DEBUG
+
+#define fribidi_char_from_joining_type FRIBIDI_PRIVATESPACE(char_from_joining_type)
+char
+fribidi_char_from_joining_type (
+  FriBidiJoiningType j         /* input joining type */
+) FRIBIDI_GNUC_HIDDEN;
+
+#endif /* DEBUG */
+
+#include <fribidi-enddecls.h>
+
+#endif /* !_JOINING_TYPES_H */
+/* Editor directions:
+ * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
+ */
index db1bb4b8212d1bb7c817f7dc2ad39ff2db94cc1b..9388048a6b1e45460def9ab9a8f447b35f786950 100644 (file)
--- a/lib/run.h
+++ b/lib/run.h
@@ -1,10 +1,10 @@
 /* FriBidi
  * run.h - text run data type
  *
- * $Id: run.h,v 1.4 2004-06-04 16:43:51 behdad Exp $
+ * $Id: run.h,v 1.5 2004-06-13 20:11:42 behdad Exp $
  * $Author: behdad $
- * $Date: 2004-06-04 16:43:51 $
- * $Revision: 1.4 $
+ * $Date: 2004-06-13 20:11:42 $
+ * $Revision: 1.5 $
  * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/run.h,v $
  *
  * Authors:
@@ -44,7 +44,9 @@
 
 #include <fribidi-begindecls.h>
 
-struct _FriBidiRun
+typedef struct _FriBidiRunStruct FriBidiRun;
+
+struct _FriBidiRunStruct
 {
   FriBidiRun *prev;
   FriBidiRun *next;