@NAME = (); while() { chop; s/\s*$//; (($n, $m, $c) = split(" ", $_, 3)) >= 3 || next; push(@NAME, $n); $MAP{$n} = $m; $CODE{$n} = $c; } foreach $name (@NAME) { $code = $CODE{$name}; $map = $MAP{$name}; print "$name\t$map\t$code\n"; @to_ucs1 = (); @to_ucs2 = (); %from_ucs = (); open(MAP, "< $map"); open(OUT, "> ${name}_ucs.map"); while() { /^#/ && next; s/#.*//; (($i, $u) = split(" ")) || next; $i =~ s/0x(.)/0x/; $p = $1; $i = hex($i); $u = hex($u); if ($p == 1) { $to_ucs1[$i] = $u; $from_ucs{$u} = $i; } elsif ($p == 2) { $to_ucs2[$i] = $u; $from_ucs{$u} = $i + 0x8000; } } # print OUT < $b } keys %from_ucs; $nucs = @ucs + 0; print OUT <