00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00096 #ifndef __UTF_H__
00097 #define __UTF_H__
00098
00099
00100
00101
00102
00103
00104
00105 #include "unicode/umachine.h"
00106 #include <stddef.h>
00107
00108
00115 #ifndef U_HAVE_WCHAR_H
00116 # define U_HAVE_WCHAR_H 1
00117 #endif
00118
00125 #if U_SIZEOF_WCHAR_T==0
00126 # undef U_SIZEOF_WCHAR_T
00127 # define U_SIZEOF_WCHAR_T 4
00128 #endif
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
00143 # ifdef __STDC_ISO_10646__
00144 # if (U_SIZEOF_WCHAR_T==2)
00145 # define U_WCHAR_IS_UTF16
00146 # elif (U_SIZEOF_WCHAR_T==4)
00147 # define U_WCHAR_IS_UTF32
00148 # endif
00149 # elif defined __UCS2__
00150 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
00151 # define U_WCHAR_IS_UTF16
00152 # endif
00153 # elif defined __UCS4__
00154 # if (U_SIZEOF_WCHAR_T==4)
00155 # define U_WCHAR_IS_UTF32
00156 # endif
00157 # elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
00158 # define U_WCHAR_IS_UTF16
00159 # endif
00160 #endif
00161
00162
00163
00165 #define U_SIZEOF_UCHAR 2
00166
00178
00179 #if U_SIZEOF_WCHAR_T==2
00180 typedef wchar_t UChar;
00181 #else
00182 typedef uint16_t UChar;
00183 #endif
00184
00202 typedef int32_t UChar32;
00203
00204
00205
00224 #define U_SENTINEL (-1)
00225
00232 #define U_IS_UNICODE_NONCHAR(c) \
00233 ((c)>=0xfdd0 && \
00234 ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
00235 (uint32_t)(c)<=0x10ffff)
00236
00254 #define U_IS_UNICODE_CHAR(c) \
00255 ((uint32_t)(c)<0xd800 || \
00256 ((uint32_t)(c)>0xdfff && \
00257 (uint32_t)(c)<=0x10ffff && \
00258 !U_IS_UNICODE_NONCHAR(c)))
00259
00266 #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
00267
00274 #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
00275
00282 #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
00283
00291 #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
00292
00293
00294
00295 #include "unicode/utf8.h"
00296 #include "unicode/utf16.h"
00297
00298
00299 #include "unicode/utf_old.h"
00300
00301 #endif