# Revision history for Perl extension Encode.
#
-# $Id: Changes,v 1.96 2003/06/18 09:29:02 dankogai Exp $
+# $Id: Changes,v 1.97 2003/07/08 21:52:14 dankogai Exp $
#
-$Revision: 1.96 $ $Date: 2003/06/18 09:29:02 $
+$Revision: 1.97 $ $Date: 2003/07/08 21:52:14 $
+! encoding.pm lib/Encode/Guess.pm lib/Encode/Alias.pm
+ lib/Encode/JP/JIS7.pm lib/Encode/Encoder.pm Encode.pm
+ $DEBUG replaced with DEBUG() so perl optimizes better,
+ by Rafael with further fixes by dankogai
+ Message-Id: <20030705222023.1f24e041.rgarciasuarez@free.fr>
+! lib/Encode/Aliases.pm
+ Was: define_alias( qr/\bGB[-_ ]?2312(?:\D.*$|$)/i => '"euc-cn"' );
+ Now: define_alias( qr/\bGB[-_ ]?2312(?!-?raw)/i => '"euc-cn"' );
+ So new hash seeding introduced in bleedperl works.
+ Message-Id: <20030629100937.GD20285@vipunen.hut.fi>
! lib/Encode/Guess.pm
$Encode::Guess::NoUTFAutoGuess is added so you can turn off
automatic utf(8|16|32) guessing -- originally by Autrijus
#
-# $Id: Encode.pm,v 1.96 2003/06/18 09:29:02 dankogai Exp $
+# $Id: Encode.pm,v 1.97 2003/07/08 21:52:14 dankogai Exp $
#
package Encode;
use strict;
-our $VERSION = do { my @r = (q$Revision: 1.96 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
-our $DEBUG = 0;
+our $VERSION = do { my @r = (q$Revision: 1.97 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+sub DEBUG () { 0 }
use XSLoader ();
XSLoader::load(__PACKAGE__, $VERSION);
}else{
%enc = %Encoding;
for my $mod (map {m/::/o ? $_ : "Encode::$_" } @_){
- $DEBUG and warn $mod;
+ DEBUG and warn $mod;
for my $enc (keys %ExtModule){
$ExtModule{$enc} eq $mod and $enc{$enc} = $mod;
}
push @Encode::utf8::ISA, 'Encode::Encoding';
#
if ($use_xs){
- $DEBUG and warn __PACKAGE__, " XS on";
+ Encode::DEBUG and warn __PACKAGE__, " XS on";
*decode = \&decode_xs;
*encode = \&encode_xs;
}else{
- $DEBUG and warn __PACKAGE__, " XS off";
+ Encode::DEBUG and warn __PACKAGE__, " XS off";
*decode = sub{
my ($obj,$octets,$chk) = @_;
my $str = Encode::decode_utf8($octets);
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Encode
-version: 1.96
+version: 1.97
version_from: Encode.pm
installdirs: perl
requires:
-# $Id: encoding.pm,v 1.45 2003/06/18 09:29:02 dankogai Exp $
+# $Id: encoding.pm,v 1.46 2003/07/08 21:52:14 dankogai Exp $
package encoding;
-our $VERSION = do { my @r = (q$Revision: 1.45 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.46 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
use Encode;
use strict;
-our $DEBUG = 0;
+sub DEBUG () { 0 }
BEGIN {
if (ord("A") == 193) {
}
$name = $enc->name; # canonize
unless ($arg{Filter}) {
- $DEBUG and warn "_exception($name) = ", _exception($name);
+ DEBUG and warn "_exception($name) = ", _exception($name);
_exception($name) or ${^ENCODING} = $enc;
$HAS_PERLIO or return 1;
}else{
filter_add(sub{
my $status = filter_read();
if ($status > 0){
- # $DEBUG and warn $_;
$_ = $enc->decode($_, 1);
- $DEBUG and warn $_;
+ DEBUG and warn $_;
}
$status ;
});
};
- } $DEBUG and warn "Filter installed";
+ } DEBUG and warn "Filter installed";
defined ${^UNICODE} and ${^UNICODE} != 0 and return 1;
for my $h (qw(STDIN STDOUT)){
if ($arg{$h}){
use strict;
no warnings 'redefine';
use Encode;
-our $VERSION = do { my @r = (q$Revision: 1.36 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
-our $DEBUG = 0;
+our $VERSION = do { my @r = (q$Revision: 1.37 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+sub DEBUG () { 0 }
use base qw(Exporter);
my $new;
if (ref($alias) eq 'Regexp' && $find =~ $alias)
{
- $DEBUG and warn "eval $val";
+ DEBUG and warn "eval $val";
$new = eval $val;
- $DEBUG and $@ and warn "$val, $@";
+ DEBUG and $@ and warn "$val, $@";
}
elsif (ref($alias) eq 'CODE')
{
- $DEBUG and warn "$alias", "->", "($find)";
+ DEBUG and warn "$alias", "->", "($find)";
$new = $alias->($find);
}
elsif (lc($find) eq lc($alias))
if (defined($new))
{
next if $new eq $find; # avoid (direct) recursion on bugs
- $DEBUG and warn "$alias, $new";
+ DEBUG and warn "$alias, $new";
my $enc = (ref($new)) ? $new : Encode::find_encoding($new);
if ($enc)
{
}
}
}
- if ($DEBUG){
+ if (DEBUG){
my $name;
if (my $e = $Alias{$find}){
$name = $e->name;
for my $k (@a){
if (ref($alias) eq 'Regexp' && $k =~ $alias)
{
- $DEBUG and warn "delete \$Alias\{$k\}";
+ DEBUG and warn "delete \$Alias\{$k\}";
delete $Alias{$k};
}
elsif (ref($alias) eq 'CODE')
{
- $DEBUG and warn "delete \$Alias\{$k\}";
+ DEBUG and warn "delete \$Alias\{$k\}";
delete $Alias{$alias->($name)};
}
}
}else{
- $DEBUG and warn "delete \$Alias\{$alias\}";
+ DEBUG and warn "delete \$Alias\{$alias\}";
delete $Alias{$alias};
}
}
#
-# $Id: Encoder.pm,v 0.6 2003/02/06 01:52:11 dankogai Exp $
+# $Id: Encoder.pm,v 0.7 2003/07/08 21:52:14 dankogai Exp $
#
package Encode::Encoder;
use strict;
use warnings;
-our $VERSION = do { my @r = (q$Revision: 0.6 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 0.7 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw ( encoder );
our $AUTOLOAD;
-our $DEBUG = 0;
+sub DEBUG () { 0 }
use Encode qw(encode decode find_encoding from_to);
use Carp;
}
sub DESTROY{ # defined so it won't autoload.
- $DEBUG and warn shift;
+ DEBUG and warn shift;
}
sub AUTOLOAD {
$myname =~ s/.*://; # strip fully-qualified portion
my $obj = find_encoding($myname)
or confess __PACKAGE__, ": unknown encoding: $myname";
- $DEBUG and warn $self->{encoding}, " => ", $obj->name;
+ DEBUG and warn $self->{encoding}, " => ", $obj->name;
if ($self->{encoding}){
from_to($self->{data}, $self->{encoding}, $obj->name, 1);
}else{
use strict;
use Encode qw(:fallbacks find_encoding);
-our $VERSION = do { my @r = (q$Revision: 1.8 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
my $Canon = 'Guess';
-our $DEBUG = 0;
+sub DEBUG () { 0 }
our %DEF_SUSPECTS = map { $_ => find_encoding($_) } qw(ascii utf8);
$Encode::Encoding{$Canon} =
bless {
for my $c (@_){
my $e = find_encoding($c) or die "Unknown encoding: $c";
$self->{Suspects}{$e->name} = $e;
- $DEBUG and warn "Added: ", $e->name;
+ DEBUG and warn "Added: ", $e->name;
}
}
$char & 0xff00 and $le++;
}
}
- $DEBUG and warn "$utf, be == $be, le == $le";
+ DEBUG and warn "$utf, be == $be, le == $le";
$be == $le
and return
"Encodings ambiguous between $utf BE and LE ($be, $le)";
for my $c (@_){
my $e = find_encoding($c) or die "Unknown encoding: $c";
$try{$e->name} = $e;
- $DEBUG and warn "Added: ", $e->name;
+ DEBUG and warn "Added: ", $e->name;
}
my $nline = 1;
for my $line (split /\r\n?|\n/, $octet){
my $scratch = $line;
$try{$k}->decode($scratch, FB_QUIET);
if ($scratch eq ''){
- $DEBUG and warn sprintf("%4d:%-24s ok\n", $nline, $k);
+ DEBUG and warn sprintf("%4d:%-24s ok\n", $nline, $k);
}else{
use bytes ();
- $DEBUG and
+ DEBUG and
warn sprintf("%4d:%-24s not ok; %d bytes left\n",
$nline, $k, bytes::length($scratch));
delete $ok{$k};
package Encode::JP::JIS7;
use strict;
-our $VERSION = do { my @r = (q$Revision: 1.11 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.12 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
use Encode qw(:fallbacks);
use Encode::CJKConstants qw(:all);
-our $DEBUG = 0;
-
#
# decode is identical for all 2022 variants
#