/[suikacvs]/perl/lib/Encode/ISO2022/SevenBit.pm
Suika

Contents of /perl/lib/Encode/ISO2022/SevenBit.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Wed Nov 6 09:29:16 2002 UTC (22 years, 1 month ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +2 -2 lines
FILE REMOVED
2002-11-06  Wakaba <w@suika.fam.cx>

	* SevenBit.esr, EightBit.esr, JUNET.esr,
	JUNETCompatible.esr, EUCJA.esr, EUCJACompatible.esr,
	EUCKR.esr, EUCZH.esr: New files.
	* SevenBit.pm, EightBit.pm: Removed.
	(Now these modules are auto-generated from *.esr files.)

1 =head1 NAME
2
3 Encode::ISO2022::SevenBit --- Encode and decode of 7-bit ISO/IEC 2022
4 based encodings
5
6 =head1 ENCODINGS
7
8 =over 4
9
10 =cut
11
12 require 5.7.3;
13 use strict;
14 package Encode::ISO2022::SevenBit;
15 use vars qw($VERSION);
16 $VERSION=do{my @r=(q$Revision: 1.10 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
17 use base qw(Encode::Encoding);
18 __PACKAGE__->Define (qw/iso-2022-7bit iso-2022-7 jis junet jis7
19 7bit-jis/);
20 require Encode::ISO2022;
21
22 sub encode ($$;$) {
23 my ($obj, $str, $chk) = @_;
24 $_[1] = '' if $chk;
25 if (!defined $obj->{_encode_mapping} || $obj->{_encode_mapping}) {
26 require Encode::Table;
27 $str = Encode::Table::convert ($str, $obj->__encode_map,
28 -autoload => defined $obj->{_encode_mapping_autoload} ?
29 $obj->{_encode_mapping_autoload} : 1);
30 }
31 $str = &Encode::ISO2022::internal_to_iso2022 ($str, $obj->__2022_encode);
32 $str;
33 }
34
35 sub decode ($$;$) {
36 my ($obj, $str, $chk) = @_;
37 $_[1] = '' if $chk;
38 $str = &Encode::ISO2022::iso2022_to_internal ($str, $obj->__2022_decode);
39 if (!defined $obj->{_decode_mapping} || $obj->{_decode_mapping}) {
40 require Encode::Table;
41 $str = Encode::Table::convert ($str, $obj->__decode_map,
42 -autoload => defined $obj->{_decode_mapping_autoload} ?
43 $obj->{_decode_mapping_autoload} : 1);
44 }
45 $str;
46 }
47
48 sub __clone ($) {
49 my $self = shift;
50 bless {%$self}, ref $self;
51 };
52
53 =item iso-2022-7bit
54
55 ISO/IEC 2022 based 7-bit encoding using only G0
56 (Alias: junet (emacsen), jis, jis7, iso-2022-7 (emacsen), 7bit-jis (perl))
57
58 =cut
59
60 sub __2022__common ($) {
61 my $C = Encode::ISO2022->new_object;
62 $C->{bit} = 7;
63 $C->{option}->{designate_to}->{G96}->{default} = 0;
64 $C->{option}->{designate_to}->{G96n}->{default} = 0;
65 $C;
66 }
67 sub __2022_encode ($) {
68 my $C = shift->__2022__common;
69 $C->{GR} = undef;
70 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
71 $C;
72 }
73 sub __2022_decode ($) {
74 my $C = shift->__2022__common;
75
76 $C;
77 }
78 sub __encode_map ($) {
79 [];
80 }
81 sub __decode_map ($) {
82 [];
83 }
84
85 package Encode::ISO2022::SevenBit::JP;
86 use vars qw/@ISA/;
87 push @ISA, 'Encode::ISO2022::SevenBit';
88 __PACKAGE__->Define (qw/iso-2022-jp junet-code japanese-iso-7bit csiso2022jp
89 iso2022jp/);
90
91 =item iso-2022-jp
92
93 ISO/IEC 2022 based 7-bit encoding for Japanese.
94 Defined by Junet no tebiki, RFC 1468 and JIS X 0208:1997 Appendix 2.
95 (Alias: junet-code, japanese-iso-7bit (emacsen), csISO2022JP (IANA))
96
97 =cut
98
99 sub __2022__common ($) {
100 my $C = Encode::ISO2022->new_object;
101 $C->{bit} = 7;
102 $C->{option}->{designate_to}->{C0}->{default} = -1;
103 $C->{option}->{designate_to}->{C0}->{"\x40"} = 0;
104 $C->{option}->{designate_to}->{C1}->{default} = -1;
105 $C->{option}->{designate_to}->{G94}->{default} = -1;
106 $C->{option}->{designate_to}->{G94n}->{default} = -1;
107 $C->{option}->{designate_to}->{G96}->{default} = -1;
108 $C->{option}->{designate_to}->{G96n}->{default} = -1;
109 $C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman
110 $C->{option}->{designate_to}->{G94n}->{"\x40"} = 0; ## JIS X 0208-1978
111 $C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## JIS X 0208-1983
112 $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = 0; ## JIS X 0208-1990
113 $C->{option}->{use_revision} = 0;
114 $C;
115 }
116 sub __2022_encode ($) {
117 my $C = shift->__2022__common;
118 $C->{GR} = undef;
119 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
120 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
121 $C;
122 }
123 sub __encode_map ($) {
124 [qw/ucs_to_ascii ucs_to_jisx0208_1983 ucs_to_jisx0208_1990 ucs_to_jisx0208_1978 ucs_to_jisx0201_latin/];
125 }
126 sub __decode_map ($) {
127 [qw/jisx0208_1983_to_ucs jisx0208_1990_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs/];
128 }
129
130 package Encode::ISO2022::SevenBit::JP1978IRV;
131 use vars qw/@ISA/;
132 push @ISA, 'Encode::ISO2022::SevenBit::JP';
133 __PACKAGE__->Define (qw/iso-2022-jp-1978-irv japanese-iso-7bit-1978-irv old-jis
134 x-obsoleted-iso-2022-jp jis78/);
135
136 =item iso-2022-jp-1978-irv
137
138 ISO/IEC 2022 based 7-bit encoding for Japanese,
139 using JIS X 0208-1978.
140 (Alias: japanese-iso-7bit-1978-irv (emacsen), old-jis (emacsen),
141 jis78)
142
143 =cut
144
145 sub __2022_encode ($) {
146 my $C = shift->__2022__common;
147 $C->{GR} = undef;
148 $C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman
149 $C->{option}->{designate_to}->{G94n}->{"\x42"} = -1; ## JIS X 0208-1983
150 $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990
151 $C;
152 }
153 sub __encode_map ($) {
154 [qw/ucs_to_ascii ucs_to_jisx0208_1978 ucs_to_jisx0201_latin/];
155 }
156 sub __decode_map ($) {
157 [qw/jisx0208_1983_to_ucs jisx0208_1990_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs/];
158 }
159
160 package Encode::ISO2022::SevenBit::JP1;
161 use vars qw/@ISA/;
162 push @ISA, 'Encode::ISO2022::SevenBit::JP';
163 __PACKAGE__->Define (qw/iso-2022-jp-1 iso2022jp-1/);
164
165 =item iso-2022-jp-1
166
167 ISO/IEC 2022 based 7-bit encoding for Japanese,
168 defined by RFC 2237. (Alias: iso2022jp-1)
169
170 =cut
171
172 sub __2022__common ($) {
173 my $C = shift->SUPER::__2022__common;
174 $C->{option}->{designate_to}->{G94n}->{"\x44"} = 0; ## JIS X 0212-1990
175 $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990
176 $C;
177 }
178 sub __encode_map ($) {
179 [qw/ucs_to_ascii ucs_to_jisx0208_1983 ucs_to_jisx0212_1990 ucs_to_jisx0208_1978 ucs_to_jisx0201_latin/];
180 }
181 sub __decode_map ($) {
182 [qw/jisx0208_1983_to_ucs jisx0212_1990_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs/];
183 }
184
185 package Encode::ISO2022::SevenBit::JP3;
186 use vars qw/@ISA/;
187 push @ISA, 'Encode::ISO2022::SevenBit::JP';
188 __PACKAGE__->Define (qw/iso-2022-jp-3 x-iso-2022-jp-3 iso2022jp-3
189 jis0213/);
190
191 =item iso-2022-jp-3
192
193 ISO/IEC 2022 based 7-bit encoding for Japanese,
194 defined by JIS X 0213:2000 Appendix 2.
195 (Alias: x-iso-2022-jp-3, iso2022jp-3, jis0213)
196
197 =cut
198
199 sub __2022__common ($) {
200 my $C = shift->SUPER::__2022__common;
201 $C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman
202 $C->{option}->{designate_to}->{G94n}->{"\x40"} = -1; ## JIS X 0208-1978
203 $C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## restricted JIS X 0213:2000 plane 1
204 $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990
205 $C->{option}->{designate_to}->{G94n}->{"\x4F"} = 0; ## JIS X 0213:2000 plane 1
206 $C->{option}->{designate_to}->{G94n}->{"\x50"} = 0; ## JIS X 0213:2000 plane 2
207 $C;
208 }
209 sub __encode_map ($) {
210 [qw/ucs_to_ascii ucs_to_jisx0213_2000_1 ucs_to_jisx0213_2000_2/];
211 }
212 sub __decode_map ($) {
213 [qw/jisx0213_2000_1_to_ucs jisx0212_0213_to_ucs jisx0208_1983_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs/];
214 }
215
216 package Encode::ISO2022::SevenBit::JP3Strict;
217 use vars qw/@ISA/;
218 push @ISA, 'Encode::ISO2022::SevenBit::JP3';
219 __PACKAGE__->Define (qw/iso-2022-jp-3-strict/);
220
221 =item iso-2022-jp-3-strict
222
223 ISO/IEC 2022 based 7-bit encoding for Japanese.
224 A subset of iso-2022-jp-3.
225 See <http://www.m17n.org/m17n2000_all_but_registration/proceedings/kawabata/jisx0213.html>.
226
227 =cut
228
229 sub __encode_map ($) {
230 [qw/ucs_to_ascii ucs_to_jisx0213_2000_1_esc_24_42 ucs_to_jisx0213_2000_1 ucs_to_jisx0213_2000_2/];
231 }
232
233 package Encode::ISO2022::SevenBit::JP3Compatible;
234 use vars qw/@ISA/;
235 push @ISA, 'Encode::ISO2022::SevenBit::JP3';
236 __PACKAGE__->Define (qw/iso-2022-jp-3-compatible/);
237
238 =item iso-2022-jp-3-compatible
239
240 ISO/IEC 2022 based 7-bit encoding for Japanese.
241 See <http://www.m17n.org/m17n2000_all_but_registration/proceedings/kawabata/jisx0213.html>.
242
243 =cut
244
245 sub __encode_map ($) {
246 [qw/ucs_to_ascii ucs_to_jisx0208_1983 ucs_to_jisx0213_2000_1 ucs_to_jisx0213_2000_2/];
247 }
248
249 package Encode::ISO2022::SevenBit::JP3Plane1;
250 use vars qw/@ISA/;
251 push @ISA, 'Encode::ISO2022::SevenBit::JP3';
252 __PACKAGE__->Define (qw/iso-2022-jp-3-plane1/);
253
254 =item iso-2022-jp-3-plane1
255
256 ISO/IEC 2022 based 7-bit encoding for Japanese,
257 defined by JIS X 0213:2000 Appendix 2.
258
259 =cut
260
261 sub __2022__common ($) {
262 my $C = shift->SUPER::__2022__common;
263 $C->{option}->{designate_to}->{G94n}->{"\x50"} = -1; ## JIS X 0213:2000 plane 2
264 $C;
265 }
266 sub __encode_map ($) {
267 [qw/ucs_to_ascii ucs_to_jisx0213_2000_1/];
268 }
269 sub __decode_map ($) {
270 [qw/jisx0213_2000_1_to_ucs jisx0208_1983_to_ucs/];
271 }
272
273 package Encode::ISO2022::SevenBit::SS2;
274 use vars qw/@ISA/;
275 push @ISA, 'Encode::ISO2022::SevenBit';
276 __PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2 iso-2022-ss2-7
277 jis_encoding csjisencoding/);
278
279 =item iso-2022-7bit-ss2
280
281 ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset
282 (Alias: x-iso-2022-jp-2, iso-2022-ss2-7 (emacsen))
283
284 =cut
285
286 sub __2022__common ($) {
287 my $C = shift->SUPER::__2022__common;
288 $C->{option}->{designate_to}->{G96}->{default} = 2;
289 $C->{option}->{designate_to}->{G96n}->{default} = 2;
290 $C->{option}->{Ginvoke_by_single_shift}->[2] = 1;
291 $C;
292 }
293
294 package Encode::ISO2022::SevenBit::JP2;
295 use vars qw/@ISA/;
296 push @ISA, 'Encode::ISO2022::SevenBit::SS2';
297 __PACKAGE__->Define (qw/iso-2022-jp-2 csiso2022jp2 iso2022jp-2/);
298
299 =item iso-2022-jp-2
300
301 ISO/IEC 2022 based 7-bit multilingual encoding, defined by
302 RFC 1554. A subset of iso-2022-7bit-ss2. (Alias: iso2022jp-2,
303 csISO2022JP2 (IANA))
304
305 =cut
306
307 sub __2022__common ($) {
308 my $C = shift->SUPER::__2022__common;
309 $C->{option}->{designate_to}->{C0}->{default} = -1;
310 $C->{option}->{designate_to}->{C0}->{"\x40"} = 0;
311 $C->{option}->{designate_to}->{C1}->{default} = -1;
312 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x47"}; ## Minimum C1
313 $C->{option}->{designate_to}->{C1}->{"\x47"} = -1;
314 $C->{option}->{designate_to}->{G94}->{default} = -1;
315 $C->{option}->{designate_to}->{G94n}->{default} = -1;
316 $C->{option}->{designate_to}->{G96}->{default} = -1;
317 $C->{option}->{designate_to}->{G96n}->{default} = -1;
318 $C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman
319 for ("\x40", "\x41", "\x42", "\x43", "\x44") {
320 $C->{option}->{designate_to}->{G94n}->{ $_ } = 0;
321 }
322 for ("\x41", "\x46") {
323 $C->{option}->{designate_to}->{G96}->{ $_ } = 2;
324 }
325 $C;
326 }
327 sub __2022_encode ($) {
328 my $C = shift->__2022__common;
329 $C->{GR} = undef;
330 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
331 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
332 $C;
333 }
334 sub __encode_map ($) {
335 [qw/ucs_to_ascii ucs_to_jisx0208_1983 ucs_to_jisx0212_1990 ucs_to_gb2312_1980 ucs_to_ksx1001_1992 ucs_to_jisx0208_1978 ucs_to_isoiec8859_1 ucs_to_isoiec8859_7 ucs_to_jisx0201_latin/];
336 }
337 sub __decode_map ($) {
338 [qw/jisx0208_1983_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs gb2312_1980_to_ucs ksx1001_1992_to_ucs isoiec8859_7_to_ucs/];
339 }
340
341 package Encode::ISO2022::SevenBit::Lock;
342 use vars qw/@ISA/;
343 push @ISA, 'Encode::ISO2022::SevenBit';
344 __PACKAGE__->Define (qw/iso-2022-7bit-lock/);
345
346 =item iso-2022-7bit-lock
347
348 ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for 96-charset
349
350 =cut
351
352 sub __2022__common ($) {
353 my $C = shift->SUPER::__2022__common;
354 $C->{option}->{designate_to}->{G96}->{default} = 1;
355 $C->{option}->{designate_to}->{G96n}->{default} = 1;
356 $C;
357 }
358
359 package Encode::ISO2022::SevenBit::INT;
360 use vars qw/@ISA/;
361 push @ISA, 'Encode::ISO2022::SevenBit';
362 __PACKAGE__->Define (qw/iso-2022-int iso-2022-int-* iso-2022-int-2/);
363
364 =item iso-2022-int
365
366 ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for
367 KS X 1001 and 96-charset. See draft-ohta-text-encoding.
368 (Alias: iso-2022-int-*)
369
370 =cut
371
372 sub __2022__common ($) {
373 my $C = shift->SUPER::__2022__common;
374 $C->{option}->{designate_to}->{G96}->{default} = 1;
375 $C->{option}->{designate_to}->{G96n}->{default} = 1;
376 $C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001
377 $C;
378 }
379 sub __2022_encode ($) {
380 my $C = shift->__2022__common;
381 $C->{GR} = undef;
382 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
383 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
384 $C;
385 }
386 sub __2022_decode ($) {
387 my $C = shift->__2022__common;
388 $C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001
389 $C;
390 }
391
392 package Encode::ISO2022::SevenBit::KR;
393 use vars qw/@ISA/;
394 push @ISA, 'Encode::ISO2022::SevenBit';
395 __PACKAGE__->Define (qw/iso-2022-kr korean-iso-7bit csiso2022kr cp50225 kr2022 korean-mail/);
396
397 =item iso-2022-kr
398
399 An ISO/IEC 2022 based 7-bit encoding for Korean,
400 defined by RFC 1557 (Alias: korean-iso-7bit (emacsen),
401 csISO2022KR (IANA), CP50225 (M$), KR2022, korean-mail (emacsen))
402
403 =cut
404
405 sub __2022__common ($) {
406 my $C = shift->SUPER::__2022__common;
407 $C->{option}->{designate_to}->{C0}->{default} = -1;
408 $C->{option}->{designate_to}->{C0}->{"\x40"} = 0;
409 $C->{option}->{designate_to}->{C1}->{default} = -1;
410 $C->{option}->{designate_to}->{G94}->{default} = -1;
411 $C->{option}->{designate_to}->{G94n}->{default} = -1;
412 $C->{option}->{designate_to}->{G96}->{default} = -1;
413 $C->{option}->{designate_to}->{G96n}->{default} = -1;
414 $C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001
415 $C;
416 }
417 sub __2022_encode ($) {
418 my $C = shift->__2022__common;
419 $C->{GR} = undef;
420 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
421 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
422 $C;
423 }
424 sub __2022_decode ($) {
425 my $C = shift->__2022__common;
426 $C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001
427 $C;
428 }
429 sub __encode_map ($) {
430 [qw/ucs_to_ascii ksx1001_1992_to_ucs/];
431 }
432 sub __decode_map ($) {
433 [qw/ksx1001_1992_to_ucs/];
434 }
435
436 package Encode::ISO2022::SevenBit::INT1;
437 use vars qw/@ISA/;
438 push @ISA, 'Encode::ISO2022::SevenBit';
439 __PACKAGE__->Define (qw/iso-2022-int-1/);
440
441 =item iso-2022-int-1
442
443 An ISO/IEC 2022 based 7-bit multilingual encoding,
444 defined by draft-ohta-text-encoding
445
446 =cut
447
448 sub __2022__common ($) {
449 my $C = shift->SUPER::__2022__common;
450 $C->{option}->{designate_to}->{C0}->{default} = -1;
451 $C->{option}->{designate_to}->{C0}->{"\x40"} = 0;
452 $C->{option}->{designate_to}->{C1}->{default} = -1;
453 $C->{option}->{designate_to}->{G94}->{default} = -1;
454 $C->{option}->{designate_to}->{G94n}->{default} = -1;
455 $C->{option}->{designate_to}->{G96}->{default} = -1;
456 $C->{option}->{designate_to}->{G96n}->{default} = -1;
457 $C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman
458 for ("\x40", "\x41", "\x42", "\x44") {
459 $C->{option}->{designate_to}->{G94n}->{ $_ } = 0;
460 }
461 $C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001
462 for ("\x41", "\x46") { ## ISO/IEC 8859-1,7
463 $C->{option}->{designate_to}->{G96}->{ $_ } = 1;
464 }
465 $C;
466 }
467 sub __2022_encode ($) {
468 my $C = shift->__2022__common;
469 $C->{GR} = undef;
470 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
471 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
472 $C;
473 }
474 sub __2022_decode ($) {
475 my $C = shift->__2022__common;
476 $C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001
477 $C;
478 }
479 sub __encode_map ($) {
480 [qw/ucs_to_ascii ucs_to_jisx0208_1983 ucs_to_gb2312_1980 ucs_to_ksx1001_1992 ucs_to_isoiec8859_1 ucs_to_isoiec8859_7 ucs_to_jisx0212_1990 ucs_to_jisx0208_1978 ucs_to_jisx0201_latin/];
481 }
482 sub __decode_map ($) {
483 [qw/jisx0208_1983_to_ucs jisx0208_1978_to_ucs jisx0201_latin_to_ucs gb2312_1980_to_ucs ksx1001_1992_to_ucs isoiec8859_7_to_ucs/];
484 }
485
486 package Encode::ISO2022::SevenBit::LockSS2;
487 use vars qw/@ISA/;
488 push @ISA, 'Encode::ISO2022::SevenBit';
489 __PACKAGE__->Define (qw/iso-2022-7bit-lock-ss2 iso-2022-cjk/);
490
491 =item iso-2022-7bit-lock-ss2
492
493 An ISO/IEC 2022 based 7-bit encoding. Mixture of ISO-2022-JP,
494 ISO-2022-KR, ISO-2022-CN. (Alias: iso-2022-cjk (emacsen))
495
496 =cut
497
498 sub __2022__common ($) {
499 my $C = shift->SUPER::__2022__common;
500 $C->{option}->{designate_to}->{G96}->{default} = 2;
501 $C->{option}->{designate_to}->{G96n}->{default} = 2;
502 $C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312
503 $C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001
504 $C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165
505 $C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1
506 $C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2
507 $C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3
508 $C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4
509 $C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5
510 $C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6
511 $C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7
512 $C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345
513 $C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589
514 $C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131
515 $C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590
516 $C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132
517 $C;
518 }
519 sub __2022_decode ($) {
520 my $C = shift->__2022__common;
521 $C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001
522 $C;
523 }
524
525 package Encode::ISO2022::SevenBit::CN;
526 use vars qw/@ISA/;
527 push @ISA, 'Encode::ISO2022::SevenBit';
528 __PACKAGE__->Define (qw/iso-2022-cn chinese-iso-7bit iso2022cn-cns iso2022cn-gb/);
529
530 =item iso-2022-cn
531
532 An ISO/IEC 2022 based 7-bit encoding for Chinese,
533 defined by RFC 1922 (Alias: chinese-iso-7bit (emacsen))
534
535 =cut
536
537 sub __2022__common ($) {
538 my $C = shift->SUPER::__2022__common;
539 $C->{option}->{designate_to}->{C0}->{default} = -1;
540 $C->{option}->{designate_to}->{C0}->{"\x40"} = 0;
541 $C->{option}->{designate_to}->{C1}->{default} = -1;
542 $C->{option}->{designate_to}->{G94}->{default} = -1;
543 $C->{option}->{designate_to}->{G94n}->{default} = -1;
544 $C->{option}->{designate_to}->{G96}->{default} = -1;
545 $C->{option}->{designate_to}->{G96n}->{default} = -1;
546 $C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312
547 $C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1
548 $C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2
549 $C;
550 }
551 sub __2022_encode ($) {
552 my $C = shift->__2022__common;
553 $C->{GR} = undef;
554 $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set
555 $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set
556 $C;
557 }
558 sub __encode_map ($) {
559 [qw/ucs_to_ascii ucs_to_gb2312_1980 ucs_to_cns11643_1 ucs_to_cns11643_2/];
560 }
561 sub __decode_map ($) {
562 [qw/gb2312_1980_to_ucs cns11643_1_to_ucs cns11643_2_to_ucs/];
563 }
564
565 package Encode::ISO2022::SevenBit::CNExt;
566 use vars qw/@ISA/;
567 push @ISA, 'Encode::ISO2022::SevenBit::CN';
568 __PACKAGE__->Define (qw/iso-2022-cn-ext/);
569
570 =item iso-2022-cn-ext
571
572 An ISO/IEC 2022 based 7-bit encoding for Chinese,
573 defined by RFC 1922
574
575 =cut
576
577 sub __2022__common ($) {
578 my $C = shift->SUPER::__2022__common;
579 $C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165
580 $C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3
581 $C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4
582 $C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5
583 $C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6
584 $C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7
585 $C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345
586 $C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589
587 $C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131
588 $C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590
589 $C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132
590 $C->{option}->{designate_to}->{G94n}->{P1_0} = 3; ## CNS 11643 plane 8
591 $C->{option}->{designate_to}->{G94n}->{P1_1} = 3; ## CNS 11643 plane 9
592 $C->{option}->{designate_to}->{G94n}->{P1_2} = 3; ## CNS 11643 plane 10
593 $C->{option}->{designate_to}->{G94n}->{P1_3} = 3; ## CNS 11643 plane 11
594 $C->{option}->{designate_to}->{G94n}->{P1_4} = 3; ## CNS 11643 plane 12
595 $C->{option}->{designate_to}->{G94n}->{P1_5} = 3; ## CNS 11643 plane 13
596 $C->{option}->{designate_to}->{G94n}->{P1_6} = 3; ## CNS 11643 plane 14
597 $C->{option}->{designate_to}->{G94n}->{P2_0} = 3; ## CNS 11643 plane 15
598 $C->{option}->{designate_to}->{G94n}->{P2_1} = 3; ## CNS 11643 plane 16
599 $C;
600 }
601 sub __encode_map ($) {
602 [qw/ucs_to_ascii ucs_to_gb2312_1980 ucs_to_iso_ir_165 ucs_to_cns11643_1 ucs_to_cns11643_2 ucs_to_cns11643_3 ucs_to_cns11643_4 ucs_to_cns11643_5 ucs_to_cns11643_6 ucs_to_cns11643_7/];
603 }
604 sub __decode_map ($) {
605 [qw/gb2312_1980_to_ucs iso_ir_165_to_ucs cns11643_1_to_ucs cns11643_2_to_ucs cns11643_3_to_ucs cns11643_4_to_ucs cns11643_5_to_ucs cns11643_6_to_ucs cns11643_7_to_ucs/];
606 }
607
608 1;
609 __END__
610
611 =back
612
613 =head1 AUTHORS
614
615 Wakaba <w@suika.fam.cx>
616
617 Nanashi-san
618
619 =head1 LICENSE
620
621 Copyright 2002 AUTHORS
622
623 This library is free software; you can redistribute it
624 and/or modify it under the same terms as Perl itself.
625
626 =cut
627
628 # $Date: 2002/10/12 07:27:01 $
629 ### SevenBit.pm ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24