1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ |
2 | /* Display width functions. |
3 | Copyright (C) 2001-2002, 2005, 2007, 2009-2019 Free Software Foundation, |
4 | Inc. |
5 | |
6 | This program is free software: you can redistribute it and/or modify it |
7 | under the terms of the GNU General Public License as published |
8 | by the Free Software Foundation; either version 3 of the License, or |
9 | (at your option) any later version. |
10 | |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #ifndef _UNIWIDTH_H |
20 | #define _UNIWIDTH_H |
21 | |
22 | #include "unitypes.h" |
23 | |
24 | /* Get size_t. */ |
25 | #include <stddef.h> |
26 | |
27 | /* Get locale_charset() declaration. */ |
28 | #include "localcharset.h" |
29 | |
30 | #ifdef __cplusplus |
31 | extern "C" { |
32 | #endif |
33 | |
34 | |
35 | /* Display width. */ |
36 | |
37 | /* These functions are locale dependent. The encoding argument identifies |
38 | the encoding (e.g. "ISO-8859-2" for Polish). */ |
39 | |
40 | /* Determine number of column positions required for UC. */ |
41 | extern int |
42 | uc_width (ucs4_t uc, const char *encoding) |
43 | _UC_ATTRIBUTE_PURE; |
44 | |
45 | /* Determine number of column positions required for first N units |
46 | (or fewer if S ends before this) in S. */ |
47 | extern int |
48 | u8_width (const uint8_t *s, size_t n, const char *encoding) |
49 | _UC_ATTRIBUTE_PURE; |
50 | extern int |
51 | u16_width (const uint16_t *s, size_t n, const char *encoding) |
52 | _UC_ATTRIBUTE_PURE; |
53 | extern int |
54 | u32_width (const uint32_t *s, size_t n, const char *encoding) |
55 | _UC_ATTRIBUTE_PURE; |
56 | |
57 | /* Determine number of column positions required for S. */ |
58 | extern int |
59 | u8_strwidth (const uint8_t *s, const char *encoding) |
60 | _UC_ATTRIBUTE_PURE; |
61 | extern int |
62 | u16_strwidth (const uint16_t *s, const char *encoding) |
63 | _UC_ATTRIBUTE_PURE; |
64 | extern int |
65 | u32_strwidth (const uint32_t *s, const char *encoding) |
66 | _UC_ATTRIBUTE_PURE; |
67 | |
68 | |
69 | #ifdef __cplusplus |
70 | } |
71 | #endif |
72 | |
73 | #endif /* _UNIWIDTH_H */ |
74 | |