[FriBidi-commit] fribidi/lib fribidi-bidi-type.c, 1.10, 1.11 fribidi-bidi-types.h, 1.6, 1.7 fribidi-mirroring.c, 1.9, 1.10 fribidi-types.h, 1.5, 1.6 fribidi.h, 1.4, 1.5

Behdad Esfahbod behdad at pdx.freedesktop.org
Wed Jun 9 13:01:02 PDT 2004


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

Modified Files:
	fribidi-bidi-type.c fribidi-bidi-types.h fribidi-mirroring.c 
	fribidi-types.h fribidi.h 
Log Message:
Wow!!!  I use the wonderful packtab to compress the mirroring table now!  It
gives an smaller and faster table than the old binary search one!  Moreover,
packtab deals with tables with empty heads much better.  Voila!


Index: fribidi-bidi-type.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-type.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- a/fribidi-bidi-type.c	9 Jun 2004 14:59:21 -0000	1.10
+++ b/fribidi-bidi-type.c	9 Jun 2004 20:01:00 -0000	1.11
@@ -58,12 +58,8 @@
 FRIBIDI_ENTRY FriBidiCharType
 fribidi_get_bidi_type (
   /* input */
-  FriBidiChar uch
+  FriBidiChar ch
 )
 {
-  if (uch < FRIBIDI_UNICODE_CHARS)
-    return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (uch)];
-  else
-    return FRIBIDI_TYPE_LTR;
-  /* Non-Unicode chars */
+  return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)];
 }

Index: fribidi-bidi-types.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-bidi-types.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- a/fribidi-bidi-types.h	9 Jun 2004 14:59:21 -0000	1.6
+++ b/fribidi-bidi-types.h	9 Jun 2004 20:01:00 -0000	1.7
@@ -176,7 +176,7 @@
 	FRIBIDI_TYPE_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
 # include "fribidi-bidi-types-list.h"
 # undef _FRIBIDI_ADD_TYPE
-  _FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
+  _FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL	/* Don't use this */
 } FriBidiCharType;
 
 typedef enum
@@ -187,7 +187,7 @@
 # include "fribidi-bidi-types-list.h"
 # undef _FRIBIDI_ADD_TYPE
 # undef _FRIBIDI_PAR_TYPES
-  _FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
+  _FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL	/* Don't use this */
 } FriBidiParType;
 
 #else

Index: fribidi-mirroring.c
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-mirroring.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- a/fribidi-mirroring.c	9 Jun 2004 14:59:21 -0000	1.9
+++ b/fribidi-mirroring.c	9 Jun 2004 20:01:00 -0000	1.10
@@ -38,11 +38,6 @@
 
 #include <fribidi-mirroring.h>
 
-struct _FriBidiMirroredPair
-{
-  FriBidiChar ch, mirrored_ch;
-};
-
 #include "mirroring.tab.i"
 
 FRIBIDI_ENTRY fribidi_boolean
@@ -53,40 +48,11 @@
   FriBidiChar *mirrored_ch
 )
 {
-  register int pos;
-  int step;
-  fribidi_boolean found;
-
-  pos = step = (nFriBidiMirroredChars / 2) + 1;
-
-  while LIKELY
-    (step > 1)
-    {
-      FriBidiChar cmp_ch = FriBidiMirroredChars[pos].ch;
-      step = (step + 1) / 2;
-
-      if (cmp_ch < ch)
-	{
-	  pos += step;
-	  if UNLIKELY
-	    (pos >= nFriBidiMirroredChars) pos = nFriBidiMirroredChars - 1;
-	}
-      else if LIKELY
-	(cmp_ch > ch)
-	{
-	  pos -= step;
-	  if UNLIKELY
-	    (pos < 0) pos = 0;
-	}
-      else
-	break;
-    }
-  found = FriBidiMirroredChars[pos].ch == ch;
-
+  register FriBidiChar result;
+  result = FRIBIDI_GET_MIRRORING_DELTA (ch);
   if (mirrored_ch)
-    *mirrored_ch = found ? FriBidiMirroredChars[pos].mirrored_ch : ch;
-
-  return found;
+    *mirrored_ch = ch + result;
+  return result ? true : false;
 }
 
 /* Editor directions:

Index: fribidi-types.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi-types.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/fribidi-types.h	9 Jun 2004 14:59:21 -0000	1.5
+++ b/fribidi-types.h	9 Jun 2004 20:01:00 -0000	1.6
@@ -39,35 +39,35 @@
 
 
 #if !FRIBIDI_USE_GLIB
-# if HAVE_INTTYPES_H
+# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
 #  ifndef __FRIBIDI_DOC
-#   include <inttypes.h>
+#   if HAVE_INTTYPES_H
+#    include <inttypes.h>
+#   elif HAVE_STDINT_H
+#    include <stdint.h>
+#   endif /* !HAVE_STDINT_H */
 #  endif /* !__FRIBIDI_DOC */
+#  define FRIBIDI_INT8_LOCAL		int8_t
+#  define FRIBIDI_INT16_LOCAL		int16_t
+#  define FRIBIDI_INT32_LOCAL		int32_t
 #  define FRIBIDI_UINT8_LOCAL		uint8_t
 #  define FRIBIDI_UINT16_LOCAL		uint16_t
 #  define FRIBIDI_UINT32_LOCAL		uint32_t
