* build-aux/config.guess: Update from config.
[gnulib.git] / lib / uniwidth.h
1 /* Display width functions.
2    Copyright (C) 2001-2002, 2005, 2007 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify it
5    under the terms of the GNU Library General Public License as published
6    by the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17    USA.  */
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
44 /* Determine number of column positions required for first N units
45    (or fewer if S ends before this) in S.  */
46 extern int
47        u8_width (const uint8_t *s, size_t n, const char *encoding);
48 extern int
49        u16_width (const uint16_t *s, size_t n, const char *encoding);
50 extern int
51        u32_width (const uint32_t *s, size_t n, const char *encoding);
52
53 /* Determine number of column positions required for S.  */
54 extern int
55        u8_strwidth (const uint8_t *s, const char *encoding);
56 extern int
57        u16_strwidth (const uint16_t *s, const char *encoding);
58 extern int
59        u32_strwidth (const uint32_t *s, const char *encoding);
60
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif /* _UNIWIDTH_H */