New module 'uninorm/decomposing-form'.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Mar 2009 10:24:50 +0000 (11:24 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Mar 2009 10:24:50 +0000 (11:24 +0100)
lib/uninorm.h
lib/uninorm/decomposing-form.c [new file with mode: 0644]
lib/uninorm/nfc.c
lib/uninorm/nfd.c
lib/uninorm/nfkc.c
lib/uninorm/nfkd.c
lib/uninorm/normalize-internal.h
modules/uninorm/decomposing-form [new file with mode: 0644]
modules/uninorm/nfc
modules/uninorm/nfkc

index 15f1015b6ea5d2aabdd5d80afe0936d7acbb6d04..1750779fe611a844dd0c8472503a811abd36ed4a 100644 (file)
@@ -132,6 +132,10 @@ extern const struct unicode_normalization_form uninorm_nfkc;
 #define uninorm_is_composing(nf) \
   ((* (const unsigned int *) (nf) >> 1) & 1)
 
+/* Return the decomposing variant of a normalization form.
+   This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD.  */
+extern uninorm_t uninorm_decomposing_form (uninorm_t nf);
+
 
 /* Return the specified normalization form of a string.  */
 extern uint8_t *
diff --git a/lib/uninorm/decomposing-form.c b/lib/uninorm/decomposing-form.c
new file mode 100644 (file)
index 0000000..3b49cb8
--- /dev/null
@@ -0,0 +1,29 @@
+/* Decomposing variant of a normalization form.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   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 "uninorm.h"
+
+#include "normalize-internal.h"
+
+uninorm_t
+uninorm_decomposing_form (uninorm_t nf)
+{
+  return nf->decomposing_variant;
+}
index 6ba5a69cb102e82e1132279a0fe0369d03b694c7..c205b1668847ae276fa2fa860a832f5ab25837c0 100644 (file)
@@ -26,5 +26,6 @@ const struct unicode_normalization_form uninorm_nfc =
   {
     NF_IS_COMPOSING,
     uc_canonical_decomposition,
-    uc_composition
+    uc_composition,
+    &uninorm_nfd
   };
index 47f16771792d49ece990bbb57a85a7faf86b78af..54c98bc2feaaea34d910c6738546a3869000c043 100644 (file)
@@ -26,5 +26,6 @@ const struct unicode_normalization_form uninorm_nfd =
   {
     0,
     uc_canonical_decomposition,
-    NULL
+    NULL,
+    &uninorm_nfd
   };
index 1c4da900ecf28f5a3bb0dd05028643700a531fa3..1fb52f13b8f867bbd5fa9d0e78bc9100783877a7 100644 (file)
@@ -27,5 +27,6 @@ const struct unicode_normalization_form uninorm_nfkc =
   {
     NF_IS_COMPAT_DECOMPOSING | NF_IS_COMPOSING,
     uc_compat_decomposition,
-    uc_composition
+    uc_composition,
+    &uninorm_nfkd
   };
index 49a8ed0d9bcae2a307ac89c6f8698a836144438e..871dd647d740bea14bae21e4f1833f91e88d602a 100644 (file)
@@ -27,5 +27,6 @@ const struct unicode_normalization_form uninorm_nfkd =
   {
     NF_IS_COMPAT_DECOMPOSING,
     uc_compat_decomposition,
-    NULL
+    NULL,
+    &uninorm_nfkd
   };
index 05338635a4263122da527172856a4c5f4617f040..0b346c65898277c03392b5101c9b036b123478ef 100644 (file)
@@ -32,4 +32,6 @@ struct unicode_normalization_form
   /* Function that combines two Unicode characters, a starter and another
      character.  */
   ucs4_t (*composer) (ucs4_t uc1, ucs4_t uc2);
+  /* Decomposing variant.  */
+  const struct unicode_normalization_form *decomposing_variant;
 };
diff --git a/modules/uninorm/decomposing-form b/modules/uninorm/decomposing-form
new file mode 100644 (file)
index 0000000..3df8f9d
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+Decomposing variant of a normalization form.
+
+Files:
+lib/uninorm/decomposing-form.c
+lib/uninorm/normalize-internal.h
+
+Depends-on:
+uninorm/base
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += uninorm/decomposing-form.c
+
+Include:
+"uninorm.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
+
index 097d0ddf1fe8e1365f63b716945dda30038aae1e..31417d388da7361a559f64177adb0fb1e3087046 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 uninorm/base
 uninorm/canonical-decomposition
 uninorm/composition
+uninorm/nfd
 
 configure.ac:
 
index ae31ad19e567ee473afc66e5c7769e9059d1d24e..408c8a10a73d8a7a555567bca814ff1ac6fa1b7d 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 uninorm/base
 uninorm/compat-decomposition
 uninorm/composition
+uninorm/nfkd
 
 configure.ac: