New module 'uninorm/u8-normxfrm'.
[pspp] / lib / uninorm.h
index 54497469ceee3a0c81513b8d561867881fff54ca..6680f819ca226a07b18884b358f8aba16b19de7f 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 *
@@ -145,7 +149,7 @@ extern uint32_t *
                      uint32_t *resultbuf, size_t *lengthp);
 
 
-/* Compare S1 and S2, ignoring normalization.
+/* Compare S1 and S2, ignoring differences in normalization.
    NF must be either UNINORM_NFD or UNINORM_NFKD.
    If successful, set *RESULT to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
    return 0.  Upon failure, return the error number.  */
@@ -160,6 +164,21 @@ extern int
                    uninorm_t nf, int *result);
 
 
+/* Converts the string S of length N to a string in locale encoding, in such a
+   way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with memcmp2() is
+   equivalent to comparing S1 and S2 with uN_normcoll().
+   NF must be either UNINORM_NFC or UNINORM_NFKC.  */
+extern char *
+       u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf,
+                   char *resultbuf, size_t *lengthp);
+extern char *
+       u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf,
+                    char *resultbuf, size_t *lengthp);
+extern char *
+       u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf,
+                    char *resultbuf, size_t *lengthp);
+
+
 /* Normalization of a stream of Unicode characters.
 
    A "stream of Unicode characters" is essentially a function that accepts an