utf32.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00030 #ifndef __UTF32_H__
00031 #define __UTF32_H__
00032
00033
00034
00035 #define UTF32_IS_SAFE(c, strict) \
00036 (!(strict) ? \
00037 (uint32_t)(c)<=0x10ffff : \
00038 UTF_IS_UNICODE_CHAR(c))
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #define UTF32_IS_SINGLE(uchar) 1
00050 #define UTF32_IS_LEAD(uchar) 0
00051 #define UTF32_IS_TRAIL(uchar) 0
00052
00053
00054 #define UTF32_NEED_MULTIPLE_UCHAR(c) 0
00055 #define UTF32_CHAR_LENGTH(c) 1
00056 #define UTF32_MAX_CHAR_LENGTH 1
00057
00058
00059 #define UTF32_ARRAY_SIZE(size) (size)
00060
00061 #define UTF32_GET_CHAR_UNSAFE(s, i, c) { \
00062 (c)=(s)[i]; \
00063 }
00064
00065 #define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) { \
00066 (c)=(s)[i]; \
00067 if(!UTF32_IS_SAFE(c, strict)) { \
00068 (c)=UTF_ERROR_VALUE; \
00069 } \
00070 }
00071
00072
00073
00074 #define UTF32_NEXT_CHAR_UNSAFE(s, i, c) { \
00075 (c)=(s)[(i)++]; \
00076 }
00077
00078 #define UTF32_APPEND_CHAR_UNSAFE(s, i, c) { \
00079 (s)[(i)++]=(c); \
00080 }
00081
00082 #define UTF32_FWD_1_UNSAFE(s, i) { \
00083 ++(i); \
00084 }
00085
00086 #define UTF32_FWD_N_UNSAFE(s, i, n) { \
00087 (i)+=(n); \
00088 }
00089
00090 #define UTF32_SET_CHAR_START_UNSAFE(s, i) { \
00091 }
00092
00093 #define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) { \
00094 (c)=(s)[(i)++]; \
00095 if(!UTF32_IS_SAFE(c, strict)) { \
00096 (c)=UTF_ERROR_VALUE; \
00097 } \
00098 }
00099
00100 #define UTF32_APPEND_CHAR_SAFE(s, i, length, c) { \
00101 if((uint32_t)(c)<=0x10ffff) { \
00102 (s)[(i)++]=(c); \
00103 } else { \
00104 (s)[(i)++]=0xfffd; \
00105 } \
00106 }
00107
00108 #define UTF32_FWD_1_SAFE(s, i, length) { \
00109 ++(i); \
00110 }
00111
00112 #define UTF32_FWD_N_SAFE(s, i, length, n) { \
00113 if(((i)+=(n))>(length)) { \
00114 (i)=(length); \
00115 } \
00116 }
00117
00118 #define UTF32_SET_CHAR_START_SAFE(s, start, i) { \
00119 }
00120
00121
00122
00123 #define UTF32_PREV_CHAR_UNSAFE(s, i, c) { \
00124 (c)=(s)[--(i)]; \
00125 }
00126
00127 #define UTF32_BACK_1_UNSAFE(s, i) { \
00128 --(i); \
00129 }
00130
00131 #define UTF32_BACK_N_UNSAFE(s, i, n) { \
00132 (i)-=(n); \
00133 }
00134
00135 #define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) { \
00136 }
00137
00138 #define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) { \
00139 (c)=(s)[--(i)]; \
00140 if(!UTF32_IS_SAFE(c, strict)) { \
00141 (c)=UTF_ERROR_VALUE; \
00142 } \
00143 }
00144
00145 #define UTF32_BACK_1_SAFE(s, start, i) { \
00146 --(i); \
00147 }
00148
00149 #define UTF32_BACK_N_SAFE(s, start, i, n) { \
00150 (i)-=(n); \
00151 if((i)<(start)) { \
00152 (i)=(start); \
00153 } \
00154 }
00155
00156 #define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) { \
00157 }
00158
00159 #endif
Generated on Wed Jul 28 05:45:13 2004 for ICU 2.1 by
1.3.7