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