/[pub]/test/oldencodeutils/lib/Encode/ISO2022/SevenBit.pm
Suika

Diff of /test/oldencodeutils/lib/Encode/ISO2022/SevenBit.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Sun Sep 15 05:08:13 2002 UTC revision 1.8 by wakaba, Fri Oct 4 23:58:04 2002 UTC
# Line 15  package Encode::ISO2022::SevenBit; Line 15  package Encode::ISO2022::SevenBit;
15  use vars qw($VERSION);  use vars qw($VERSION);
16  $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};  $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
17  use base qw(Encode::Encoding);  use base qw(Encode::Encoding);
18  __PACKAGE__->Define (qw/iso-2022-7bit jis junet jis7/);  __PACKAGE__->Define (qw/iso-2022-7bit iso-2022-7 jis junet jis7
19      7bit-jis/);
20  require Encode::ISO2022;  require Encode::ISO2022;
21    
22  sub encode ($$;$) {  sub encode ($$;$) {
# Line 34  sub decode ($$;$) { Line 35  sub decode ($$;$) {
35  =item iso-2022-7bit  =item iso-2022-7bit
36    
37  ISO/IEC 2022 based 7-bit encoding using only G0  ISO/IEC 2022 based 7-bit encoding using only G0
38  (Alias: junet, jis, jis7)  (Alias: junet (emacsen), jis, jis7, iso-2022-7 (emacsen), 7bit-jis (perl))
39    
40  =cut  =cut
41    
# Line 47  sub __2022__common ($) { Line 48  sub __2022__common ($) {
48  }  }
49  sub __2022_encode ($) {  sub __2022_encode ($) {
50    my $C = shift->__2022__common;    my $C = shift->__2022__common;
51      $C->{GR} = undef;
52    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
53    $C;    $C;
54  }  }
# Line 60  package Encode::ISO2022::SevenBit::JP; Line 62  package Encode::ISO2022::SevenBit::JP;
62  use vars qw/@ISA/;  use vars qw/@ISA/;
63  push @ISA, 'Encode::ISO2022::SevenBit';  push @ISA, 'Encode::ISO2022::SevenBit';
64  __PACKAGE__->Define (qw/iso-2022-jp junet-code japanese-iso-7bit csiso2022jp  __PACKAGE__->Define (qw/iso-2022-jp junet-code japanese-iso-7bit csiso2022jp
65   cp50220 iso2022jp/);   iso2022jp/);
66    
67  =item iso-2022-jp  =item iso-2022-jp
68    
69  ISO/IEC 2022 based 7-bit encoding for Japanese.  ISO/IEC 2022 based 7-bit encoding for Japanese.
70  Defined by Junet no tebiki, RFC 1468 and JIS X 0208:1997 Appendix 2.  Defined by Junet no tebiki, RFC 1468 and JIS X 0208:1997 Appendix 2.
71  (Alias: junet-code, japanese-iso-7bit (emacsen), csISO2022JP (IANA),  (Alias: junet-code, japanese-iso-7bit (emacsen), csISO2022JP (IANA))
 CP50220 (M$))  
