/[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.2 by wakaba, Sat Oct 5 01:34:55 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    
21  my %_Cache;  my %_Cache;
22  sub convert ($@) {  sub convert ($@%) {
23    my @s = split //, shift;    my @s = split //, shift;
24    my $tbl = shift;    my $tbl = shift;
25    my $tbls = join ' ', @$tbl;    my $tbls = join ' ', @$tbl;
26      my %option = @_;
27      load_table (@$tbl) if $option{-autoload};
28    for my $c (@s) {    for my $c (@s) {
29      unless (defined $_Cache{$tbls}->{$c}) {      unless (defined $_Cache{$tbls}->{$c}) {
30        for (@$tbl) {        for (@$tbl) {
# Line 36  sub convert ($@) { Line 39  sub convert ($@) {
39    join '', @s;    join '', @s;
40  }  }
41    
42    sub load_table (@) {
43      no strict 'refs';
44      for (@_) {
45        my $name = $_;
46        if ($name =~ /^ucs_to_(.+)$/) { $name = $1 }
47        elsif ($name =~ /^(.+)_to_ucs$/) { $name = $1 }
48        unless (${ 'Encode::Table::' . $name . '::VERSION' }) {
49          eval qq{require Encode::Table::$name; Encode::Table::$name->import} or warn $@;
50        }
51      }
52    }
53    
54  1;  1;
55  __END__  __END__
56    
# Line 53  and/or modify it under the same terms as Line 68  and/or modify it under the same terms as
68  =cut  =cut
69    
70  # $Date$  # $Date$
71  ### $Source$ ends here  ### $RCSfile$ ends here

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24