File: ustr-utf8.h

package info (click to toggle)
ustr 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,580 kB
  • ctags: 2,100
  • sloc: ansic: 19,191; makefile: 884; perl: 778; sh: 683; xml: 97
file content (82 lines) | stat: -rw-r--r-- 2,973 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Copyright (c) 2007 James Antill -- See LICENSE file for terms. */
#ifndef USTR_UTF8_H
#define USTR_UTF8_H 1

#ifndef USTR_MAIN_H
#error " You should have already included ustr-main.h, or just include ustr.h."
#endif

#ifdef __unix__ /* FIXME: Hacky, but this isn't a 9899:1999 type */
#define USTR__SSIZE ssize_t
#else
#define USTR__SSIZE long
#endif


USTR_CONF_E_PROTO
int ustr_utf8_valid(const struct Ustr *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_E_PROTO
size_t ustr_utf8_len(const struct Ustr *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_E_PROTO
USTR__SSIZE ustr_utf8_width(const struct Ustr *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_E_PROTO
size_t ustr_utf8_chars2bytes(const struct Ustr *, size_t, size_t, size_t *)
    USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
USTR_CONF_E_PROTO
size_t ustr_utf8_bytes2chars(const struct Ustr *, size_t, size_t, size_t *)
    USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));

USTR_CONF_E_PROTO
int ustrp_utf8_valid(const struct Ustrp *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_EI_PROTO
size_t ustrp_utf8_len(const struct Ustrp *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_EI_PROTO
USTR__SSIZE ustrp_utf8_width(const struct Ustrp *)
    USTR__COMPILE_ATTR_PURE() USTR__COMPILE_ATTR_WARN_UNUSED_RET()
    USTR__COMPILE_ATTR_NONNULL_A();
USTR_CONF_EI_PROTO
size_t ustrp_utf8_chars2bytes(const struct Ustrp *, size_t, size_t, size_t *)
    USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));
USTR_CONF_EI_PROTO
size_t ustrp_utf8_bytes2chars(const struct Ustrp *, size_t, size_t, size_t *)
    USTR__COMPILE_ATTR_WARN_UNUSED_RET() USTR__COMPILE_ATTR_NONNULL_L((1));

#if USTR_CONF_INCLUDE_INTERNAL_HEADERS
# include "ustr-utf8-internal.h"
#endif

#if USTR_CONF_INCLUDE_CODEONLY_HEADERS
# include "ustr-utf8-code.h"
#endif

#if USTR_CONF_COMPILE_USE_INLINE
USTR_CONF_II_PROTO
int ustrp_utf8_valid(const struct Ustrp *s1)
{ return (ustr_utf8_valid(&s1->s)); }
USTR_CONF_II_PROTO
size_t ustrp_utf8_len(const struct Ustrp *s1)
{ return (ustr_utf8_len(&s1->s)); }
USTR_CONF_II_PROTO
USTR__SSIZE ustrp_utf8_width(const struct Ustrp *s1)
{ return (ustr_utf8_width(&s1->s)); }
USTR_CONF_II_PROTO
size_t ustrp_utf8_chars2bytes(const struct Ustrp *s1, size_t pos, size_t len,
                              size_t *ret_pos)
{ return (ustr_utf8_chars2bytes(&s1->s, pos, len, ret_pos)); }
USTR_CONF_II_PROTO
size_t ustrp_utf8_bytes2chars(const struct Ustrp *s1, size_t pos, size_t len,
                              size_t *ret_pos)
{ return (ustr_utf8_bytes2chars(&s1->s, pos, len, ret_pos)); }
#endif

#endif