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