aboutsummaryrefslogtreecommitdiff
path: root/src/wcwidth.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wcwidth.h')
-rw-r--r--src/wcwidth.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wcwidth.h b/src/wcwidth.h
new file mode 100644
index 0000000..f2fee11
--- /dev/null
+++ b/src/wcwidth.h
@@ -0,0 +1,21 @@
1// wcwidth.h
2
3// Windows does not have a wcwidth function, so we use compatibilty code from
4// http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c by Markus Kuhn
5
6#ifndef MK_WCWIDTH_H
7#define MK_WCWIDTH_H
8
9
10#ifdef _WIN32
11#include <stdint.h>
12typedef uint32_t mk_wchar_t; // Windows wchar_t can be 16-bit, we need 32-bit
13#else
14#include <wchar.h>
15typedef wchar_t mk_wchar_t; // Posix wchar_t is 32-bit so just use that
16#endif
17
18int mk_wcwidth(mk_wchar_t ucs);
19int mk_wcswidth(const mk_wchar_t *pwcs, size_t n);
20
21#endif // MK_WCWIDTH_H