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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Sun Sep 22 11:08:23 2002 UTC (22 years, 2 months ago) by wakaba
Branch: MAIN
2002-09-22  Wakaba <w@suika.fam.cx>

	* ISO646.pm, RFC1345.pm: New modules.

1 wakaba 1.1 =head1 NAME
2    
3     Encode::ISO2022::RFC1345 --- Encode and decode of ISO/IEC 2022
4     based encodings described in IETF RFC 1345 (and not defined by
5     other standards)
6    
7     =head1 ENCODINGS
8    
9     =over 4
10    
11     =cut
12    
13     require 5.7.3;
14     use strict;
15     package Encode::ISO2022::RFC1345;
16     use vars qw($VERSION);
17     $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
18     use base qw(Encode::Encoding);
19     require Encode::ISO2022;
20    
21     sub encode ($$;$) {
22     my ($obj, $str, $chk) = @_;
23     $_[1] = '' if $chk;
24     $str = &Encode::ISO2022::internal_to_iso2022 ($str, $obj->__2022_encode);
25     return $str;
26     }
27    
28     sub decode ($$;$) {
29     my ($obj, $str, $chk) = @_;
30     $_[1] = '' if $chk;
31     return &Encode::ISO2022::iso2022_to_internal ($str, $obj->__2022_decode);
32     }
33    
34     sub __2022__common ($) {
35     my $C = Encode::ISO2022->new_object;
36     $C->{option}->{designate_to}->{C0}->{default} = -1;
37     $C->{option}->{designate_to}->{C1}->{default} = -1;
38     $C->{option}->{designate_to}->{G94}->{default} = -1;
39     $C->{option}->{designate_to}->{G94}->{B} = -1;
40     $C->{option}->{designate_to}->{G94n}->{default} = -1;
41     $C->{option}->{designate_to}->{G96}->{default} = -1;
42     $C->{option}->{designate_to}->{G96n}->{default} = -1;
43     $C->{G1} = $Encode::ISO2022::CHARSET{G94}->{"\x7E"}; ## empty
44     $C->{option}->{reset}->{Gdesignation} = 0;
45     $C->{option}->{reset}->{Ginvoke} = 0;
46     $C;
47     }
48     sub __2022_encode ($) {
49     my $C = shift->__2022__common;
50     $C->{GR} = undef;
51     $C;
52     }
53     sub __2022_decode ($) {
54     my $C = shift->__2022__common;
55     $C;
56     }
57    
58     package Encode::ISO2022::RFC1345::NATSSEFI;
59     use vars qw/@ISA/;
60     push @ISA, 'Encode::ISO2022::RFC1345';
61     __PACKAGE__->Define (qw/NATS-SEFI iso-ir-8-1 csNATSSEFI/);
62    
63     =item NATS-SEFI
64    
65     NATS-SEFI (Alias: iso-ir-8-1, csNATSSEFI (IANA))
66    
67     =cut
68    
69     sub __2022__common ($) {
70     my $C = shift->SUPER::__2022__common;
71     $C->{bit} = 7;
72     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x43"};
73     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
74     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x43"}];
75     $C;
76     }
77    
78     package Encode::ISO2022::RFC1345::NATSSEFIADD;
79     use vars qw/@ISA/;
80     push @ISA, 'Encode::ISO2022::RFC1345';
81     __PACKAGE__->Define (qw/NATS-SEFI-ADD iso-ir-8-2 csNATSSEFIADD/);
82    
83     =item NATS-SEFI-ADD
84    
85     NATS-SEFI-ADD (Alias: iso-ir-8-2, csNATSSEFIADD (IANA))
86    
87     =cut
88    
89     sub __2022__common ($) {
90     my $C = shift->SUPER::__2022__common;
91     $C->{bit} = 7;
92     $C->{C0} = $Encode::ISO2022::CHARSET{C0}->{"\x7E"}; ## empty
93     # 0x20, 0x7E = undef
94     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x44"};
95     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
96     # no replacement character available
97     $C;
98     }
99    
100     package Encode::ISO2022::RFC1345::NATSDANO;
101     use vars qw/@ISA/;
102     push @ISA, 'Encode::ISO2022::RFC1345';
103     __PACKAGE__->Define (qw/NATS-DANO iso-ir-9-1 csNATSDANO/);
104    
105     =item NATS-DANO
106    
107     NATS-DANO (Alias: iso-ir-9-1, csNATSDANO (IANA))
108    
109     =cut
110    
111     sub __2022__common ($) {
112     my $C = shift->SUPER::__2022__common;
113     $C->{bit} = 7;
114     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x45"};
115     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
116     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x45"}];
117     $C;
118     }
119    
120     package Encode::ISO2022::RFC1345::NATSDANOADD;
121     use vars qw/@ISA/;
122     push @ISA, 'Encode::ISO2022::RFC1345';
123     __PACKAGE__->Define (qw/NATS-DANO-ADD iso-ir-9-2 csNATSDANOADD/);
124    
125     =item NATS-DANO-ADD
126    
127     NATS-DANO-ADD (Alias: iso-ir-9-2, csNATSDANOADD (IANA))
128    
129     =cut
130    
131     sub __2022__common ($) {
132     my $C = shift->SUPER::__2022__common;
133     $C->{bit} = 7;
134     $C->{C0} = $Encode::ISO2022::CHARSET{C0}->{"\x7E"}; ## empty
135     # 0x20, 0x7E = undef
136     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x46"};
137     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
138     # no replacement character available
139     $C;
140     }
141    
142     package Encode::ISO2022::RFC1345::csISO18Greek7Old;
143     use vars qw/@ISA/;
144     push @ISA, 'Encode::ISO2022::RFC1345';
145     __PACKAGE__->Define (qw/greek7-old iso-ir-18 csISO18Greek7Old/);
146    
147     =item greek7-old
148    
149     greek7-old (Alias: iso-ir-18, csISO18Greek7Old (IANA))
150    
151     =cut
152    
153     sub __2022__common ($) {
154     my $C = shift->SUPER::__2022__common;
155     $C->{bit} = 7;
156     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x5B"};
157     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
158     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x5B"}];
159     $C;
160     }
161    
162     package Encode::ISO2022::RFC1345::csISO19LatinGreek;
163     use vars qw/@ISA/;
164     push @ISA, 'Encode::ISO2022::RFC1345';
165     __PACKAGE__->Define (qw/latin-greek iso-ir-19 csISO19LatinGreek/);
166    
167     =item latin-greek
168    
169     latin-greek (Alias: iso-ir-19, csISO19LatinGreek (IANA))
170    
171     =cut
172    
173     sub __2022__common ($) {
174     my $C = shift->SUPER::__2022__common;
175     $C->{bit} = 7;
176     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x5C"};
177     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
178     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x5C"}];
179     $C;
180     }
181    
182     package Encode::ISO2022::RFC1345::csISO27LatinGreek1;
183     use vars qw/@ISA/;
184     push @ISA, 'Encode::ISO2022::RFC1345';
185     __PACKAGE__->Define (qw/Latin-greek-1 iso-ir-27 csISO27LatinGreek1/);
186    
187     =item Latin-greek-1
188    
189     Latin-greek-1 (Alias: iso-ir-27, csISO27LatinGreek1 (IANA))
190    
191     =cut
192    
193     sub __2022__common ($) {
194     my $C = shift->SUPER::__2022__common;
195     $C->{bit} = 7;
196     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x55"};
197     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
198     $C->{option}->{undef_char} = ["\x20"];
199     $C;
200     }
201    
202     package Encode::ISO2022::RFC1345::ISO_5427;
203     use vars qw/@ISA/;
204     push @ISA, 'Encode::ISO2022::RFC1345';
205     __PACKAGE__->Define (qw/ISO_5427 iso-ir-37 csISO5427Cyrillic/);
206    
207     =item ISO_5427
208    
209     ISO_5427 (Alias: iso-ir-37, csISO5427Cyrillic (IANA))
210    
211     =cut
212    
213     sub __2022__common ($) {
214     my $C = shift->SUPER::__2022__common;
215     $C->{bit} = 7;
216     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x4E"};
217     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
218     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x4E"}];
219     $C;
220     }
221    
222     package Encode::ISO2022::RFC1345::BS_viewdata;
223     use vars qw/@ISA/;
224     push @ISA, 'Encode::ISO2022::RFC1345';
225     __PACKAGE__->Define (qw/BS_viewdata iso-ir-47 csISO47BSViewdata/);
226    
227     =item BS_viewdata
228    
229     BS_viewdata (Alias: iso-ir-47, csISO47BSViewdata (IANA))
230    
231     =cut
232    
233     sub __2022__common ($) {
234     my $C = shift->SUPER::__2022__common;
235     $C->{bit} = 7;
236     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x56"};
237     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
238     $C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => "\x56"}];
239     $C;
240     }
241    
242     package Encode::ISO2022::RFC1345::INIS;
243     use vars qw/@ISA/;
244     push @ISA, 'Encode::ISO2022::RFC1345';
245     __PACKAGE__->Define (qw/INIS iso-ir-49 csISO49INIS/);
246    
247     =item INIS
248    
249     INIS (Alias: iso-ir-49, csISO49INIS (IANA))
250    
251     =cut
252    
253     sub __2022__common ($) {
254     my $C = shift->SUPER::__2022__common;
255     $C->{bit} = 7;
256     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x57"};
257     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
258     $C->{option}->{undef_char} = ["\x20"];
259     $C;
260     }
261    
262     package Encode::ISO2022::RFC1345::csISO50INIS8;
263     use vars qw/@ISA/;
264     push @ISA, 'Encode::ISO2022::RFC1345';
265     __PACKAGE__->Define (qw/INIS-8 iso-ir-50 csISO50INIS8/);
266    
267     =item INIS-8
268    
269     INIS-8 (Alias: iso-ir-50, csISO50INIS8 (IANA))
270    
271     =cut
272    
273     sub __2022__common ($) {
274     my $C = shift->SUPER::__2022__common;
275     $C->{bit} = 7;
276     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x5D"};
277     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
278     $C->{option}->{undef_char} = ["\x20"];
279     $C;
280     }
281    
282     package Encode::ISO2022::RFC1345::csISO51INISCyrillic;
283     use vars qw/@ISA/;
284     push @ISA, 'Encode::ISO2022::RFC1345';
285     __PACKAGE__->Define (qw/INIS-cyrillic iso-ir-51 csISO51INISCyrillic/);
286    
287     =item INIS-cyrillic
288    
289     INIS-cyrillic (Alias: iso-ir-51, csISO51INISCyrillic (IANA))
290    
291     =cut
292    
293     sub __2022__common ($) {
294     my $C = shift->SUPER::__2022__common;
295     $C->{bit} = 7;
296     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x5E"};
297     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
298     $C->{option}->{undef_char} = ["\x20"];
299     $C;
300     }
301    
302     package Encode::ISO2022::RFC1345::ISO5427Cyrillic1981;
303     use vars qw/@ISA/;
304     push @ISA, 'Encode::ISO2022::RFC1345';
305     __PACKAGE__->Define (qw/ISO_5427:1981 iso-ir-54 ISO5427Cyrillic1981/);
306    
307     =item ISO_5427:1981
308    
309     ISO_5427:1981 (Alias: iso-ir-54, ISO5427Cyrillic1981 (IANA))
310    
311     =cut
312    
313     sub __2022__common ($) {
314     my $C = shift->SUPER::__2022__common;
315     $C->{bit} = 7;
316     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x51"};
317     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
318     $C->{option}->{undef_char} = ["\x20"];
319     $C;
320     }
321    
322     package Encode::ISO2022::RFC1345::csISO5428Greek;
323     use vars qw/@ISA/;
324     push @ISA, 'Encode::ISO2022::RFC1345';
325     __PACKAGE__->Define (qw/ISO_5428:1980 iso-ir-55 csISO5428Greek/);
326    
327     =item ISO_5428:1980
328    
329     ISO_5428:1980 (Alias: iso-ir-55, csISO5428Greek (IANA))
330    
331     =cut
332    
333     sub __2022__common ($) {
334     my $C = shift->SUPER::__2022__common;
335     $C->{bit} = 7;
336     $C->{G0} = $Encode::ISO2022::CHARSET{G94}->{"\x53"};
337     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
338     $C->{option}->{undef_char} = ["\x20"];
339     $C;
340     }
341    
342    
343     package Encode::ISO2022::RFC1345::csISO42JISC62261978;
344     use vars qw/@ISA/;
345     push @ISA, 'Encode::ISO2022::RFC1345';
346     __PACKAGE__->Define (qw/JIS_C6226-1978 iso-ir-42 csISO42JISC62261978/);
347    
348     =item JIS_C6226-1978
349    
350     JIS_C6226-1978 (Alias: iso-ir-42, csISO42JISC62261978 (IANA))
351    
352     =cut
353    
354     sub __2022__common ($) {
355     my $C = shift->SUPER::__2022__common;
356     $C->{bit} = 7;
357     # 0x20, 0x7F = undef
358     $C->{C0} = $Encode::ISO2022::CHARSET{C0}->{"\x7E"};
359     $C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{"\x40"};
360     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
361     $C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => "\x40"}];
362     $C;
363     }
364    
365     package Encode::ISO2022::RFC1345::GB_2312;
366     use vars qw/@ISA/;
367     push @ISA, 'Encode::ISO2022::RFC1345';
368     __PACKAGE__->Define (qw/GB_2312-80 iso-ir-58 chinese csISO58GB231280/);
369    
370     =item GB_2312-80
371    
372     GB_2312-80 (Alias: iso-ir-58, chinese, csISO58GB231280 (IANA))
373    
374     =cut
375    
376     sub __2022__common ($) {
377     my $C = shift->SUPER::__2022__common;
378     $C->{bit} = 7;
379     # 0x20, 0x7F = undef
380     $C->{C0} = $Encode::ISO2022::CHARSET{C0}->{"\x7E"};
381     $C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{"\x41"};
382     $C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; $C->{G3} = $C->{G1};
383     $C->{option}->{undef_char} = ["\x21\x7E", {type => 'G94n', charset => "\x41"}];
384     $C;
385     }
386    
387     1;
388     __END__
389    
390     =back
391    
392     Note that although other JISes such as JIS X 0212 and JIS X 9010
393     define ISO/IEC 2022-comfprming coded character sets,
394     these standards do not define complete coding system (but define
395     as used on ISO/IEC 2022 environment), so this module
396     does not include those coded character sets. (IETF RFC 1345
397     and IANAREG give charset name to coded character sets
398     consist of such standards. But those are defined by RFC 1345,
399     not by JIS. Such coded character sets should be implemented
400     in Encode::ISO2022::RFC1345.)
401    
402     =head1 LICENSE
403    
404     Copyright 2002 Wakaba <w@suika.fam.cx>
405    
406     This library is free software; you can redistribute it
407     and/or modify it under the same terms as Perl itself.
408    
409     =cut
410    
411     # $Date: 2002/09/20 14:01:45 $
412     ### JIS.pm ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24