summaryrefslogtreecommitdiff
path: root/lib/unistr.h
diff options
context:
space:
mode:
authorManuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>2016-05-27 14:35:16 +0100
committerManuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>2016-05-27 14:35:16 +0100
commit3590c846d4c2febbc05b4ad6b14a06edc549e453 (patch)
treee5d38581c2f36e1cca02efedd2d85044d77f76f9 /lib/unistr.h
parenta9a31b1de5776a3b08a82101a4fa711294f0dd1d (diff)
Imported Upstream version 0.9.6+really0.9.6upstream/0.9.6+really0.9.6
Diffstat (limited to 'lib/unistr.h')
-rw-r--r--lib/unistr.h182
1 files changed, 124 insertions, 58 deletions
diff --git a/lib/unistr.h b/lib/unistr.h
index 4d3c3259..ee8ed391 100644
--- a/lib/unistr.h
+++ b/lib/unistr.h
@@ -1,5 +1,6 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Elementary Unicode string functions.
- Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2015 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
@@ -69,17 +70,20 @@ 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);
+ u8_check (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u16_check (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u32_check (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Elementary string conversions. */
@@ -122,11 +126,14 @@ 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);
+ u8_mblen (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_mblen (const uint16_t *s, size_t n);
+ u16_mblen (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_mblen (const uint32_t *s, size_t n);
+ u32_mblen (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* 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,
@@ -403,38 +410,50 @@ 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);
+ u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n);
+ u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n);
+ u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2);
+ u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2);
+ u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_chr (const uint16_t *s, size_t n, ucs4_t uc);
+ u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_chr (const uint32_t *s, size_t n, ucs4_t uc);
+ u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_mbsnlen (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_mbsnlen (const uint16_t *s, size_t n);
+ u16_mbsnlen (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_mbsnlen (const uint32_t *s, size_t n);
+ u32_mbsnlen (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Elementary string functions with memory allocation. */
@@ -451,11 +470,14 @@ 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);
+ u8_strmblen (const uint8_t *s)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_strmblen (const uint16_t *s);
+ u16_strmblen (const uint16_t *s)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_strmblen (const uint32_t *s);
+ u32_strmblen (const uint32_t *s)
+ _UC_ATTRIBUTE_PURE;
/* 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
@@ -490,20 +512,26 @@ extern const uint32_t *
/* Return the number of units in S. */
/* Similar to strlen(), wcslen(). */
extern size_t
- u8_strlen (const uint8_t *s);
+ u8_strlen (const uint8_t *s)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strlen (const uint16_t *s);
+ u16_strlen (const uint16_t *s)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strlen (const uint32_t *s);
+ u32_strlen (const uint32_t *s)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_strnlen (const uint8_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strnlen (const uint16_t *s, size_t maxlen);
+ u16_strnlen (const uint16_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strnlen (const uint32_t *s, size_t maxlen);
+ u32_strnlen (const uint32_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
/* Copy SRC to DEST. */
/* Similar to strcpy(), wcscpy(). */
@@ -562,12 +590,23 @@ 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 (const uint8_t *s1, const uint8_t *s2);
+ u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)
+ _UC_ATTRIBUTE_PURE;
+# define u8_strcmp u8_strcmp_gnu
+#else
extern int
- u16_strcmp (const uint16_t *s1, const uint16_t *s2);
+ 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;
extern int
- u32_strcmp (const uint32_t *s1, const uint32_t *s2);
+ u32_strcmp (const uint32_t *s1, const uint32_t *s2)
+ _UC_ATTRIBUTE_PURE;
/* 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.
@@ -583,11 +622,14 @@ 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);
+ u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n);
+ u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n);
+ u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Duplicate S, returning an identical malloc'd string. */
/* Similar to strdup(), wcsdup(). */
@@ -601,74 +643,98 @@ 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);
+ u8_strchr (const uint8_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strchr (const uint16_t *str, ucs4_t uc);
+ u16_strchr (const uint16_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strchr (const uint32_t *str, ucs4_t uc);
+ u32_strchr (const uint32_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* Find the last occurrence of UC in STR. */
/* Similar to strrchr(), wcsrchr(). */
extern uint8_t *
- u8_strrchr (const uint8_t *str, ucs4_t uc);
+ u8_strrchr (const uint8_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strrchr (const uint16_t *str, ucs4_t uc);
+ u16_strrchr (const uint16_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strrchr (const uint32_t *str, ucs4_t uc);
+ u32_strrchr (const uint32_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_strcspn (const uint8_t *str, const uint8_t *reject)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strcspn (const uint16_t *str, const uint16_t *reject);
+ u16_strcspn (const uint16_t *str, const uint16_t *reject)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strcspn (const uint32_t *str, const uint32_t *reject);
+ u32_strcspn (const uint32_t *str, const uint32_t *reject)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_strspn (const uint8_t *str, const uint8_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strspn (const uint16_t *str, const uint16_t *accept);
+ u16_strspn (const uint16_t *str, const uint16_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strspn (const uint32_t *str, const uint32_t *accept);
+ u32_strspn (const uint32_t *str, const uint32_t *accept)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_strpbrk (const uint8_t *str, const uint8_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strpbrk (const uint16_t *str, const uint16_t *accept);
+ u16_strpbrk (const uint16_t *str, const uint16_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strpbrk (const uint32_t *str, const uint32_t *accept);
+ u32_strpbrk (const uint32_t *str, const uint32_t *accept)
+ _UC_ATTRIBUTE_PURE;
/* 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);
+ u8_strstr (const uint8_t *haystack, const uint8_t *needle)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strstr (const uint16_t *haystack, const uint16_t *needle);
+ u16_strstr (const uint16_t *haystack, const uint16_t *needle)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strstr (const uint32_t *haystack, const uint32_t *needle);
+ u32_strstr (const uint32_t *haystack, const uint32_t *needle)
+ _UC_ATTRIBUTE_PURE;
/* Test whether STR starts with PREFIX. */
extern bool
- u8_startswith (const uint8_t *str, const uint8_t *prefix);
+ u8_startswith (const uint8_t *str, const uint8_t *prefix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u16_startswith (const uint16_t *str, const uint16_t *prefix);
+ u16_startswith (const uint16_t *str, const uint16_t *prefix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u32_startswith (const uint32_t *str, const uint32_t *prefix);
+ u32_startswith (const uint32_t *str, const uint32_t *prefix)
+ _UC_ATTRIBUTE_PURE;
/* Test whether STR ends with SUFFIX. */
extern bool
- u8_endswith (const uint8_t *str, const uint8_t *suffix);
+ u8_endswith (const uint8_t *str, const uint8_t *suffix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u16_endswith (const uint16_t *str, const uint16_t *suffix);
+ u16_endswith (const uint16_t *str, const uint16_t *suffix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u32_endswith (const uint32_t *str, const uint32_t *suffix);
+ u32_endswith (const uint32_t *str, const uint32_t *suffix)
+ _UC_ATTRIBUTE_PURE;
/* Divide STR into tokens separated by characters in DELIM.
This interface is actually more similar to wcstok than to strtok. */