-# else /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#   ifndef __FRIBIDI_DOC
-#    include <stdint.h>
-#   endif /* !__FRIBIDI_DOC */
-#   define FRIBIDI_UINT8_LOCAL		uint8_t
-#   define FRIBIDI_UINT16_LOCAL		uint16_t
-#   define FRIBIDI_UINT32_LOCAL		uint32_t
-#  else	/* !HAVE_STDINT_H */
-#   define FRIBIDI_UINT8_LOCAL		unsigned char
-#   if !defined(SIZEOF_SHORT) || SIZEOF_SHORT >= 2
-#    define FRIBIDI_UINT16_LOCAL	unsigned short
-#   else /* SIZEOF_SHORT < 2 */
-#    define FRIBIDI_UINT16_LOCAL	unsigned int
-#   endif /* SIZEOF_SHORT < 2 */
-#   if !defined(SIZEOF_INT) || SIZEOF_INT >= 4
-#    define FRIBIDI_UINT32_LOCAL	unsigned int
-#   else /* SIZEOF_INT < 4 */
-#    define FRIBIDI_UINT32_LOCAL	unsigned long
-#   endif /* SIZEOF_INT < 4 */
-#  endif /* !HAVE_STDINT_H */
-# endif	/* !HAVE_INTTYPES_H */
+# else /* no int types */
+#  define FRIBIDI_INT8_LOCAL		signed char
+#  define FRIBIDI_UINT8_LOCAL		unsigned char
+#  if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
+#   define FRIBIDI_INT16_LOCAL		signed short
+#   define FRIBIDI_UINT16_LOCAL		unsigned short
+#   define FRIBIDI_INT32_LOCAL		signed int
+#   define FRIBIDI_UINT32_LOCAL		unsigned int
+#  else	/* SIZEOF_INT < 4 */
+#   define FRIBIDI_INT16_LOCAL		signed int
+#   define FRIBIDI_UINT16_LOCAL		unsigned int
+#   define FRIBIDI_INT32_LOCAL		signed long
+#   define FRIBIDI_UINT32_LOCAL		unsigned long
+#  endif /* SIZEOF_INT < 4 */
+# endif	/* no int types */
 # if HAVE_STDBOOL_H
 #  ifndef __FRIBIDI_DOC
 #   include <stdbool.h>
@@ -92,10 +92,13 @@
 #  define FRIBIDI_UNICHAR_LOCAL		fribidi_uint32
 # endif	/* SIZEOF_WCHAR_T < 4 */
 #else /* FRIBIDI_USE_GLIB */
-#  ifndef __FRIBIDI_DOC
-#   include <glib/gtypes.h>
-#   include <glib/gunicode.h>
-#  endif /* !__FRIBIDI_DOC */
+# ifndef __FRIBIDI_DOC
+#  include <glib/gtypes.h>
+#  include <glib/gunicode.h>
+# endif	/* !__FRIBIDI_DOC */
+# define FRIBIDI_INT8_LOCAL		gint8
+# define FRIBIDI_INT16_LOCAL		gint16
+# define FRIBIDI_INT32_LOCAL		gint32
 # define FRIBIDI_UINT8_LOCAL		guint8
 # define FRIBIDI_UINT16_LOCAL		guint16
 # define FRIBIDI_UINT32_LOCAL		guint32
@@ -103,15 +106,14 @@
 # define FRIBIDI_UNICHAR_LOCAL		gunichar
 #endif /* FRIBIDI_USE_GLIB */
 
-#ifndef FRIBIDI_UINT8
+#if !FRIBIDI_INT_TYPES
+# define FRIBIDI_INT8	FRIBIDI_INT8_LOCAL
+# define FRIBIDI_INT16	FRIBIDI_INT16_LOCAL
+# define FRIBIDI_INT32	FRIBIDI_INT32_LOCAL
 # define FRIBIDI_UINT8	FRIBIDI_UINT8_LOCAL
-#endif /* !FRIBIDI_UINT8 */
-#ifndef FRIBIDI_UINT16
 # define FRIBIDI_UINT16	FRIBIDI_UINT16_LOCAL
-#endif /* !FRIBIDI_UINT16 */
-#ifndef FRIBIDI_UINT32
 # define FRIBIDI_UINT32	FRIBIDI_UINT32_LOCAL
-#endif /* !FRIBIDI_UINT32 */
+#endif /* !FRIBIDI_INT_TYPES */
 #ifndef FRIBIDI_BOOLEAN
 # define FRIBIDI_BOOLEAN	FRIBIDI_BOOLEAN_LOCAL
 #endif /* !FRIBIDI_BOOLEAN */
@@ -123,6 +125,9 @@
 #endif /* FRIBIDI_STR_INDEX */
 
 
+typedef FRIBIDI_UINT8 fribidi_int8;
+typedef FRIBIDI_INT16 fribidi_int16;
+typedef FRIBIDI_INT32 fribidi_int32;
 typedef FRIBIDI_UINT8 fribidi_uint8;
 typedef FRIBIDI_UINT16 fribidi_uint16;
 typedef FRIBIDI_UINT32 fribidi_uint32;

Index: fribidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi/lib/fribidi.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/fribidi.h	9 Jun 2004 14:59:21 -0000	1.4
+++ b/fribidi.h	9 Jun 2004 20:01:00 -0000	1.5
@@ -135,7 +135,7 @@
 
 #define fribidi_version_info FRIBIDI_NAMESPACE(version_info)
 /* An string containing the version information of the library. */
-extern const char *fribidi_version_info;
+     extern const char *fribidi_version_info;
 
 #include "fribidi-enddecls.h"
 




More information about the FriBidi-Commit mailing list