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

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

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

revision 1.6 by wakaba, Sat Sep 21 01:34:08 2002 UTC revision 1.8 by wakaba, Sat Oct 12 11:03:00 2002 UTC
# Line 292  sub _iso2022_to_internal ($;\%) { Line 292  sub _iso2022_to_internal ($;\%) {
292                $C->{GL} = 'G2'; '';                $C->{GL} = 'G2'; '';
293              } elsif ($Fs eq "\x6F") {   ## LS3              } elsif ($Fs eq "\x6F") {   ## LS3
294                $C->{GL} = 'G3'; '';                $C->{GL} = 'G3'; '';
295              } elsif ($Fs eq "\x7E") {   ## LS1R              } elsif ($Fs eq "\x7E" || $Fs eq "\x6B") {  ## LS1R
296                $C->{GR} = 'G1';  $C->{GL} = 'G1' if $C->{bit} == 7; '';                $C->{GR} = 'G1';  $C->{GL} = 'G1' if $C->{bit} == 7; '';
297              } elsif ($Fs eq "\x7D") {   ## LS2R              } elsif ($Fs eq "\x7D" || $Fs eq "\x6C") {  ## LS2R
298                $C->{GR} = 'G2';  $C->{GL} = 'G2' if $C->{bit} == 7; '';                $C->{GR} = 'G2';  $C->{GL} = 'G2' if $C->{bit} == 7; '';
299              } elsif ($Fs eq "\x7C") {   ## LS3R              } elsif ($Fs eq "\x7C" || $Fs eq "\x6D") {  ## LS3R
300                $C->{GR} = 'G3';  $C->{GL} = 'G3' if $C->{bit} == 7; '';                $C->{GR} = 'G3';  $C->{GL} = 'G3' if $C->{bit} == 7; '';
301              } else {              } else {
302                chr ($CHARSET{single_control}->{Fs}->{ucs} + (ord ($Fs) - 0x60));                chr ($CHARSET{single_control}->{Fs}->{ucs} + (ord ($Fs) - 0x60));
# Line 346  sub internal_to_iso2022 ($\%) { Line 346  sub internal_to_iso2022 ($\%) {
346        $t = _i2g ($c, $C, type => 'G94', charset => 'B');        $t = _i2g ($c, $C, type => 'G94', charset => 'B');
347      } elsif ($cc <= 0x9F) {      } elsif ($cc <= 0x9F) {
348        $t = _i2c ($c, $C, type => 'C1', charset_id => '64291991C1',        $t = _i2c ($c, $C, type => 'C1', charset_id => '64291991C1',
349          charset => $C->{private_set}->{XC1}->{'64291991C1'});          charset => $C->{option}->{private_set}->{XC1}->{'64291991C1'});
350      } elsif ($cc <= 0xFF) {      } elsif ($cc <= 0xFF) {
351        $t = _i2g (chr($cc-0x80), $C, type => 'G96', charset => 'A');        $t = _i2g (chr($cc-0x80), $C, type => 'G96', charset => 'A');
352      } elsif ($cc <= 0x24FF) {      } elsif ($cc <= 0x24FF) {
353        my $c = $cc - 0x100;        my $c = $cc - 0x100;
354        my $final = $C->{private_set}->{U96n}->[0];        my $final = $C->{option}->{private_set}->{U96n}->[0];
355        if (length $final) {        if (length $final) {
356          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,
357            type => 'G96n', charset => $final);            type => 'G96n', charset => $final);
358        }        }
359      } elsif ($cc <= 0x33FF) {      } elsif ($cc <= 0x33FF) {
360        my $c = $cc - 0x2500;        my $c = $cc - 0x2500;
361        my $final = $C->{private_set}->{U96n}->[1];        my $final = $C->{option}->{private_set}->{U96n}->[1];
362        if (length $final) {        if (length $final) {
363          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,
364            type => 'G96n', charset => $final);            type => 'G96n', charset => $final);
365        }        }
366      } elsif (0xE000 <= $cc && $cc <= 0xFFFF) {      } elsif (0xE000 <= $cc && $cc <= 0xFFFF) {
367        my $c = $cc - 0xE000;        my $c = $cc - 0xE000;
368        my $final = $C->{private_set}->{U96n}->[2];        my $final = $C->{option}->{private_set}->{U96n}->[2];
369        if (length $final) {        if (length $final) {
370          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,          $t = _i2g (chr(($c / 96)+0x20).chr(($c % 96)+0x20), $C,
371            type => 'G96n', charset => $final);            type => 'G96n', charset => $final);
# Line 431  sub internal_to_iso2022 ($\%) { Line 431  sub internal_to_iso2022 ($\%) {
431      } elsif (0x70400000 <= $cc && $cc <= 0x7040FFED) {      } elsif (0x70400000 <= $cc && $cc <= 0x7040FFED) {
432        my $c = $cc - 0x70400000;        my $c = $cc - 0x70400000;
433        $t = _i2g (chr(($c % 94)+0x21), $C, charset_id => 'P'.int ($c / 94),        $t = _i2g (chr(($c % 94)+0x21), $C, charset_id => 'P'.int ($c / 94),
434            type => 'G94', charset => $C->{private_set}->{G94}->[ $c / 94 ]);            type => 'G94', charset => $C->{option}->{private_set}->{G94}->[ $c / 94 ]);
435      } elsif (0x70410000 <= $cc && $cc <= 0x7041FFBF) {      } elsif (0x70410000 <= $cc && $cc <= 0x7041FFBF) {
436        my $c = $cc - 0x70410000;        my $c = $cc - 0x70410000;
437        $t = _i2g (chr(($c % 96)+0x20), $C, charset_id => 'P'.int ($c / 96),        $t = _i2g (chr(($c % 96)+0x20), $C, charset_id => 'P'.int ($c / 96),
438            type => 'G96', charset => $C->{private_set}->{G96}->[ $c / 96 ]);            type => 'G96', charset => $C->{option}->{private_set}->{G96}->[ $c / 96 ]);
439      } elsif (0x70420000 <= $cc && $cc <= 0x7046F19B) {      } elsif (0x70420000 <= $cc && $cc <= 0x7046F19B) {
440        my $c = $cc % 0x10000;        my $c = $cc % 0x10000;
441        $t = _i2g (chr((($c % 8836) / 94)+0x21).chr(($c % 94)+0x21), $C,        $t = _i2g (chr((($c % 8836) / 94)+0x21).chr(($c % 94)+0x21), $C,
442            type => 'G94n',            type => 'G94n',
443            charset_id => 'P'.int(($cc / 0x10000) - 0x7042).'_'.int($c / 8836),            charset_id => 'P'.int(($cc / 0x10000) - 0x7042).'_'.int($c / 8836),
444            charset => $C->{private_set}->{G94n}->[ ($cc / 0x10000) - 0x7042 ]            charset => $C->{option}->{private_set}->{G94n}
445                         ->[ $c / 8836 ]);                         ->[ ($cc / 0x10000) - 0x7042 ]->[ $c / 8836 ]);
446      }      }
447      if (defined $t) {      if (defined $t) {
448        $t = _i2o ($t, $C, cs_F => "\x40")        $t = _i2o ($t, $C, cs_F => "\x40")
# Line 464  sub internal_to_iso2022 ($\%) { Line 464  sub internal_to_iso2022 ($\%) {
464      if (defined $t) {      if (defined $t) {
465        $r .= $t;        $r .= $t;
466      } else {      } else {
467        $t = _i2g ($C->{option}->{undef_char}->[0], $C,        unless ($C->{option}->{undef_char}->[0] eq "\x20") {
468                    %{ $C->{option}->{undef_char}->[1] });          $t = _i2g ($C->{option}->{undef_char}->[0], $C,
469                        %{ $C->{option}->{undef_char}->[1] });
470          } else {  ## SP
471            $t = _back2ascii ($C) . "\x20";
472          }
473        $r .= $C->{coding_system} eq $CODING_SYSTEM{"\x40"} ?        $r .= $C->{coding_system} eq $CODING_SYSTEM{"\x40"} ?
474              $t : _i2o ($t, $C, cs_F => "\x40");              $t : _i2o ($t, $C, cs_F => "\x40");
475      }      }
# Line 630  sub _i2o ($\%%) { Line 634  sub _i2o ($\%%) {
634    if ($CS ne $C->{coding_system}) {    if ($CS ne $C->{coding_system}) {
635      my $e = '';      my $e = '';
636      $e .= "\x1B\x25";      $e .= "\x1B\x25";
637      $e .= $O{cs_F} || $C->{private_set}->{coding_system}->{ $O{cs_id} }      $e .= $O{cs_F} || $C->{option}->{private_set}->{coding_system}->{ $O{cs_id} }
638            || return undef;            || return undef;
639      if ($C->{coding_system} eq $CODING_SYSTEM{"\x2F\x40"}      if ($C->{coding_system} eq $CODING_SYSTEM{"\x2F\x40"}
640       || $C->{coding_system} eq $CODING_SYSTEM{"\x2F\x43"}       || $C->{coding_system} eq $CODING_SYSTEM{"\x2F\x43"}

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.8

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24