tdf#154546 skip dispatch when presenter controller is not set
[LibreOffice.git] / sal / textenc / generate / cns116431992.pl
blob29bbefabf39052bafd17c6e31ccf7b64f4e06f1b
1 #!/usr/bin/env perl
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # The following files must be available in a ./input subdir:
22 # <http://www.unicode.org/Public/UNIDATA/Unihan.txt>:
23 # "Unicode version: 3.1.1 Table version: 1.1 Date: 28 June 2001"
24 # contains descriptions for:
25 # U+3400..4DFF CJK Unified Ideographs Extension A
26 # U+4E00..9FFF CJK Unified Ideographs
27 # U+F900..FAFF CJK Compatibility Ideographs
28 # U+20000..2F7FF CJK Unified Ideographs Extension B
29 # U+2F800..2FFFF CJK Compatibility Ideographs Supplement
31 # <http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/CNS11643.TXT>:
32 # "Unicode version: 1.1 Table version: 0.0d1 Date: 21 October 1994"
33 # contains mappings for CNS 11643-1986
35 # <http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/ftp/CJKtable/Uni2CNS.Z>:
36 # "Unicode version: 1.1 Table version: 0.49 Date: 26 March 1998"
37 # contains mappings for CNS 11643-1992 that are incompatible with
38 # CNS11643.TXT
40 $id = "Cns116431992";
42 sub isValidUtf32
44 my $utf32 = $_[0];
45 return $utf32 >= 0 && $utf32 <= 0x10FFFF
46 && !($utf32 >= 0xD800 && $utf32 <= 0xDFFF)
47 && !($utf32 >= 0xFDD0 && $utf32 <= 0xFDEF)
48 && ($utf32 & 0xFFFF) < 0xFFFE;
51 sub printUtf32
53 my $utf32 = $_[0];
54 return sprintf("U+%04X", $utf32);
57 sub isValidCns116431992
59 my $plane = $_[0];
60 my $row = $_[1];
61 my $column = $_[2];
62 return $plane >= 1 && $plane <= 16
63 && $row >= 1 && $row <= 94
64 && $column >= 1 && $column <= 94;
67 sub printCns116431992
69 my $plane = $_[0];
70 my $row = $_[1];
71 my $column = $_[2];
72 return sprintf("%d-%02d/%02d", $plane, $row, $column);
75 sub printStats
77 my $used = $_[0];
78 my $space = $_[1];
79 return sprintf("%d/%d bytes (%.1f%%)",
80 $used,
81 $space,
82 $used * 100 / $space);
85 sub printSpaces
87 my $column_width = $_[0];
88 my $columns_per_line = $_[1];
89 my $end = $_[2];
90 $output = "";
91 for ($i = int($end / $columns_per_line) * $columns_per_line;
92 $i < $end;
93 ++$i)
95 for ($j = 0; $j < $column_width; ++$j)
97 $output = $output . " ";
100 return $output;
103 $count_Unihan_txt = 0;
104 $count_CNS11643_TXT = 0;
105 $count_Uni2CNS = 0;
107 if (1)
109 $filename = "Unihan.txt";
110 open IN, ("input/" . $filename) or die "Cannot read " . $filename;
111 while (<IN>)
113 if (/^U\+([0-9A-F]+)\tkCNS1992\t([0-9A-F])-([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])$/)
115 $utf32 = oct("0x" . $1);
116 $cns_plane = oct("0x" . $2);
117 $cns_row = oct("0x" . $3) - 0x20;
118 $cns_column = oct("0x" . $4) - 0x20;
119 isValidUtf32($utf32)
120 or die "Bad UTF32 char U+" . printUtf32($utf32);
121 isValidCns116431992($cns_plane, $cns_row, $cns_column)
122 or die "Bad CNS11643-1992 char "
123 . printCns116431992($cns_plane,
124 $cns_row,
125 $cns_column);
126 if (!defined($cns_map[$cns_plane][$cns_row][$cns_column]))
128 $cns_map[$cns_plane][$cns_row][$cns_column] = $utf32;
129 $cns_plane_used[$cns_plane] = 1;
130 ++$count_Unihan_txt;
132 else
134 ($cns_map[$cns_plane][$cns_row][$cns_column] == $utf32)
135 or die "Mapping "
136 . printCns116431992($cns_plane,
137 $cns_row,
138 $cns_column)
139 . " to "
140 . printUtf32($cns_map[$cns_plane]
141 [$cns_row]
142 [$cns_column])
143 . ", NOT "
144 . printUtf32($utf32);
147 elsif (/^U\+([0-9A-F]+)\tkIRG_TSource\t([0-9A-F])-([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])$/)
149 $utf32 = oct("0x" . $1);
150 $cns_plane = oct("0x" . $2);
151 $cns_row = oct("0x" . $3) - 0x20;
152 $cns_column = oct("0x" . $4) - 0x20;
153 isValidUtf32($utf32)
154 or die "Bad UTF32 char U+" . printUtf32($utf32);
155 isValidCns116431992($cns_plane, $cns_row, $cns_column)
156 or die "Bad CNS11643-1992 char "
157 . printCns116431992($cns_plane,
158 $cns_row,
159 $cns_column);
160 if (!defined($cns_map[$cns_plane][$cns_row][$cns_column]))
162 $cns_map[$cns_plane][$cns_row][$cns_column] = $utf32;
163 $cns_plane_used[$cns_plane] = 1;
164 ++$count_Unihan_txt;
166 else
168 ($cns_map[$cns_plane][$cns_row][$cns_column] == $utf32)
169 or print "WARNING! Mapping ",
170 printCns116431992($cns_plane,
171 $cns_row,
172 $cns_column),
173 " to ",
174 printUtf32($cns_map[$cns_plane]
175 [$cns_row]
176 [$cns_column]),
177 ", NOT ",
178 printUtf32($utf32),
179 "\n";
182 elsif (/^U\+([0-9A-F]+)\tkCNS1992\t.*$/)
184 die "Bad format";
187 close IN;
190 if (1)
192 $filename = "CNS11643.TXT";
193 open IN, ("input/" . $filename) or die "Cannot read " . $filename;
194 while (<IN>)
196 if (/0x([0-9A-F])([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])\t0x([0-9A-F]+)\t\#.*$/)
198 $utf32 = oct("0x" . $4);
199 $cns_plane = oct("0x" . $1);
200 $cns_row = oct("0x" . $2) - 0x20;
201 $cns_column = oct("0x" . $3) - 0x20;
202 isValidUtf32($utf32)
203 or die "Bad UTF32 char U+" . printUtf32($utf32);
204 isValidCns116431992($cns_plane, $cns_row, $cns_column)
205 or die "Bad CNS11643-1992 char "
206 . printCns116431992($cns_plane,
207 $cns_row,
208 $cns_column);
209 if ($cns_plane <= 2)
211 if (!defined($cns_map[$cns_plane][$cns_row][$cns_column]))
213 $cns_map[$cns_plane][$cns_row][$cns_column] = $utf32;
214 $cns_plane_used[$cns_plane] = 1;
215 ++$count_CNS11643_TXT;
217 else
219 ($cns_map[$cns_plane][$cns_row][$cns_column] == $utf32)
220 or die "Mapping "
221 . printCns116431992($cns_plane,
222 $cns_row,
223 $cns_column)
224 . " to "
225 . printUtf32($cns_map[$cns_plane]
226 [$cns_row]
227 [$cns_column])
228 . ", NOT "
229 . printUtf32($utf32);
234 close IN;
237 if (0)
239 $filename = "Uni2CNS";
240 open IN, ("input/" . $filename) or die "Cannot read " . $filename;
241 while (<IN>)
243 if (/([0-9A-F]+)\t([0-9A-F])-([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])\t.*$/)
245 $utf32 = oct("0x" . $1);
246 $cns_plane = oct("0x" . $2);
247 $cns_row = oct("0x" . $3) - 0x20;
248 $cns_column = oct("0x" . $4) - 0x20;
249 isValidUtf32($utf32)
250 or die "Bad UTF32 char U+" . printUtf32($utf32);
251 isValidCns116431992($cns_plane, $cns_row, $cns_column)
252 or die "Bad CNS11643-1992 char "
253 . printCns116431992($cns_plane,
254 $cns_row,
255 $cns_column);
256 if (!defined($cns_map[$cns_plane][$cns_row][$cns_column]))
258 $cns_map[$cns_plane][$cns_row][$cns_column] = $utf32;
259 $cns_plane_used[$cns_plane] = 1;
260 ++$count_Uni2CNS;
262 else
264 # ($cns_map[$cns_plane][$cns_row][$cns_column] == $utf32)
265 # or die "Mapping "
266 # . printCns116431992($cns_plane,
267 # $cns_row,
268 # $cns_column)
269 # . " to "
270 # . printUtf32($cns_map[$cns_plane]
271 # [$cns_row]
272 # [$cns_column])
273 # . ", NOT "
274 # . printUtf32($utf32);
276 if ($cns_plane == 1)
278 print printCns116431992($cns_plane, $cns_row, $cns_column),
279 "\n";
283 close IN;
286 for ($cns_plane = 1; $cns_plane <= 16; ++$cns_plane)
288 if (defined($cns_plane_used[$cns_plane]))
290 for ($cns_row = 1; $cns_row <= 94; ++$cns_row)
292 for ($cns_column = 1; $cns_column <= 94; ++$cns_column)
294 if (defined($cns_map[$cns_plane][$cns_row][$cns_column]))
296 $utf32 = $cns_map[$cns_plane][$cns_row][$cns_column];
297 $uni_plane = $utf32 >> 16;
298 $uni_page = ($utf32 >> 8) & 0xFF;
299 $uni_index = $utf32 & 0xFF;
300 if (!defined($uni_plane_used[$uni_plane])
301 || !defined($uni_page_used[$uni_plane][$uni_page])
302 || !defined($uni_map[$uni_plane]
303 [$uni_page]
304 [$uni_index]))
306 $uni_map[$uni_plane][$uni_page][$uni_index]
307 = ($cns_plane << 16)
308 | ($cns_row << 8)
309 | $cns_column;
310 $uni_plane_used[$uni_plane] = 1;
311 $uni_page_used[$uni_plane][$uni_page] = 1;
313 else
315 $cns1 = $uni_map[$uni_plane][$uni_page][$uni_index];
316 $cns1_plane = $cns1 >> 16;
317 $cns1_row = ($cns1 >> 8) & 0xFF;
318 $cns1_column = $cns1 & 0xFF;
320 # Do not map from Unicode to Fictitious Character Set
321 # Extensions (Lunde, p. 131), if possible:
322 if ($cns_plane == 3
323 && ($cns_row == 66 && $cns_column > 38
324 || $cns_row > 66))
326 print " (",
327 printUtf32($utf32),
328 " to fictitious ",
329 printCns116431992($cns_plane,
330 $cns_row,
331 $cns_column),
332 " ignored, favouring ",
333 printCns116431992($cns1_plane,
334 $cns1_row,
335 $cns1_column),
336 ")\n";
338 elsif ($cns1_plane == 3
339 && ($cns1_row == 66 && $cns1_column > 38
340 || $cns1_row > 66))
342 $uni_map[$uni_plane][$uni_page][$uni_index]
343 = ($cns_plane << 16)
344 | ($cns_row << 8)
345 | $cns_column;
346 print " (",
347 printUtf32($utf32),
348 " to fictitious ",
349 printCns116431992($cns1_plane,
350 $cns1_row,
351 $cns1_column),
352 " ignored, favouring ",
353 printCns116431992($cns_plane,
354 $cns_row,
355 $cns_column),
356 ")\n";
358 else
360 print "WARNING! Mapping ",
361 printUtf32($utf32),
362 " to ",
363 printCns116431992($cns1_plane,
364 $cns1_row,
365 $cns1_column),
366 ", NOT ",
367 printCns116431992($cns_plane,
368 $cns_row,
369 $cns_column),
370 "\n";
378 if (defined($uni_plane_used[0]) && defined($uni_page_used[0][0]))
380 for ($utf32 = 0; $utf32 <= 0x7F; ++$utf32)
382 if (defined($uni_map[0][0][$uni_index]))
384 $cns = $uni_map[0][0][$utf32];
385 die "Mapping "
386 . printUtf32($utf32)
387 . " to "
388 . printCns116431992($cns >> 16,
389 ($cns >> 8) & 0xFF,
390 $cns & 0xFF);
395 $filename = lc($id) . ".tab";
396 open OUT, ("> " . $filename) or die "Cannot write " . $filename;
399 $filename = lc($id). ".pl";
400 open IN, $filename or die "Cannot read ". $filename;
401 $first = 1;
402 while (<IN>)
404 if (/^\#!.*$/)
407 elsif (/^\#(\*.*)$/)
409 if ($first == 1)
411 print OUT "/", $1, "\n";
412 $first = 0;
414 else
416 print OUT " ", substr($1, 0, length($1) - 1), "/\n";
419 elsif (/^\# (.*)$/)
421 print OUT " *", $1, "\n";
423 elsif (/^\#(.*)$/)
425 print OUT " *", $1, "\n";
427 else
429 goto done;
432 done:
435 print OUT "\n",
436 "#include \"sal/types.h\"\n",
437 "\n";
439 print OUT "static sal_uInt16 const aImpl", $id, "ToUnicodeData[] = {\n";
440 $cns_data_index = 0;
441 for ($cns_plane = 1; $cns_plane <= 16; ++$cns_plane)
443 if (defined($cns_plane_used[$cns_plane]))
445 $cns_rows = 0;
446 $cns_chars = 0;
447 for ($cns_row = 1; $cns_row <= 94; ++$cns_row)
449 $cns_row_first = -1;
450 for ($cns_column = 1; $cns_column <= 94; ++$cns_column)
452 if (defined($cns_map[$cns_plane][$cns_row][$cns_column]))
454 if ($cns_row_first == -1)
456 $cns_row_first = $cns_column;
458 $cns_row_last = $cns_column;
461 if ($cns_row_first != -1)
463 $cns_data_offsets[$cns_plane][$cns_row] = $cns_data_index;
464 ++$cns_rows;
465 print OUT " /* plane ", $cns_plane, ", row ", $cns_row,
466 " */\n";
468 $cns_row_surrogates_first = -1;
469 $cns_row_chars = 0;
470 $cns_row_surrogates = 0;
472 print OUT " ", $cns_row_first, " | (", $cns_row_last,
473 " << 8), /* first, last */\n";
474 ++$cns_data_index;
476 print OUT " ", printSpaces(7, 10, $cns_row_first);
477 $bol = 0;
478 for ($cns_column = $cns_row_first;
479 $cns_column <= $cns_row_last;
480 ++$cns_column)
482 if ($bol == 1)
484 print OUT " ";
485 $bol = 0;
487 if (defined($cns_map[$cns_plane][$cns_row][$cns_column]))
489 $utf32 = $cns_map[$cns_plane][$cns_row][$cns_column];
490 ++$cns_row_chars;
491 if ($utf32 <= 0xFFFF)
493 printf OUT "0x%04X,", $utf32;
495 else
497 ++$cns_row_surrogates;
498 printf OUT "0x%04X,",
499 (0xD800 | (($utf32 - 0x10000) >> 10));
500 if ($cns_row_surrogates_first == -1)
502 $cns_row_surrogates_first = $cns_column;
504 $cns_row_surrogates_last = $cns_column;
507 else
509 printf OUT "0xffff,";
511 ++$cns_data_index;
512 if ($cns_column % 10 == 9)
514 print OUT "\n";
515 $bol = 1;
518 if ($bol == 0)
520 print OUT "\n";
523 if ($cns_row_surrogates_first != -1)
525 print OUT " ", $cns_row_surrogates_first,
526 ", /* first low-surrogate */\n";
527 ++$cns_data_index;
529 print OUT " ",
530 printSpaces(7, 10, $cns_row_surrogates_first);
531 $bol = 0;
532 for ($cns_column = $cns_row_surrogates_first;
533 $cns_column <= $cns_row_surrogates_last;
534 ++$cns_column)
536 if ($bol == 1)
538 print OUT " ";
539 $bol = 0;
541 $utf32 = 0;
542 if (defined($cns_map[$cns_plane]
543 [$cns_row]
544 [$cns_column]))
546 $utf32
547 = $cns_map[$cns_plane][$cns_row][$cns_column];
549 if ($utf32 <= 0xFFFF)
551 printf OUT " 0,";
553 else
555 printf OUT "0x%04X,",
556 (0xDC00
557 | (($utf32 - 0x10000) & 0x3FF));
559 ++$cns_data_index;
560 if ($cns_column % 10 == 9)
562 print OUT "\n";
563 $bol = 1;
566 if ($bol == 0)
568 print OUT "\n";
572 $cns_chars += $cns_row_chars;
573 $cns_data_space[$cns_plane][$cns_row]
574 = ($cns_data_index
575 - $cns_data_offsets[$cns_plane][$cns_row]) * 2;
576 $cns_data_used[$cns_plane][$cns_row]
577 = (1 + $cns_row_chars
578 + ($cns_row_surrogates == 0 ?
579 0 : 1 + $cns_row_surrogates)) * 2;
581 else
583 print OUT " /* plane ", $cns_plane, ", row ", $cns_row,
584 ": --- */\n";
585 $cns_data_offsets[$cns_plane][$cns_row] = -1;
588 print "cns plane ",
589 $cns_plane,
590 ": rows = ",
591 $cns_rows,
592 ", chars = ",
593 $cns_chars,
594 "\n";
597 print OUT "};\n\n";
599 print OUT "static sal_Int32 const aImpl", $id, "ToUnicodeRowOffsets[] = {\n";
600 for ($cns_plane = 1; $cns_plane <= 16; ++$cns_plane)
602 if (defined ($cns_plane_used[$cns_plane]))
604 $cns_rowoffsets_used[$cns_plane] = 0;
605 for ($cns_row = 1; $cns_row <= 94; ++$cns_row)
607 if ($cns_data_offsets[$cns_plane][$cns_row] == -1)
609 print OUT " -1, /* plane ",
610 $cns_plane,
611 ", row ",
612 $cns_row,
613 " */\n";
615 else
617 print OUT " ",
618 $cns_data_offsets[$cns_plane][$cns_row],
619 ", /* plane ",
620 $cns_plane,
621 ", row ",
622 $cns_row,
623 "; ",
624 printStats($cns_data_used[$cns_plane][$cns_row],
625 $cns_data_space[$cns_plane][$cns_row]),
626 " */\n";
627 $cns_rowoffsets_used[$cns_plane] += 4;
631 else
633 print OUT " /* plane ", $cns_plane, ": --- */\n";
636 print OUT "};\n\n";
638 print OUT "static sal_Int32 const aImpl",
639 $id,
640 "ToUnicodePlaneOffsets[] = {\n";
641 $cns_row_offset = 0;
642 for ($cns_plane = 1; $cns_plane <= 16; ++$cns_plane)
644 if (defined ($cns_plane_used[$cns_plane]))
646 print OUT " ",
647 $cns_row_offset++,
648 " * 94, /* plane ",
649 $cns_plane,
650 "; ",
651 printStats($cns_rowoffsets_used[$cns_plane], 94 * 4),
652 " */\n";
654 else
656 print OUT " -1, /* plane ", $cns_plane, " */\n";
659 print OUT "};\n\n";
661 print OUT "static sal_uInt8 const aImplUnicodeTo", $id, "Data[] = {\n";
662 $uni_data_index = 0;
663 for ($uni_plane = 0; $uni_plane <= 16; ++$uni_plane)
665 if (defined($uni_plane_used[$uni_plane]))
667 for ($uni_page = 0; $uni_page <= 255; ++$uni_page)
669 if (defined($uni_page_used[$uni_plane][$uni_page]))
671 $uni_data_offsets[$uni_plane][$uni_page] = $uni_data_index;
672 print OUT " /* plane ", $uni_plane, ", page ", $uni_page,
673 " */\n";
675 $uni_page_first = -1;
676 for ($uni_index = 0; $uni_index <= 255; ++$uni_index)
678 if (defined($uni_map[$uni_plane][$uni_page][$uni_index]))
680 if ($uni_page_first == -1)
682 $uni_page_first = $uni_index;
684 $uni_page_last = $uni_index;
688 $uni_data_used[$uni_plane][$uni_page] = 0;
690 print OUT " ", $uni_page_first, ", ", $uni_page_last,
691 ", /* first, last */\n";
692 $uni_data_index += 2;
693 $uni_data_used[$uni_plane][$uni_page] += 2;
695 print OUT " ", printSpaces(9, 8, $uni_page_first);
696 $bol = 0;
697 for ($uni_index = $uni_page_first;
698 $uni_index <= $uni_page_last;
699 ++$uni_index)
701 if ($bol == 1)
703 print OUT " ";
704 $bol = 0;
706 if (defined($uni_map[$uni_plane][$uni_page][$uni_index]))
708 $cns = $uni_map[$uni_plane][$uni_page][$uni_index];
709 printf OUT "%2d,%2d,%2d,",
710 $cns >> 16,
711 $cns >> 8 & 0xFF,
712 $cns & 0xFF;
713 $uni_data_used[$uni_plane][$uni_page] += 3;
715 else
717 print OUT " 0, 0, 0,";
719 $uni_data_index += 3;
720 if ($uni_index % 8 == 7)
722 print OUT "\n";
723 $bol = 1;
726 if ($bol == 0)
728 print OUT "\n";
731 $uni_data_space[$uni_plane][$uni_page]
732 = $uni_data_index
733 - $uni_data_offsets[$uni_plane][$uni_page];
735 else
737 $uni_data_offsets[$uni_plane][$uni_page] = -1;
738 print OUT " /* plane ", $uni_plane, ", page ", $uni_page,
739 ": --- */\n";
743 else
745 print OUT " /* plane ", $uni_plane, ": --- */\n";
748 print OUT "};\n\n";
750 print OUT "static sal_Int32 const aImplUnicodeTo", $id, "PageOffsets[] = {\n";
751 for ($uni_plane = 0; $uni_plane <= 16; ++$uni_plane)
753 if (defined($uni_plane_used[$uni_plane]))
755 $uni_pageoffsets_used[$uni_plane] = 0;
756 $uni_data_used_sum[$uni_plane] = 0;
757 $uni_data_space_sum[$uni_plane] = 0;
758 for ($uni_page = 0; $uni_page <= 255; ++$uni_page)
760 $offset = $uni_data_offsets[$uni_plane][$uni_page];
761 if ($offset == -1)
763 print OUT " -1, /* plane ",
764 $uni_plane,
765 ", page ",
766 $uni_page,
767 " */\n";
769 else
771 print OUT " ",
772 $offset,
773 ", /* plane ",
774 $uni_plane,
775 ", page ",
776 $uni_page,
777 "; ",
778 printStats($uni_data_used[$uni_plane][$uni_page],
779 $uni_data_space[$uni_plane][$uni_page]),
780 " */\n";
781 $uni_pageoffsets_used[$uni_plane] += 4;
782 $uni_data_used_sum[$uni_plane]
783 += $uni_data_used[$uni_plane][$uni_page];
784 $uni_data_space_sum[$uni_plane]
785 += $uni_data_space[$uni_plane][$uni_page];
789 else
791 print OUT " /* plane ", $uni_plane, ": --- */\n";
794 print OUT "};\n\n";
796 print OUT "static sal_Int32 const aImplUnicodeTo",
797 $id,
798 "PlaneOffsets[] = {\n";
799 $uni_page_offset = 0;
800 $uni_planeoffsets_used = 0;
801 $uni_pageoffsets_used_sum = 0;
802 $uni_pageoffsets_space_sum = 0;
803 $uni_data_used_sum2 = 0;
804 $uni_data_space_sum2 = 0;
805 for ($uni_plane = 0; $uni_plane <= 16; ++$uni_plane)
807 if (defined ($uni_plane_used[$uni_plane]))
809 print OUT " ",
810 $uni_page_offset++,
811 " * 256, /* plane ",
812 $uni_plane,
813 "; ",
814 printStats($uni_pageoffsets_used[$uni_plane], 256 * 4),
815 ", ",
816 printStats($uni_data_used_sum[$uni_plane],
817 $uni_data_space_sum[$uni_plane]),
818 " */\n";
819 $uni_planeoffsets_used += 4;
820 $uni_pageoffsets_used_sum += $uni_pageoffsets_used[$uni_plane];
821 $uni_pageoffsets_space_sum += 256 * 4;
822 $uni_data_used_sum2 += $uni_data_used_sum[$uni_plane];
823 $uni_data_space_sum2 += $uni_data_space_sum[$uni_plane];
825 else
827 print OUT " -1, /* plane ", $uni_plane, " */\n";
830 print OUT " /* ",
831 printStats($uni_planeoffsets_used, 17 * 4),
832 ", ",
833 printStats($uni_pageoffsets_used_sum, $uni_pageoffsets_space_sum),
834 ", ",
835 printStats($uni_data_used_sum2, $uni_data_space_sum2),
836 " */\n};\n";
838 close OUT;
840 print "Unihan.txt = ", $count_Unihan_txt,
841 ", CNS11643.TXT = ", $count_CNS11643_TXT,
842 ", Uni2CNS = ", $count_Uni2CNS,
843 ", total = ",
844 ($count_Unihan_txt + $count_CNS11643_TXT + $count_Uni2CNS),
845 "\n";