NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
mbyte.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_LIB_MBYTE_H
24 #define MUTT_LIB_MBYTE_H
25 
26 #include "config.h"
27 #include <ctype.h>
28 #include <stdbool.h>
29 #include <wchar.h> // IWYU pragma: keep
30 #include <wctype.h> // IWYU pragma: keep
31 
32 extern bool OptLocales;
33 
34 #ifdef LOCALES_HACK
35 #define IsPrint(ch) (isprint((unsigned char) (ch)) || ((unsigned char) (ch) >= 0xa0))
36 #define IsWPrint(wc) (iswprint(wc) || wc >= 0xa0)
37 #else
38 #define IsPrint(ch) (isprint((unsigned char) (ch)) || (OptLocales ? 0 : ((unsigned char) (ch) >= 0xa0)))
39 #define IsWPrint(wc) (iswprint(wc) || (OptLocales ? 0 : (wc >= 0xa0)))
40 #endif
41 
42 int mutt_mb_charlen(const char *s, int *width);
43 int mutt_mb_filter_unprintable(char **s);
44 bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen);
45 bool mutt_mb_is_display_corrupting_utf8(wchar_t wc);
46 bool mutt_mb_is_lower(const char *s);
47 bool mutt_mb_is_shell_char(wchar_t ch);
48 size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf);
49 void mutt_mb_wcstombs(char *dest, size_t dlen, const wchar_t *src, size_t slen);
50 int mutt_mb_wcswidth(const wchar_t *s, size_t n);
51 int mutt_mb_wcwidth(wchar_t wc);
52 int mutt_mb_width(const char *str, int col, bool display);
53 size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1);
54 
55 #endif /* MUTT_LIB_MBYTE_H */
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
Definition: mbyte.c:294
int mutt_mb_charlen(const char *s, int *width)
Count the bytes in a (multibyte) character.
Definition: mbyte.c:54
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
Definition: mbyte.c:177
int mutt_mb_width(const char *str, int col, bool display)
Measure a string&#39;s display width (in screen columns)
Definition: mbyte.c:138
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
Definition: mbyte.c:216
bool mutt_mb_is_display_corrupting_utf8(wchar_t wc)
Will this character corrupt the display?
Definition: mbyte.c:389
void mutt_mb_wcstombs(char *dest, size_t dlen, const wchar_t *src, size_t slen)
Convert a string from wide to multibyte characters.
Definition: mbyte.c:236
bool OptLocales
(pseudo) set if user has valid locale definition
Definition: mbyte.c:43
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
Definition: mbyte.c:357
bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen)
Turn a name into initials.
Definition: mbyte.c:83
bool mutt_mb_is_shell_char(wchar_t ch)
Is character not typically part of a pathname.
Definition: mbyte.c:343
int mutt_mb_filter_unprintable(char **s)
Replace unprintable characters.
Definition: mbyte.c:423
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
Definition: mbyte.c:195