/[suikacvs]/perl/lib/Encode/ISO2022.pm
Suika

Diff of /perl/lib/Encode/ISO2022.pm

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

revision 1.14 by wakaba, Wed Dec 18 10:21:09 2002 UTC revision 1.15 by wakaba, Wed Dec 18 12:57:40 2002 UTC
# Line 487  sub internal_to_iso2022 ($;%) { Line 487  sub internal_to_iso2022 ($;%) {
487        if (defined $t) {        if (defined $t) {
488          my %D = (fallback => $C->{option}->{fallback_from_ucs}, reset => $C->{option}->{reset});          my %D = (fallback => $C->{option}->{fallback_from_ucs}, reset => $C->{option}->{reset});
489          $C->{option}->{fallback_from_ucs} = 'croak';          $C->{option}->{fallback_from_ucs} = 'croak';
490          $C->{option}->{reset} = {Gdesignation => 0, Ginvoke => 0};          $C->{option}->{reset_at_end} = {Gdesignation => 0, Ginvoke => 0};
491          eval q{$t = $C->{_encoder}->_encode_internal ($t, $C)} or undef $t;          eval q{$t = $C->{_encoder}->_encode_internal ($t, $C)} or undef $t;
492          $C->{option}->{fallback_from_ucs} = $D{fallback};          $C->{option}->{fallback_from_ucs} = $D{fallback};
493          $C->{option}->{reset} = $D{reset};          $C->{option}->{reset_at_end} = $D{reset_at_end};
494        }        }
495        if (defined $t) {        if (defined $t) {
496          $r .= $t;          $r .= $t;
# Line 506  sub internal_to_iso2022 ($;%) { Line 506  sub internal_to_iso2022 ($;%) {
506        }        }
507      }      }
508    }    }
509    ($r . _back2ascii ($C));      ## Back to ASCII at the end of document if specified    ($r . _back2ascii ($C, at => 'reset_at_end'));
510  }  }
511    
512  ## $O{charset} eq undef means that charset is same as the current designated one.  ## $O{charset} eq undef means that charset is same as the current designated one.
# Line 623  sub _i2g ($%%) { Line 623  sub _i2g ($%%) {
623    $s =~ tr/\x00-\x7F/\x80-\xFF/ unless $left;    $s =~ tr/\x00-\x7F/\x80-\xFF/ unless $left;
624    $r . $s;    $r . $s;
625  }  }
626  sub _back2ascii (%) {  sub _back2ascii ($;%) {
627    my ($C, %O) = @_;    my ($C, %O) = @_;
628    my $r = '';    my $r = '';
629    if ($C->{option}->{reset}->{Gdesignation}) {    $O{at} ||= 'reset';
630      my $F = $C->{option}->{reset}->{Gdesignation};      # \x42    if ($C->{option}->{$O{at}}->{Gdesignation}||$C->{option}->{reset}->{Gdesignation}) {
631        my $F = $C->{option}->{$O{at}}->{Gdesignation}
632             || $C->{option}->{reset}->{Gdesignation};      # \x42
633      $r .= "\x1B\x28".$F unless $C->{G0} eq $CHARSET{G94}->{$F};      $r .= "\x1B\x28".$F unless $C->{G0} eq $CHARSET{G94}->{$F};
634      $C->{G0} = $CHARSET{G94}->{$F};      $C->{G0} = $CHARSET{G94}->{$F};
635      if ($O{reset_all}) {      if ($O{reset_all}) {
# Line 636  sub _back2ascii (%) { Line 638  sub _back2ascii (%) {
638        $C->{G3} = $CHARSET{G94}->{"\x7E"};        $C->{G3} = $CHARSET{G94}->{"\x7E"};
639      }      }
640    }    }
641    if ($C->{option}->{reset}->{Ginvoke}) {    if ($C->{option}->{$O{at}}->{Ginvoke}||$C->{option}->{reset}->{Ginvoke}) {
642      if ($C->{GL} ne 'G0') {      if ($C->{GL} ne 'G0') {
643        $r .= $C->{C0}->{C_LS0} || ($C->{C0} = $CHARSET{C0}->{'@'},"\x1B\x21\x40\x0F");        $r .= $C->{C0}->{C_LS0} || ($C->{C0} = $CHARSET{C0}->{'@'},"\x1B\x21\x40\x0F");
644        $C->{GL} = 'G0';        $C->{GL} = 'G0';

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24