[FriBidi-commit] fribidi/lib Headers.mk, 1.4, 1.5 fribidi-bidi-type.c, 1.8, 1.9 fribidi-bidi-type.h, 1.2, 1.3 fribidi-bidi-types-list.h, 1.1, 1.2 fribidi-bidi-types.c, 1.4, 1.5 fribidi-bidi-types.h, 1.3, 1.4 fribidi-bidi.c, 1.7, 1.8 fribidi-bidi.h, 1.3, 1.4 fribidi-common.h, 1.7, 1.8 fribidi-config.h.in, 1.2, 1.3 fribidi.def, 1.1, 1.2

Behdad Esfahbod behdad at pdx.freedesktop.org
Fri Jun 4 02:41:14 PDT 2004


Update of /cvs/fribidi/fribidi/lib
In directory pdx:/tmp/cvs-serv367/lib

Modified Files:
	Headers.mk fribidi-bidi-type.c fribidi-bidi-type.h 
	fribidi-bidi-types-list.h fribidi-bidi-types.c 
	fribidi-bidi-types.h fribidi-bidi.c fribidi-bidi.h 
	fribidi-common.h fribidi-config.h.in fribidi.def 
Log Message:
Cleaning up here and there.  Last lingers before adding joining.


Index: Headers.mk
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/Headers.mk,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/Headers.mk	31 May 2004 18:39:39 -0000	1.4
+++ b/Headers.mk	4 Jun 2004 09:41:11 -0000	1.5
@@ -14,4 +14,4 @@
 		fribidi-unicode-version.h \
 		fribidi.h
 
-include $(top_srcdir)/lib/fribidi.def
+libfribidi_la_symbols := $(shell cat "$(top_srcdir)/lib/fribidi.def")

Index: fribidi-bidi-type.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-type.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/fribidi-bidi-type.c	31 May 2004 18:43:26 -0000	1.8
+++ b/fribidi-bidi-type.c	4 Jun 2004 09:41:11 -0000	1.9
@@ -43,7 +43,7 @@
 # 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 @@
   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 */

Index: fribidi-bidi-type.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-type.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fribidi-bidi-type.h	3 May 2004 22:05:19 -0000	1.2
+++ b/fribidi-bidi-type.h	4 Jun 2004 09:41:11 -0000	1.3
@@ -50,9 +50,15 @@
   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 @@
   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"
 

Index: fribidi-bidi-types-list.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types-list.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/fribidi-bidi-types-list.h	31 May 2004 18:43:26 -0000	1.1
+++ b/fribidi-bidi-types-list.h	4 Jun 2004 09:41:11 -0000	1.2
@@ -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 (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 (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* */

Index: fribidi-bidi-types.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/fribidi-bidi-types.c	31 May 2004 18:39:39 -0000	1.4
+++ b/fribidi-bidi-types.c	4 Jun 2004 09:41:11 -0000	1.5
@@ -48,7 +48,9 @@
   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 @@
   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 "?";

Index: fribidi-bidi-types.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/fribidi-bidi-types.h	3 May 2004 22:05:19 -0000	1.3
+++ b/fribidi-bidi-types.h	4 Jun 2004 09:41:11 -0000	1.4
@@ -160,6 +160,7 @@
 /* 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 @@
 
 /* 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 @@
 	(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

Index: fribidi-bidi.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/fribidi-bidi.c	31 May 2004 18:39:39 -0000	1.7
+++ b/fribidi-bidi.c	4 Jun 2004 09:41:11 -0000	1.8
@@ -118,98 +118,6 @@
     }
 }
 
-/*=========================================================================
- * 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 @@
 }
 #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 @@
 /*======================================================================
  *  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 @@
   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 @@
 
   /* 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 @@
 
     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 @@
 
     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 @@
       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 @@
 # 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 @@
 
   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 @@
     }
 
   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 @@
 	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 @@
 }
 
 FRIBIDI_ENTRY fribidi_boolean
-fribidi_log2vis_get_embedding_levels (
+fribidi_get_embedding_levels (
   /* input */
   const FriBidiChar *str,
   FriBidiStrIndex len,
@@ -1143,10 +1141,10 @@
 )
 {
   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 @@
     (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);
 

Index: fribidi-bidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/fribidi-bidi.h	22 May 2004 10:35:31 -0000	1.3
+++ b/fribidi-bidi.h	4 Jun 2004 09:41:11 -0000	1.4
@@ -69,8 +69,8 @@
   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 @@
  * 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 @@
   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
  *

Index: fribidi-common.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-common.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/fribidi-common.h	31 May 2004 18:39:39 -0000	1.7
+++ b/fribidi-common.h	4 Jun 2004 09:41:11 -0000	1.8
@@ -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

Index: fribidi-config.h.in
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-config.h.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fribidi-config.h.in	31 May 2004 18:39:39 -0000	1.2
+++ b/fribidi-config.h.in	4 Jun 2004 09:41:11 -0000	1.3
@@ -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 */

Index: fribidi.def
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.def,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/fribidi.def	3 May 2004 22:05:19 -0000	1.1
+++ b/fribidi.def	4 Jun 2004 09:41:11 -0000	1.2
@@ -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




More information about the FriBidi-Commit mailing list