|
Packit Service |
a2489d |
/* Display width functions.
|
|
Packit Service |
a2489d |
Copyright (C) 2001-2002, 2005, 2007, 2009-2018 Free Software Foundation,
|
|
Packit Service |
a2489d |
Inc.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
This program is free software: you can redistribute it and/or modify it
|
|
Packit Service |
a2489d |
under the terms of the GNU General Public License as published
|
|
Packit Service |
a2489d |
by the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
a2489d |
(at your option) any later version.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
a2489d |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
a2489d |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
a2489d |
General Public License for more details.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
a2489d |
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
#ifndef _UNIWIDTH_H
|
|
Packit Service |
a2489d |
#define _UNIWIDTH_H
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
#include "unitypes.h"
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Get size_t. */
|
|
Packit Service |
a2489d |
#include <stddef.h>
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Get locale_charset() declaration. */
|
|
Packit Service |
a2489d |
#include "localcharset.h"
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
#ifdef __cplusplus
|
|
Packit Service |
a2489d |
extern "C" {
|
|
Packit Service |
a2489d |
#endif
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Display width. */
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* These functions are locale dependent. The encoding argument identifies
|
|
Packit Service |
a2489d |
the encoding (e.g. "ISO-8859-2" for Polish). */
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Determine number of column positions required for UC. */
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
uc_width (ucs4_t uc, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
uc_width1 (ucs4_t uc)
|
|
Packit Service |
a2489d |
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
|
Packit Service |
a2489d |
__attribute__ ((__pure__))
|
|
Packit Service |
a2489d |
#endif
|
|
Packit Service |
a2489d |
;
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Determine number of column positions required for first N units
|
|
Packit Service |
a2489d |
(or fewer if S ends before this) in S. */
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u8_width (const uint8_t *s, size_t n, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u16_width (const uint16_t *s, size_t n, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u32_width (const uint32_t *s, size_t n, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
/* Determine number of column positions required for S. */
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u8_strwidth (const uint8_t *s, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u16_strwidth (const uint16_t *s, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
extern int
|
|
Packit Service |
a2489d |
u32_strwidth (const uint32_t *s, const char *encoding)
|
|
Packit Service |
a2489d |
_UC_ATTRIBUTE_PURE;
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
#ifdef __cplusplus
|
|
Packit Service |
a2489d |
}
|
|
Packit Service |
a2489d |
#endif
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
#endif /* _UNIWIDTH_H */
|