1
2
3
4
5
6
7 #ifndef UTF8NORM_H
8 #define UTF8NORM_H
9
10 #include <linux/types.h>
11 #include <linux/export.h>
12 #include <linux/string.h>
13 #include <linux/module.h>
14
15
16 #define UNICODE_MAJ_SHIFT (16)
17 #define UNICODE_MIN_SHIFT (8)
18
19 #define UNICODE_AGE(MAJ, MIN, REV) \
20 (((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) | \
21 ((unsigned int)(MIN) << UNICODE_MIN_SHIFT) | \
22 ((unsigned int)(REV)))
23
24
25 extern int utf8version_is_supported(u8 maj, u8 min, u8 rev);
26 extern int utf8version_latest(void);
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 extern const struct utf8data *utf8nfdi(unsigned int maxage);
44 extern const struct utf8data *utf8nfdicf(unsigned int maxage);
45
46
47
48
49
50
51 extern int utf8agemax(const struct utf8data *data, const char *s);
52 extern int utf8nagemax(const struct utf8data *data, const char *s, size_t len);
53
54
55
56
57
58
59 extern int utf8agemin(const struct utf8data *data, const char *s);
60 extern int utf8nagemin(const struct utf8data *data, const char *s, size_t len);
61
62
63
64
65
66
67
68 extern ssize_t utf8len(const struct utf8data *data, const char *s);
69 extern ssize_t utf8nlen(const struct utf8data *data, const char *s, size_t len);
70
71
72 #define UTF8HANGULLEAF (12)
73
74
75
76
77 struct utf8cursor {
78 const struct utf8data *data;
79 const char *s;
80 const char *p;
81 const char *ss;
82 const char *sp;
83 unsigned int len;
84 unsigned int slen;
85 short int ccc;
86 short int nccc;
87 unsigned char hangul[UTF8HANGULLEAF];
88 };
89
90
91
92
93
94
95 extern int utf8cursor(struct utf8cursor *u8c, const struct utf8data *data,
96 const char *s);
97 extern int utf8ncursor(struct utf8cursor *u8c, const struct utf8data *data,
98 const char *s, size_t len);
99
100
101
102
103
104
105
106 extern int utf8byte(struct utf8cursor *u8c);
107
108 #endif