72    
73  =cut  =cut
74    
# Line 90  sub __2022__common ($) { Line 91  sub __2022__common ($) {
91  }  }
92  sub __2022_encode ($) {  sub __2022_encode ($) {
93    my $C = shift->__2022__common;    my $C = shift->__2022__common;
94      $C->{GR} = undef;
95    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
96    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
97    $C;    $C;
# Line 99  package Encode::ISO2022::SevenBit::JP197 Line 101  package Encode::ISO2022::SevenBit::JP197
101  use vars qw/@ISA/;  use vars qw/@ISA/;
102  push @ISA, 'Encode::ISO2022::SevenBit::JP';  push @ISA, 'Encode::ISO2022::SevenBit::JP';
103  __PACKAGE__->Define (qw/iso-2022-jp-1978-irv japanese-iso-7bit-1978-irv old-jis  __PACKAGE__->Define (qw/iso-2022-jp-1978-irv japanese-iso-7bit-1978-irv old-jis
104    x-obsoleted-iso-2022-jp/);    x-obsoleted-iso-2022-jp jis78/);
105    
106  =item iso-2022-jp-1978-irv  =item iso-2022-jp-1978-irv
107    
108  ISO/IEC 2022 based 7-bit encoding for Japanese.  ISO/IEC 2022 based 7-bit encoding for Japanese,
109  (Alias: japanese-iso-7bit-1978-irv (emacsen), old-jis (emacsen))  using JIS X 0208-1978.
110    (Alias: japanese-iso-7bit-1978-irv (emacsen), old-jis (emacsen),
111    jis78)
112    
113  =cut  =cut
114    
115  sub __2022_encode ($) {  sub __2022_encode ($) {
116    my $C = shift->__2022__common;    my $C = shift->__2022__common;
117      $C->{GR} = undef;
118    $C->{option}->{designate_to}->{G94}->{"\x4A"} = -1;   ## JIS X 0201 roman    $C->{option}->{designate_to}->{G94}->{"\x4A"} = -1;   ## JIS X 0201 roman
119    $C->{option}->{designate_to}->{G94n}->{"\x42"} = -1;  ## JIS X 0208-1983    $C->{option}->{designate_to}->{G94n}->{"\x42"} = -1;  ## JIS X 0208-1983
120    $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1;      ## JIS X 0208-1990    $C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1;      ## JIS X 0208-1990
# Line 119  sub __2022_encode ($) { Line 124  sub __2022_encode ($) {
124  package Encode::ISO2022::SevenBit::JP1;  package Encode::ISO2022::SevenBit::JP1;
125  use vars qw/@ISA/;  use vars qw/@ISA/;
126  push @ISA, 'Encode::ISO2022::SevenBit::JP';  push @ISA, 'Encode::ISO2022::SevenBit::JP';
127  __PACKAGE__->Define (qw/iso-2022-jp-1/);  __PACKAGE__->Define (qw/iso-2022-jp-1 iso2022jp-1/);
128    
129  =item iso-2022-jp-1  =item iso-2022-jp-1
130    
131  ISO/IEC 2022 based 7-bit encoding for Japanese,  ISO/IEC 2022 based 7-bit encoding for Japanese,
132  defined by RFC 2237  defined by RFC 2237.  (Alias: iso2022jp-1)
133    
134  =cut  =cut
135    
# Line 138  sub __2022__common ($) { Line 143  sub __2022__common ($) {
143  package Encode::ISO2022::SevenBit::JP3;  package Encode::ISO2022::SevenBit::JP3;
144  use vars qw/@ISA/;  use vars qw/@ISA/;
145  push @ISA, 'Encode::ISO2022::SevenBit::JP';  push @ISA, 'Encode::ISO2022::SevenBit::JP';
146  __PACKAGE__->Define (qw/iso-2022-jp-3 x-iso-2022-jp-3   iso-2022-jp-3-compatible iso-2022-jp-3-strict/);  __PACKAGE__->Define (qw/iso-2022-jp-3 x-iso-2022-jp-3 iso2022jp-3
147     jis0213   iso-2022-jp-3-compatible iso-2022-jp-3-strict/);
148    
149  =item iso-2022-jp-3  =item iso-2022-jp-3
150    
151  ISO/IEC 2022 based 7-bit encoding for Japanese,  ISO/IEC 2022 based 7-bit encoding for Japanese,
152  defined by JIS X 0213:2000 Appendix 2.  defined by JIS X 0213:2000 Appendix 2.
153  (Alias: x-iso-2022-jp-3)  (Alias: x-iso-2022-jp-3, iso2022jp-3, jis0213)
154    
155  =item iso-2022-jp-3-compatible  =item iso-2022-jp-3-compatible
156    
# Line 189  sub __2022__common ($) { Line 195  sub __2022__common ($) {
195  package Encode::ISO2022::SevenBit::SS2;  package Encode::ISO2022::SevenBit::SS2;
196  use vars qw/@ISA/;  use vars qw/@ISA/;
197  push @ISA, 'Encode::ISO2022::SevenBit';  push @ISA, 'Encode::ISO2022::SevenBit';
198  __PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2  jis_encoding csjisencoding/);  __PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2 iso-2022-ss2-7
199       jis_encoding csjisencoding/);
200    
201  =item iso-2022-7bit-ss2  =item iso-2022-7bit-ss2
202    
203  ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset  ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset
204  (Alias: x-iso-2022-jp-2)  (Alias: x-iso-2022-jp-2, iso-2022-ss2-7 (emacsen))
205    
206  =cut  =cut
207    
# Line 209  sub __2022__common ($) { Line 216  sub __2022__common ($) {
216  package Encode::ISO2022::SevenBit::JP2;  package Encode::ISO2022::SevenBit::JP2;
217  use vars qw/@ISA/;  use vars qw/@ISA/;
218  push @ISA, 'Encode::ISO2022::SevenBit::SS2';  push @ISA, 'Encode::ISO2022::SevenBit::SS2';
219  __PACKAGE__->Define (qw/iso-2022-jp-2 csiso2022jp2/);  __PACKAGE__->Define (qw/iso-2022-jp-2 csiso2022jp2 iso2022jp-2/);
220    
221  =item iso-2022-jp-2  =item iso-2022-jp-2
222    
223  ISO/IEC 2022 based 7-bit multilingual encoding, defined by  ISO/IEC 2022 based 7-bit multilingual encoding, defined by
224  RFC 1554.  A subset of iso-2022-7bit-ss2.  (Alias: csISO2022JP2 (IANA))  RFC 1554.  A subset of iso-2022-7bit-ss2.  (Alias: iso2022jp-2,
225    csISO2022JP2 (IANA))
226    
227  =cut  =cut
228    
# Line 240  sub __2022__common ($) { Line 248  sub __2022__common ($) {
248  }  }
249  sub __2022_encode ($) {  sub __2022_encode ($) {
250    my $C = shift->__2022__common;    my $C = shift->__2022__common;
251      $C->{GR} = undef;
252    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
253    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
254    $C;    $C;
# Line 263  sub __2022__common ($) { Line 272  sub __2022__common ($) {
272    $C;    $C;
273  }  }
274    
275    package Encode::ISO2022::SevenBit::INT;
276    use vars qw/@ISA/;
277    push @ISA, 'Encode::ISO2022::SevenBit';
278    __PACKAGE__->Define (qw/iso-2022-int iso-2022-int-*  iso-2022-int-2/);
279    
280    =item iso-2022-int
281    
282    ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for
283    KS X 1001 and 96-charset.  See draft-ohta-text-encoding.
284    (Alias: iso-2022-int-*)
285    
286    =cut
287    
288    sub __2022__common ($) {
289      my $C = shift->SUPER::__2022__common;
290      $C->{option}->{designate_to}->{G96}->{default} = 1;
291      $C->{option}->{designate_to}->{G96n}->{default} = 1;
292      $C->{option}->{designate_to}->{G94n}->{"\x43"} = 1;   ## KS X 1001
293      $C;
294    }
295    sub __2022_encode ($) {
296      my $C = shift->__2022__common;
297      $C->{GR} = undef;
298      $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
299      $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
300      $C;
301    }
302    sub __2022_decode ($) {
303      my $C = shift->__2022__common;
304      $C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001
305      $C;
306    }
307    
308  package Encode::ISO2022::SevenBit::KR;  package Encode::ISO2022::SevenBit::KR;
309  use vars qw/@ISA/;  use vars qw/@ISA/;
310  push @ISA, 'Encode::ISO2022::SevenBit';  push @ISA, 'Encode::ISO2022::SevenBit';
# Line 290  sub __2022__common ($) { Line 332  sub __2022__common ($) {
332  }  }
333  sub __2022_encode ($) {  sub __2022_encode ($) {
334    my $C = shift->__2022__common;    my $C = shift->__2022__common;
335      $C->{GR} = undef;
336    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
337    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
338    $C;    $C;
# Line 333  sub __2022__common ($) { Line 376  sub __2022__common ($) {
376  }  }
377  sub __2022_encode ($) {  sub __2022_encode ($) {
378    my $C = shift->__2022__common;    my $C = shift->__2022__common;
379      $C->{GR} = undef;
380    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
381    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
382    $C;    $C;
# Line 410  sub __2022__common ($) { Line 454  sub __2022__common ($) {
454  }  }
455  sub __2022_encode ($) {  sub __2022_encode ($) {
456    my $C = shift->__2022__common;    my $C = shift->__2022__common;
457      $C->{GR} = undef;
458    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set    $C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"};   ## empty set
459    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set    $C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"};  ## empty set
460    $C;    $C;
# Line 459  __END__ Line 504  __END__
504    
505  =head1 LICENSE  =head1 LICENSE
506    
507  Copyright 2002 wakaba <w@suika.fam.cx>  Copyright 2002 Wakaba <w@suika.fam.cx>
508    
509  This library is free software; you can redistribute it  This library is free software; you can redistribute it
510  and/or modify it under the same terms as Perl itself.  and/or modify it under the same terms as Perl itself.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24