/[suikacvs]/test/oldencodeutils/lib/Encode/SJIS.pm
Suika

Diff of /test/oldencodeutils/lib/Encode/SJIS.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by wakaba, Mon Dec 16 10:25:01 2002 UTC revision 1.6 by wakaba, Wed Dec 18 10:21:09 2002 UTC
# Line 52  sub sjis_to_internal ($$) { Line 52  sub sjis_to_internal ($$) {
52          $f -= $f < 0xA0 ? 0x81 : 0xC1;  $s -= 0x40 + ($s > 0x7F);          $f -= $f < 0xA0 ? 0x81 : 0xC1;  $s -= 0x40 + ($s > 0x7F);
53          chr ($C->{G1}->{ucs} + $f * 188 + $s);          chr ($C->{G1}->{ucs} + $f * 188 + $s);
54        } else {  ## [\xF0-\xFC].        } else {  ## [\xF0-\xFC].
55          my ($f, $s) = unpack ('CC', $c2);          my ($f, $s) = (ord substr ($c2, 0, 1), ord substr ($c2, 1, 1));
56          if ($C->{G3}->{Csjis_kuE}) {          if ($C->{G3}->{Csjis_kuE}) {    ## 94^2 set with first-byte->ku mapping
57            $f = $s > 0x9E ? $C->{G3}->{Csjis_kuE}->{ $f }:            my $F = $s > 0x9E ? $C->{G3}->{Csjis_kuE}->{ $f }:    ## ku of even number
58                             $C->{G3}->{Csjis_kuO}->{ $f };                                $C->{G3}->{Csjis_kuO}->{ $f };    ## ku of odd number
59            $s -= ($s > 0x9E ? 0x9F : $s > 0x7F ? 0x41 : 0x40);            if (defined $F) {
60            chr ($C->{G3}->{ucs} + $f * 94 + $s);              $s -= ($s > 0x9E ? 0x9F : $s > 0x7F ? 0x41 : 0x40);
61          } else {              chr ($C->{G3}->{ucs} + $F * 94 + $s);
62              } else {      ## Mapping is not defined
63                $f -= 0xF0; $s -= 0x40 + ($s > 0x7F);
64