| unicase.h | | unicase.h | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 94 | |
| it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly | | it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly | |
| allocated string is returned. In both cases, *lengthp is set to the | | allocated string is returned. In both cases, *lengthp is set to the | |
| length (number of units) of the returned string. In case of error, | | length (number of units) of the returned string. In case of error, | |
| NULL is returned and errno is set. */ | | NULL is returned and errno is set. */ | |
| | | | |
| /* Return the uppercase mapping of a string. | | /* Return the uppercase mapping of a string. | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It can also be NULL, for no normalization. */ | | case-mapping. It can also be NULL, for no normalization. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, | | u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_toupper (const uint16_t *s, size_t n, const char *iso639_languag
e, | | u16_toupper (const uint16_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_toupper (const uint32_t *s, size_t n, const char *iso639_languag
e, | | u32_toupper (const uint32_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Return the lowercase mapping of a string. | | /* Return the lowercase mapping of a string. | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It can also be NULL, for no normalization. */ | | case-mapping. It can also be NULL, for no normalization. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, | | u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_tolower (const uint16_t *s, size_t n, const char *iso639_languag
e, | | u16_tolower (const uint16_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_tolower (const uint32_t *s, size_t n, const char *iso639_languag
e, | | u32_tolower (const uint32_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Return the titlecase mapping of a string. | | /* Return the titlecase mapping of a string. | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It can also be NULL, for no normalization. */ | | case-mapping. It can also be NULL, for no normalization. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, | | u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_totitle (const uint16_t *s, size_t n, const char *iso639_languag
e, | | u16_totitle (const uint16_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_totitle (const uint32_t *s, size_t n, const char *iso639_languag
e, | | u32_totitle (const uint32_t *s, size_t n, const char *iso639_languag
e, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* The case-mapping context given by a prefix string. */ | | /* The case-mapping context given by a prefix string. */ | |
| typedef struct casing_prefix_context | | typedef struct casing_prefix_context | |
|
| { | | { | |
| /* These fields are private, undocumented. */ | | /* These fields are private, undocumented. */ | |
| uint32_t last_char_except_ignorable; | | uint32_t last_char_except_ignorable; | |
| uint32_t last_char_normal_or_above; | | uint32_t last_char_normal_or_above; | |
| } | | } | |
| casing_prefix_context_t; | | casing_prefix_context_t; | |
| /* The case-mapping context of the empty prefix string. */ | | /* The case-mapping context of the empty prefix string. */ | |
| extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empt
y_prefix_context; | | extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empt
y_prefix_context; | |
| /* Return the case-mapping context of a given prefix string. */ | | /* Return the case-mapping context of a given prefix string. */ | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u8_casing_prefix_context (const uint8_t *s, size_t n); | | u8_casing_prefix_context (const uint8_t *s, size_t n); | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u16_casing_prefix_context (const uint16_t *s, size_t n); | | u16_casing_prefix_context (const uint16_t *s, size_t n); | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u32_casing_prefix_context (const uint32_t *s, size_t n); | | u32_casing_prefix_context (const uint32_t *s, size_t n); | |
| /* Return the case-mapping context of the prefix concat(A, S), given the | | /* Return the case-mapping context of the prefix concat(A, S), given the | |
| case-mapping context of the prefix A. */ | | case-mapping context of the prefix A. */ | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u8_casing_prefixes_context (const uint8_t *s, size_t n, | | u8_casing_prefixes_context (const uint8_t *s, size_t n, | |
|
| casing_prefix_context_t a_context); | | casing_prefix_context_t a_context); | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u16_casing_prefixes_context (const uint16_t *s, size_t n, | | u16_casing_prefixes_context (const uint16_t *s, size_t n, | |
|
| casing_prefix_context_t a_context); | | casing_prefix_context_t a_context); | |
| extern casing_prefix_context_t | | extern casing_prefix_context_t | |
| u32_casing_prefixes_context (const uint32_t *s, size_t n, | | u32_casing_prefixes_context (const uint32_t *s, size_t n, | |
|
| casing_prefix_context_t a_context); | | casing_prefix_context_t a_context); | |
| | | | |
| /* The case-mapping context given by a suffix string. */ | | /* The case-mapping context given by a suffix string. */ | |
| typedef struct casing_suffix_context | | typedef struct casing_suffix_context | |
|
| { | | { | |
| /* These fields are private, undocumented. */ | | /* These fields are private, undocumented. */ | |
| uint32_t first_char_except_ignorable; | | uint32_t first_char_except_ignorable; | |
| uint32_t bits; | | uint32_t bits; | |
| } | | } | |
| casing_suffix_context_t; | | casing_suffix_context_t; | |
| /* The case-mapping context of the empty suffix string. */ | | /* The case-mapping context of the empty suffix string. */ | |
| extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empt
y_suffix_context; | | extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empt
y_suffix_context; | |
| /* Return the case-mapping context of a given suffix string. */ | | /* Return the case-mapping context of a given suffix string. */ | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u8_casing_suffix_context (const uint8_t *s, size_t n); | | u8_casing_suffix_context (const uint8_t *s, size_t n); | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u16_casing_suffix_context (const uint16_t *s, size_t n); | | u16_casing_suffix_context (const uint16_t *s, size_t n); | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u32_casing_suffix_context (const uint32_t *s, size_t n); | | u32_casing_suffix_context (const uint32_t *s, size_t n); | |
| /* Return the case-mapping context of the suffix concat(S, A), given the | | /* Return the case-mapping context of the suffix concat(S, A), given the | |
| case-mapping context of the suffix A. */ | | case-mapping context of the suffix A. */ | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u8_casing_suffixes_context (const uint8_t *s, size_t n, | | u8_casing_suffixes_context (const uint8_t *s, size_t n, | |
|
| casing_suffix_context_t a_context); | | casing_suffix_context_t a_context); | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u16_casing_suffixes_context (const uint16_t *s, size_t n, | | u16_casing_suffixes_context (const uint16_t *s, size_t n, | |
|
| casing_suffix_context_t a_context); | | casing_suffix_context_t a_context); | |
| extern casing_suffix_context_t | | extern casing_suffix_context_t | |
| u32_casing_suffixes_context (const uint32_t *s, size_t n, | | u32_casing_suffixes_context (const uint32_t *s, size_t n, | |
|
| casing_suffix_context_t a_context); | | casing_suffix_context_t a_context); | |
| | | | |
| /* Return the uppercase mapping of a string that is surrounded by a prefix | | /* Return the uppercase mapping of a string that is surrounded by a prefix | |
| and a suffix. */ | | and a suffix. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_ct_toupper (const uint8_t *s, size_t n, | | u8_ct_toupper (const uint8_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_ct_toupper (const uint16_t *s, size_t n, | | u16_ct_toupper (const uint16_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_ct_toupper (const uint32_t *s, size_t n, | | u32_ct_toupper (const uint32_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Return the lowercase mapping of a string that is surrounded by a prefix | | /* Return the lowercase mapping of a string that is surrounded by a prefix | |
| and a suffix. */ | | and a suffix. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_ct_tolower (const uint8_t *s, size_t n, | | u8_ct_tolower (const uint8_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_ct_tolower (const uint16_t *s, size_t n, | | u16_ct_tolower (const uint16_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_ct_tolower (const uint32_t *s, size_t n, | | u32_ct_tolower (const uint32_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Return the titlecase mapping of a string that is surrounded by a prefix | | /* Return the titlecase mapping of a string that is surrounded by a prefix | |
| and a suffix. */ | | and a suffix. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_ct_totitle (const uint8_t *s, size_t n, | | u8_ct_totitle (const uint8_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_ct_totitle (const uint16_t *s, size_t n, | | u16_ct_totitle (const uint16_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_ct_totitle (const uint32_t *s, size_t n, | | u32_ct_totitle (const uint32_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Return the case folded string. | | /* Return the case folded string. | |
| Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equiva
lent | | Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equiva
lent | |
| to comparing S1 and S2 with uN_casecmp(). | | to comparing S1 and S2 with uN_casecmp(). | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It can also be NULL, for no normalization. */ | | case-mapping. It can also be NULL, for no normalization. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_casefold (const uint8_t *s, size_t n, const char *iso639_language
, | | u8_casefold (const uint8_t *s, size_t n, const char *iso639_language
, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_casefold (const uint16_t *s, size_t n, const char *iso639_langua
ge, | | u16_casefold (const uint16_t *s, size_t n, const char *iso639_langua
ge, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_casefold (const uint32_t *s, size_t n, const char *iso639_langua
ge, | | u32_casefold (const uint32_t *s, size_t n, const char *iso639_langua
ge, | |
|
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| /* Likewise, for a string that is surrounded by a prefix and a suffix. */ | | /* Likewise, for a string that is surrounded by a prefix and a suffix. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_ct_casefold (const uint8_t *s, size_t n, | | u8_ct_casefold (const uint8_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_ct_casefold (const uint16_t *s, size_t n, | | u16_ct_casefold (const uint16_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_ct_casefold (const uint32_t *s, size_t n, | | u32_ct_casefold (const uint32_t *s, size_t n, | |
|
| casing_prefix_context_t prefix_context, | | casing_prefix_context_t prefix_context, | |
| casing_suffix_context_t suffix_context, | | casing_suffix_context_t suffix_context, | |
| const char *iso639_language, | | const char *iso639_language, | |
| uninorm_t nf, | | uninorm_t nf, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Compare S1 and S2, ignoring differences in case and normalization. | | /* Compare S1 and S2, ignoring differences in case and normalization. | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It can also be NULL, for no normalization. | | case-mapping. It can also be NULL, for no normalization. | |
| If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | | If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | |
| return 0. Upon failure, return -1 with errno set. */ | | return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_casecmp (const uint8_t *s1, size_t n1, | | u8_casecmp (const uint8_t *s1, size_t n1, | |
|
| const uint8_t *s2, size_t n2, | | const uint8_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp); | | const char *iso639_language, uninorm_t nf, int *resultp) | |
| | | ; | |
| extern int | | extern int | |
| u16_casecmp (const uint16_t *s1, size_t n1, | | u16_casecmp (const uint16_t *s1, size_t n1, | |
|
| const uint16_t *s2, size_t n2, | | const uint16_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp) | | const char *iso639_language, uninorm_t nf, int *resultp | |
| ; | | ); | |
| extern int | | extern int | |
| u32_casecmp (const uint32_t *s1, size_t n1, | | u32_casecmp (const uint32_t *s1, size_t n1, | |
|
| const uint32_t *s2, size_t n2, | | const uint32_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp) | | const char *iso639_language, uninorm_t nf, int *resultp | |
| ; | | ); | |
| extern int | | extern int | |
| ulc_casecmp (const char *s1, size_t n1, | | ulc_casecmp (const char *s1, size_t n1, | |
|
| const char *s2, size_t n2, | | const char *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp) | | const char *iso639_language, uninorm_t nf, int *resultp | |
| ; | | ); | |
| | | | |
| /* Convert the string S of length N to a NUL-terminated byte sequence, in s
uch | | /* Convert the string S of length N to a NUL-terminated byte sequence, in s
uch | |
| a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnul
ib | | a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnul
ib | |
| function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll
(). | | function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll
(). | |
| NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalizatio
n. */ | | NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalizatio
n. */ | |
| extern char * | | extern char * | |
| u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language
, | | u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language
, | |
|
| uninorm_t nf, char *resultbuf, size_t *lengthp); | | uninorm_t nf, char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_langua
ge, | | u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_langua
ge, | |
|
| uninorm_t nf, char *resultbuf, size_t *lengthp); | | uninorm_t nf, char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_langua
ge, | | u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_langua
ge, | |
|
| uninorm_t nf, char *resultbuf, size_t *lengthp); | | uninorm_t nf, char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| ulc_casexfrm (const char *s, size_t n, const char *iso639_language, | | ulc_casexfrm (const char *s, size_t n, const char *iso639_language, | |
|
| uninorm_t nf, char *resultbuf, size_t *lengthp); | | uninorm_t nf, char *resultbuf, size_t *lengthp); | |
| | | | |
| /* Compare S1 and S2, ignoring differences in case and normalization, using
the | | /* Compare S1 and S2, ignoring differences in case and normalization, using
the | |
| collation rules of the current locale. | | collation rules of the current locale. | |
| The nf argument identifies the normalization form to apply after the | | The nf argument identifies the normalization form to apply after the | |
| case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can al
so | | case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can al
so | |
| be NULL, for no normalization. | | be NULL, for no normalization. | |
| If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | | If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | |
| return 0. Upon failure, return -1 with errno set. */ | | return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_casecoll (const uint8_t *s1, size_t n1, | | u8_casecoll (const uint8_t *s1, size_t n1, | |
|
| const uint8_t *s2, size_t n2, | | const uint8_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp) | | const char *iso639_language, uninorm_t nf, int *resultp | |
| ; | | ); | |
| extern int | | extern int | |
| u16_casecoll (const uint16_t *s1, size_t n1, | | u16_casecoll (const uint16_t *s1, size_t n1, | |
|
| const uint16_t *s2, size_t n2, | | const uint16_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp | | const char *iso639_language, uninorm_t nf, int *result | |
| ); | | p); | |
| extern int | | extern int | |
| u32_casecoll (const uint32_t *s1, size_t n1, | | u32_casecoll (const uint32_t *s1, size_t n1, | |
|
| const uint32_t *s2, size_t n2, | | const uint32_t *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp | | const char *iso639_language, uninorm_t nf, int *result | |
| ); | | p); | |
| extern int | | extern int | |
| ulc_casecoll (const char *s1, size_t n1, | | ulc_casecoll (const char *s1, size_t n1, | |
|
| const char *s2, size_t n2, | | const char *s2, size_t n2, | |
| const char *iso639_language, uninorm_t nf, int *resultp | | const char *iso639_language, uninorm_t nf, int *result | |
| ); | | p); | |
| | | | |
| /* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to f
alse | | /* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to f
alse | |
| otherwise, and return 0. Upon failure, return -1 with errno set. */ | | otherwise, and return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_is_uppercase (const uint8_t *s, size_t n, | | u8_is_uppercase (const uint8_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u16_is_uppercase (const uint16_t *s, size_t n, | | u16_is_uppercase (const uint16_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u32_is_uppercase (const uint32_t *s, size_t n, | | u32_is_uppercase (const uint32_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| | | | |
| /* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to f
alse | | /* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to f
alse | |
| otherwise, and return 0. Upon failure, return -1 with errno set. */ | | otherwise, and return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_is_lowercase (const uint8_t *s, size_t n, | | u8_is_lowercase (const uint8_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u16_is_lowercase (const uint16_t *s, size_t n, | | u16_is_lowercase (const uint16_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u32_is_lowercase (const uint32_t *s, size_t n, | | u32_is_lowercase (const uint32_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| | | | |
| /* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to f
alse | | /* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to f
alse | |
| otherwise, and return 0. Upon failure, return -1 with errno set. */ | | otherwise, and return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_is_titlecase (const uint8_t *s, size_t n, | | u8_is_titlecase (const uint8_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u16_is_titlecase (const uint16_t *s, size_t n, | | u16_is_titlecase (const uint16_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u32_is_titlecase (const uint32_t *s, size_t n, | | u32_is_titlecase (const uint32_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| | | | |
| /* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or t
o | | /* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or t
o | |
| false otherwise, and return 0. Upon failure, return -1 with errno set.
*/ | | false otherwise, and return 0. Upon failure, return -1 with errno set.
*/ | |
| extern int | | extern int | |
| u8_is_casefolded (const uint8_t *s, size_t n, | | u8_is_casefolded (const uint8_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u16_is_casefolded (const uint16_t *s, size_t n, | | u16_is_casefolded (const uint16_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u32_is_casefolded (const uint32_t *s, size_t n, | | u32_is_casefolded (const uint32_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| | | | |
| /* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) t
o | | /* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) t
o | |
| either upper case or lower case or title case is not a no-op. | | either upper case or lower case or title case is not a no-op. | |
| Set *RESULTP to false if NFD(S) maps to itself under the upper case mapp
ing, | | Set *RESULTP to false if NFD(S) maps to itself under the upper case mapp
ing, | |
| under the lower case mapping, and under the title case mapping; in other | | under the lower case mapping, and under the title case mapping; in other | |
| words, when NFD(S) consists entirely of caseless characters. | | words, when NFD(S) consists entirely of caseless characters. | |
| Upon failure, return -1 with errno set. */ | | Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_is_cased (const uint8_t *s, size_t n, | | u8_is_cased (const uint8_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u16_is_cased (const uint16_t *s, size_t n, | | u16_is_cased (const uint16_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| extern int | | extern int | |
| u32_is_cased (const uint32_t *s, size_t n, | | u32_is_cased (const uint32_t *s, size_t n, | |
|
| const char *iso639_language, | | const char *iso639_language, | |
| bool *resultp); | | bool *resultp); | |
| | | | |
| /* ========================================================================
= */ | | /* ========================================================================
= */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* _UNICASE_H */ | | #endif /* _UNICASE_H */ | |
| | | | |
End of changes. 59 change blocks. |
| 159 lines changed or deleted | | 160 lines changed or added | |
|
| uniconv.h | | uniconv.h | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| or *RESULTBUF can be NULL. | | or *RESULTBUF can be NULL. | |
| May erase the contents of the memory at RESULTBUF. | | May erase the contents of the memory at RESULTBUF. | |
| If successful: The resulting Unicode string (non-NULL) is returned and i
ts | | If successful: The resulting Unicode string (non-NULL) is returned and i
ts | |
| length stored in *LENGTHP. The resulting string is RESULTBUF if no dyna
mic | | length stored in *LENGTHP. The resulting string is RESULTBUF if no dyna
mic | |
| memory allocation was necessary, or a freshly allocated memory block | | memory allocation was necessary, or a freshly allocated memory block | |
| otherwise. | | otherwise. | |
| In case of error: NULL is returned and errno is set. Particular errno | | In case of error: NULL is returned and errno is set. Particular errno | |
| values: EINVAL, EILSEQ, ENOMEM. */ | | values: EINVAL, EILSEQ, ENOMEM. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_conv_from_encoding (const char *fromcode, | | u8_conv_from_encoding (const char *fromcode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const char *src, size_t srclen, | | const char *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_conv_from_encoding (const char *fromcode, | | u16_conv_from_encoding (const char *fromcode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const char *src, size_t srclen, | | const char *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_conv_from_encoding (const char *fromcode, | | u32_conv_from_encoding (const char *fromcode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const char *src, size_t srclen, | | const char *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Converts an entire Unicode string, possibly including NUL units, from a | | /* Converts an entire Unicode string, possibly including NUL units, from a | |
| Unicode encoding to a given encoding. | | Unicode encoding to a given encoding. | |
| Converts a memory region to encoding TOCODE. TOCODE is as for | | Converts a memory region to encoding TOCODE. TOCODE is as for | |
| iconv_open(3). | | iconv_open(3). | |
| The input is in the memory region between SRC (inclusive) and SRC + SRCL
EN | | The input is in the memory region between SRC (inclusive) and SRC + SRCL
EN | |
| (exclusive). | | (exclusive). | |
| If OFFSETS is not NULL, it should point to an array of SRCLEN integers;
this | | If OFFSETS is not NULL, it should point to an array of SRCLEN integers;
this | |
| array is filled with offsets into the result, i.e. the character startin
g | | array is filled with offsets into the result, i.e. the character startin
g | |
| at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]
], | | at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]
], | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 93 | |
| RESULTBUF and *LENGTHP should initially be a scratch buffer and its size
, | | RESULTBUF and *LENGTHP should initially be a scratch buffer and its size
, | |
| or RESULTBUF can be NULL. | | or RESULTBUF can be NULL. | |
| May erase the contents of the memory at RESULTBUF. | | May erase the contents of the memory at RESULTBUF. | |
| If successful: The resulting string (non-NULL) is returned and its lengt
h | | If successful: The resulting string (non-NULL) is returned and its lengt
h | |
| stored in *LENGTHP. The resulting string is RESULTBUF if no dynamic mem
ory | | stored in *LENGTHP. The resulting string is RESULTBUF if no dynamic mem
ory | |
| allocation was necessary, or a freshly allocated memory block otherwise. | | allocation was necessary, or a freshly allocated memory block otherwise. | |
| In case of error: NULL is returned and errno is set. Particular errno | | In case of error: NULL is returned and errno is set. Particular errno | |
| values: EINVAL, EILSEQ, ENOMEM. */ | | values: EINVAL, EILSEQ, ENOMEM. */ | |
| extern char * | | extern char * | |
| u8_conv_to_encoding (const char *tocode, | | u8_conv_to_encoding (const char *tocode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const uint8_t *src, size_t srclen, | | const uint8_t *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u16_conv_to_encoding (const char *tocode, | | u16_conv_to_encoding (const char *tocode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const uint16_t *src, size_t srclen, | | const uint16_t *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u32_conv_to_encoding (const char *tocode, | | u32_conv_to_encoding (const char *tocode, | |
|
| enum iconv_ilseq_handler handler, | | enum iconv_ilseq_handler handler, | |
| const uint32_t *src, size_t srclen, | | const uint32_t *src, size_t srclen, | |
| size_t *offsets, | | size_t *offsets, | |
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| | | | |
| /* Converts a NUL terminated string from a given encoding. | | /* Converts a NUL terminated string from a given encoding. | |
| The result is malloc allocated, or NULL (with errno set) in case of erro
r. | | The result is malloc allocated, or NULL (with errno set) in case of erro
r. | |
| Particular errno values: EILSEQ, ENOMEM. */ | | Particular errno values: EILSEQ, ENOMEM. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_strconv_from_encoding (const char *string, | | u8_strconv_from_encoding (const char *string, | |
|
| const char *fromcode, | | const char *fromcode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_strconv_from_encoding (const char *string, | | u16_strconv_from_encoding (const char *string, | |
|
| const char *fromcode, | | const char *fromcode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_strconv_from_encoding (const char *string, | | u32_strconv_from_encoding (const char *string, | |
|
| const char *fromcode, | | const char *fromcode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| | | | |
| /* Converts a NUL terminated string to a given encoding. | | /* Converts a NUL terminated string to a given encoding. | |
| The result is malloc allocated, or NULL (with errno set) in case of erro
r. | | The result is malloc allocated, or NULL (with errno set) in case of erro
r. | |
| Particular errno values: EILSEQ, ENOMEM. */ | | Particular errno values: EILSEQ, ENOMEM. */ | |
| extern char * | | extern char * | |
| u8_strconv_to_encoding (const uint8_t *string, | | u8_strconv_to_encoding (const uint8_t *string, | |
|
| const char *tocode, | | const char *tocode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| extern char * | | extern char * | |
| u16_strconv_to_encoding (const uint16_t *string, | | u16_strconv_to_encoding (const uint16_t *string, | |
|
| const char *tocode, | | const char *tocode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| extern char * | | extern char * | |
| u32_strconv_to_encoding (const uint32_t *string, | | u32_strconv_to_encoding (const uint32_t *string, | |
|
| const char *tocode, | | const char *tocode, | |
| enum iconv_ilseq_handler handler); | | enum iconv_ilseq_handler handler); | |
| | | | |
| /* Converts a NUL terminated string from the locale encoding. | | /* Converts a NUL terminated string from the locale encoding. | |
| The result is malloc allocated, or NULL (with errno set) in case of erro
r. | | The result is malloc allocated, or NULL (with errno set) in case of erro
r. | |
| Particular errno values: ENOMEM. */ | | Particular errno values: ENOMEM. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_strconv_from_locale (const char *string); | | u8_strconv_from_locale (const char *string); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_strconv_from_locale (const char *string); | | u16_strconv_from_locale (const char *string); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_strconv_from_locale (const char *string); | | u32_strconv_from_locale (const char *string); | |
| | | | |
End of changes. 12 change blocks. |
| 36 lines changed or deleted | | 36 lines changed or added | |
|
| uninorm.h | | uninorm.h | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 140 | |
| #define uninorm_is_composing(nf) \ | | #define uninorm_is_composing(nf) \ | |
| ((* (const unsigned int *) (nf) >> 1) & 1) | | ((* (const unsigned int *) (nf) >> 1) & 1) | |
| | | | |
| /* Return the decomposing variant of a normalization form. | | /* Return the decomposing variant of a normalization form. | |
| This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */ | | This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */ | |
| extern uninorm_t uninorm_decomposing_form (uninorm_t nf); | | extern uninorm_t uninorm_decomposing_form (uninorm_t nf); | |
| | | | |
| /* Return the specified normalization form of a string. */ | | /* Return the specified normalization form of a string. */ | |
| extern uint8_t * | | extern uint8_t * | |
| u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, | | u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, | |
|
| uint8_t *resultbuf, size_t *lengthp); | | uint8_t *resultbuf, size_t *lengthp); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, | | u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, | |
|
| uint16_t *resultbuf, size_t *lengthp); | | uint16_t *resultbuf, size_t *lengthp); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, | | u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, | |
|
| uint32_t *resultbuf, size_t *lengthp); | | uint32_t *resultbuf, size_t *lengthp); | |
| | | | |
| /* Compare S1 and S2, ignoring differences in normalization. | | /* Compare S1 and S2, ignoring differences in normalization. | |
| NF must be either UNINORM_NFD or UNINORM_NFKD. | | NF must be either UNINORM_NFD or UNINORM_NFKD. | |
| If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | | If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | |
| return 0. Upon failure, return -1 with errno set. */ | | return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t
n2, | | u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t
n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| extern int | | extern int | |
| u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size
_t n2, | | u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size
_t n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| extern int | | extern int | |
| u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size
_t n2, | | u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size
_t n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| | | | |
| /* Converts the string S of length N to a NUL-terminated byte sequence, in
such | | /* Converts the string S of length N to a NUL-terminated byte sequence, in
such | |
| a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2(
) is | | a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2(
) is | |
| equivalent to comparing S1 and S2 with uN_normcoll(). | | equivalent to comparing S1 and S2 with uN_normcoll(). | |
| NF must be either UNINORM_NFC or UNINORM_NFKC. */ | | NF must be either UNINORM_NFC or UNINORM_NFKC. */ | |
| extern char * | | extern char * | |
| u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, | | u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, | |
|
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, | | u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, | |
|
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| extern char * | | extern char * | |
| u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, | | u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, | |
|
| char *resultbuf, size_t *lengthp); | | char *resultbuf, size_t *lengthp); | |
| | | | |
| /* Compare S1 and S2, ignoring differences in normalization, using the | | /* Compare S1 and S2, ignoring differences in normalization, using the | |
| collation rules of the current locale. | | collation rules of the current locale. | |
| NF must be either UNINORM_NFC or UNINORM_NFKC. | | NF must be either UNINORM_NFC or UNINORM_NFKC. | |
| If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | | If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2
, and | |
| return 0. Upon failure, return -1 with errno set. */ | | return 0. Upon failure, return -1 with errno set. */ | |
| extern int | | extern int | |
| u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t
n2, | | u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t
n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| extern int | | extern int | |
| u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, siz
e_t n2, | | u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, siz
e_t n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| extern int | | extern int | |
| u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, siz
e_t n2, | | u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, siz
e_t n2, | |
|
| uninorm_t nf, int *resultp); | | uninorm_t nf, int *resultp); | |
| | | | |
| /* Normalization of a stream of Unicode characters. | | /* Normalization of a stream of Unicode characters. | |
| | | | |
| A "stream of Unicode characters" is essentially a function that accepts
an | | A "stream of Unicode characters" is essentially a function that accepts
an | |
| ucs4_t argument repeatedly, optionally combined with a function that | | ucs4_t argument repeatedly, optionally combined with a function that | |
| "flushes" the stream. */ | | "flushes" the stream. */ | |
| | | | |
| /* Data type of a stream of Unicode characters that normalizes its input | | /* Data type of a stream of Unicode characters that normalizes its input | |
| according to a given normalization form and passes the normalized charac
ter | | according to a given normalization form and passes the normalized charac
ter | |
| sequence to the encapsulated stream of Unicode characters. */ | | sequence to the encapsulated stream of Unicode characters. */ | |
| struct uninorm_filter; | | struct uninorm_filter; | |
| | | | |
| /* Create and return a normalization filter for Unicode characters. | | /* Create and return a normalization filter for Unicode characters. | |
| The pair (stream_func, stream_data) is the encapsulated stream. | | The pair (stream_func, stream_data) is the encapsulated stream. | |
| stream_func (stream_data, uc) receives the Unicode character uc | | stream_func (stream_data, uc) receives the Unicode character uc | |
| and returns 0 if successful, or -1 with errno set upon failure. | | and returns 0 if successful, or -1 with errno set upon failure. | |
| Return the new filter, or NULL with errno set upon failure. */ | | Return the new filter, or NULL with errno set upon failure. */ | |
| extern struct uninorm_filter * | | extern struct uninorm_filter * | |
| uninorm_filter_create (uninorm_t nf, | | uninorm_filter_create (uninorm_t nf, | |
|
| int (*stream_func) (void *stream_data, ucs4_t | | int (*stream_func) (void *stream_data, ucs4_t | |
| uc), | | uc), | |
| void *stream_data); | | void *stream_data); | |
| | | | |
| /* Stuff a Unicode character into a normalizing filter. | | /* Stuff a Unicode character into a normalizing filter. | |
| Return 0 if successful, or -1 with errno set upon failure. */ | | Return 0 if successful, or -1 with errno set upon failure. */ | |
| extern int | | extern int | |
| uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc); | | uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc); | |
| | | | |
| /* Bring data buffered in the filter to its destination, the encapsulated | | /* Bring data buffered in the filter to its destination, the encapsulated | |
| stream. | | stream. | |
| Return 0 if successful, or -1 with errno set upon failure. | | Return 0 if successful, or -1 with errno set upon failure. | |
| Note! If after calling this function, additional characters are written | | Note! If after calling this function, additional characters are written | |
| | | | |
End of changes. 13 change blocks. |
| 15 lines changed or deleted | | 15 lines changed or added | |
|
| unistdio.h | | unistdio.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| resultbuf is not NULL and the result fits into *lengthp units, it is put | | resultbuf is not NULL and the result fits into *lengthp units, it is put | |
| in resultbuf, and resultbuf is returned. Otherwise, a freshly allocated | | in resultbuf, and resultbuf is returned. Otherwise, a freshly allocated | |
| string is returned. In both cases, *lengthp is set to the length (numbe
r | | string is returned. In both cases, *lengthp is set to the length (numbe
r | |
| of units) of the returned string. In case of error, NULL is returned an
d | | of units) of the returned string. In case of error, NULL is returned an
d | |
| errno is set. | | errno is set. | |
| */ | | */ | |
| | | | |
| /* ASCII format string, result in locale dependent encoded 'char *'. */ | | /* ASCII format string, result in locale dependent encoded 'char *'. */ | |
| extern int | | extern int | |
| ulc_sprintf (char *buf, | | ulc_sprintf (char *buf, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| ulc_snprintf (char *buf, size_t size, | | ulc_snprintf (char *buf, size_t size, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| ulc_asprintf (char **resultp, | | ulc_asprintf (char **resultp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern char * | | extern char * | |
| ulc_asnprintf (char *resultbuf, size_t *lengthp, | | ulc_asnprintf (char *resultbuf, size_t *lengthp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| ulc_vsprintf (char *buf, | | ulc_vsprintf (char *buf, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| ulc_vsnprintf (char *buf, size_t size, | | ulc_vsnprintf (char *buf, size_t size, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| ulc_vasprintf (char **resultp, | | ulc_vasprintf (char **resultp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern char * | | extern char * | |
| ulc_vasnprintf (char *resultbuf, size_t *lengthp, | | ulc_vasnprintf (char *resultbuf, size_t *lengthp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| | | | |
| /* ASCII format string, result in UTF-8 format. */ | | /* ASCII format string, result in UTF-8 format. */ | |
| extern int | | extern int | |
| u8_sprintf (uint8_t *buf, | | u8_sprintf (uint8_t *buf, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u8_snprintf (uint8_t *buf, size_t size, | | u8_snprintf (uint8_t *buf, size_t size, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u8_asprintf (uint8_t **resultp, | | u8_asprintf (uint8_t **resultp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern uint8_t * | | extern uint8_t * | |
| u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, | | u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u8_vsprintf (uint8_t *buf, | | u8_vsprintf (uint8_t *buf, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u8_vsnprintf (uint8_t *buf, size_t size, | | u8_vsnprintf (uint8_t *buf, size_t size, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u8_vasprintf (uint8_t **resultp, | | u8_vasprintf (uint8_t **resultp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern uint8_t * | | extern uint8_t * | |
| u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, | | u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| | | | |
| /* UTF-8 format string, result in UTF-8 format. */ | | /* UTF-8 format string, result in UTF-8 format. */ | |
| extern int | | extern int | |
| u8_u8_sprintf (uint8_t *buf, | | u8_u8_sprintf (uint8_t *buf, | |
|
| const uint8_t *format, ...); | | const uint8_t *format, ...); | |
| extern int | | extern int | |
| u8_u8_snprintf (uint8_t *buf, size_t size, | | u8_u8_snprintf (uint8_t *buf, size_t size, | |
|
| const uint8_t *format, ...); | | const uint8_t *format, ...); | |
| extern int | | extern int | |
| u8_u8_asprintf (uint8_t **resultp, | | u8_u8_asprintf (uint8_t **resultp, | |
|
| const uint8_t *format, ...); | | const uint8_t *format, ...); | |
| extern uint8_t * | | extern uint8_t * | |
| u8_u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, | | u8_u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, | |
|
| const uint8_t *format, ...); | | const uint8_t *format, ...); | |
| extern int | | extern int | |
| u8_u8_vsprintf (uint8_t *buf, | | u8_u8_vsprintf (uint8_t *buf, | |
|
| const uint8_t *format, va_list ap); | | const uint8_t *format, va_list ap); | |
| extern int | | extern int | |
| u8_u8_vsnprintf (uint8_t *buf, size_t size, | | u8_u8_vsnprintf (uint8_t *buf, size_t size, | |
|
| const uint8_t *format, va_list ap); | | const uint8_t *format, va_list ap); | |
| extern int | | extern int | |
| u8_u8_vasprintf (uint8_t **resultp, | | u8_u8_vasprintf (uint8_t **resultp, | |
|
| const uint8_t *format, va_list ap); | | const uint8_t *format, va_list ap); | |
| extern uint8_t * | | extern uint8_t * | |
| u8_u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, | | u8_u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, | |
|
| const uint8_t *format, va_list ap); | | const uint8_t *format, va_list ap); | |
| | | | |
| /* ASCII format string, result in UTF-16 format. */ | | /* ASCII format string, result in UTF-16 format. */ | |
| extern int | | extern int | |
| u16_sprintf (uint16_t *buf, | | u16_sprintf (uint16_t *buf, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u16_snprintf (uint16_t *buf, size_t size, | | u16_snprintf (uint16_t *buf, size_t size, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u16_asprintf (uint16_t **resultp, | | u16_asprintf (uint16_t **resultp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, | | u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u16_vsprintf (uint16_t *buf, | | u16_vsprintf (uint16_t *buf, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u16_vsnprintf (uint16_t *buf, size_t size, | | u16_vsnprintf (uint16_t *buf, size_t size, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u16_vasprintf (uint16_t **resultp, | | u16_vasprintf (uint16_t **resultp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, | | u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| | | | |
| /* UTF-16 format string, result in UTF-16 format. */ | | /* UTF-16 format string, result in UTF-16 format. */ | |
| extern int | | extern int | |
| u16_u16_sprintf (uint16_t *buf, | | u16_u16_sprintf (uint16_t *buf, | |
|
| const uint16_t *format, ...); | | const uint16_t *format, ...); | |
| extern int | | extern int | |
| u16_u16_snprintf (uint16_t *buf, size_t size, | | u16_u16_snprintf (uint16_t *buf, size_t size, | |
|
| const uint16_t *format, ...); | | const uint16_t *format, ...); | |
| extern int | | extern int | |
| u16_u16_asprintf (uint16_t **resultp, | | u16_u16_asprintf (uint16_t **resultp, | |
|
| const uint16_t *format, ...); | | const uint16_t *format, ...); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, | | u16_u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, | |
|
| const uint16_t *format, ...); | | const uint16_t *format, ...); | |
| extern int | | extern int | |
| u16_u16_vsprintf (uint16_t *buf, | | u16_u16_vsprintf (uint16_t *buf, | |
|
| const uint16_t *format, va_list ap); | | const uint16_t *format, va_list ap); | |
| extern int | | extern int | |
| u16_u16_vsnprintf (uint16_t *buf, size_t size, | | u16_u16_vsnprintf (uint16_t *buf, size_t size, | |
|
| const uint16_t *format, va_list ap); | | const uint16_t *format, va_list ap); | |
| extern int | | extern int | |
| u16_u16_vasprintf (uint16_t **resultp, | | u16_u16_vasprintf (uint16_t **resultp, | |
|
| const uint16_t *format, va_list ap); | | const uint16_t *format, va_list ap); | |
| extern uint16_t * | | extern uint16_t * | |
| u16_u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, | | u16_u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, | |
|
| const uint16_t *format, va_list ap); | | const uint16_t *format, va_list ap); | |
| | | | |
| /* ASCII format string, result in UTF-32 format. */ | | /* ASCII format string, result in UTF-32 format. */ | |
| extern int | | extern int | |
| u32_sprintf (uint32_t *buf, | | u32_sprintf (uint32_t *buf, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u32_snprintf (uint32_t *buf, size_t size, | | u32_snprintf (uint32_t *buf, size_t size, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u32_asprintf (uint32_t **resultp, | | u32_asprintf (uint32_t **resultp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, | | u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| u32_vsprintf (uint32_t *buf, | | u32_vsprintf (uint32_t *buf, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u32_vsnprintf (uint32_t *buf, size_t size, | | u32_vsnprintf (uint32_t *buf, size_t size, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern int | | extern int | |
| u32_vasprintf (uint32_t **resultp, | | u32_vasprintf (uint32_t **resultp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, | | u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| | | | |
| /* UTF-32 format string, result in UTF-32 format. */ | | /* UTF-32 format string, result in UTF-32 format. */ | |
| extern int | | extern int | |
| u32_u32_sprintf (uint32_t *buf, | | u32_u32_sprintf (uint32_t *buf, | |
|
| const uint32_t *format, ...); | | const uint32_t *format, ...); | |
| extern int | | extern int | |
| u32_u32_snprintf (uint32_t *buf, size_t size, | | u32_u32_snprintf (uint32_t *buf, size_t size, | |
|
| const uint32_t *format, ...); | | const uint32_t *format, ...); | |
| extern int | | extern int | |
| u32_u32_asprintf (uint32_t **resultp, | | u32_u32_asprintf (uint32_t **resultp, | |
|
| const uint32_t *format, ...); | | const uint32_t *format, ...); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, | | u32_u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, | |
|
| const uint32_t *format, ...); | | const uint32_t *format, ...); | |
| extern int | | extern int | |
| u32_u32_vsprintf (uint32_t *buf, | | u32_u32_vsprintf (uint32_t *buf, | |
|
| const uint32_t *format, va_list ap); | | const uint32_t *format, va_list ap); | |
| extern int | | extern int | |
| u32_u32_vsnprintf (uint32_t *buf, size_t size, | | u32_u32_vsnprintf (uint32_t *buf, size_t size, | |
|
| const uint32_t *format, va_list ap); | | const uint32_t *format, va_list ap); | |
| extern int | | extern int | |
| u32_u32_vasprintf (uint32_t **resultp, | | u32_u32_vasprintf (uint32_t **resultp, | |
|
| const uint32_t *format, va_list ap); | | const uint32_t *format, va_list ap); | |
| extern uint32_t * | | extern uint32_t * | |
| u32_u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, | | u32_u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, | |
|
| const uint32_t *format, va_list ap); | | const uint32_t *format, va_list ap); | |
| | | | |
| /* ASCII format string, output to FILE in locale dependent encoding. */ | | /* ASCII format string, output to FILE in locale dependent encoding. */ | |
| extern int | | extern int | |
| ulc_fprintf (FILE *stream, | | ulc_fprintf (FILE *stream, | |
|
| const char *format, ...); | | const char *format, ...); | |
| extern int | | extern int | |
| ulc_vfprintf (FILE *stream, | | ulc_vfprintf (FILE *stream, | |
|
| const char *format, va_list ap); | | const char *format, va_list ap); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* _UNISTDIO_H */ | | #endif /* _UNISTDIO_H */ | |
| | | | |
End of changes. 58 change blocks. |
| 58 lines changed or deleted | | 58 lines changed or added | |
|