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

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

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

revision 1.1 by wakaba, Fri Oct 4 23:58:04 2002 UTC revision 1.3 by wakaba, Sat Oct 5 05:01:24 2002 UTC
# Line 16  for (0x00..0x7F) { Line 16  for (0x00..0x7F) {
16    $TABLE{ascii_to_ucs}->{$c} = $c;    $TABLE{ascii_to_ucs}->{$c} = $c;
17    $TABLE{ucs_to_ascii}->{$c} = $c;    $TABLE{ucs_to_ascii}->{$c} = $c;
18  }  }
19    $Encode::Table::ascii::VERSION = $VERSION;
20    for (0xA0..0xFF) {
21      my $c = chr $_;
22      $TABLE{isoiec8859_1_to_ucs}->{$c} = $c;
23      $TABLE{ucs_to_isoiec8859_1}->{$c} = $c;
24    }
25    $Encode::Table::isoiec8859_1::VERSION = $VERSION;
26    
27  my %_Cache;  my %_Cache;
28  sub convert ($@) {  sub convert ($@%) {
29      return $_[0] unless @{$_[1]} > 0;
30    my @s = split //, shift;    my @s = split //, shift;
31    my $tbl = shift;    my $tbl = shift;
32    my $tbls = join ' ', @$tbl;    my $tbls = join ' ', @$tbl;
33      my %option = @_;
34      load_table (@$tbl) if $option{-autoload};
35    for my $c (@s) {    for my $c (@s) {
36      unless (defined $_Cache{$tbls}->{$c}) {      unless (defined $_Cache{$tbls}->{$c}) {
37        for (@$tbl) {        for (@$tbl) {
# Line 36  sub convert ($@) { Line 46  sub convert ($@) {
46    join '', @s;    join '', @s;
47  }  }
48    
49    sub load_table (@) {
50      no strict 'refs';
51      for (@_) {
52        my $name = $_;
53        if ($name =~ /^ucs_to_(.+)$/) { $name = $1 }
54        elsif ($name =~ /^(.+)_to_ucs$/) { $name = $1 }
55        unless (${ 'Encode::Table::' . $name . '::VERSION' }) {
56          eval qq{require Encode::Table::$name; Encode::Table::$name->import} or warn $@;
57        }
58      }
59    }
60    
61  1;  1;
62  __END__  __END__
63    
# Line 53  and/or modify it under the same terms as Line 75  and/or modify it under the same terms as
75  =cut  =cut
76    
77  # $Date$  # $Date$
78  ### $Source$ ends here  ### $RCSfile$ ends here

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24