1package String::Multibyte::EUC;
2
3use vars qw($VERSION);
4$VERSION = '1.12';
5
6+{
7    charset  => 'EUC',
8
9    regexp   => '(?:[\x00-\x7F]|[\xA1-\xFE][\xA1-\xFE])',
10
11    cmpchar => sub { $_[0] cmp $_[1] },
12
13    nextchar => sub {
14	my $ch = shift;
15	my $len = length $ch;
16	if ($len < 1 || 2 < $len) {
17	    return undef;
18	}
19	elsif ($len == 1) {
20	    return $ch eq "\x7F"
21		? "\xA1\xA1"
22		: chr(ord($ch)+1);
23	}
24	else {
25	    my($c, $d) = unpack('CC', $ch);
26	    return $ch eq "\xFE\xFE"
27		? undef
28		: $d == 0xFE
29		    ? chr($c+1)."\xA1"
30		    : pack('CC', $c, $d+1);
31	}
32    },
33};
34
35__END__
36
37=head1 NAME
38
39String::Multibyte::EUC - internally used by String::Multibyte
40for simple EUC encodings
41
42=head1 SYNOPSIS
43
44    use String::Multibyte;
45
46    $euc = String::Multibyte->new('EUC');
47    $euc_length = $euc->length($euc_string);
48
49=head1 DESCRIPTION
50
51C<String::Multibyte::EUC> is used for manipulation of strings in EUC
52comprising C<C0>, C<G0>, and C<G1> in which a double-byte set is invoked.
53
54Byte range of single-byte characters:
55C<0x00..0x7F>.
56
57Leading byte range of double-byte characters:
58C<0xA1..0xFE>.
59
60Trailing byte range of double-byte characters:
61C<0xA1..0xFE>.
62
63Character order: C<0x00..0x7F>, C<0xA1A1..0xFEFE>
64
65=head1 CAVEAT
66
67C1 controls, C<0x80..0x9E>, are not supported.
68
69=head1 SEE ALSO
70
71L<String::Multibyte>
72
73=cut
74