/[pub]/test/oldencodeutils/lib/Encode/Charset.pm
Suika

Contents of /test/oldencodeutils/lib/Encode/Charset.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Wed Dec 18 10:21:09 2002 UTC (23 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.6: +16 -11 lines
*** empty log message ***

<
1
2 =head1 NAME
3
4 Encode::Charset --- Coded Character Sets objects,
5 used by Encode::ISO2022, Encode::SJIS, and other modules.
6
7 =cut
8
9 package Encode::Charset;
10 use strict;
11 use vars qw(%CHARSET %CODING_SYSTEM $VERSION);
12 $VERSION=do{my @r=(q$Revision: 1.6 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
13
14 ## --- Make initial charset definitions
15 &_make_initial_charsets;
16 sub _make_initial_charsets () {
17 for my $f (0x30..0x7E) {
18 my $F = pack 'C', $f;
19 for ('', '!', '"', '#') {
20 $CHARSET{G94}->{ $_.$F }->{dimension} = 1;
21 $CHARSET{G94}->{ $_.$F }->{chars} = 94;
22 $CHARSET{G94}->{ $_.$F }->{ucs} =
23 {'' => 0xE90940, '!' => 0xE944A0, '"' => 0xE98000, '#' => 0xE9BB60}->{ $_ }
24 + 94 * ($f-0x30);
25
26 $CHARSET{G96}->{ $_.$F }->{dimension} = 1;
27 $CHARSET{G96}->{ $_.$F }->{chars} = 96;
28 $CHARSET{G96}->{ $_.$F }->{ucs} =
29 {'' => 0xE926A0, '!' => 0xE96200, '"' => 0xE99D60, '#' => 0xE9D8C0}->{ $_ }
30 + 96 * ($f-0x30);
31
32 $CHARSET{C0}->{ $_.$F }->{dimension} = 1;
33 $CHARSET{C0}->{ $_.$F }->{chars} = 32;
34 $CHARSET{C0}->{ $_.$F }->{ucs} =
35 {'' => 0x70000000, '!' => 0x70001400,
36 '"' => 0x70002800, '#' => 0x70003C00}->{ $_ } + 32 * ($f-0x30);
37
38 $CHARSET{C1}->{ $_.$F }->{dimension} = 1;
39 $CHARSET{C1}->{ $_.$F }->{chars} = 32;
40 $CHARSET{C1}->{ $_.$F }->{ucs} =
41 {'' => 0x70000A00, '!' => 0x70001E00,
42 '"' => 0x70003200, '#' => 0x70004600}->{ $_ } + 32 * ($f-0x30);
43
44 $CHARSET{G94}->{ ' '.$_.$F }->{dimension} = 1; ## DRCS
45 $CHARSET{G94}->{ ' '.$_.$F }->{chars} = 94;
46 $CHARSET{G94}->{ ' '.$_.$F }->{ucs} =
47 {'' => 0x70090940, '!' => 0x700944A0,
48 '"' => 0x70098000, '#' => 0x7009BB60}->{ $_ } + 94 * ($f-0x30);
49
50 $CHARSET{G96}->{ ' '.$_.$F }->{dimension} = 1; ## DRCS
51 $CHARSET{G96}->{ ' '.$_.$F }->{chars} = 96;
52 $CHARSET{G96}->{ ' '.$_.$F }->{ucs} =
53 {'' => 0x700926A0, '!' => 0x70096200,
54 '"' => 0x70099D60, '#' => 0x7009D8C0}->{ $_ } + 96 * ($f-0x30);
55 }
56 }
57 for my $f (0x30..0x5F, 0x7E) {
58 my $F = pack 'C', $f;
59 for ('', '!', '"', '#', ' ') {
60 $CHARSET{G94n}->{ $_.$F }->{dimension} = 2;
61 $CHARSET{G94n}->{ $_.$F }->{chars} = 94;
62 $CHARSET{G94n}->{ $_.$F }->{ucs} =
63 ({'' => 0xE9F6C0}->{ $_ }||0) + 94*94 * ($f-0x30);
64 ## BUG: 94^n sets with I byte have no mapping area
65
66 $CHARSET{G96n}->{ $_.$F }->{dimension} = 2;
67 $CHARSET{G96n}->{ $_.$F }->{chars} = 96;
68 $CHARSET{G96n}->{ $_.$F }->{ucs} =
69 ({'' => 0xF4C000}->{ $_ }||0) + 96*96 * ($f-0x30);
70 ## BUG: 96^n DRCSes with I byte have no mapping area
71 }
72 }
73 $CHARSET{G94n}->{"\x20\x40"}->{ucs} = 0x70460000; ## DRCS 94^2 04/00
74 $CHARSET{G94n}->{P4_0} = $CHARSET{G94n}->{"\x20\x40"};
75
76 for (0x60..0x6F) {
77 my $F = pack 'C', $_;
78 ## BUG: 9x^3 sets have no mapping area
79 for ('', '!', '"', '#', ' ') {
80 $CHARSET{G94n}->{ $_.$F }->{dimension} = 3;
81 $CHARSET{G94n}->{ $_.$F }->{chars} = 94;
82
83 $CHARSET{G96n}->{ $_.$F }->{dimension} = 3;
84 $CHARSET{G96n}->{ $_.$F }->{chars} = 96;
85 }
86 }
87 for (0x70..0x7D) {
88 my $F = pack 'C', $_;