From: Jarkko Hietaniemi Date: Tue, 5 Mar 2002 14:29:41 +0000 (+0000) Subject: Remove HanZi and 7bit-kr, from SADAHIRO Tomoyuki. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=550b4c192a7ab403f3e0188e96ad1e2b9da72d36;p=p5sagit%2Fp5-mst-13.2.git Remove HanZi and 7bit-kr, from SADAHIRO Tomoyuki. p4raw-id: //depot/perl@15045 --- diff --git a/MANIFEST b/MANIFEST index b6e5bd3..5f7e712 100644 --- a/MANIFEST +++ b/MANIFEST @@ -212,7 +212,6 @@ ext/Encode/Encode/2022.enc Encode table ext/Encode/Encode/7bit-greek.enc Encode table ext/Encode/Encode/7bit-jis.enc Encode table ext/Encode/Encode/7bit-kana.enc Encode table -ext/Encode/Encode/7bit-kr.enc Encode table ext/Encode/Encode/7bit-latin1.enc Encode table ext/Encode/Encode/8859-1.enc Encode table ext/Encode/Encode/8859-1.ucm Encode table @@ -349,7 +348,6 @@ ext/Encode/lib/Encode/JP/Tr.pm Encode extension ext/Encode/lib/Encode/Tcl.pm Encode extension ext/Encode/lib/Encode/Tcl/Escape.pm Encode extension ext/Encode/lib/Encode/Tcl/Extended.pm Encode extension -ext/Encode/lib/Encode/Tcl/HanZi.pm Encode extension ext/Encode/lib/Encode/Tcl/Table.pm Encode extension ext/Encode/lib/Encode/ucs2_le.pm Encode extension ext/Encode/lib/Encode/Unicode.pm Encode extension diff --git a/ext/Encode/Encode/7bit-kr.enc b/ext/Encode/Encode/7bit-kr.enc deleted file mode 100644 index 30c5395..0000000 --- a/ext/Encode/Encode/7bit-kr.enc +++ /dev/null @@ -1,7 +0,0 @@ -# Encoding file: 7bit-kr, escape-driven -E -name 7bit-kr -init \x1b$)C -final {} -ascii \x0f -ksc5601 \x0e diff --git a/ext/Encode/lib/Encode/Tcl.pm b/ext/Encode/lib/Encode/Tcl.pm index 916e175..9ed3fe5 100644 --- a/ext/Encode/lib/Encode/Tcl.pm +++ b/ext/Encode/lib/Encode/Tcl.pm @@ -103,8 +103,7 @@ sub loadEncoding } my $subclass = ($type eq 'X') ? 'Extended' : - ($type eq 'H') ? 'HanZi' : - ($type eq 'E') ? 'Escape' : 'Table'; + ($type eq 'E') ? 'Escape' : 'Table'; my $class = ref($obj) . '::' . $subclass; # carp "Loading $file"; bless $obj,$class; @@ -132,7 +131,6 @@ sub INC_find require Encode::Tcl::Table; require Encode::Tcl::Escape; require Encode::Tcl::Extended; -require Encode::Tcl::HanZi; 1; __END__ diff --git a/ext/Encode/lib/Encode/Tcl/HanZi.pm b/ext/Encode/lib/Encode/Tcl/HanZi.pm deleted file mode 100644 index 3a6a5c0..0000000 --- a/ext/Encode/lib/Encode/Tcl/HanZi.pm +++ /dev/null @@ -1,151 +0,0 @@ -package Encode::Tcl::HanZi; -our $VERSION = do {my @r=(q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r}; -use base 'Encode::Encoding'; - -use Carp; - -sub read -{ - my ($obj,$fh,$name) = @_; - my(%tbl, @seq, $enc); - while (<$fh>) - { - next unless /^(\S+)\s+(.*)$/; - my ($key,$val) = ($1,$2); - $val =~ s/^\{(.*?)\}/$1/g; - $val =~ s/\\x([0-9a-f]{2})/chr(hex($1))/ge; - if($enc = Encode->getEncoding($key)) - { - $tbl{$val} = ref($enc) eq 'Encode::Tcl' ? $enc->loadEncoding : $enc; - push @seq, $val; - } - else - { - $obj->{$key} = $val; - } - } - $obj->{'Seq'} = \@seq; # escape sequences - $obj->{'Tbl'} = \%tbl; # encoding tables - return $obj; -} - -sub decode -{ - my ($obj,$str,$chk) = @_; - my $name = $obj->{'Name'}; - my $tbl = $obj->{'Tbl'}; - my $seq = $obj->{'Seq'}; - my $std = $seq->[0]; - my $cur = $std; - my $uni; - while (length($str)){ - my $cc = substr($str,0,1,''); - if($cc eq "~") - { - if($str =~ s/^\cJ//) - { - next; - } - elsif($str =~ s/^\~//) - { - 1; # no-op - } - elsif($str =~ s/^([{}])//) - { - $cur = "~$1"; - next; - } - elsif(! length $str) - { - $str = '~'; - last; - } - else - { - $str =~ s/^([^~])//; - croak "unknown HanZi escape sequence: ~$1"; - next; - } - } - if(ref($tbl->{$cur}) ne 'Encode::Tcl::Table') - { - $uni .= $tbl->{$cur}->decode($cc); - next; - } - my $ch = ord($cc); - my $rep = $tbl->{$cur}->{'Rep'}; - my $touni = $tbl->{$cur}->{'ToUni'}; - my $x; - if (&$rep($ch) eq 'C') - { - $x = $touni->[0][$ch]; - } - else - { - if(! length $str) - { - $str = $cc; # split leading byte - last; - } - my $c2 = substr($str,0,1,''); - $cc .= $c2; - $x = $touni->[$ch][ord($c2)]; - } - unless (defined $x) - { - Encode::Tcl::no_map_in_decode($name, $cc.$str); - } - $uni .= $x; - } - if($chk) - { - $_[1] = $cur eq $std ? $str : $cur.$str; - } - return $uni; -} - -sub encode -{ - my ($obj,$uni,$chk) = @_; - my $name = $obj->{'Name'}; - my $tbl = $obj->{'Tbl'}; - my $seq = $obj->{'Seq'}; - my $std = $seq->[0]; - my $str; - my $pre = $std; - my $cur = $pre; - - while (length($uni)) - { - my $ch = substr($uni,0,1,''); - my $x; - foreach my $e_seq (@$seq) - { - $x = ref($tbl->{$e_seq}) eq 'Encode::Tcl::Table' - ? $tbl->{$e_seq}->{FmUni}->{$ch} - : $tbl->{$e_seq}->encode($ch,1); - $cur = $e_seq and last if defined $x; - } - unless (defined $x) - { - unless($chk) - { - Encode::Tcl::no_map_in_encode(ord($ch), $name) - } - return undef; - } - if(ref($tbl->{$cur}) eq 'Encode::Tcl::Table') - { - my $def = $tbl->{$cur}->{'Def'}; - my $rep = $tbl->{$cur}->{'Rep'}; - $x = pack(&$rep($x),$x); - } - $str .= $cur eq $pre ? $x : ($pre = $cur).$x; - $str .= '~' if $x eq '~'; # to '~~' - } - $str .= $std unless $cur eq $std; - $_[1] = $uni if $chk; - return $str; -} -1; -__END__