Simple lua repl for testing
[notion.git] / ioncore / dummywc.h
blob588f1649a2612c9301678e0cd416f8913dc7c07d
1 /*
2 * ion/ioncore/dummywc.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 /* This file contains dummy implementations of multibyte/widechar routines
10 * used by Ion for retarded platforms.
13 #ifndef ION_IONCORE_DUMMYWC_H
14 #define ION_IONCORE_DUMMYWC_H
16 #include <string.h>
17 #include <ctype.h>
19 #define wchar_t int
20 #define mbstate_t int
22 #define iswalnum isalnum
23 #define iswprint isprint
24 #define iswspace isspace
26 #define mbrlen dummywc_mbrlen
27 #define mbtowc dummywc_mbtowc
28 #define mbrtowc dummywc_mbrtowc
30 static size_t dummywc_mbrlen(const char *s, size_t n, mbstate_t *ps)
32 if(*s=='\0')
33 return 0;
34 return 1;
37 static int dummywc_mbtowc(wchar_t *pwc, const char *s, size_t n)
39 if(n>0 && *s!='\0'){
40 *pwc=*s;
41 return 1;
43 return 0;
46 static size_t dummywc_mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
48 return mbtowc(pwc, s, n);
51 #endif /* ION_IONCORE_DUMMYWC_H */