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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/* zueci.h - UTF-8 to/from Extended Channel Interpretations */
/*
libzueci - an open source UTF-8 ECI library adapted from libzint
Copyright (C) 2022 gitlost
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/* Version: 1.0.1 */
/* Warning and error returns from API functions below */
extern "C" ZUECI_EMBED_NO_TO_ECI
/*
Convert UTF-8 `src` of length `src_len` to `eci`-encoded `dest`.
`p_dest_len` is set to length of `dest` on output.
`dest` must be big enough (4-times the `src_len`, or see `zueci_dest_len_eci()`). It is not NUL-terminated.
Returns 0 if successful, one of `ZUECI_ERROR_XXX` if not.
*/
ZUECI_EXTERN int ;
/*
Calculate sufficient (i.e. approx.) length needed to convert UTF-8 `src` of length `len` from UTF-8 to ECI
`eci`, and place in `p_dest_len`.
Returns 0 if successful, one of `ZUECI_ERROR_XXX` if not.
*/
ZUECI_EXTERN int ;
/* ZUECI_EMBED_NO_TO_ECI */
/*
These flags can be OR-ed together to change the behaviour of `zueci_eci_to_utf8()` and `zueci_dest_len_utf8()`
*/
/*
For single-byte ECIs copy the source straight-thru rather than erroring or replacing if undefined. Affects
ISO/IEC 8859 (ECIs 1, 3-13, 15-18), Windows 125x (ECIs 21-24), ASCII (ECI 27) & ISO/IEC 646 Invariant (ECI 170).
*/
/*
For ECI 20 Shift JIS, copy backslash & tilde straight-thru rather than mapping to Yen sign & overline resp.
*/
/*
If embedding the library (i.e. including the 10 files directly) and only want UTF-8-to-ECI functionality,
define `ZUECI_EMBED_NO_TO_UTF8`
*/
/*
Convert ECI-encoded `src` of length `src_len` to UTF-8 `dest`.
`p_dest_len` is set to length of `dest` on output.
`dest` must be big enough (4-times the `src_len`, or see `zueci_dest_len_utf8()`). It is not NUL-terminated.
If the Unicode BMP `replacement_char` (<= 0xFFFF) is non-zero then it will substituted for all source characters
with no mapping and processing will continue, returning ZUECI_WARN_INVALID_DATA unless other errors.
`flags` can be set with `ZUECI_FLAG_XXX` to change behaviour.
Returns 0 if successful, one of `ZUECI_ERROR_XXX` if not.
*/
ZUECI_EXTERN int ;
/*
Calculate exact length needed to convert ECI-encoded `src` of length `len` from ECI `eci`, and place in
`p_dest_len`.
Returns 0 if successful, one of `ZUECI_ERROR_XXX` if not.
*/
ZUECI_EXTERN int ;
/* ZUECI_EMBED_NO_TO_UTF8 */
}
/* vim: set ts=4 sw=4 et : */
/* ZUECI_H */