OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2004-2013, International Business Machines | 4 * Copyright (C) 2004-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: ubidi_props.c | 8 * file name: ubidi_props.c |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2004dec30 | 13 * created on: 2004dec30 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 10 matching lines...) Expand all Loading... |
25 #include "cmemory.h" | 25 #include "cmemory.h" |
26 #include "utrie2.h" | 26 #include "utrie2.h" |
27 #include "ubidi_props.h" | 27 #include "ubidi_props.h" |
28 #include "ucln_cmn.h" | 28 #include "ucln_cmn.h" |
29 | 29 |
30 struct UBiDiProps { | 30 struct UBiDiProps { |
31 UDataMemory *mem; | 31 UDataMemory *mem; |
32 const int32_t *indexes; | 32 const int32_t *indexes; |
33 const uint32_t *mirrors; | 33 const uint32_t *mirrors; |
34 const uint8_t *jgArray; | 34 const uint8_t *jgArray; |
| 35 const uint8_t *jgArray2; |
35 | 36 |
36 UTrie2 trie; | 37 UTrie2 trie; |
37 uint8_t formatVersion[4]; | 38 uint8_t formatVersion[4]; |
38 }; | 39 }; |
39 | 40 |
40 /* ubidi_props_data.h is machine-generated by genbidi --csource */ | 41 /* ubidi_props_data.h is machine-generated by genbidi --csource */ |
41 #define INCLUDED_FROM_UBIDI_PROPS_C | 42 #define INCLUDED_FROM_UBIDI_PROPS_C |
42 #include "ubidi_props_data.h" | 43 #include "ubidi_props_data.h" |
43 | 44 |
44 /* UBiDiProps singleton ----------------------------------------------------- */ | 45 /* UBiDiProps singleton ----------------------------------------------------- */ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 length=bdp->indexes[UBIDI_IX_MIRROR_LENGTH]; | 78 length=bdp->indexes[UBIDI_IX_MIRROR_LENGTH]; |
78 for(i=0; i<length; ++i) { | 79 for(i=0; i<length; ++i) { |
79 c=UBIDI_GET_MIRROR_CODE_POINT(bdp->mirrors[i]); | 80 c=UBIDI_GET_MIRROR_CODE_POINT(bdp->mirrors[i]); |
80 sa->addRange(sa->set, c, c+1); | 81 sa->addRange(sa->set, c, c+1); |
81 } | 82 } |
82 | 83 |
83 /* add the code points from the Joining_Group array where the value changes
*/ | 84 /* add the code points from the Joining_Group array where the value changes
*/ |
84 start=bdp->indexes[UBIDI_IX_JG_START]; | 85 start=bdp->indexes[UBIDI_IX_JG_START]; |
85 limit=bdp->indexes[UBIDI_IX_JG_LIMIT]; | 86 limit=bdp->indexes[UBIDI_IX_JG_LIMIT]; |
86 jgArray=bdp->jgArray; | 87 jgArray=bdp->jgArray; |
87 prev=0; | 88 for(;;) { |
88 while(start<limit) { | 89 prev=0; |
89 jg=*jgArray++; | 90 while(start<limit) { |
90 if(jg!=prev) { | 91 jg=*jgArray++; |
91 sa->add(sa->set, start); | 92 if(jg!=prev) { |
92 prev=jg; | 93 sa->add(sa->set, start); |
| 94 prev=jg; |
| 95 } |
| 96 ++start; |
93 } | 97 } |
94 ++start; | 98 if(prev!=0) { |
95 } | 99 /* add the limit code point if the last value was not 0 (it is now s
tart==limit) */ |
96 if(prev!=0) { | 100 sa->add(sa->set, limit); |
97 /* add the limit code point if the last value was not 0 (it is now start
==limit) */ | 101 } |
98 sa->add(sa->set, limit); | 102 if(limit==bdp->indexes[UBIDI_IX_JG_LIMIT]) { |
| 103 /* switch to the second Joining_Group range */ |
| 104 start=bdp->indexes[UBIDI_IX_JG_START2]; |
| 105 limit=bdp->indexes[UBIDI_IX_JG_LIMIT2]; |
| 106 jgArray=bdp->jgArray2; |
| 107 } else { |
| 108 break; |
| 109 } |
99 } | 110 } |
100 | 111 |
101 /* add code points with hardcoded properties, plus the ones following them *
/ | 112 /* add code points with hardcoded properties, plus the ones following them *
/ |
102 | 113 |
103 /* (none right now) */ | 114 /* (none right now) */ |
104 } | 115 } |
105 | 116 |
106 /* property access functions ------------------------------------------------ */ | 117 /* property access functions ------------------------------------------------ */ |
107 | 118 |
108 U_CFUNC int32_t | 119 U_CFUNC int32_t |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 208 } |
198 | 209 |
199 U_CFUNC UJoiningGroup | 210 U_CFUNC UJoiningGroup |
200 ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c) { | 211 ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c) { |
201 UChar32 start, limit; | 212 UChar32 start, limit; |
202 | 213 |
203 start=bdp->indexes[UBIDI_IX_JG_START]; | 214 start=bdp->indexes[UBIDI_IX_JG_START]; |
204 limit=bdp->indexes[UBIDI_IX_JG_LIMIT]; | 215 limit=bdp->indexes[UBIDI_IX_JG_LIMIT]; |
205 if(start<=c && c<limit) { | 216 if(start<=c && c<limit) { |
206 return (UJoiningGroup)bdp->jgArray[c-start]; | 217 return (UJoiningGroup)bdp->jgArray[c-start]; |
207 } else { | |
208 return U_JG_NO_JOINING_GROUP; | |
209 } | 218 } |
| 219 start=bdp->indexes[UBIDI_IX_JG_START2]; |
| 220 limit=bdp->indexes[UBIDI_IX_JG_LIMIT2]; |
| 221 if(start<=c && c<limit) { |
| 222 return (UJoiningGroup)bdp->jgArray2[c-start]; |
| 223 } |
| 224 return U_JG_NO_JOINING_GROUP; |
210 } | 225 } |
211 | 226 |
212 U_CFUNC UBidiPairedBracketType | 227 U_CFUNC UBidiPairedBracketType |
213 ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c) { | 228 ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c) { |
214 uint16_t props=UTRIE2_GET16(&bdp->trie, c); | 229 uint16_t props=UTRIE2_GET16(&bdp->trie, c); |
215 return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT); | 230 return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT); |
216 } | 231 } |
217 | 232 |
218 U_CFUNC UChar32 | 233 U_CFUNC UChar32 |
219 ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c) { | 234 ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c) { |
(...skipping 19 matching lines...) Expand all Loading... |
239 | 254 |
240 U_CFUNC UChar32 | 255 U_CFUNC UChar32 |
241 u_charMirror(UChar32 c) { | 256 u_charMirror(UChar32 c) { |
242 return ubidi_getMirror(&ubidi_props_singleton, c); | 257 return ubidi_getMirror(&ubidi_props_singleton, c); |
243 } | 258 } |
244 | 259 |
245 U_STABLE UChar32 U_EXPORT2 | 260 U_STABLE UChar32 U_EXPORT2 |
246 u_getBidiPairedBracket(UChar32 c) { | 261 u_getBidiPairedBracket(UChar32 c) { |
247 return ubidi_getPairedBracket(&ubidi_props_singleton, c); | 262 return ubidi_getPairedBracket(&ubidi_props_singleton, c); |
248 } | 263 } |
OLD | NEW |