summaryrefslogtreecommitdiff
path: root/src/wcwidth.h
blob: f2fee1105b850f4eb4263556df5ce6549dc04260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// wcwidth.h

// Windows does not have a wcwidth function, so we use compatibilty code from
// http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c by Markus Kuhn

#ifndef MK_WCWIDTH_H
#define MK_WCWIDTH_H


#ifdef _WIN32
#include <stdint.h>
typedef uint32_t mk_wchar_t; // Windows wchar_t can be 16-bit, we need 32-bit
#else
#include <wchar.h>
typedef wchar_t mk_wchar_t;  // Posix wchar_t is 32-bit so just use that
#endif

int mk_wcwidth(mk_wchar_t ucs);
int mk_wcswidth(const mk_wchar_t *pwcs, size_t n);

#endif // MK_WCWIDTH_H