1 : /* Copyright (c) 2007 James Antill -- See LICENSE file for terms. */
2 : #ifndef USTR_UTF8_H
3 : #define USTR_UTF8_H 1
4 :
5 : #ifndef USTR_MAIN_H
6 : #error " You should have already included ustr-main.h, or just include ustr.h."
7 : #endif
8 :
9 : #ifdef __unix__ /* FIXME: Hacky, but this isn't a 9899:1999 type */
10 : #define USTR__SSIZE ssize_t
11 : #else
12 : #define USTR__SSIZE long
13 : #endif
14 :
15 :
16 : USTR_CONF_E_PROTO
17 : int ustr_utf8_valid(const struct Ustr *)
18 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
19 : USTR__COMPILE_ATTR_NONNULL_A();
20 : USTR_CONF_E_PROTO
21 : size_t ustr_utf8_len(const struct Ustr *)
22 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
23 : USTR__COMPILE_ATTR_NONNULL_A();
24 : USTR_CONF_E_PROTO
25 : USTR__SSIZE ustr_utf8_width(const struct Ustr *)
26 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
27 : USTR__COMPILE_ATTR_NONNULL_A();
28 : USTR_CONF_E_PROTO
29 : size_t ustr_utf8_chars2bytes(const struct Ustr *, size_t, size_t, size_t *)
30 : USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
31 : USTR_CONF_E_PROTO
32 : size_t ustr_utf8_bytes2chars(const struct Ustr *, size_t, size_t, size_t *)
33 : USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
34 :
35 : USTR_CONF_E_PROTO
36 : int ustrp_utf8_valid(const struct Ustrp *)
37 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
38 : USTR__COMPILE_ATTR_NONNULL_A();
39 : USTR_CONF_EI_PROTO
40 : size_t ustrp_utf8_len(const struct Ustrp *)
41 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
42 : USTR__COMPILE_ATTR_NONNULL_A();
43 : USTR_CONF_EI_PROTO
44 : USTR__SSIZE ustrp_utf8_width(const struct Ustrp *)
45 : USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
46 : USTR__COMPILE_ATTR_NONNULL_A();
47 : USTR_CONF_EI_PROTO
48 : size_t ustrp_utf8_chars2bytes(const struct Ustrp *, size_t, size_t, size_t *)
49 : USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
50 : USTR_CONF_EI_PROTO
51 : size_t ustrp_utf8_bytes2chars(const struct Ustrp *, size_t, size_t, size_t *)
52 : USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
53 :
54 : #if USTR_CONF_INCLUDE_INTERNAL_HEADERS
55 : # include "ustr-utf8-internal.h"
56 : #endif
57 :
58 : #if USTR_CONF_INCLUDE_CODEONLY_HEADERS
59 : # include "ustr-utf8-code.h"
60 : #endif
61 :
62 : #if USTR_CONF_COMPILE_USE_INLINE
63 : USTR_CONF_II_PROTO
64 : int ustrp_utf8_valid(const struct Ustrp *s1)
65 16 : { return (ustr_utf8_valid(&s1->s)); }
66 : USTR_CONF_II_PROTO
67 : size_t ustrp_utf8_len(const struct Ustrp *s1)
68 12 : { return (ustr_utf8_len(&s1->s)); }
69 : USTR_CONF_II_PROTO
70 : USTR__SSIZE ustrp_utf8_width(const struct Ustrp *s1)
71 8 : { return (ustr_utf8_width(&s1->s)); }
72 : USTR_CONF_II_PROTO
73 : size_t ustrp_utf8_chars2bytes(const struct Ustrp *s1, size_t pos, size_t len,
74 : size_t *ret_pos)
75 16 : { return (ustr_utf8_chars2bytes(&s1->s, pos, len, ret_pos)); }
76 : USTR_CONF_II_PROTO
77 : size_t ustrp_utf8_bytes2chars(const struct Ustrp *s1, size_t pos, size_t len,
78 : size_t *ret_pos)
79 8 : { return (ustr_utf8_bytes2chars(&s1->s, pos, len, ret_pos)); }
80 : #endif
81 :
82 : #endif
|