00001 #ifndef CHAR2UNI_H_HEADER_INCLUDED
00002 #define CHAR2UNI_H_HEADER_INCLUDED
00003
00004
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008
00009 typedef enum {
00010 CHARSET_ISO8859_1 = 0,
00011 CHARSET_ISO8859_2,
00012 CHARSET_ISO8859_3,
00013 CHARSET_ISO8859_4,
00014 CHARSET_ISO8859_5,
00015 CHARSET_ISO8859_6,
00016 CHARSET_ISO8859_7,
00017 CHARSET_ISO8859_8,
00018 CHARSET_ISO8859_9,
00019 CHARSET_ISO8859_10,
00020 CHARSET_ISO8859_13,
00021 CHARSET_ISO8859_14,
00022 CHARSET_ISO8859_15,
00023 CHARSET_ISO8859_16,
00024 CHARSET_KOI8_R,
00025 CHARSET_KOI8_RU,
00026 CHARSET_KOI8_U,
00027 CHARSET_CP1250,
00028 CHARSET_CP1251,
00029 CHARSET_CP1252,
00030 CHARSET_UTF8,
00031 SUPPORTED_CHARSETS_NUM
00032 }ASSupportedCharsets ;
00033
00034 extern const unsigned short *as_current_charset ;
00035 extern ASSupportedCharsets as_current_charset_id ;
00036
00037 #define UNICODE_CHAR CARD32
00038
00039 #define IsUTF8Locale() (as_current_charset_id==CHARSET_UTF8)
00040
00041
00042
00043
00044
00045
00046
00047 #if 1
00048 #define CHAR2UNICODE(c) \
00049 ((UNICODE_CHAR)(((((unsigned short)(c))&0x0080)!=0)? \
00050 as_current_charset[((unsigned short)(c))&0x007F]:\
00051 ((unsigned char)(c))))
00052 #else
00053 #define CHAR2UNICODE(c) ((UNICODE_CHAR)(((unsigned short)(c))&0x00FF))
00054 #endif
00055
00056 ASSupportedCharsets as_set_charset( ASSupportedCharsets new_charset );
00057 ASSupportedCharsets parse_charset_name( const char *name );
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #define UTF8_CHAR_SIZE(c) ((((c)&0xC0)==0xC0)? \
00070 (((c)&0x20)? \
00071 (((c)&0x10)? \
00072 (((c)&0x08)? \
00073 (((c)&0x04)?6:5):4):3):2):1)
00074 #ifdef WIN32
00075 #define UNICODE_CHAR_SIZE(c) sizeof(UNICODE_CHAR)
00076 #endif
00077 #define CHAR_SIZE(c) 1
00078
00079
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083
00084
00085 #endif