summaryrefslogtreecommitdiffstats
path: root/intl/uconv/tools/jis0212tojdx.pl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /intl/uconv/tools/jis0212tojdx.pl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/uconv/tools/jis0212tojdx.pl')
-rw-r--r--intl/uconv/tools/jis0212tojdx.pl62
1 files changed, 62 insertions, 0 deletions
diff --git a/intl/uconv/tools/jis0212tojdx.pl b/intl/uconv/tools/jis0212tojdx.pl
new file mode 100644
index 000000000..6644ffdc0
--- /dev/null
+++ b/intl/uconv/tools/jis0212tojdx.pl
@@ -0,0 +1,62 @@
+#!/user/local/bin/perl
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+sub jis0212tonum()
+{
+ my($jis0212) = (@_);
+ my($first,$second,$jnum);
+ $first = hex(substr($jis0212,2,2));
+ $second = hex(substr($jis0212,4,2));
+ $jnum = (($first - 0x21) * 94);
+ $jnum += $second - 0x21 ;
+ return $jnum;
+}
+
+@map = {};
+sub readtable()
+{
+open(JIS0212, "<JIS0212") || die "cannot open JIS0212";
+while(<JIS0212>)
+{
+ if(! /^#/) {
+ ($j, $u, $r) = split(/\t/,$_);
+ if(length($j) > 4)
+ {
+ $n = &jis0212tonum($j);
+ $map{$n} = $u;
+ }
+ }
+}
+}
+
+## add eudc to $map here
+
+sub printtable()
+{
+for($i=0;$i<94;$i++)
+{
+ printf ( "/* 0x%2XXX */\n", ( $i + 0x21));
+ printf " ";
+ for($j=0;$j<94;$j++)
+ {
+ if("" == ($map{($i * 94 + $j)}))
+ {
+ print "0xFFFD,"
+ }
+ else
+ {
+ print $map{($i * 94 + $j)} . ",";
+ }
+ if( 7 == (($j + 1) % 8))
+ {
+ printf "/* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16), (6==($j%16))?0:8;
+ }
+ }
+ printf " /* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16),(6==($j%16))?0:8;
+}
+}
+&readtable();
+&printtable();
+