changeset 14451:3a8e630d8a31

New module 'unictype/joiningtype-of'. * modules/unictype/joiningtype-of: New file. * lib/unictype/joiningtype_of.c: New file. * lib/unictype/joiningtype_of.h: New file, automatically generated by gen-uni-tables.
author Bruno Haible <bruno@clisp.org>
date Mon, 21 Mar 2011 23:02:14 +0100
parents fdc55132bd6b
children b61ad0463b76
files ChangeLog lib/unictype/joiningtype_of.c lib/unictype/joiningtype_of.h modules/unictype/joiningtype-of
diffstat 4 files changed, 214 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-03-21  Bruno Haible  <bruno@clisp.org>
 
+	New module 'unictype/joiningtype-of'.
+	* modules/unictype/joiningtype-of: New file.
+	* lib/unictype/joiningtype_of.c: New file.
+	* lib/unictype/joiningtype_of.h: New file, automatically generated by
+	gen-uni-tables.
+
 	Tests for module 'unictype/joiningtype-byname'.
 	* modules/unictype/joiningtype-byname-tests: New file.
 	* tests/unictype/test-joiningtype_byname.c: New file.
new file mode 100644
--- /dev/null
+++ b/lib/unictype/joiningtype_of.c
@@ -0,0 +1,54 @@
+/* Arabic joining type of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This program 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 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+/* Define u_joining_type table.  */
+#include "joiningtype_of.h"
+
+int
+uc_joining_type (ucs4_t uc)
+{
+  unsigned int index1 = uc >> joining_type_header_0;
+  if (index1 < joining_type_header_1)
+    {
+      int lookup1 = u_joining_type.level1[index1];
+      if (lookup1 >= 0)
+        {
+          unsigned int index2 = (uc >> joining_type_header_2) & joining_type_header_3;
+          int lookup2 = u_joining_type.level2[lookup1 + index2];
+          if (lookup2 >= 0)
+            {
+              unsigned int index3 = (uc & joining_type_header_4) + lookup2;
+              /* level3 contains 4-bit values.  */
+              unsigned int lookup3 =
+                (u_joining_type.level3[index3>>1] >> ((index3 % 2) * 4))
+                & 0x0f;
+
+              if (lookup3 != 0x0f)
+                return lookup3;
+            }
+        }
+    }
+  if (uc_is_general_category_withtable
+       (uc, UC_CATEGORY_MASK_Mn | UC_CATEGORY_MASK_Me | UC_CATEGORY_MASK_Cf))
+    return UC_JOINING_TYPE_T;
+  return UC_JOINING_TYPE_U;
+}
new file mode 100644
--- /dev/null
+++ b/lib/unictype/joiningtype_of.h
@@ -0,0 +1,127 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Arabic joining type of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+#define joining_type_header_0 16
+#define joining_type_header_1 1
+#define joining_type_header_2 7
+#define joining_type_header_3 511
+#define joining_type_header_4 127
+static const
+struct
+  {
+    int level1[1];
+    short level2[1 << 9];
+    unsigned char level3[5 * 64];
+  }
+u_joining_type =
+{
+  {     0 },
+  {
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,     0,   128,   256,   384,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      512,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
+  },
+  {
+    0x00, 0x00, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x05, 0x44, 0x44, 0x45, 0x45, 0x55, 0x55, 0x45,
+    0x44, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x52, 0x55, 0x55, 0x55, 0x54, 0xf5, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x55,
+    0x4f, 0x44, 0x40, 0x44, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x44, 0x44, 0x44, 0x44,
+    0x44, 0x44, 0x44, 0x44, 0x44, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x54, 0x45, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45,
+    0x55, 0x44, 0x4f, 0xff, 0xff, 0xff, 0x0f, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x44,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0xf5, 0x5f,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xf4, 0x55, 0x45, 0x44, 0x44, 0x55, 0x55, 0x54,
+    0x55, 0x55, 0x55, 0x55, 0x54, 0x54, 0x54, 0x45,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x45, 0x44, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x54, 0x55,
+    0x45, 0x45, 0x54, 0x55, 0x44, 0x55, 0x55, 0x55,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0xf5, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+  }
+};
new file mode 100644
--- /dev/null
+++ b/modules/unictype/joiningtype-of
@@ -0,0 +1,27 @@
+Description:
+Determine Arabic joining type of a Unicode character.
+
+Files:
+lib/unictype/joiningtype_of.c
+lib/unictype/joiningtype_of.h
+
+Depends-on:
+unictype/base
+unictype/category-test-withtable
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joiningtype-of])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGTYPE_OF
+lib_SOURCES += unictype/joiningtype_of.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible