diff options
Diffstat (limited to 'lib/unistr.h')
-rw-r--r-- | lib/unistr.h | 182 |
1 files changed, 58 insertions, 124 deletions
diff --git a/lib/unistr.h b/lib/unistr.h index ee8ed391..4d3c3259 100644 --- a/lib/unistr.h +++ b/lib/unistr.h @@ -1,6 +1,5 @@ -/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Elementary Unicode string functions. - Copyright (C) 2001-2002, 2005-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc. 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 @@ -70,20 +69,17 @@ extern "C" { /* Check whether an UTF-8 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint8_t * - u8_check (const uint8_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u8_check (const uint8_t *s, size_t n); /* Check whether an UTF-16 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint16_t * - u16_check (const uint16_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u16_check (const uint16_t *s, size_t n); /* Check whether an UCS-4 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint32_t * - u32_check (const uint32_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u32_check (const uint32_t *s, size_t n); /* Elementary string conversions. */ @@ -126,14 +122,11 @@ extern uint16_t * failure. */ /* Similar to mblen(), except that s must not be NULL. */ extern int - u8_mblen (const uint8_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u8_mblen (const uint8_t *s, size_t n); extern int - u16_mblen (const uint16_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u16_mblen (const uint16_t *s, size_t n); extern int - u32_mblen (const uint32_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u32_mblen (const uint32_t *s, size_t n); /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd, @@ -410,50 +403,38 @@ extern uint32_t * /* Compare S1 and S2, each of length N. */ /* Similar to memcmp(). */ extern int - u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n); extern int - u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n); extern int - u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n); /* Compare S1 and S2. */ /* Similar to the gnulib function memcmp2(). */ extern int - u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2) - _UC_ATTRIBUTE_PURE; + u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2); extern int - u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2) - _UC_ATTRIBUTE_PURE; + u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2); extern int - u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2) - _UC_ATTRIBUTE_PURE; + u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2); /* Search the string at S for UC. */ /* Similar to memchr(). */ extern uint8_t * - u8_chr (const uint8_t *s, size_t n, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u8_chr (const uint8_t *s, size_t n, ucs4_t uc); extern uint16_t * - u16_chr (const uint16_t *s, size_t n, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u16_chr (const uint16_t *s, size_t n, ucs4_t uc); extern uint32_t * - u32_chr (const uint32_t *s, size_t n, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u32_chr (const uint32_t *s, size_t n, ucs4_t uc); /* Count the number of Unicode characters in the N units from S. */ /* Similar to mbsnlen(). */ extern size_t - u8_mbsnlen (const uint8_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u8_mbsnlen (const uint8_t *s, size_t n); extern size_t - u16_mbsnlen (const uint16_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u16_mbsnlen (const uint16_t *s, size_t n); extern size_t - u32_mbsnlen (const uint32_t *s, size_t n) - _UC_ATTRIBUTE_PURE; + u32_mbsnlen (const uint32_t *s, size_t n); /* Elementary string functions with memory allocation. */ @@ -470,14 +451,11 @@ extern uint32_t * /* Return the length (number of units) of the first character in S. Return 0 if it is the NUL character. Return -1 upon failure. */ extern int - u8_strmblen (const uint8_t *s) - _UC_ATTRIBUTE_PURE; + u8_strmblen (const uint8_t *s); extern int - u16_strmblen (const uint16_t *s) - _UC_ATTRIBUTE_PURE; + u16_strmblen (const uint16_t *s); extern int - u32_strmblen (const uint32_t *s) - _UC_ATTRIBUTE_PURE; + u32_strmblen (const uint32_t *s); /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL @@ -512,26 +490,20 @@ extern const uint32_t * /* Return the number of units in S. */ /* Similar to strlen(), wcslen(). */ extern size_t - u8_strlen (const uint8_t *s) - _UC_ATTRIBUTE_PURE; + u8_strlen (const uint8_t *s); extern size_t - u16_strlen (const uint16_t *s) - _UC_ATTRIBUTE_PURE; + u16_strlen (const uint16_t *s); extern size_t - u32_strlen (const uint32_t *s) - _UC_ATTRIBUTE_PURE; + u32_strlen (const uint32_t *s); /* Return the number of units in S, but at most MAXLEN. */ /* Similar to strnlen(), wcsnlen(). */ extern size_t - u8_strnlen (const uint8_t *s, size_t maxlen) - _UC_ATTRIBUTE_PURE; + u8_strnlen (const uint8_t *s, size_t maxlen); extern size_t - u16_strnlen (const uint16_t *s, size_t maxlen) - _UC_ATTRIBUTE_PURE; + u16_strnlen (const uint16_t *s, size_t maxlen); extern size_t - u32_strnlen (const uint32_t *s, size_t maxlen) - _UC_ATTRIBUTE_PURE; + u32_strnlen (const uint32_t *s, size_t maxlen); /* Copy SRC to DEST. */ /* Similar to strcpy(), wcscpy(). */ @@ -590,23 +562,12 @@ extern uint32_t * /* Compare S1 and S2. */ /* Similar to strcmp(), wcscmp(). */ -#ifdef __sun -/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */ extern int - u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2) - _UC_ATTRIBUTE_PURE; -# define u8_strcmp u8_strcmp_gnu -#else + u8_strcmp (const uint8_t *s1, const uint8_t *s2); extern int - u8_strcmp (const uint8_t *s1, const uint8_t *s2) - _UC_ATTRIBUTE_PURE; -#endif -extern int - u16_strcmp (const uint16_t *s1, const uint16_t *s2) - _UC_ATTRIBUTE_PURE; + u16_strcmp (const uint16_t *s1, const uint16_t *s2); extern int - u32_strcmp (const uint32_t *s1, const uint32_t *s2) - _UC_ATTRIBUTE_PURE; + u32_strcmp (const uint32_t *s1, const uint32_t *s2); /* Compare S1 and S2 using the collation rules of the current locale. Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2. @@ -622,14 +583,11 @@ extern int /* Compare no more than N units of S1 and S2. */ /* Similar to strncmp(), wcsncmp(). */ extern int - u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n); extern int - u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n); extern int - u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n) - _UC_ATTRIBUTE_PURE; + u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n); /* Duplicate S, returning an identical malloc'd string. */ /* Similar to strdup(), wcsdup(). */ @@ -643,98 +601,74 @@ extern uint32_t * /* Find the first occurrence of UC in STR. */ /* Similar to strchr(), wcschr(). */ extern uint8_t * - u8_strchr (const uint8_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u8_strchr (const uint8_t *str, ucs4_t uc); extern uint16_t * - u16_strchr (const uint16_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u16_strchr (const uint16_t *str, ucs4_t uc); extern uint32_t * - u32_strchr (const uint32_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u32_strchr (const uint32_t *str, ucs4_t uc); /* Find the last occurrence of UC in STR. */ /* Similar to strrchr(), wcsrchr(). */ extern uint8_t * - u8_strrchr (const uint8_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u8_strrchr (const uint8_t *str, ucs4_t uc); extern uint16_t * - u16_strrchr (const uint16_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u16_strrchr (const uint16_t *str, ucs4_t uc); extern uint32_t * - u32_strrchr (const uint32_t *str, ucs4_t uc) - _UC_ATTRIBUTE_PURE; + u32_strrchr (const uint32_t *str, ucs4_t uc); /* Return the length of the initial segment of STR which consists entirely of Unicode characters not in REJECT. */ /* Similar to strcspn(), wcscspn(). */ extern size_t - u8_strcspn (const uint8_t *str, const uint8_t *reject) - _UC_ATTRIBUTE_PURE; + u8_strcspn (const uint8_t *str, const uint8_t *reject); extern size_t - u16_strcspn (const uint16_t *str, const uint16_t *reject) - _UC_ATTRIBUTE_PURE; + u16_strcspn (const uint16_t *str, const uint16_t *reject); extern size_t - u32_strcspn (const uint32_t *str, const uint32_t *reject) - _UC_ATTRIBUTE_PURE; + u32_strcspn (const uint32_t *str, const uint32_t *reject); /* Return the length of the initial segment of STR which consists entirely of Unicode characters in ACCEPT. */ /* Similar to strspn(), wcsspn(). */ extern size_t - u8_strspn (const uint8_t *str, const uint8_t *accept) - _UC_ATTRIBUTE_PURE; + u8_strspn (const uint8_t *str, const uint8_t *accept); extern size_t - u16_strspn (const uint16_t *str, const uint16_t *accept) - _UC_ATTRIBUTE_PURE; + u16_strspn (const uint16_t *str, const uint16_t *accept); extern size_t - u32_strspn (const uint32_t *str, const uint32_t *accept) - _UC_ATTRIBUTE_PURE; + u32_strspn (const uint32_t *str, const uint32_t *accept); /* Find the first occurrence in STR of any character in ACCEPT. */ /* Similar to strpbrk(), wcspbrk(). */ extern uint8_t * - u8_strpbrk (const uint8_t *str, const uint8_t *accept) - _UC_ATTRIBUTE_PURE; + u8_strpbrk (const uint8_t *str, const uint8_t *accept); extern uint16_t * - u16_strpbrk (const uint16_t *str, const uint16_t *accept) - _UC_ATTRIBUTE_PURE; + u16_strpbrk (const uint16_t *str, const uint16_t *accept); extern uint32_t * - u32_strpbrk (const uint32_t *str, const uint32_t *accept) - _UC_ATTRIBUTE_PURE; + u32_strpbrk (const uint32_t *str, const uint32_t *accept); /* Find the first occurrence of NEEDLE in HAYSTACK. */ /* Similar to strstr(), wcsstr(). */ extern uint8_t * - u8_strstr (const uint8_t *haystack, const uint8_t *needle) - _UC_ATTRIBUTE_PURE; + u8_strstr (const uint8_t *haystack, const uint8_t *needle); extern uint16_t * - u16_strstr (const uint16_t *haystack, const uint16_t *needle) - _UC_ATTRIBUTE_PURE; + u16_strstr (const uint16_t *haystack, const uint16_t *needle); extern uint32_t * - u32_strstr (const uint32_t *haystack, const uint32_t *needle) - _UC_ATTRIBUTE_PURE; + u32_strstr (const uint32_t *haystack, const uint32_t *needle); /* Test whether STR starts with PREFIX. */ extern bool - u8_startswith (const uint8_t *str, const uint8_t *prefix) - _UC_ATTRIBUTE_PURE; + u8_startswith (const uint8_t *str, const uint8_t *prefix); extern bool - u16_startswith (const uint16_t *str, const uint16_t *prefix) - _UC_ATTRIBUTE_PURE; + u16_startswith (const uint16_t *str, const uint16_t *prefix); extern bool - u32_startswith (const uint32_t *str, const uint32_t *prefix) - _UC_ATTRIBUTE_PURE; + u32_startswith (const uint32_t *str, const uint32_t *prefix); /* Test whether STR ends with SUFFIX. */ extern bool - u8_endswith (const uint8_t *str, const uint8_t *suffix) - _UC_ATTRIBUTE_PURE; + u8_endswith (const uint8_t *str, const uint8_t *suffix); extern bool - u16_endswith (const uint16_t *str, const uint16_t *suffix) - _UC_ATTRIBUTE_PURE; + u16_endswith (const uint16_t *str, const uint16_t *suffix); extern bool - u32_endswith (const uint32_t *str, const uint32_t *suffix) - _UC_ATTRIBUTE_PURE; + u32_endswith (const uint32_t *str, const uint32_t *suffix); /* Divide STR into tokens separated by characters in DELIM. This interface is actually more similar to wcstok than to strtok. */ |