module_wcwidth.c
1 #include <kuroko/vm.h>
2 #include <kuroko/util.h>
3 
4 #include <wchar.h>
5 #include <locale.h>
6 
7 #ifndef _WIN32
8 extern int wcwidth(wchar_t c);
9 #else
10 static
11 #include "../wcwidth._h"
12 #endif
13 
14 KRK_Function(wcwidth) {
15  FUNCTION_TAKES_EXACTLY(1);
16  CHECK_ARG(0,int,krk_integer_type,codepoint);
17  return INTEGER_VAL(wcwidth(codepoint));
18 }
19 
20 KRK_Module(wcwidth) {
21  KRK_DOC(module, "Character widths.");
22  BIND_FUNC(module, wcwidth);
23 
24 #ifndef _WIN32
25  setlocale(LC_ALL, "");
26 #endif
27 }
28 
KRK_Module(socket)
Utilities for creating native bindings.
#define KRK_DOC(thing, text)
Attach documentation to a thing of various types.
Definition: util.h:304
Core API for the bytecode virtual machine.