| 1 |
|
| |
| 2 |
|
| #define PERL_NO_GET_CONTEXT /* we want efficiency */ |
| 3 |
|
| |
| 4 |
|
| /* I guese no private function needs pTHX_ and aTHX_ */ |
| 5 |
|
| |
| 6 |
|
| #include "EXTERN.h" |
| 7 |
|
| #include "perl.h" |
| 8 |
|
| #include "XSUB.h" |
| 9 |
|
| |
| 10 |
|
| /* This file is prepared by mkheader */ |
| 11 |
|
| #include "ucatbl.h" |
| 12 |
|
| |
| 13 |
|
| /* At present, char > 0x10ffff are unaffected without complaint, right? */ |
| 14 |
|
| #define VALID_UTF_MAX (0x10ffff) |
| 15 |
|
| #define OVER_UTF_MAX(uv) (VALID_UTF_MAX < (uv)) |
| 16 |
|
| |
| 17 |
|
| #define MAX_DIV_16 (UV_MAX / 16) |
| 18 |
|
| |
| 19 |
|
| /* Supported Levels */ |
| 20 |
|
| #define MinLevel (1) |
| 21 |
|
| #define MaxLevel (4) |
| 22 |
|
| |
| 23 |
|
| /* Shifted weight at 4th level */ |
| 24 |
|
| #define Shift4Wt (0xFFFF) |
| 25 |
|
| |
| 26 |
|
| #define VCE_Length (9) |
| 27 |
|
| |
| 28 |
|
| #define Hangul_SBase (0xAC00) |
| 29 |
|
| #define Hangul_SIni (0xAC00) |
| 30 |
|
| #define Hangul_SFin (0xD7A3) |
| 31 |
|
| #define Hangul_NCount (588) |
| 32 |
|
| #define Hangul_TCount (28) |
| 33 |
|
| #define Hangul_LBase (0x1100) |
| 34 |
|
| #define Hangul_LIni (0x1100) |
| 35 |
|
| #define Hangul_LFin (0x1159) |
| 36 |
|
| #define Hangul_LFill (0x115F) |
| 37 |
|
| #define Hangul_LEnd (0x115F) /* Unicode 5.2 */ |
| 38 |
|
| #define Hangul_VBase (0x1161) |
| 39 |
|
| #define Hangul_VIni (0x1160) /* from Vowel Filler */ |
| 40 |
|
| #define Hangul_VFin (0x11A2) |
| 41 |
|
| #define Hangul_VEnd (0x11A7) /* Unicode 5.2 */ |
| 42 |
|
| #define Hangul_TBase (0x11A7) /* from "no-final" codepoint */ |
| 43 |
|
| #define Hangul_TIni (0x11A8) |
| 44 |
|
| #define Hangul_TFin (0x11F9) |
| 45 |
|
| #define Hangul_TEnd (0x11FF) /* Unicode 5.2 */ |
| 46 |
|
| #define HangulL2Ini (0xA960) /* Unicode 5.2 */ |
| 47 |
|
| #define HangulL2Fin (0xA97C) /* Unicode 5.2 */ |
| 48 |
|
| #define HangulV2Ini (0xD7B0) /* Unicode 5.2 */ |
| 49 |
|
| #define HangulV2Fin (0xD7C6) /* Unicode 5.2 */ |
| 50 |
|
| #define HangulT2Ini (0xD7CB) /* Unicode 5.2 */ |
| 51 |
|
| #define HangulT2Fin (0xD7FB) /* Unicode 5.2 */ |
| 52 |
|
| |
| 53 |
|
| #define CJK_UidIni (0x4E00) |
| 54 |
|
| #define CJK_UidFin (0x9FA5) |
| 55 |
|
| #define CJK_UidF41 (0x9FBB) /* Unicode 4.1 */ |
| 56 |
|
| #define CJK_UidF51 (0x9FC3) /* Unicode 5.1 */ |
| 57 |
|
| #define CJK_UidF52 (0x9FCB) /* Unicode 5.2 */ |
| 58 |
|
| #define CJK_UidF61 (0x9FCC) /* Unicode 6.1 */ |
| 59 |
|
| #define CJK_UidF80 (0x9FD5) /* Unicode 8.0 */ |
| 60 |
|
| #define CJK_UidF100 (0x9FEA) /* Unicode 10.0 */ |
| 61 |
|
| #define CJK_UidF110 (0x9FEF) /* Unicode 11.0 */ |
| 62 |
|
| #define CJK_UidF130 (0x9FFC) /* Unicode 13.0 */ |
| 63 |
|
| |
| 64 |
|
| #define CJK_ExtAIni (0x3400) /* Unicode 3.0 */ |
| 65 |
|
| #define CJK_ExtAFin (0x4DB5) /* Unicode 3.0 */ |
| 66 |
|
| #define CJK_ExtA130 (0x4DBF) /* Unicode 13.0 */ |
| 67 |
|
| #define CJK_ExtBIni (0x20000) /* Unicode 3.1 */ |
| 68 |
|
| #define CJK_ExtBFin (0x2A6D6) /* Unicode 3.1 */ |
| 69 |
|
| #define CJK_ExtB130 (0x2A6DD) /* Unicode 13.0 */ |
| 70 |
|
| #define CJK_ExtCIni (0x2A700) /* Unicode 5.2 */ |
| 71 |
|
| #define CJK_ExtCFin (0x2B734) /* Unicode 5.2 */ |
| 72 |
|
| #define CJK_ExtDIni (0x2B740) /* Unicode 6.0 */ |
| 73 |
|
| #define CJK_ExtDFin (0x2B81D) /* Unicode 6.0 */ |
| 74 |
|
| #define CJK_ExtEIni (0x2B820) /* Unicode 8.0 */ |
| 75 |
|
| #define CJK_ExtEFin (0x2CEA1) /* Unicode 8.0 */ |
| 76 |
|
| #define CJK_ExtFIni (0x2CEB0) /* Unicode 10.0 */ |
| 77 |
|
| #define CJK_ExtFFin (0x2EBE0) /* Unicode 10.0 */ |
| 78 |
|
| #define CJK_ExtGIni (0x30000) /* Unicode 13.0 */ |
| 79 |
|
| #define CJK_ExtGFin (0x3134A) /* Unicode 13.0 */ |
| 80 |
|
| |
| 81 |
|
| #define CJK_CompIni (0xFA0E) |
| 82 |
|
| #define CJK_CompFin (0xFA29) |
| 83 |
|
| static const STDCHAR UnifiedCompat[] = { |
| 84 |
|
| 1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,1 |
| 85 |
|
| }; /* E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 */ |
| 86 |
|
| |
| 87 |
|
| #define TangIdeoIni (0x17000) /* Unicode 9.0 */ |
| 88 |
|
| #define TangIdeoFin (0x187EC) /* Unicode 9.0 */ |
| 89 |
|
| #define TangIdeo110 (0x187F1) /* Unicode 11.0 */ |
| 90 |
|
| #define TangIdeo120 (0x187F7) /* Unicode 12.0 */ |
| 91 |
|
| #define TangCompIni (0x18800) /* Unicode 9.0 */ |
| 92 |
|
| #define TangCompFin (0x18AF2) /* Unicode 9.0 */ |
| 93 |
|
| #define TangComp130 (0x18AFF) /* Unicode 13.0 */ |
| 94 |
|
| #define TangSuppIni (0x18D00) /* Unicode 13.0 */ |
| 95 |
|
| #define TangSuppFin (0x18D08) /* Unicode 13.0 */ |
| 96 |
|
| #define NushuIni (0x1B170) /* Unicode 10.0 */ |
| 97 |
|
| #define NushuFin (0x1B2FB) /* Unicode 10.0 */ |
| 98 |
|
| #define KhitanIni (0x18B00) /* Unicode 13.0 */ |
| 99 |
|
| #define KhitanFin (0x18CD5) /* Unicode 13.0 */ |
| 100 |
|
| |
| 101 |
|
| #define codeRange(bcode, ecode) ((bcode) <= code && code <= (ecode)) |
| 102 |
|
| |
| 103 |
|
| MODULE = Unicode::Collate PACKAGE = Unicode::Collate |
| 104 |
|
| |
| 105 |
|
| PROTOTYPES: DISABLE |
| 106 |
|
| |
| 107 |
|
| void |
| 108 |
|
| _fetch_rest () |
| 109 |
|
| PREINIT: |
| 110 |
|
| char ** rest; |
| 111 |
|
| PPCODE: |
| 112 |
120015 |
▶ | for (rest = (char **)UCA_rest; *rest; ++rest) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (rest = (char **)UCA_rest; *rest; ++rest) { |
119888 |
127 |
120015 |
|
| 113 |
119888 |
▶ | XPUSHs(sv_2mortal(newSVpv((char *) *rest, 0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv((char *) *rest, 0))); |
0 |
119888 |
119888 |
|
| 114 |
|
| } |
| 115 |
|
| |
| 116 |
|
| |
| 117 |
|
| void |
| 118 |
|
| _fetch_simple (uv) |
| 119 |
|
| UV uv |
| 120 |
|
| PREINIT: |
| 121 |
|
| U8 ***plane, **row; |
| 122 |
16798 |
| U8* result = NULL; |
| 123 |
|
| PPCODE: |
| 124 |
16798 |
▶ | if (!OVER_UTF_MAX(uv)){ |
Branch: 1 branch
| Branch | True | False | Total |
| if (!OVER_UTF_MAX(uv)){ |
16798 |
0 |
16798 |
|
| 125 |
16798 |
| plane = (U8***)UCA_simple[uv >> 16]; |
| 126 |
16798 |
▶ | if (plane) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (plane) { |
16798 |
0 |
16798 |
|
| 127 |
16798 |
| row = plane[(uv >> 8) & 0xff]; |
| 128 |
16798 |
▶ | result = row ? row[uv & 0xff] : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| result = row ? row[uv & 0xff] : NULL; |
16798 |
0 |
16798 |
|
| 129 |
|
| } |
| 130 |
|
| } |
| 131 |
16798 |
▶ | if (result) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (result) { |
16798 |
0 |
16798 |
|
| 132 |
|
| int i; |
| 133 |
16798 |
| int num = (int)*result; |
| 134 |
16798 |
| ++result; |
| 135 |
16798 |
▶ | EXTEND(SP, num); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(SP, num); |
16798 |
0 |
16798 |
| EXTEND(SP, num); |
0 |
16798 |
16798 |
|
| 136 |
38682 |
▶ | for (i = 0; i < num; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < num; ++i) { |
21884 |
16798 |
38682 |
|
| 137 |
21884 |
| PUSHs(sv_2mortal(newSVpvn((char *) result, VCE_Length))); |
| 138 |
21884 |
| result += VCE_Length; |
| 139 |
|
| } |
| 140 |
|
| } else { |
| 141 |
0 |
| PUSHs(sv_2mortal(newSViv(0))); |
| 142 |
|
| } |
| 143 |
|
| |
| 144 |
|
| SV* |
| 145 |
|
| _ignorable_simple (uv) |
| 146 |
|
| UV uv |
| 147 |
|
| ALIAS: |
| 148 |
|
| _exists_simple = 1 |
| 149 |
|
| PREINIT: |
| 150 |
|
| U8 ***plane, **row; |
| 151 |
58109 |
| int num = -1; |
| 152 |
58109 |
| U8* result = NULL; |
| 153 |
|
| CODE: |
| 154 |
58109 |
▶ | if (!OVER_UTF_MAX(uv)){ |
Branch: 1 branch
| Branch | True | False | Total |
| if (!OVER_UTF_MAX(uv)){ |
58109 |
0 |
58109 |
|
| 155 |
58109 |
| plane = (U8***)UCA_simple[uv >> 16]; |
| 156 |
58109 |
▶ | if (plane) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (plane) { |
58105 |
4 |
58109 |
|
| 157 |
58105 |
| row = plane[(uv >> 8) & 0xff]; |
| 158 |
58105 |
▶ | result = row ? row[uv & 0xff] : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| result = row ? row[uv & 0xff] : NULL; |
33900 |
24205 |
58105 |
|
| 159 |
|
| } |
| 160 |
58109 |
▶ | if (result) |
Branch: 1 branch
| Branch | True | False | Total |
| if (result) |
33570 |
24539 |
58109 |
|
| 161 |
33570 |
| num = (int)*result; /* assuming 0 <= num < 128 */ |
| 162 |
|
| } |
| 163 |
|
| |
| 164 |
58109 |
▶ | if (ix) |
Branch: 1 branch
| Branch | True | False | Total |
| if (ix) |
29006 |
29103 |
58109 |
|
| 165 |
29006 |
▶ | RETVAL = boolSV(num >0); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = boolSV(num >0); |
16798 |
12208 |
29006 |
|
| 166 |
|
| else |
| 167 |
29103 |
▶ | RETVAL = boolSV(num==0); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = boolSV(num==0); |
54 |
29049 |
29103 |
|
| 168 |
|
| OUTPUT: |
| 169 |
|
| RETVAL |
| 170 |
|
| |
| 171 |
|
| |
| 172 |
|
| void |
| 173 |
|
| _getHexArray (src) |
| 174 |
|
| SV* src |
| 175 |
|
| PREINIT: |
| 176 |
|
| char *s, *e; |
| 177 |
|
| STRLEN byte; |
| 178 |
|
| UV value; |
| 179 |
574242 |
| bool overflowed = FALSE; |
| 180 |
|
| const char *hexdigit; |
| 181 |
|
| PPCODE: |
| 182 |
574242 |
| s = SvPV(src,byte); |
| 183 |
2556048 |
▶ | for (e = s + byte; s < e;) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (e = s + byte; s < e;) { |
1981806 |
574242 |
2556048 |
|
| 184 |
1981806 |
| hexdigit = strchr((char *) PL_hexdigit, *s++); |
| 185 |
1981806 |
▶ | if (! hexdigit) |
Branch: 1 branch
| Branch | True | False | Total |
| if (! hexdigit) |
514116 |
1467690 |
1981806 |
|
| 186 |
514116 |
| continue; |
| 187 |
1467690 |
| value = (hexdigit - PL_hexdigit) & 0xF; |
| 188 |
5894710 |
▶ | while (*s) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (*s) { |
5539079 |
355631 |
5894710 |
|
| 189 |
5539079 |
| hexdigit = strchr((char *) PL_hexdigit, *s++); |
| 190 |
5539079 |
▶ | if (! hexdigit) |
Branch: 1 branch
| Branch | True | False | Total |
| if (! hexdigit) |
1112059 |
4427020 |
5539079 |
|
| 191 |
1112059 |
| break; |
| 192 |
4427020 |
▶ | if (overflowed) |
Branch: 1 branch
| Branch | True | False | Total |
| if (overflowed) |
0 |
4427020 |
4427020 |
|
| 193 |
0 |
| continue; |
| 194 |
4427020 |
▶ | if (value > MAX_DIV_16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (value > MAX_DIV_16) { |
0 |
4427020 |
4427020 |
|
| 195 |
0 |
| overflowed = TRUE; |
| 196 |
0 |
| continue; |
| 197 |
|
| } |
| 198 |
4427020 |
| value = (value << 4) | ((hexdigit - PL_hexdigit) & 0xF); |
| 199 |
|
| } |
| 200 |
1467690 |
▶ | XPUSHs(sv_2mortal(newSVuv(overflowed ? UV_MAX : value))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(overflowed ? UV_MAX : value))); |
0 |
1467690 |
1467690 |
| XPUSHs(sv_2mortal(newSVuv(overflowed ? UV_MAX : value))); |
0 |
1467690 |
1467690 |
|
| 201 |
|
| } |
| 202 |
|
| |
| 203 |
|
| |
| 204 |
|
| SV* |
| 205 |
|
| _isIllegal (sv) |
| 206 |
|
| SV* sv |
| 207 |
|
| PREINIT: |
| 208 |
|
| UV uv; |
| 209 |
|
| CODE: |
| 210 |
4888 |
▶ | if (!sv || !SvIOK(sv)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv || !SvIOK(sv)) |
4888 |
0 |
4888 |
| if (!sv || !SvIOK(sv)) |
0 |
4888 |
4888 |
|
| 211 |
0 |
| XSRETURN_YES; |
| 212 |
4888 |
| uv = SvUVX(sv); |
| 213 |
4888 |
▶ | RETVAL = boolSV( |
Branch: 6 branches
| Branch | True | False | Total |
| RETVAL = boolSV( |
4847 |
41 |
4888 |
| RETVAL = boolSV( |
4828 |
19 |
4847 |
| RETVAL = boolSV( |
1442 |
3386 |
4828 |
| RETVAL = boolSV( |
1431 |
11 |
1442 |
| RETVAL = boolSV( |
969 |
3848 |
4817 |
| RETVAL = boolSV( |
4 |
965 |
969 |
|
| 214 |
|
| 0x10FFFF < uv /* out of range */ |
| 215 |
|
| || ((uv & 0xFFFE) == 0xFFFE) /* ??FFF[EF] */ |
| 216 |
|
| || (0xD800 <= uv && uv <= 0xDFFF) /* unpaired surrogates */ |
| 217 |
|
| || (0xFDD0 <= uv && uv <= 0xFDEF) /* other non-characters */ |
| 218 |
|
| ); |
| 219 |
|
| OUTPUT: |
| 220 |
|
| RETVAL |
| 221 |
|
| |
| 222 |
|
| |
| 223 |
|
| void |
| 224 |
|
| _decompHangul (code) |
| 225 |
|
| UV code |
| 226 |
|
| PREINIT: |
| 227 |
|
| UV sindex, lindex, vindex, tindex; |
| 228 |
|
| PPCODE: |
| 229 |
|
| /* code *must* be in Hangul syllable. |
| 230 |
|
| * Check it before you enter here. */ |
| 231 |
105 |
| sindex = code - Hangul_SBase; |
| 232 |
105 |
| lindex = sindex / Hangul_NCount; |
| 233 |
105 |
| vindex = (sindex % Hangul_NCount) / Hangul_TCount; |
| 234 |
105 |
| tindex = sindex % Hangul_TCount; |
| 235 |
|
| |
| 236 |
105 |
▶ | EXTEND(SP, tindex ? 3 : 2); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTEND(SP, tindex ? 3 : 2); |
60 |
45 |
105 |
| EXTEND(SP, tindex ? 3 : 2); |
0 |
105 |
105 |
| EXTEND(SP, tindex ? 3 : 2); |
0 |
0 |
0 |
|
| 237 |
105 |
| PUSHs(sv_2mortal(newSVuv(lindex + Hangul_LBase))); |
| 238 |
105 |
| PUSHs(sv_2mortal(newSVuv(vindex + Hangul_VBase))); |
| 239 |
105 |
▶ | if (tindex) |
Branch: 1 branch
| Branch | True | False | Total |
| if (tindex) |
60 |
45 |
105 |
|
| 240 |
60 |
| PUSHs(sv_2mortal(newSVuv(tindex + Hangul_TBase))); |
| 241 |
|
| |
| 242 |
|
| |
| 243 |
|
| SV* |
| 244 |
|
| getHST (code, uca_vers = 0) |
| 245 |
|
| UV code; |
| 246 |
|
| IV uca_vers; |
| 247 |
|
| PREINIT: |
| 248 |
|
| const char * hangtype; |
| 249 |
|
| STRLEN typelen; |
| 250 |
|
| CODE: |
| 251 |
1198 |
▶ | if (codeRange(Hangul_SIni, Hangul_SFin)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (codeRange(Hangul_SIni, Hangul_SFin)) { |
434 |
764 |
1198 |
| if (codeRange(Hangul_SIni, Hangul_SFin)) { |
111 |
323 |
434 |
|
| 252 |
111 |
▶ | if ((code - Hangul_SBase) % Hangul_TCount) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ((code - Hangul_SBase) % Hangul_TCount) { |
66 |
45 |
111 |
|
| 253 |
66 |
| hangtype = "LVT"; typelen = 3; |
| 254 |
|
| } else { |
| 255 |
45 |
| hangtype = "LV"; typelen = 2; |
| 256 |
|
| } |
| 257 |
1087 |
▶ | } else if (uca_vers < 20) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (uca_vers < 20) { |
270 |
817 |
1087 |
|
| 258 |
270 |
▶ | if (codeRange(Hangul_LIni, Hangul_LFin) || code == Hangul_LFill) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (codeRange(Hangul_LIni, Hangul_LFin) || code == Hangul_LFill) { |
246 |
24 |
270 |
| if (codeRange(Hangul_LIni, Hangul_LFin) || code == Hangul_LFill) { |
228 |
18 |
246 |
| if (codeRange(Hangul_LIni, Hangul_LFin) || code == Hangul_LFill) { |
6 |
246 |
252 |
|
| 259 |
24 |
| hangtype = "L"; typelen = 1; |
| 260 |
246 |
▶ | } else if (codeRange(Hangul_VIni, Hangul_VFin)) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (codeRange(Hangul_VIni, Hangul_VFin)) { |
210 |
36 |
246 |
| } else if (codeRange(Hangul_VIni, Hangul_VFin)) { |
24 |
186 |
210 |
|
| 261 |
24 |
| hangtype = "V"; typelen = 1; |
| 262 |
222 |
▶ | } else if (codeRange(Hangul_TIni, Hangul_TFin)) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (codeRange(Hangul_TIni, Hangul_TFin)) { |
174 |
48 |
222 |
| } else if (codeRange(Hangul_TIni, Hangul_TFin)) { |
24 |
150 |
174 |
|
| 263 |
24 |
| hangtype = "T"; typelen = 1; |
| 264 |
|
| } else { |
| 265 |
198 |
| hangtype = ""; typelen = 0; |
| 266 |
|
| } |
| 267 |
|
| } else { |
| 268 |
817 |
▶ | if (codeRange(Hangul_LIni, Hangul_LEnd) || |
Branch: 3 branches
| Branch | True | False | Total |
| if (codeRange(Hangul_LIni, Hangul_LEnd) || |
755 |
62 |
817 |
| if (codeRange(Hangul_LIni, Hangul_LEnd) || |
602 |
153 |
755 |
| if (codeRange(Hangul_LIni, Hangul_LEnd) || |
286 |
378 |
664 |
|
| 269 |
286 |
▶ | codeRange(HangulL2Ini, HangulL2Fin)) { |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(HangulL2Ini, HangulL2Fin)) { |
39 |
247 |
286 |
|
| 270 |
192 |
| hangtype = "L"; typelen = 1; |
| 271 |
625 |
▶ | } else if (codeRange(Hangul_VIni, Hangul_VEnd) || |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (codeRange(Hangul_VIni, Hangul_VEnd) || |
563 |
62 |
625 |
| } else if (codeRange(Hangul_VIni, Hangul_VEnd) || |
405 |
158 |
563 |
| } else if (codeRange(Hangul_VIni, Hangul_VEnd) || |
195 |
272 |
467 |
|
| 272 |
195 |
▶ | codeRange(HangulV2Ini, HangulV2Fin)) { |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(HangulV2Ini, HangulV2Fin)) { |
39 |
156 |
195 |
|
| 273 |
197 |
| hangtype = "V"; typelen = 1; |
| 274 |
428 |
▶ | } else if (codeRange(Hangul_TIni, Hangul_TEnd) || |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (codeRange(Hangul_TIni, Hangul_TEnd) || |
366 |
62 |
428 |
| } else if (codeRange(Hangul_TIni, Hangul_TEnd) || |
254 |
112 |
366 |
| } else if (codeRange(Hangul_TIni, Hangul_TEnd) || |
130 |
186 |
316 |
|
| 275 |
130 |
▶ | codeRange(HangulT2Ini, HangulT2Fin)) { |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(HangulT2Ini, HangulT2Fin)) { |
39 |
91 |
130 |
|
| 276 |
151 |
| hangtype = "T"; typelen = 1; |
| 277 |
|
| } else { |
| 278 |
277 |
| hangtype = ""; typelen = 0; |
| 279 |
|
| } |
| 280 |
|
| } |
| 281 |
|
| |
| 282 |
1198 |
| RETVAL = newSVpvn(hangtype, typelen); |
| 283 |
|
| OUTPUT: |
| 284 |
|
| RETVAL |
| 285 |
|
| |
| 286 |
|
| |
| 287 |
|
| void |
| 288 |
|
| _derivCE_9 (code) |
| 289 |
|
| UV code |
| 290 |
|
| ALIAS: |
| 291 |
|
| _derivCE_14 = 1 |
| 292 |
|
| _derivCE_18 = 2 |
| 293 |
|
| _derivCE_20 = 3 |
| 294 |
|
| _derivCE_22 = 4 |
| 295 |
|
| _derivCE_24 = 5 |
| 296 |
|
| _derivCE_32 = 6 |
| 297 |
|
| _derivCE_34 = 7 |
| 298 |
|
| _derivCE_36 = 8 |
| 299 |
|
| _derivCE_38 = 9 |
| 300 |
|
| _derivCE_40 = 10 |
| 301 |
|
| _derivCE_43 = 11 |
| 302 |
|
| PREINIT: |
| 303 |
|
| UV base, aaaa, bbbb; |
| 304 |
12743 |
| U8 a[VCE_Length + 1] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
| 305 |
12743 |
| U8 b[VCE_Length + 1] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
| 306 |
12743 |
| bool basic_unified = 0, tangut = 0, nushu = 0, khitan = 0; |
| 307 |
|
| PPCODE: |
| 308 |
12743 |
▶ | if (codeRange(CJK_UidIni, CJK_CompFin)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (codeRange(CJK_UidIni, CJK_CompFin)) { |
9718 |
3025 |
12743 |
| if (codeRange(CJK_UidIni, CJK_CompFin)) { |
6123 |
3595 |
9718 |
|
| 309 |
6123 |
▶ | if (codeRange(CJK_CompIni, CJK_CompFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (codeRange(CJK_CompIni, CJK_CompFin)) |
792 |
5331 |
6123 |
| if (codeRange(CJK_CompIni, CJK_CompFin)) |
792 |
0 |
792 |
|
| 310 |
792 |
| basic_unified = (bool)UnifiedCompat[code - CJK_CompIni]; |
| 311 |
|
| else |
| 312 |
5331 |
▶ | basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
Branch: 8 branches
| Branch | True | False | Total |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
2845 |
2486 |
5331 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
354 |
2132 |
2486 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
127 |
2005 |
2132 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
270 |
1735 |
2005 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
582 |
1153 |
1735 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
296 |
857 |
1153 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
156 |
701 |
857 |
| basic_unified = (ix >= 11 ? (code <= CJK_UidF130) : |
334 |
367 |
701 |
|
| 313 |
|
| ix >= 9 ? (code <= CJK_UidF110) : |
| 314 |
|
| ix == 8 ? (code <= CJK_UidF100) : |
| 315 |
|
| ix >= 6 ? (code <= CJK_UidF80) : |
| 316 |
|
| ix == 5 ? (code <= CJK_UidF61) : |
| 317 |
|
| ix >= 3 ? (code <= CJK_UidF52) : |
| 318 |
|
| ix == 2 ? (code <= CJK_UidF51) : |
| 319 |
|
| ix == 1 ? (code <= CJK_UidF41) : |
| 320 |
|
| (code <= CJK_UidFin)); |
| 321 |
|
| } else { |
| 322 |
6620 |
▶ | if (ix >= 7) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (ix >= 7) { |
3302 |
3318 |
6620 |
|
| 323 |
5353 |
▶ | tangut = (ix >= 11) ? (codeRange(TangIdeoIni, TangIdeo120) || |
Branch: 2 branches
| Branch | True | False | Total |
| tangut = (ix >= 11) ? (codeRange(TangIdeoIni, TangIdeo120) || |
1111 |
28 |
1139 |
| tangut = (ix >= 11) ? (codeRange(TangIdeoIni, TangIdeo120) || |
1108 |
915 |
2023 |
|
| 324 |
5189 |
▶ | codeRange(TangCompIni, TangComp130) || |
Branch: 3 branches
| Branch | True | False | Total |
| codeRange(TangCompIni, TangComp130) || |
1139 |
912 |
2051 |
| codeRange(TangCompIni, TangComp130) || |
1096 |
12 |
1108 |
| codeRange(TangCompIni, TangComp130) || |
1087 |
924 |
2011 |
|
| 325 |
7691 |
▶ | codeRange(TangSuppIni, TangSuppFin)) : |
Branch: 4 branches
| Branch | True | False | Total |
| codeRange(TangSuppIni, TangSuppFin)) : |
2051 |
1251 |
3302 |
| codeRange(TangSuppIni, TangSuppFin)) : |
2 |
1085 |
1087 |
| codeRange(TangSuppIni, TangSuppFin)) : |
496 |
755 |
1251 |
| codeRange(TangSuppIni, TangSuppFin)) : |
248 |
507 |
755 |
|
| 326 |
682 |
▶ | (ix == 10) ? (codeRange(TangIdeoIni, TangIdeo120) || |
Branch: 3 branches
| Branch | True | False | Total |
| (ix == 10) ? (codeRange(TangIdeoIni, TangIdeo120) || |
248 |
248 |
496 |
| (ix == 10) ? (codeRange(TangIdeoIni, TangIdeo120) || |
192 |
56 |
248 |
| (ix == 10) ? (codeRange(TangIdeoIni, TangIdeo120) || |
186 |
254 |
440 |
|
| 327 |
186 |
▶ | codeRange(TangCompIni, TangCompFin)) : |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(TangCompIni, TangCompFin)) : |
20 |
166 |
186 |
|
| 328 |
341 |
▶ | (ix == 9) ? (codeRange(TangIdeoIni, TangIdeo110) || |
Branch: 3 branches
| Branch | True | False | Total |
| (ix == 9) ? (codeRange(TangIdeoIni, TangIdeo110) || |
124 |
124 |
248 |
| (ix == 9) ? (codeRange(TangIdeoIni, TangIdeo110) || |
99 |
25 |
124 |
| (ix == 9) ? (codeRange(TangIdeoIni, TangIdeo110) || |
93 |
130 |
223 |
|
| 329 |
93 |
▶ | codeRange(TangCompIni, TangCompFin)) : |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(TangCompIni, TangCompFin)) : |
10 |
83 |
93 |
|
| 330 |
702 |
▶ | (codeRange(TangIdeoIni, TangIdeoFin) || |
Branch: 3 branches
| Branch | True | False | Total |
| (codeRange(TangIdeoIni, TangIdeoFin) || |
259 |
248 |
507 |
| (codeRange(TangIdeoIni, TangIdeoFin) || |
221 |
38 |
259 |
| (codeRange(TangIdeoIni, TangIdeoFin) || |
195 |
274 |
469 |
|
| 331 |
195 |
▶ | codeRange(TangCompIni, TangCompFin)); |
Branch: 1 branch
| Branch | True | False | Total |
| codeRange(TangCompIni, TangCompFin)); |
22 |
173 |
195 |
|
| 332 |
|
| } |
| 333 |
6620 |
▶ | if (ix >= 8) |
Branch: 1 branch
| Branch | True | False | Total |
| if (ix >= 8) |
3048 |
3572 |
6620 |
|
| 334 |
3048 |
▶ | nushu = (codeRange(NushuIni, NushuFin)); |
Branch: 2 branches
| Branch | True | False | Total |
| nushu = (codeRange(NushuIni, NushuFin)); |
1376 |
1672 |
3048 |
| nushu = (codeRange(NushuIni, NushuFin)); |
69 |
1307 |
1376 |
|
| 335 |
6620 |
▶ | if (ix >= 11) |
Branch: 1 branch
| Branch | True | False | Total |
| if (ix >= 11) |
2051 |
4569 |
6620 |
|
| 336 |
2051 |
▶ | khitan = (codeRange(KhitanIni, KhitanFin)); |
Branch: 2 branches
| Branch | True | False | Total |
| khitan = (codeRange(KhitanIni, KhitanFin)); |
1096 |
955 |
2051 |
| khitan = (codeRange(KhitanIni, KhitanFin)); |
7 |
1089 |
1096 |
|
| 337 |
|
| } |
| 338 |
12743 |
| base = tangut |
| 339 |
28223 |
▶ | ? 0xFB00 : |
Branch: 6 branches
| Branch | True | False | Total |
| ? 0xFB00 : |
213 |
12530 |
12743 |
| ? 0xFB00 : |
69 |
12461 |
12530 |
| ? 0xFB00 : |
7 |
12454 |
12461 |
| ? 0xFB00 : |
4230 |
8224 |
12454 |
| ? 0xFB00 : |
2044 |
6180 |
8224 |
| ? 0xFB00 : |
1486 |
5770 |
7256 |
|
| 340 |
|
| nushu |
| 341 |
|
| ? 0xFB01 : |
| 342 |
|
| khitan |
| 343 |
|
| ? 0xFB02 : |
| 344 |
|
| basic_unified |
| 345 |
|
| ? 0xFB40 : /* CJK */ |
| 346 |
2044 |
▶ | ((ix >= 11 ? codeRange(CJK_ExtAIni, CJK_ExtA130) |
Branch: 2 branches
| Branch | True | False | Total |
| ((ix >= 11 ? codeRange(CJK_ExtAIni, CJK_ExtA130) |
1796 |
248 |
2044 |
| ((ix >= 11 ? codeRange(CJK_ExtAIni, CJK_ExtA130) |
558 |
1238 |
1796 |
|
| 347 |
6180 |
▶ | : codeRange(CJK_ExtAIni, CJK_ExtAFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| : codeRange(CJK_ExtAIni, CJK_ExtAFin)) |
4440 |
1740 |
6180 |
| : codeRange(CJK_ExtAIni, CJK_ExtAFin)) |
410 |
4030 |
4440 |
|
| 348 |
15480 |
▶ | || |
Branch: 4 branches
| Branch | True | False | Total |
| || |
1486 |
558 |
2044 |
| || |
5770 |
410 |
6180 |
| || |
475 |
1011 |
1486 |
| || |
5683 |
87 |
5770 |
|
| 349 |
1486 |
▶ | (ix >= 11 ? codeRange(CJK_ExtBIni, CJK_ExtB130) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 11 ? codeRange(CJK_ExtBIni, CJK_ExtB130) |
1065 |
421 |
1486 |
| (ix >= 11 ? codeRange(CJK_ExtBIni, CJK_ExtB130) |
1011 |
54 |
1065 |
|
| 350 |
5770 |
▶ | : codeRange(CJK_ExtBIni, CJK_ExtBFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| : codeRange(CJK_ExtBIni, CJK_ExtBFin)) |
1063 |
4707 |
5770 |
| : codeRange(CJK_ExtBIni, CJK_ExtBFin)) |
87 |
976 |
1063 |
|
| 351 |
6158 |
▶ | || |
Branch: 1 branch
| Branch | True | False | Total |
| || |
4182 |
1976 |
6158 |
|
| 352 |
4182 |
▶ | (ix >= 3 && codeRange(CJK_ExtCIni, CJK_ExtCFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 3 && codeRange(CJK_ExtCIni, CJK_ExtCFin)) |
632 |
3550 |
4182 |
| (ix >= 3 && codeRange(CJK_ExtCIni, CJK_ExtCFin)) |
580 |
52 |
632 |
|
| 353 |
6106 |
▶ | || |
Branch: 1 branch
| Branch | True | False | Total |
| || |
3785 |
2321 |
6106 |
|
| 354 |
3785 |
▶ | (ix >= 4 && codeRange(CJK_ExtDIni, CJK_ExtDFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 4 && codeRange(CJK_ExtDIni, CJK_ExtDFin)) |
487 |
3298 |
3785 |
| (ix >= 4 && codeRange(CJK_ExtDIni, CJK_ExtDFin)) |
439 |
48 |
487 |
|
| 355 |
6058 |
▶ | || |
Branch: 1 branch
| Branch | True | False | Total |
| || |
1963 |
4095 |
6058 |
|
| 356 |
1963 |
▶ | (ix >= 6 && codeRange(CJK_ExtEIni, CJK_ExtEFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 6 && codeRange(CJK_ExtEIni, CJK_ExtEFin)) |
207 |
1756 |
1963 |
| (ix >= 6 && codeRange(CJK_ExtEIni, CJK_ExtEFin)) |
179 |
28 |
207 |
|
| 357 |
6030 |
▶ | || |
Branch: 1 branch
| Branch | True | False | Total |
| || |
1363 |
4667 |
6030 |
|
| 358 |
1363 |
▶ | (ix >= 8 && codeRange(CJK_ExtFIni, CJK_ExtFFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 8 && codeRange(CJK_ExtFIni, CJK_ExtFFin)) |
107 |
1256 |
1363 |
| (ix >= 8 && codeRange(CJK_ExtFIni, CJK_ExtFFin)) |
87 |
20 |
107 |
|
| 359 |
6010 |
▶ | || |
Branch: 1 branch
| Branch | True | False | Total |
| || |
459 |
5551 |
6010 |
|
| 360 |
459 |
▶ | (ix >= 11 && codeRange(CJK_ExtGIni, CJK_ExtGFin))) |
Branch: 2 branches
| Branch | True | False | Total |
| (ix >= 11 && codeRange(CJK_ExtGIni, CJK_ExtGFin))) |
15 |
444 |
459 |
| (ix >= 11 && codeRange(CJK_ExtGIni, CJK_ExtGFin))) |
4 |
11 |
15 |
|
| 361 |
|
| ? 0xFB80 /* CJK ext. */ |
| 362 |
|
| : 0xFBC0; /* others */ |
| 363 |
12743 |
▶ | aaaa = tangut || nushu || khitan ? base : base + (code >> 15); |
Branch: 3 branches
| Branch | True | False | Total |
| aaaa = tangut || nushu || khitan ? base : base + (code >> 15); |
12530 |
213 |
12743 |
| aaaa = tangut || nushu || khitan ? base : base + (code >> 15); |
12461 |
69 |
12530 |
| aaaa = tangut || nushu || khitan ? base : base + (code >> 15); |
12454 |
7 |
12461 |
|
| 364 |
12956 |
| bbbb = (tangut ? (code - TangIdeoIni) : |
| 365 |
69 |
| nushu ? (code - NushuIni) : |
| 366 |
12743 |
▶ | khitan ? (code - KhitanIni) : (code & 0x7FFF)) | 0x8000; |
Branch: 3 branches
| Branch | True | False | Total |
| khitan ? (code - KhitanIni) : (code & 0x7FFF)) | 0x8000; |
213 |
12530 |
12743 |
| khitan ? (code - KhitanIni) : (code & 0x7FFF)) | 0x8000; |
69 |
12461 |
12530 |
| khitan ? (code - KhitanIni) : (code & 0x7FFF)) | 0x8000; |
7 |
12454 |
12461 |
|
| 367 |
12743 |
| a[1] = (U8)(aaaa >> 8); |
| 368 |
12743 |
| a[2] = (U8)(aaaa & 0xFF); |
| 369 |
12743 |
| b[1] = (U8)(bbbb >> 8); |
| 370 |
12743 |
| b[2] = (U8)(bbbb & 0xFF); |
| 371 |
12743 |
| a[4] = (U8)(0x20); /* second octet of level 2 */ |
| 372 |
12743 |
| a[6] = (U8)(0x02); /* second octet of level 3 */ |
| 373 |
12743 |
| a[7] = b[7] = (U8)(code >> 8); |
| 374 |
12743 |
| a[8] = b[8] = (U8)(code & 0xFF); |
| 375 |
12743 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
12743 |
12743 |
|
| 376 |
12743 |
| PUSHs(sv_2mortal(newSVpvn((char *) a, VCE_Length))); |
| 377 |
12743 |
| PUSHs(sv_2mortal(newSVpvn((char *) b, VCE_Length))); |
| 378 |
|
| |
| 379 |
|
| |
| 380 |
|
| void |
| 381 |
|
| _derivCE_8 (code) |
| 382 |
|
| UV code |
| 383 |
|
| PREINIT: |
| 384 |
|
| UV aaaa, bbbb; |
| 385 |
495 |
| U8 a[VCE_Length + 1] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
| 386 |
495 |
| U8 b[VCE_Length + 1] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
| 387 |
|
| PPCODE: |
| 388 |
495 |
| aaaa = 0xFF80 + (code >> 15); |
| 389 |
495 |
| bbbb = (code & 0x7FFF) | 0x8000; |
| 390 |
495 |
| a[1] = (U8)(aaaa >> 8); |
| 391 |
495 |
| a[2] = (U8)(aaaa & 0xFF); |
| 392 |
495 |
| b[1] = (U8)(bbbb >> 8); |
| 393 |
495 |
| b[2] = (U8)(bbbb & 0xFF); |
| 394 |
495 |
| a[4] = (U8)(0x02); /* second octet of level 2 */ |
| 395 |
495 |
| a[6] = (U8)(0x01); /* second octet of level 3 */ |
| 396 |
495 |
| a[7] = b[7] = (U8)(code >> 8); |
| 397 |
495 |
| a[8] = b[8] = (U8)(code & 0xFF); |
| 398 |
495 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
495 |
495 |
|
| 399 |
495 |
| PUSHs(sv_2mortal(newSVpvn((char *) a, VCE_Length))); |
| 400 |
495 |
| PUSHs(sv_2mortal(newSVpvn((char *) b, VCE_Length))); |
| 401 |
|
| |
| 402 |
|
| |
| 403 |
|
| void |
| 404 |
|
| _uideoCE_8 (code) |
| 405 |
|
| UV code |
| 406 |
|
| PREINIT: |
| 407 |
96 |
| U8 uice[VCE_Length + 1] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
| 408 |
|
| PPCODE: |
| 409 |
96 |
| uice[1] = uice[7] = (U8)(code >> 8); |
| 410 |
96 |
| uice[2] = uice[8] = (U8)(code & 0xFF); |
| 411 |
96 |
| uice[4] = (U8)(0x20); /* second octet of level 2 */ |
| 412 |
96 |
| uice[6] = (U8)(0x02); /* second octet of level 3 */ |
| 413 |
96 |
| PUSHs(sv_2mortal(newSVpvn((char *) uice, VCE_Length))); |
| 414 |
|
| |
| 415 |
|
| |
| 416 |
|
| SV* |
| 417 |
|
| _isUIdeo (code, uca_vers) |
| 418 |
|
| UV code; |
| 419 |
|
| IV uca_vers; |
| 420 |
|
| bool basic_unified = 0; |
| 421 |
|
| CODE: |
| 422 |
|
| /* uca_vers = 0 for _uideoCE_8() */ |
| 423 |
14307 |
▶ | if (CJK_UidIni <= code) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (CJK_UidIni <= code) { |
13119 |
1188 |
14307 |
|
| 424 |
13119 |
▶ | if (codeRange(CJK_CompIni, CJK_CompFin)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (codeRange(CJK_CompIni, CJK_CompFin)) |
2164 |
10955 |
13119 |
| if (codeRange(CJK_CompIni, CJK_CompFin)) |
576 |
1588 |
2164 |
|
| 425 |
576 |
| basic_unified = (bool)UnifiedCompat[code - CJK_CompIni]; |
| 426 |
|
| else |
| 427 |
12543 |
▶ | basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
Branch: 8 branches
| Branch | True | False | Total |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
10160 |
2383 |
12543 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
342 |
2041 |
2383 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
114 |
1927 |
2041 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
228 |
1699 |
1927 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
456 |
1243 |
1699 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
228 |
1015 |
1243 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
114 |
901 |
1015 |
| basic_unified = (uca_vers >= 43 ? (code <= CJK_UidF130) : |
228 |
673 |
901 |
|
| 428 |
|
| uca_vers >= 38 ? (code <= CJK_UidF110) : |
| 429 |
|
| uca_vers >= 36 ? (code <= CJK_UidF100) : |
| 430 |
|
| uca_vers >= 32 ? (code <= CJK_UidF80) : |
| 431 |
|
| uca_vers >= 24 ? (code <= CJK_UidF61) : |
| 432 |
|
| uca_vers >= 20 ? (code <= CJK_UidF52) : |
| 433 |
|
| uca_vers >= 18 ? (code <= CJK_UidF51) : |
| 434 |
|
| uca_vers >= 14 ? (code <= CJK_UidF41) : |
| 435 |
|
| (code <= CJK_UidFin)); |
| 436 |
|
| } |
| 437 |
14307 |
▶ | RETVAL = boolSV( |
Branch: 27 branches
| Branch | True | False | Total |
| RETVAL = boolSV( |
4081 |
10226 |
14307 |
| RETVAL = boolSV( |
3550 |
531 |
4081 |
| RETVAL = boolSV( |
2937 |
613 |
3550 |
| RETVAL = boolSV( |
999 |
2469 |
3468 |
| RETVAL = boolSV( |
951 |
48 |
999 |
| RETVAL = boolSV( |
949 |
2 |
951 |
| RETVAL = boolSV( |
3051 |
415 |
3466 |
| RETVAL = boolSV( |
1388 |
1663 |
3051 |
| RETVAL = boolSV( |
456 |
932 |
1388 |
| RETVAL = boolSV( |
101 |
2433 |
2534 |
| RETVAL = boolSV( |
24 |
77 |
101 |
| RETVAL = boolSV( |
22 |
2 |
24 |
| RETVAL = boolSV( |
1305 |
1227 |
2532 |
| RETVAL = boolSV( |
260 |
1045 |
1305 |
| RETVAL = boolSV( |
234 |
26 |
260 |
| RETVAL = boolSV( |
1168 |
1338 |
2506 |
| RETVAL = boolSV( |
192 |
976 |
1168 |
| RETVAL = boolSV( |
168 |
24 |
192 |
| RETVAL = boolSV( |
611 |
1871 |
2482 |
| RETVAL = boolSV( |
84 |
527 |
611 |
| RETVAL = boolSV( |
70 |
14 |
84 |
| RETVAL = boolSV( |
409 |
2059 |
2468 |
| RETVAL = boolSV( |
40 |
369 |
409 |
| RETVAL = boolSV( |
30 |
10 |
40 |
| RETVAL = boolSV( |
91 |
2367 |
2458 |
| RETVAL = boolSV( |
4 |
87 |
91 |
| RETVAL = boolSV( |
2 |
2 |
4 |
|
| 438 |
|
| (basic_unified) |
| 439 |
|
| || |
| 440 |
|
| (codeRange(CJK_ExtAIni, CJK_ExtAFin)) |
| 441 |
|
| || |
| 442 |
|
| (uca_vers >= 43 && codeRange(CJK_ExtAIni, CJK_ExtA130)) |
| 443 |
|
| || |
| 444 |
|
| (uca_vers >= 8 && codeRange(CJK_ExtBIni, CJK_ExtBFin)) |
| 445 |
|
| || |
| 446 |
|
| (uca_vers >= 43 && codeRange(CJK_ExtBIni, CJK_ExtB130)) |
| 447 |
|
| || |
| 448 |
|
| (uca_vers >= 20 && codeRange(CJK_ExtCIni, CJK_ExtCFin)) |
| 449 |
|
| || |
| 450 |
|
| (uca_vers >= 22 && codeRange(CJK_ExtDIni, CJK_ExtDFin)) |
| 451 |
|
| || |
| 452 |
|
| (uca_vers >= 32 && codeRange(CJK_ExtEIni, CJK_ExtEFin)) |
| 453 |
|
| || |
| 454 |
|
| (uca_vers >= 36 && codeRange(CJK_ExtFIni, CJK_ExtFFin)) |
| 455 |
|
| || |
| 456 |
|
| (uca_vers >= 43 && codeRange(CJK_ExtGIni, CJK_ExtGFin)) |
| 457 |
|
| ); |
| 458 |
|
| OUTPUT: |
| 459 |
|
| RETVAL |
| 460 |
|
| |
| 461 |
|
| |
| 462 |
|
| SV* |
| 463 |
|
| mk_SortKey (self, buf) |
| 464 |
|
| SV* self; |
| 465 |
|
| SV* buf; |
| 466 |
|
| PREINIT: |
| 467 |
|
| SV *dst, **svp; |
| 468 |
|
| STRLEN dlen, vlen; |
| 469 |
|
| U8 *d, *p, *e, *v, *s[MaxLevel], *eachlevel[MaxLevel]; |
| 470 |
|
| AV *bufAV; |
| 471 |
|
| HV *selfHV; |
| 472 |
|
| UV back_flag; |
| 473 |
|
| I32 i, buf_len; |
| 474 |
|
| IV lv, level, uca_vers; |
| 475 |
|
| bool upper_lower, kata_hira, v2i, last_is_var; |
| 476 |
|
| CODE: |
| 477 |
59153 |
▶ | if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
59153 |
0 |
59153 |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
59153 |
0 |
59153 |
|
| 478 |
59153 |
| selfHV = (HV*)SvRV(self); |
| 479 |
|
| else |
| 480 |
0 |
| croak("$self is not a HASHREF."); |
| 481 |
|
| |
| 482 |
59153 |
▶ | if (SvROK(buf) && SvTYPE(SvRV(buf)) == SVt_PVAV) |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(buf) && SvTYPE(SvRV(buf)) == SVt_PVAV) |
59153 |
0 |
59153 |
| if (SvROK(buf) && SvTYPE(SvRV(buf)) == SVt_PVAV) |
59153 |
0 |
59153 |
|
| 483 |
59153 |
| bufAV = (AV*)SvRV(buf); |
| 484 |
|
| else |
| 485 |
0 |
| croak("XSUB, not an ARRAYREF."); |
| 486 |
|
| |
| 487 |
59153 |
| buf_len = av_len(bufAV); |
| 488 |
|
| |
| 489 |
59153 |
▶ | if (buf_len < 0) { /* empty: -1 */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (buf_len < 0) { /* empty: -1 */ |
2241 |
56912 |
59153 |
|
| 490 |
2241 |
| dlen = 2 * (MaxLevel - 1); |
| 491 |
2241 |
| dst = newSV(dlen); |
| 492 |
2241 |
| (void)SvPOK_only(dst); |
| 493 |
2241 |
| d = (U8*)SvPVX(dst); |
| 494 |
15687 |
▶ | while (dlen--) |
Branch: 1 branch
| Branch | True | False | Total |
| while (dlen--) |
13446 |
2241 |
15687 |
|
| 495 |
13446 |
| *d++ = '\0'; |
| 496 |
|
| } else { |
| 497 |
56912 |
| svp = hv_fetch(selfHV, "level", 5, FALSE); |
| 498 |
56912 |
▶ | level = svp ? SvIV(*svp) : MaxLevel; |
Branch: 1 branch
| Branch | True | False | Total |
| level = svp ? SvIV(*svp) : MaxLevel; |
56912 |
0 |
56912 |
|
| 499 |
|
| |
| 500 |
218319 |
▶ | for (lv = 0; lv < level; lv++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = 0; lv < level; lv++) { |
161407 |
56912 |
218319 |
|
| 501 |
161407 |
| New(0, eachlevel[lv], 2 * (1 + buf_len) + 1, U8); |
| 502 |
161407 |
| s[lv] = eachlevel[lv]; |
| 503 |
|
| } |
| 504 |
|
| |
| 505 |
56912 |
| svp = hv_fetch(selfHV, "upper_before_lower", 18, FALSE); |
| 506 |
56912 |
▶ | upper_lower = svp ? SvTRUE(*svp) : FALSE; |
Branch: 2 branches
| Branch | True | False | Total |
| upper_lower = svp ? SvTRUE(*svp) : FALSE; |
2430 |
54482 |
56912 |
| upper_lower = svp ? SvTRUE(*svp) : FALSE; |
1855 |
575 |
2430 |
|
| 507 |
56912 |
| svp = hv_fetch(selfHV, "katakana_before_hiragana", 24, FALSE); |
| 508 |
56912 |
▶ | kata_hira = svp ? SvTRUE(*svp) : FALSE; |
Branch: 2 branches
| Branch | True | False | Total |
| kata_hira = svp ? SvTRUE(*svp) : FALSE; |
453 |
56459 |
56912 |
| kata_hira = svp ? SvTRUE(*svp) : FALSE; |
236 |
217 |
453 |
|
| 509 |
56912 |
| svp = hv_fetch(selfHV, "UCA_Version", 11, FALSE); |
| 510 |
56912 |
| uca_vers = SvIV(*svp); |
| 511 |
56912 |
| svp = hv_fetch(selfHV, "variable", 8, FALSE); |
| 512 |
56305 |
▶ | v2i = uca_vers >= 9 && svp /* (vers >= 9) and not (non-ignorable) */ |
Branch: 1 branch
| Branch | True | False | Total |
| v2i = uca_vers >= 9 && svp /* (vers >= 9) and not (non-ignorable) */ |
56305 |
0 |
56305 |
|
| 513 |
2552 |
▶ | ? !(SvCUR(*svp) == 13 && memEQ(SvPVX(*svp), "non-ignorable", 13)) |
Branch: 1 branch
| Branch | True | False | Total |
| ? !(SvCUR(*svp) == 13 && memEQ(SvPVX(*svp), "non-ignorable", 13)) |
59 |
2493 |
2552 |
|
| 514 |
115769 |
▶ | : FALSE; |
Branch: 2 branches
| Branch | True | False | Total |
| : FALSE; |
56305 |
607 |
56912 |
| : FALSE; |
2552 |
53753 |
56305 |
|
| 515 |
|
| |
| 516 |
56912 |
| last_is_var = FALSE; |
| 517 |
157511 |
▶ | for (i = 0; i <= buf_len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= buf_len; i++) { |
100599 |
56912 |
157511 |
|
| 518 |
100599 |
| svp = av_fetch(bufAV, i, FALSE); |
| 519 |
|
| |
| 520 |
100599 |
▶ | if (svp && SvPOK(*svp)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvPOK(*svp)) |
100599 |
0 |
100599 |
| if (svp && SvPOK(*svp)) |
100599 |
0 |
100599 |
|
| 521 |
201198 |
| v = (U8*)SvPV(*svp, vlen); |
| 522 |
|
| else |
| 523 |
0 |
| croak("not a vwt."); |
| 524 |
|
| |
| 525 |
100599 |
▶ | if (vlen < VCE_Length) /* ignore short VCE (unexpected) */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (vlen < VCE_Length) /* ignore short VCE (unexpected) */ |
0 |
100599 |
100599 |
|
| 526 |
0 |
| continue; |
| 527 |
|
| |
| 528 |
|
| /* "Ignorable (L1, L2) after Variable" since track. v. 9 */ |
| 529 |
100599 |
▶ | if (v2i) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (v2i) { |
93608 |
6991 |
100599 |
|
| 530 |
93608 |
▶ | if (*v) |
Branch: 1 branch
| Branch | True | False | Total |
| if (*v) |
1777 |
91831 |
93608 |
|
| 531 |
1777 |
| last_is_var = TRUE; |
| 532 |
91831 |
▶ | else if (v[1] || v[2]) /* non zero primary weight */ |
Branch: 2 branches
| Branch | True | False | Total |
| else if (v[1] || v[2]) /* non zero primary weight */ |
7511 |
84320 |
91831 |
| else if (v[1] || v[2]) /* non zero primary weight */ |
212 |
7299 |
7511 |
|
| 533 |
84532 |
| last_is_var = FALSE; |
| 534 |
7299 |
▶ | else if (last_is_var) /* zero primary weight; skipped */ |
Branch: 1 branch
| Branch | True | False | Total |
| else if (last_is_var) /* zero primary weight; skipped */ |
43 |
7256 |
7299 |
|
| 535 |
43 |
| continue; |
| 536 |
|
| } |
| 537 |
|
| |
| 538 |
100556 |
▶ | if (v[5] == 0) { /* tert wt < 256 */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (v[5] == 0) { /* tert wt < 256 */ |
100556 |
0 |
100556 |
|
| 539 |
100556 |
▶ | if (upper_lower) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (upper_lower) { |
4279 |
96277 |
100556 |
|
| 540 |
4279 |
▶ | if (0x8 <= v[6] && v[6] <= 0xC) /* lower */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (0x8 <= v[6] && v[6] <= 0xC) /* lower */ |
832 |
3447 |
4279 |
| if (0x8 <= v[6] && v[6] <= 0xC) /* lower */ |
571 |
261 |
832 |
|
| 541 |
571 |
| v[6] -= 6; |
| 542 |
3708 |
▶ | else if (0x2 <= v[6] && v[6] <= 0x6) /* upper */ |
Branch: 2 branches
| Branch | True | False | Total |
| else if (0x2 <= v[6] && v[6] <= 0x6) /* upper */ |
2635 |
1073 |
3708 |
| else if (0x2 <= v[6] && v[6] <= 0x6) /* upper */ |
2102 |
533 |
2635 |
|
| 543 |
2102 |
| v[6] += 6; |
| 544 |
1606 |
▶ | else if (v[6] == 0x1C) /* square upper */ |
Branch: 1 branch
| Branch | True | False | Total |
| else if (v[6] == 0x1C) /* square upper */ |
57 |
1549 |
1606 |
|
| 545 |
57 |
| v[6]++; |
| 546 |
1549 |
▶ | else if (v[6] == 0x1D) /* square lower */ |
Branch: 1 branch
| Branch | True | False | Total |
| else if (v[6] == 0x1D) /* square lower */ |
61 |
1488 |
1549 |
|
| 547 |
61 |
| v[6]--; |
| 548 |
|
| } |
| 549 |
100556 |
▶ | if (kata_hira) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (kata_hira) { |
378 |
100178 |
100556 |
|
| 550 |
378 |
▶ | if (0x0F <= v[6] && v[6] <= 0x13) /* katakana */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (0x0F <= v[6] && v[6] <= 0x13) /* katakana */ |
202 |
176 |
378 |
| if (0x0F <= v[6] && v[6] <= 0x13) /* katakana */ |
202 |
0 |
202 |
|
| 551 |
202 |
| v[6] -= 2; |
| 552 |
176 |
▶ | else if (0xD <= v[6] && v[6] <= 0xE) /* hiragana */ |
Branch: 2 branches
| Branch | True | False | Total |
| else if (0xD <= v[6] && v[6] <= 0xE) /* hiragana */ |
30 |
146 |
176 |
| else if (0xD <= v[6] && v[6] <= 0xE) /* hiragana */ |
30 |
0 |
30 |
|
| 553 |
30 |
| v[6] += 5; |
| 554 |
|
| } |
| 555 |
|
| } |
| 556 |
|
| |
| 557 |
394173 |
▶ | for (lv = 0; lv < level; lv++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = 0; lv < level; lv++) { |
293617 |
100556 |
394173 |
|
| 558 |
293617 |
▶ | if (v[2 * lv + 1] || v[2 * lv + 2]) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (v[2 * lv + 1] || v[2 * lv + 2]) { |
182863 |
110754 |
293617 |
| if (v[2 * lv + 1] || v[2 * lv + 2]) { |
131159 |
51704 |
182863 |
|
| 559 |
241913 |
| *s[lv]++ = v[2 * lv + 1]; |
| 560 |
241913 |
| *s[lv]++ = v[2 * lv + 2]; |
| 561 |
|
| } |
| 562 |
|
| } |
| 563 |
|
| } |
| 564 |
|
| |
| 565 |
56912 |
| dlen = 2 * (MaxLevel - 1); |
| 566 |
218319 |
▶ | for (lv = 0; lv < level; lv++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = 0; lv < level; lv++) |
161407 |
56912 |
218319 |
|
| 567 |
161407 |
| dlen += s[lv] - eachlevel[lv]; |
| 568 |
|
| |
| 569 |
56912 |
| dst = newSV(dlen); |
| 570 |
56912 |
| (void)SvPOK_only(dst); |
| 571 |
56912 |
| d = (U8*)SvPVX(dst); |
| 572 |
|
| |
| 573 |
56912 |
| svp = hv_fetch(selfHV, "backwardsFlag", 13, FALSE); |
| 574 |
56912 |
▶ | back_flag = svp ? SvUV(*svp) : (UV)0; |
Branch: 1 branch
| Branch | True | False | Total |
| back_flag = svp ? SvUV(*svp) : (UV)0; |
56912 |
0 |
56912 |
|
| 575 |
|
| |
| 576 |
218319 |
▶ | for (lv = 0; lv < level; lv++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = 0; lv < level; lv++) { |
161407 |
56912 |
218319 |
|
| 577 |
161407 |
▶ | if (back_flag & (1 << (lv + 1))) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (back_flag & (1 << (lv + 1))) { |
381 |
161026 |
161407 |
|
| 578 |
381 |
| p = s[lv]; |
| 579 |
381 |
| e = eachlevel[lv]; |
| 580 |
2520 |
▶ | for ( ; e < p; p -= 2) { |
Branch: 1 branch
| Branch | True | False | Total |
| for ( ; e < p; p -= 2) { |
2139 |
381 |
2520 |
|
| 581 |
2139 |
| *d++ = p[-2]; |
| 582 |
2139 |
| *d++ = p[-1]; |
| 583 |
|
| } |
| 584 |
|
| } |
| 585 |
|
| else { |
| 586 |
161026 |
| p = eachlevel[lv]; |
| 587 |
161026 |
| e = s[lv]; |
| 588 |
640574 |
▶ | while (p < e) |
Branch: 1 branch
| Branch | True | False | Total |
| while (p < e) |
479548 |
161026 |
640574 |
|
| 589 |
479548 |
| *d++ = *p++; |
| 590 |
|
| } |
| 591 |
161407 |
▶ | if (lv + 1 < MaxLevel) { /* lv + 1 == real level */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (lv + 1 < MaxLevel) { /* lv + 1 == real level */ |
149270 |
12137 |
161407 |
|
| 592 |
149270 |
| *d++ = '\0'; |
| 593 |
149270 |
| *d++ = '\0'; |
| 594 |
|
| } |
| 595 |
|
| } |
| 596 |
|
| |
| 597 |
123153 |
▶ | for (lv = level; lv < MaxLevel; lv++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = level; lv < MaxLevel; lv++) { |
66241 |
56912 |
123153 |
|
| 598 |
66241 |
▶ | if (lv + 1 < MaxLevel) { /* lv + 1 == real level */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (lv + 1 < MaxLevel) { /* lv + 1 == real level */ |
21466 |
44775 |
66241 |
|
| 599 |
21466 |
| *d++ = '\0'; |
| 600 |
21466 |
| *d++ = '\0'; |
| 601 |
|
| } |
| 602 |
|
| } |
| 603 |
|
| |
| 604 |
218319 |
▶ | for (lv = 0; lv < level; lv++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (lv = 0; lv < level; lv++) { |
161407 |
56912 |
218319 |
|
| 605 |
161407 |
| Safefree(eachlevel[lv]); |
| 606 |
|
| } |
| 607 |
|
| } |
| 608 |
59153 |
| *d = '\0'; |
| 609 |
59153 |
| SvCUR_set(dst, d - (U8*)SvPVX(dst)); |
| 610 |
59153 |
| RETVAL = dst; |
| 611 |
|
| OUTPUT: |
| 612 |
|
| RETVAL |
| 613 |
|
| |
| 614 |
|
| |
| 615 |
|
| SV* |
| 616 |
|
| varCE (self, vce) |
| 617 |
|
| SV* self; |
| 618 |
|
| SV* vce; |
| 619 |
|
| PREINIT: |
| 620 |
|
| SV *dst, *vbl, **svp; |
| 621 |
|
| HV *selfHV; |
| 622 |
|
| U8 *a, *v, *d; |
| 623 |
|
| STRLEN alen, vlen; |
| 624 |
|
| bool ig_l2; |
| 625 |
|
| IV uca_vers; |
| 626 |
|
| UV totwt; |
| 627 |
|
| CODE: |
| 628 |
102824 |
▶ | if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
102824 |
0 |
102824 |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
102824 |
0 |
102824 |
|
| 629 |
102824 |
| selfHV = (HV*)SvRV(self); |
| 630 |
|
| else |
| 631 |
0 |
| croak("$self is not a HASHREF."); |
| 632 |
|
| |
| 633 |
102824 |
| svp = hv_fetch(selfHV, "ignore_level2", 13, FALSE); |
| 634 |
102824 |
▶ | ig_l2 = svp ? SvTRUE(*svp) : FALSE; |
Branch: 2 branches
| Branch | True | False | Total |
| ig_l2 = svp ? SvTRUE(*svp) : FALSE; |
897 |
101927 |
102824 |
| ig_l2 = svp ? SvTRUE(*svp) : FALSE; |
495 |
402 |
897 |
|
| 635 |
|
| |
| 636 |
102824 |
| svp = hv_fetch(selfHV, "variable", 8, FALSE); |
| 637 |
102824 |
▶ | vbl = svp ? *svp : &PL_sv_no; |
Branch: 1 branch
| Branch | True | False | Total |
| vbl = svp ? *svp : &PL_sv_no; |
102824 |
0 |
102824 |
|
| 638 |
102824 |
▶ | a = (U8*)SvPV(vbl, alen); |
Branch: 1 branch
| Branch | True | False | Total |
| a = (U8*)SvPV(vbl, alen); |
102824 |
0 |
102824 |
|
| 639 |
102824 |
| v = (U8*)SvPV(vce, vlen); |
| 640 |
|
| |
| 641 |
102824 |
| dst = newSV(vlen); |
| 642 |
102824 |
| d = (U8*)SvPVX(dst); |
| 643 |
102824 |
| (void)SvPOK_only(dst); |
| 644 |
102824 |
| Copy(v, d, vlen, U8); |
| 645 |
102824 |
| SvCUR_set(dst, vlen); |
| 646 |
102824 |
| d[vlen] = '\0'; |
| 647 |
|
| |
| 648 |
|
| /* primary weight == 0 && secondary weight != 0 */ |
| 649 |
102824 |
▶ | if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
Branch: 5 branches
| Branch | True | False | Total |
| if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
495 |
102329 |
102824 |
| if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
21 |
474 |
495 |
| if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
21 |
0 |
21 |
| if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
19 |
2 |
21 |
| if (ig_l2 && !d[1] && !d[2] && (d[3] || d[4])) { |
19 |
0 |
19 |
|
| 650 |
21 |
| d[3] = d[4] = d[5] = d[6] = '\0'; |
| 651 |
|
| } |
| 652 |
|
| |
| 653 |
|
| /* variable: checked only the first char and the length, |
| 654 |
|
| trusting checkCollator() and %VariableOK in Perl ... */ |
| 655 |
|
| |
| 656 |
102824 |
▶ | if (vlen >= VCE_Length && *a != 'n') { |
Branch: 2 branches
| Branch | True | False | Total |
| if (vlen >= VCE_Length && *a != 'n') { |
102824 |
0 |
102824 |
| if (vlen >= VCE_Length && *a != 'n') { |
97080 |
5744 |
102824 |
|
| 657 |
97080 |
▶ | if (*v) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (*v) { |
2124 |
94956 |
97080 |
|
| 658 |
2124 |
▶ | if (*a == 's') { /* shifted or shift-trimmed */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (*a == 's') { /* shifted or shift-trimmed */ |
2064 |
60 |
2124 |
|
| 659 |
2064 |
| d[7] = d[1]; /* wt level 1 to 4 */ |
| 660 |
2064 |
| d[8] = d[2]; |
| 661 |
|
| } /* else blanked */ |
| 662 |
2124 |
| d[1] = d[2] = d[3] = d[4] = d[5] = d[6] = '\0'; |
| 663 |
94956 |
▶ | } else if (*a == 's') { /* shifted or shift-trimmed */ |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (*a == 's') { /* shifted or shift-trimmed */ |
94736 |
220 |
94956 |
|
| 664 |
94736 |
| totwt = d[1] + d[2] + d[3] + d[4] + d[5] + d[6]; |
| 665 |
94736 |
▶ | if (alen == 7 && totwt != 0) { /* shifted */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (alen == 7 && totwt != 0) { /* shifted */ |
94538 |
198 |
94736 |
| if (alen == 7 && totwt != 0) { /* shifted */ |
94517 |
21 |
94538 |
|
| 666 |
94517 |
▶ | if (d[1] == 0 && d[2] == 1) { /* XXX: CollationAuxiliary-6.2.0 */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (d[1] == 0 && d[2] == 1) { /* XXX: CollationAuxiliary-6.2.0 */ |
7654 |
86863 |
94517 |
| if (d[1] == 0 && d[2] == 1) { /* XXX: CollationAuxiliary-6.2.0 */ |
66 |
7588 |
7654 |
|
| 667 |
66 |
| d[7] = d[1]; /* wt level 1 to 4 */ |
| 668 |
66 |
| d[8] = d[2]; |
| 669 |
|
| } else { |
| 670 |
94451 |
| svp = hv_fetch(selfHV, "UCA_Version", 11, FALSE); |
| 671 |
94451 |
▶ | if (!svp) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!svp) |
0 |
94451 |
94451 |
|
| 672 |
0 |
| croak("Panic: no $self->{UCA_Version} in varCE"); |
| 673 |
94451 |
| uca_vers = SvIV(*svp); |
| 674 |
|
| |
| 675 |
|
| /* completely ignorable or the second derived CE */ |
| 676 |
94451 |
▶ | if (uca_vers >= 36 && d[3] + d[4] + d[5] + d[6] == 0) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (uca_vers >= 36 && d[3] + d[4] + d[5] + d[6] == 0) { |
78164 |
16287 |
94451 |
| if (uca_vers >= 36 && d[3] + d[4] + d[5] + d[6] == 0) { |
11629 |
66535 |
78164 |
|
| 677 |
11629 |
| d[7] = d[8] = '\0'; |
| 678 |
|
| } else { |
| 679 |
82822 |
| d[7] = (U8)(Shift4Wt >> 8); |
| 680 |
82822 |
| d[8] = (U8)(Shift4Wt & 0xFF); |
| 681 |
|
| } |
| 682 |
|
| } |
| 683 |
|
| } else { /* shift-trimmed or completely ignorable */ |
| 684 |
219 |
| d[7] = d[8] = '\0'; |
| 685 |
|
| } |
| 686 |
|
| } /* else blanked */ |
| 687 |
|
| } /* else non-ignorable */ |
| 688 |
102824 |
| RETVAL = dst; |
| 689 |
|
| OUTPUT: |
| 690 |
|
| RETVAL |
| 691 |
|
| |
| 692 |
|
| |
| 693 |
|
| |
| 694 |
|
| SV* |
| 695 |
|
| visualizeSortKey (self, key) |
| 696 |
|
| SV * self |
| 697 |
|
| SV * key |
| 698 |
|
| PREINIT: |
| 699 |
|
| HV *selfHV; |
| 700 |
|
| SV **svp, *dst; |
| 701 |
|
| U8 *s, *e, *d; |
| 702 |
|
| STRLEN klen, dlen; |
| 703 |
|
| UV uv; |
| 704 |
258 |
| IV uca_vers, sep = 0; |
| 705 |
258 |
| const char *upperhex = "0123456789ABCDEF"; |
| 706 |
|
| CODE: |
| 707 |
258 |
▶ | if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
258 |
0 |
258 |
| if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) |
258 |
0 |
258 |
|
| 708 |
258 |
| selfHV = (HV*)SvRV(self); |
| 709 |
|
| else |
| 710 |
0 |
| croak("$self is not a HASHREF."); |
| 711 |
|
| |
| 712 |
258 |
| svp = hv_fetch(selfHV, "UCA_Version", 11, FALSE); |
| 713 |
258 |
▶ | if (!svp) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!svp) |
0 |
258 |
258 |
|
| 714 |
0 |
| croak("Panic: no $self->{UCA_Version} in visualizeSortKey"); |
| 715 |
258 |
| uca_vers = SvIV(*svp); |
| 716 |
|
| |
| 717 |
258 |
| s = (U8*)SvPV(key, klen); |
| 718 |
|
| |
| 719 |
|
| /* slightly *longer* than the need, but I'm afraid of miscounting; |
| 720 |
|
| = (klen / 2) * 5 - 1 |
| 721 |
|
| # FFFF and ' ' for each 16bit units but ' ' is less by 1; |
| 722 |
|
| # ' ' and '|' for level boundaries including the identical level |
| 723 |
|
| + 2 # '[' and ']' |
| 724 |
|
| + 1 # '\0' |
| 725 |
|
| (a) if klen is odd (not expected), maybe more 5 bytes. |
| 726 |
258 |
| (b) there is not always the identical level. |
| 727 |
258 |
| */ |
| 728 |
258 |
| dlen = (klen / 2) * 5 + MaxLevel * 2 + 2; |
| 729 |
258 |
| dst = newSV(dlen); |
| 730 |
|
| (void)SvPOK_only(dst); |
| 731 |
258 |
| d = (U8*)SvPVX(dst); |
| 732 |
2708 |
▶ | |
Branch: 1 branch
| Branch | True | False | Total |
|
2450 |
258 |
2708 |
|
| 733 |
2450 |
| *d++ = '['; |
| 734 |
2450 |
▶ | for (e = s + klen; s < e; s += 2) { |
Branch: 2 branches
| Branch | True | False | Total |
| for (e = s + klen; s < e; s += 2) { |
874 |
1576 |
2450 |
| for (e = s + klen; s < e; s += 2) { |
25 |
849 |
874 |
|
| 735 |
1601 |
▶ | uv = (U16)(*s << 8 | s[1]); |
Branch: 3 branches
| Branch | True | False | Total |
| uv = (U16)(*s << 8 | s[1]); |
1362 |
239 |
1601 |
| uv = (U16)(*s << 8 | s[1]); |
115 |
1247 |
1362 |
| uv = (U16)(*s << 8 | s[1]); |
51 |
64 |
115 |
|
| 736 |
1298 |
| if (uv || sep >= MaxLevel) { |
| 737 |
1601 |
| if ((d[-1] != '[') && ((9 <= uca_vers) || (d[-1] != '|'))) |
| 738 |
1601 |
| *d++ = ' '; |
| 739 |
1601 |
| *d++ = upperhex[ (s[0] >> 4) & 0xF ]; |
| 740 |
1601 |
| *d++ = upperhex[ s[0] & 0xF ]; |
| 741 |
|
| *d++ = upperhex[ (s[1] >> 4) & 0xF ]; |
| 742 |
849 |
▶ | *d++ = upperhex[ s[1] & 0xF ]; |
Branch: 2 branches
| Branch | True | False | Total |
| *d++ = upperhex[ s[1] & 0xF ]; |
765 |
84 |
849 |
| *d++ = upperhex[ s[1] & 0xF ]; |
749 |
16 |
765 |
|
| 743 |
749 |
| } else { |
| 744 |
849 |
| if ((9 <= uca_vers) && (d[-1] != '[')) |
| 745 |
849 |
| *d++ = ' '; |
| 746 |
|
| *d++ = '|'; |
| 747 |
|
| ++sep; |
| 748 |
258 |
| } |
| 749 |
258 |
| } |
| 750 |
258 |
| *d++ = ']'; |
| 751 |
258 |
| *d = '\0'; |
| 752 |
|
| SvCUR_set(dst, d - (U8*)SvPVX(dst)); |
| 753 |
|
| RETVAL = dst; |
| 754 |
|
| OUTPUT: |
| 755 |
|
| RETVAL |