uniwidth.h 2.1 KB

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