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 15f1015..1750779 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 6ba5a69..c205b16 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 47f1677..54c98bc 100644 (file)
@@ -26,5 +26,6 @@ const struct unicode_normalization_form uninorm_nfd =
   {
     0,
     uc_canonical_decomposition,
-    NULL
+    NULL,
+    &uninorm_nfd
   };
index 1c4da90..1fb52f1 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 49a8ed0..871dd64 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 0533863..0b346c6 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 097d0dd..31417d3 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 uninorm/base
 uninorm/canonical-decomposition
 uninorm/composition
+uninorm/nfd
 
 configure.ac:
 
index ae31ad1..408c8a1 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 uninorm/base
 uninorm/compat-decomposition
 uninorm/composition
+uninorm/nfkd
 
 configure.ac: