1 #ifndef CHAR2UNI_H_HEADER_INCLUDED
2 #define CHAR2UNI_H_HEADER_INCLUDED
3 
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 typedef enum {
10    CHARSET_ISO8859_1 = 0,     /* Does not require translation */
11    CHARSET_ISO8859_2,
12    CHARSET_ISO8859_3,
13    CHARSET_ISO8859_4,
14    CHARSET_ISO8859_5,
15    CHARSET_ISO8859_6,
16    CHARSET_ISO8859_7,
17    CHARSET_ISO8859_8,
18    CHARSET_ISO8859_9,
19    CHARSET_ISO8859_10,
20    CHARSET_ISO8859_13,
21    CHARSET_ISO8859_14,
22    CHARSET_ISO8859_15,
23    CHARSET_ISO8859_16,
24    CHARSET_KOI8_R,
25    CHARSET_KOI8_RU,
26    CHARSET_KOI8_U,
27    CHARSET_CP1250,
28    CHARSET_CP1251,
29    CHARSET_CP1252,
30    CHARSET_UTF8,
31    SUPPORTED_CHARSETS_NUM
32 }ASSupportedCharsets ;
33 
34 extern const unsigned short *as_current_charset ;
35 extern ASSupportedCharsets as_current_charset_id ;
36 
37 #define UNICODE_CHAR	CARD32
38 
39 #define IsUTF8Locale()  (as_current_charset_id==CHARSET_UTF8)
40 
41 /*
42 #define CHAR2UNICODE(c) \
43   ((UNICODE_CHAR)(((((unsigned short)(c))&0x0080)!=0)? \
44 					as_current_charset[((unsigned short)text[i])&0x007F]:\
45 			       ((unsigned char)(c))))
46 */
47 #if 1 /*def  I18N*/
48 #define CHAR2UNICODE(c) \
49   ((UNICODE_CHAR)(((((unsigned short)(c))&0x0080)!=0)? \
50 					as_current_charset[((unsigned short)(c))&0x007F]:\
51 			       ((unsigned char)(c))))
52 #else
53 #define CHAR2UNICODE(c)   ((UNICODE_CHAR)(((unsigned short)(c))&0x00FF))
54 #endif
55 
56 ASSupportedCharsets as_set_charset( ASSupportedCharsets new_charset );
57 ASSupportedCharsets parse_charset_name( const char *name );
58 
59 
60 /****d* libAfterImage/CHAR_SIZE
61  * NAME
62  * CHAR_SIZE - Convinient macro so we can transparently determine the
63  * number of bytes that character spans. It assumes UTF-8 encoding when
64  * I18N is enabled.
65  * SOURCE
66  */
67 /* size of the UTF-8 encoded character is based on value of
68  * the first byte : */
69 #define UTF8_CHAR_SIZE(c) 	((((c)&0xC0)==0xC0)? \
70 							 (((c)&0x20)? \
71 							 (((c)&0x10)? \
72 							 (((c)&0x08)? \
73 							 (((c)&0x04)?6:5):4):3):2):1)
74 #ifdef WIN32
75 #define UNICODE_CHAR_SIZE(c)	sizeof(UNICODE_CHAR)
76 #endif
77 #define CHAR_SIZE(c) 			1
78 /*************/
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 
85 #endif
86