RecodeData/MACHEBREW.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 6 / 6 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 31 / 31 CC 5 SCAR 13.5
CC
5
Cov
100%
_recode
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.9
« RecodeData/MACGREEK.pm ↑ Summary RecodeData/MACICELAND.pm »
1 #! /bin/false
2 # vim: set autoindent shiftwidth=4 tabstop=4:
3  
4 # Conversion routines for MACHEBREW.
5 # Copyright (C) 2002-2026 Guido Flohr <guido.flohr@cantanea.com>,
6 # all rights reserved.
7  
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12  
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17  
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20  
21 package Locale::RecodeData::MACHEBREW;
22  
23 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 require Locale::RecodeData;
26 1 ▶use base qw(Locale::RecodeData);
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 1 my @to_ucs4 = (
29 0x0000,
30 0x0001,
31 0x0002,
32 0x0003,
33 0x0004,
34 0x0005,
35 0x0006,
36 0x0007,
37 0x0008,
38 0x0009,
39 0x000a,
40 0x000b,
41 0x000c,
42 0x000d,
43 0x000e,
44 0x000f,
45 0x0010,
46 0x0011,
47 0x0012,
48 0x0013,
49 0x0014,
50 0x0015,
51 0x0016,
52 0x0017,
53 0x0018,
54 0x0019,
55 0x001a,
56 0x001b,
57 0x001c,
58 0x001d,
59 0x001e,
60 0x001f,
61 0x0020,
62 0x0021,
63 0x0022,
64 0x0023,
65 0x0024,
66 0x0025,
67 0x0026,
68 0x0027,
69 0x0028,
70 0x0029,
71 0x002a,
72 0x002b,
73 0x002c,
74 0x002d,
75 0x002e,
76 0x002f,
77 0x0030,
78 0x0031,
79 0x0032,
80 0x0033,
81 0x0034,
82 0x0035,
83 0x0036,
84 0x0037,
85 0x0038,
86 0x0039,
87 0x003a,
88 0x003b,
89 0x003c,
90 0x003d,
91 0x003e,
92 0x003f,
93 0x0040,
94 0x0041,
95 0x0042,
96 0x0043,
97 0x0044,
98 0x0045,
99 0x0046,
100 0x0047,
101 0x0048,
102 0x0049,
103 0x004a,
104 0x004b,
105 0x004c,
106 0x004d,
107 0x004e,
108 0x004f,
109 0x0050,
110 0x0051,
111 0x0052,
112 0x0053,
113 0x0054,
114 0x0055,
115 0x0056,
116 0x0057,
117 0x0058,
118 0x0059,
119 0x005a,
120 0x005b,
121 0x005c,
122 0x005d,
123 0x005e,
124 0x005f,
125 0x0060,
126 0x0061,
127 0x0062,
128 0x0063,
129 0x0064,
130 0x0065,
131 0x0066,
132 0x0067,
133 0x0068,
134 0x0069,
135 0x006a,
136 0x006b,
137 0x006c,
138 0x006d,
139 0x006e,
140 0x006f,
141 0x0070,
142 0x0071,
143 0x0072,
144 0x0073,
145 0x0074,
146 0x0075,
147 0x0076,
148 0x0077,
149 0x0078,
150 0x0079,
151 0x007a,
152 0x007b,
153 0x007c,
154 0x007d,
155 0x007e,
156 0x007f,
157 0x00c4,
158 0xfb1f,
159 0x00c7,
160 0x00c9,
161 0x00d1,
162 0x00d6,
163 0x00dc,
164 0x00e1,
165 0x00e0,
166 0x00e2,
167 0x00e4,
168 0x00e3,
169 0x00e5,
170 0x00e7,
171 0x00e9,
172 0x00e8,
173 0x00ea,
174 0x00eb,
175 0x00ed,
176 0x00ec,
177 0x00ee,
178 0x00ef,
179 0x00f1,
180 0x00f3,
181 0x00f2,
182 0x00f4,
183 0x00f6,
184 0x00f5,
185 0x00fa,
186 0x00f9,
187 0x00fb,
188 0x00fc,
189 0xfffd,
190 0xfffd,
191 0xfffd,
192 0xfffd,
193 0xfffd,
194 0xfffd,
195 0x20aa,
196 0xfffd,
197 0xfffd,
198 0xfffd,
199 0xfffd,
200 0xfffd,
201 0xfffd,
202 0xfffd,
203 0xfffd,
204 0xfffd,
205 0xfffd,
206 0xfffd,
207 0xfffd,
208 0xfffd,
209 0xfffd,
210 0xfffd,
211 0xfffd,
212 0xfffd,
213 0xfffd,
214 0xfffd,
215 0xfffd,
216 0xfffd,
217 0xfffd,
218 0xfffd,
219 0xfffd,
220 0xfffd,
221 0xfffd,
222 0x201e,
223 0xfffd,
224 0xfffd,
225 0xfffd,
226 0xfffd,
227 0x05bc,
228 0xfb4b,
229 0xfb35,
230 0x2026,
231 0x00a0,
232 0x05b8,
233 0x05b7,
234 0x05b5,
235 0x05b6,
236 0x05b4,
237 0x2013,
238 0x2014,
239 0x201c,
240 0x201d,
241 0x2018,
242 0x2019,
243 0xfb2a,
244 0xfb2b,
245 0x05bf,
246 0x05b0,
247 0x05b2,
248 0x05b1,
249 0x05bb,
250 0x05b9,
251 0xfffd,
252 0x05b3,
253 0x05d0,
254 0x05d1,
255 0x05d2,
256 0x05d3,
257 0x05d4,
258 0x05d5,
259 0x05d6,
260 0x05d7,
261 0x05d8,
262 0x05d9,
263 0x05da,
264 0x05db,
265 0x05dc,
266 0x05dd,
267 0x05de,
268 0x05df,
269 0x05e0,
270 0x05e1,
271 0x05e2,
272 0x05e3,
273 0x05e4,
274 0x05e5,
275 0x05e6,
276 0x05e7,
277 0x05e8,
278 0x05e9,
279 0x05ea,
280 0xfffd,
281 0xfffd,
282 0xfffd,
283 0xfffd,
284 0xfffd,
285 );
286  
287 1 my @to_utf8 = (
288 "\x00",
289 "\x01",
290 "\x02",
291 "\x03",
292 "\x04",
293 "\x05",
294 "\x06",
295 "\x07",
296 "\x08",
297 "\x09",
298 "\x0a",
299 "\x0b",
300 "\x0c",
301 "\x0d",
302 "\x0e",
303 "\x0f",
304 "\x10",
305 "\x11",
306 "\x12",
307 "\x13",
308 "\x14",
309 "\x15",
310 "\x16",
311 "\x17",
312 "\x18",
313 "\x19",
314 "\x1a",
315 "\x1b",
316 "\x1c",
317 "\x1d",
318 "\x1e",
319 "\x1f",
320 "\x20",
321 "\x21",
322 "\x22",
323 "\x23",
324 "\x24",
325 "\x25",
326 "\x26",
327 "\x27",
328 "\x28",
329 "\x29",
330 "\x2a",
331 "\x2b",
332 "\x2c",
333 "\x2d",
334 "\x2e",
335 "\x2f",
336 "\x30",
337 "\x31",
338 "\x32",
339 "\x33",
340 "\x34",
341 "\x35",
342 "\x36",
343 "\x37",
344 "\x38",
345 "\x39",
346 "\x3a",
347 "\x3b",
348 "\x3c",
349 "\x3d",
350 "\x3e",
351 "\x3f",
352 "\x40",
353 "\x41",
354 "\x42",
355 "\x43",
356 "\x44",
357 "\x45",
358 "\x46",
359 "\x47",
360 "\x48",
361 "\x49",
362 "\x4a",
363 "\x4b",
364 "\x4c",
365 "\x4d",
366 "\x4e",
367 "\x4f",
368 "\x50",
369 "\x51",
370 "\x52",
371 "\x53",
372 "\x54",
373 "\x55",
374 "\x56",
375 "\x57",
376 "\x58",
377 "\x59",
378 "\x5a",
379 "\x5b",
380 "\x5c",
381 "\x5d",
382 "\x5e",
383 "\x5f",
384 "\x60",
385 "\x61",
386 "\x62",
387 "\x63",
388 "\x64",
389 "\x65",
390 "\x66",
391 "\x67",
392 "\x68",
393 "\x69",
394 "\x6a",
395 "\x6b",
396 "\x6c",
397 "\x6d",
398 "\x6e",
399 "\x6f",
400 "\x70",
401 "\x71",
402 "\x72",
403 "\x73",
404 "\x74",
405 "\x75",
406 "\x76",
407 "\x77",
408 "\x78",
409 "\x79",
410 "\x7a",
411 "\x7b",
412 "\x7c",
413 "\x7d",
414 "\x7e",
415 "\x7f",
416 "\xc3\x84",
417 "\xef\xac\x9f",
418 "\xc3\x87",
419 "\xc3\x89",
420 "\xc3\x91",
421 "\xc3\x96",
422 "\xc3\x9c",
423 "\xc3\xa1",
424 "\xc3\xa0",
425 "\xc3\xa2",
426 "\xc3\xa4",
427 "\xc3\xa3",
428 "\xc3\xa5",
429 "\xc3\xa7",
430 "\xc3\xa9",
431 "\xc3\xa8",
432 "\xc3\xaa",
433 "\xc3\xab",
434 "\xc3\xad",
435 "\xc3\xac",
436 "\xc3\xae",
437 "\xc3\xaf",
438 "\xc3\xb1",
439 "\xc3\xb3",
440 "\xc3\xb2",
441 "\xc3\xb4",
442 "\xc3\xb6",
443 "\xc3\xb5",
444 "\xc3\xba",
445 "\xc3\xb9",
446 "\xc3\xbb",
447 "\xc3\xbc",
448 "\xef\xbf\xbd",
449 "\xef\xbf\xbd",
450 "\xef\xbf\xbd",
451 "\xef\xbf\xbd",
452 "\xef\xbf\xbd",
453 "\xef\xbf\xbd",
454 "\xe2\x82\xaa",
455 "\xef\xbf\xbd",
456 "\xef\xbf\xbd",
457 "\xef\xbf\xbd",
458 "\xef\xbf\xbd",
459 "\xef\xbf\xbd",
460 "\xef\xbf\xbd",
461 "\xef\xbf\xbd",
462 "\xef\xbf\xbd",
463 "\xef\xbf\xbd",
464 "\xef\xbf\xbd",
465 "\xef\xbf\xbd",
466 "\xef\xbf\xbd",
467 "\xef\xbf\xbd",
468 "\xef\xbf\xbd",
469 "\xef\xbf\xbd",
470 "\xef\xbf\xbd",
471 "\xef\xbf\xbd",
472 "\xef\xbf\xbd",
473 "\xef\xbf\xbd",
474 "\xef\xbf\xbd",
475 "\xef\xbf\xbd",
476 "\xef\xbf\xbd",
477 "\xef\xbf\xbd",
478 "\xef\xbf\xbd",
479 "\xef\xbf\xbd",
480 "\xef\xbf\xbd",
481 "\xe2\x80\x9e",
482 "\xef\xbf\xbd",
483 "\xef\xbf\xbd",
484 "\xef\xbf\xbd",
485 "\xef\xbf\xbd",
486 "\xd6\xbc",
487 "\xef\xad\x8b",
488 "\xef\xac\xb5",
489 "\xe2\x80\xa6",
490 "\xc2\xa0",
491 "\xd6\xb8",
492 "\xd6\xb7",
493 "\xd6\xb5",
494 "\xd6\xb6",
495 "\xd6\xb4",
496 "\xe2\x80\x93",
497 "\xe2\x80\x94",
498 "\xe2\x80\x9c",
499 "\xe2\x80\x9d",
500 "\xe2\x80\x98",
501 "\xe2\x80\x99",
502 "\xef\xac\xaa",
503 "\xef\xac\xab",
504 "\xd6\xbf",
505 "\xd6\xb0",
506 "\xd6\xb2",
507 "\xd6\xb1",
508 "\xd6\xbb",
509 "\xd6\xb9",
510 "\xef\xbf\xbd",
511 "\xd6\xb3",
512 "\xd7\x90",
513 "\xd7\x91",
514 "\xd7\x92",
515 "\xd7\x93",
516 "\xd7\x94",
517 "\xd7\x95",
518 "\xd7\x96",
519 "\xd7\x97",
520 "\xd7\x98",
521 "\xd7\x99",
522 "\xd7\x9a",
523 "\xd7\x9b",
524 "\xd7\x9c",
525 "\xd7\x9d",
526 "\xd7\x9e",
527 "\xd7\x9f",
528 "\xd7\xa0",
529 "\xd7\xa1",
530 "\xd7\xa2",
531 "\xd7\xa3",
532 "\xd7\xa4",
533 "\xd7\xa5",
534 "\xd7\xa6",
535 "\xd7\xa7",
536 "\xd7\xa8",
537 "\xd7\xa9",
538 "\xd7\xaa",
539 "\xef\xbf\xbd",
540 "\xef\xbf\xbd",
541 "\xef\xbf\xbd",
542 "\xef\xbf\xbd",
543 "\xef\xbf\xbd",
544 );
545  
546 1 my %from_ucs4 = (
547 0x00000000 => "\x00",
548 0x00000001 => "\x01",
549 0x00000002 => "\x02",
550 0x00000003 => "\x03",
551 0x00000004 => "\x04",
552 0x00000005 => "\x05",
553 0x00000006 => "\x06",
554 0x00000007 => "\x07",
555 0x00000008 => "\x08",
556 0x00000009 => "\x09",
557 0x0000000a => "\x0a",
558 0x0000000b => "\x0b",
559 0x0000000c => "\x0c",
560 0x0000000d => "\x0d",
561 0x0000000e => "\x0e",
562 0x0000000f => "\x0f",
563 0x00000010 => "\x10",
564 0x00000011 => "\x11",
565 0x00000012 => "\x12",
566 0x00000013 => "\x13",
567 0x00000014 => "\x14",
568 0x00000015 => "\x15",
569 0x00000016 => "\x16",
570 0x00000017 => "\x17",
571 0x00000018 => "\x18",
572 0x00000019 => "\x19",
573 0x0000001a => "\x1a",
574 0x0000001b => "\x1b",
575 0x0000001c => "\x1c",
576 0x0000001d => "\x1d",
577 0x0000001e => "\x1e",
578 0x0000001f => "\x1f",
579 0x00000020 => "\x20",
580 0x00000021 => "\x21",
581 0x00000022 => "\x22",
582 0x00000023 => "\x23",
583 0x00000024 => "\x24",
584 0x00000025 => "\x25",
585 0x00000026 => "\x26",
586 0x00000027 => "\x27",
587 0x00000028 => "\x28",
588 0x00000029 => "\x29",
589 0x0000002a => "\x2a",
590 0x0000002b => "\x2b",
591 0x0000002c => "\x2c",
592 0x0000002d => "\x2d",
593 0x0000002e => "\x2e",
594 0x0000002f => "\x2f",
595 0x00000030 => "\x30",
596 0x00000031 => "\x31",
597 0x00000032 => "\x32",
598 0x00000033 => "\x33",
599 0x00000034 => "\x34",
600 0x00000035 => "\x35",
601 0x00000036 => "\x36",
602 0x00000037 => "\x37",
603 0x00000038 => "\x38",
604 0x00000039 => "\x39",
605 0x0000003a => "\x3a",
606 0x0000003b => "\x3b",
607 0x0000003c => "\x3c",
608 0x0000003d => "\x3d",
609 0x0000003e => "\x3e",
610 0x0000003f => "\x3f",
611 0x00000040 => "\x40",
612 0x00000041 => "\x41",
613 0x00000042 => "\x42",
614 0x00000043 => "\x43",
615 0x00000044 => "\x44",
616 0x00000045 => "\x45",
617 0x00000046 => "\x46",
618 0x00000047 => "\x47",
619 0x00000048 => "\x48",
620 0x00000049 => "\x49",
621 0x0000004a => "\x4a",
622 0x0000004b => "\x4b",
623 0x0000004c => "\x4c",
624 0x0000004d => "\x4d",
625 0x0000004e => "\x4e",
626 0x0000004f => "\x4f",
627 0x00000050 => "\x50",
628 0x00000051 => "\x51",
629 0x00000052 => "\x52",
630 0x00000053 => "\x53",
631 0x00000054 => "\x54",
632 0x00000055 => "\x55",
633 0x00000056 => "\x56",
634 0x00000057 => "\x57",
635 0x00000058 => "\x58",
636 0x00000059 => "\x59",
637 0x0000005a => "\x5a",
638 0x0000005b => "\x5b",
639 0x0000005c => "\x5c",
640 0x0000005d => "\x5d",
641 0x0000005e => "\x5e",
642 0x0000005f => "\x5f",
643 0x00000060 => "\x60",
644 0x00000061 => "\x61",
645 0x00000062 => "\x62",
646 0x00000063 => "\x63",
647 0x00000064 => "\x64",
648 0x00000065 => "\x65",
649 0x00000066 => "\x66",
650 0x00000067 => "\x67",
651 0x00000068 => "\x68",
652 0x00000069 => "\x69",
653 0x0000006a => "\x6a",
654 0x0000006b => "\x6b",
655 0x0000006c => "\x6c",
656 0x0000006d => "\x6d",
657 0x0000006e => "\x6e",
658 0x0000006f => "\x6f",
659 0x00000070 => "\x70",
660 0x00000071 => "\x71",
661 0x00000072 => "\x72",
662 0x00000073 => "\x73",
663 0x00000074 => "\x74",
664 0x00000075 => "\x75",
665 0x00000076 => "\x76",
666 0x00000077 => "\x77",
667 0x00000078 => "\x78",
668 0x00000079 => "\x79",
669 0x0000007a => "\x7a",
670 0x0000007b => "\x7b",
671 0x0000007c => "\x7c",
672 0x0000007d => "\x7d",
673 0x0000007e => "\x7e",
674 0x0000007f => "\x7f",
675 0x000000a0 => "\xca",
676 0x000000c4 => "\x80",
677 0x000000c7 => "\x82",
678 0x000000c9 => "\x83",
679 0x000000d1 => "\x84",
680 0x000000d6 => "\x85",
681 0x000000dc => "\x86",
682 0x000000e0 => "\x88",
683 0x000000e1 => "\x87",
684 0x000000e2 => "\x89",
685 0x000000e3 => "\x8b",
686 0x000000e4 => "\x8a",
687 0x000000e5 => "\x8c",
688 0x000000e7 => "\x8d",
689 0x000000e8 => "\x8f",
690 0x000000e9 => "\x8e",
691 0x000000ea => "\x90",
692 0x000000eb => "\x91",
693 0x000000ec => "\x93",
694 0x000000ed => "\x92",
695 0x000000ee => "\x94",
696 0x000000ef => "\x95",
697 0x000000f1 => "\x96",
698 0x000000f2 => "\x98",
699 0x000000f3 => "\x97",
700 0x000000f4 => "\x99",
701 0x000000f5 => "\x9b",
702 0x000000f6 => "\x9a",
703 0x000000f9 => "\x9d",
704 0x000000fa => "\x9c",
705 0x000000fb => "\x9e",
706 0x000000fc => "\x9f",
707 0x000005b0 => "\xd9",
708 0x000005b1 => "\xdb",
709 0x000005b2 => "\xda",
710 0x000005b3 => "\xdf",
711 0x000005b4 => "\xcf",
712 0x000005b5 => "\xcd",
713 0x000005b6 => "\xce",
714 0x000005b7 => "\xcc",
715 0x000005b8 => "\xcb",
716 0x000005b9 => "\xdd",
717 0x000005bb => "\xdc",
718 0x000005bc => "\xc6",
719 0x000005bf => "\xd8",
720 0x000005d0 => "\xe0",
721 0x000005d1 => "\xe1",
722 0x000005d2 => "\xe2",
723 0x000005d3 => "\xe3",
724 0x000005d4 => "\xe4",
725 0x000005d5 => "\xe5",
726 0x000005d6 => "\xe6",
727 0x000005d7 => "\xe7",
728 0x000005d8 => "\xe8",
729 0x000005d9 => "\xe9",
730 0x000005da => "\xea",
731 0x000005db => "\xeb",
732 0x000005dc => "\xec",
733 0x000005dd => "\xed",
734 0x000005de => "\xee",
735 0x000005df => "\xef",
736 0x000005e0 => "\xf0",
737 0x000005e1 => "\xf1",
738 0x000005e2 => "\xf2",
739 0x000005e3 => "\xf3",
740 0x000005e4 => "\xf4",
741 0x000005e5 => "\xf5",
742 0x000005e6 => "\xf6",
743 0x000005e7 => "\xf7",
744 0x000005e8 => "\xf8",
745 0x000005e9 => "\xf9",
746 0x000005ea => "\xfa",
747 0x00002013 => "\xd0",
748 0x00002014 => "\xd1",
749 0x00002018 => "\xd4",
750 0x00002019 => "\xd5",
751 0x0000201c => "\xd2",
752 0x0000201d => "\xd3",
753 0x0000201e => "\xc1",
754 0x00002026 => "\xc9",
755 0x000020aa => "\xa6",
756 0x0000fb1f => "\x81",
757 0x0000fb2a => "\xd6",
758 0x0000fb2b => "\xd7",
759 0x0000fb35 => "\xc8",
760 0x0000fb4b => "\xc7",
761 );
762  
763 sub _recode
764 654 ▶{
Subroutine _recode: called CC=5 SCAR=16.1
765 654 ▶ if ($_[0]->{_from} eq 'INTERNAL') {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[0]{'_from'} eq 'INTERNAL') { } 216 438 654
elsif ($_[0]{'_to'} eq 'UTF-8') { } 219 219 438
766 $_[1] = join '',
767 map $from_ucs4{$_}
768 || (defined $from_ucs4{$_} ? $from_ucs4{$_} : "\x3f"),
769 216 ▶ @{$_[1]};
Branch: 1 branch
BranchTrueFalseTotal
defined $from_ucs4{$_} ? : 1 2 3
Condition100%3/3
$from_ucs4{$_} || (defined $from_ucs4{$_} ? $from_ucs4{$_} : '?')
l!l&&r!l&&!r
23121
MC/DC100%2/2
$from_ucs4{$_} || (defined $from_ucs4{$_} ? $from_ucs4{$_} : '?')
$from_ucs4{$_} (defined $from_ucs4{$_} ? $from_ucs4{$_} : '?')
Truth table100%3/3
A || B
A= $from_ucs4{$_}B= (defined $from_ucs4{$_} ? $from_ucs4{$_} : '?')
ABresult
1X1
011
000
770 } elsif ($_[0]->{_to} eq 'UTF-8',) {
771 219 $_[1] = join '', map $to_utf8[$_], unpack 'C*', $_[1];
772 } else {
773 219 $_[1] = [ map
774 $to_ucs4[$_],
775 unpack 'C*', $_[1]
776 ];
777 }
778  
779 654 return 1;
780 }
781  
782 1 1;
783  
784 __END__
« RecodeData/MACGREEK.pm ↑ Summary RecodeData/MACICELAND.pm »