]> git.decadent.org.uk Git - ion3.git/blob - ioncore/dummywc.h
Update cfg_kludge_flash for Flash 10
[ion3.git] / ioncore / dummywc.h
1 /*
2  * ion/ioncore/dummywc.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2009. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 /* This file contains dummy implementations of multibyte/widechar routines
10  * used by Ion for retarded platforms.
11  */
12
13 #ifndef ION_IONCORE_DUMMYWC_H
14 #define ION_IONCORE_DUMMYWC_H
15
16 #include <string.h>
17 #include <ctype.h>
18
19 #define wchar_t int
20 #define mbstate_t int
21
22 #define iswalnum isalnum
23 #define iswprint isprint
24 #define iswspace isspace
25
26 #define mbrlen dummywc_mbrlen
27 #define mbtowc dummywc_mbtowc
28 #define mbrtowc dummywc_mbrtowc
29
30 static size_t dummywc_mbrlen(const char *s, size_t n, mbstate_t *ps)
31 {
32     if(*s=='\0')
33         return 0;
34     return 1;
35 }
36
37 static int dummywc_mbtowc(wchar_t *pwc, const char *s, size_t n)
38 {
39     if(n>0 && *s!='\0'){
40         *pwc=*s;
41         return 1;
42     }
43     return 0;
44 }
45
46 static size_t dummywc_mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
47 {
48     return mbtowc(pwc, s, n);
49 }
50
51 #endif /* ION_IONCORE_DUMMYWC_H */
52