summaryrefslogtreecommitdiff
path: root/ext/Encode/JP
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-25 13:37:29 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-25 13:37:29 +0100
commitfafe5ad5a7e57ca14cd0844db173f3a4d6c9e8de (patch)
tree986df99d21cddd44a0a93e2048d8ad761dbc3865 /ext/Encode/JP
parent321c358920f04a77dd5318e7d76f9526d684fd5c (diff)
downloadperl-fafe5ad5a7e57ca14cd0844db173f3a4d6c9e8de.tar.gz
Move Encode from ext/ to cpan/
Diffstat (limited to 'ext/Encode/JP')
-rw-r--r--ext/Encode/JP/JP.pm99
-rw-r--r--ext/Encode/JP/Makefile.PL170
2 files changed, 0 insertions, 269 deletions
diff --git a/ext/Encode/JP/JP.pm b/ext/Encode/JP/JP.pm
deleted file mode 100644
index e78e54d052..0000000000
--- a/ext/Encode/JP/JP.pm
+++ /dev/null
@@ -1,99 +0,0 @@
-package Encode::JP;
-BEGIN {
- if ( ord("A") == 193 ) {
- die "Encode::JP not supported on EBCDIC\n";
- }
-}
-use strict;
-use warnings;
-use Encode;
-our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
-
-use XSLoader;
-XSLoader::load( __PACKAGE__, $VERSION );
-
-use Encode::JP::JIS7;
-
-1;
-__END__
-
-=head1 NAME
-
-Encode::JP - Japanese Encodings
-
-=head1 SYNOPSIS
-
- use Encode qw/encode decode/;
- $euc_jp = encode("euc-jp", $utf8); # loads Encode::JP implicitly
- $utf8 = decode("euc-jp", $euc_jp); # ditto
-
-=head1 ABSTRACT
-
-This module implements Japanese charset encodings. Encodings
-supported are as follows.
-
- Canonical Alias Description
- --------------------------------------------------------------------
- euc-jp /\beuc.*jp$/i EUC (Extended Unix Character)
- /\bjp.*euc/i
- /\bujis$/i
- shiftjis /\bshift.*jis$/i Shift JIS (aka MS Kanji)
- /\bsjis$/i
- 7bit-jis /\bjis$/i 7bit JIS
- iso-2022-jp ISO-2022-JP [RFC1468]
- = 7bit JIS with all Halfwidth Kana
- converted to Fullwidth
- iso-2022-jp-1 ISO-2022-JP-1 [RFC2237]
- = ISO-2022-JP with JIS X 0212-1990
- support. See below
- MacJapanese Shift JIS + Apple vendor mappings
- cp932 /\bwindows-31j$/i Code Page 932
- = Shift JIS + MS/IBM vendor mappings
- jis0201-raw JIS0201, raw format
- jis0208-raw JIS0201, raw format
- jis0212-raw JIS0201, raw format
- --------------------------------------------------------------------
-
-=head1 DESCRIPTION
-
-To find out how to use this module in detail, see L<Encode>.
-
-=head1 Note on ISO-2022-JP(-1)?
-
-ISO-2022-JP-1 (RFC2237) is a superset of ISO-2022-JP (RFC1468) which
-adds support for JIS X 0212-1990. That means you can use the same
-code to decode to utf8 but not vice versa.
-
- $utf8 = decode('iso-2022-jp-1', $stream);
-
-and
-
- $utf8 = decode('iso-2022-jp', $stream);
-
-yield the same result but
-
- $with_0212 = encode('iso-2022-jp-1', $utf8);
-
-is now different from
-
- $without_0212 = encode('iso-2022-jp', $utf8 );
-
-In the latter case, characters that map to 0212 are first converted
-to U+3013 (0xA2AE in EUC-JP; a white square also known as 'Tofu' or
-'geta mark') then fed to the decoding engine. U+FFFD is not used,
-in order to preserve text layout as much as possible.
-
-=head1 BUGS
-
-The ASCII region (0x00-0x7f) is preserved for all encodings, even
-though this conflicts with mappings by the Unicode Consortium. See
-
-L<http://www.debian.or.jp/~kubota/unicode-symbols.html.en>
-
-to find out why it is implemented that way.
-
-=head1 SEE ALSO
-
-L<Encode>
-
-=cut
diff --git a/ext/Encode/JP/Makefile.PL b/ext/Encode/JP/Makefile.PL
deleted file mode 100644
index a75685efd8..0000000000
--- a/ext/Encode/JP/Makefile.PL
+++ /dev/null
@@ -1,170 +0,0 @@
-use 5.7.2;
-use strict;
-use ExtUtils::MakeMaker;
-use strict;
-
-my %tables = (
- euc_jp_t => ['euc-jp.ucm'],
- sjis_t => ['shiftjis.ucm',
- 'macJapanese.ucm',
- 'cp932.ucm'],
- raw_t => [
- qw(jis0201.ucm jis0208.ucm jis0212.ucm)
- ],
- );
-
-unless ($ENV{AGGREGATE_TABLES}){
- my @ucm;
- for my $k (keys %tables){
- push @ucm, @{$tables{$k}};
- }
- %tables = ();
- my $seq = 0;
- for my $ucm (sort @ucm){
- # 8.3 compliance !
- my $t = sprintf ("%s_%02d_t", substr($ucm, 0, 2), $seq++);
- $tables{$t} = [ $ucm ];
- }
-}
-
-my $name = 'JP';
-
-WriteMakefile(
- INC => "-I../Encode",
- NAME => 'Encode::'.$name,
- VERSION_FROM => "$name.pm",
- OBJECT => '$(O_FILES)',
- 'dist' => {
- COMPRESS => 'gzip -9f',
- SUFFIX => 'gz',
- DIST_DEFAULT => 'all tardist',
- },
- MAN3PODS => {},
- # OS 390 winges about line numbers > 64K ???
- XSOPT => '-nolinenumbers',
- );
-
-package MY;
-
-sub post_initialize
-{
- my ($self) = @_;
- my %o;
- my $x = $self->{'OBJ_EXT'};
- # Add the table O_FILES
- foreach my $e (keys %tables)
- {
- $o{$e.$x} = 1;
- }
- $o{"$name$x"} = 1;
- $self->{'O_FILES'} = [sort keys %o];
- my @files = ("$name.xs");
- $self->{'C'} = ["$name.c"];
- $self->{SOURCE} .= " $name.c"
- if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
- $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
- my %xs;
- foreach my $table (keys %tables) {
- push (@{$self->{'C'}},"$table.c");
- # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
- # get built.
- foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
- push (@files,$table.$ext);
- }
- $self->{SOURCE} .= " $table.c"
- if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
- }
- $self->{'XS'} = { "$name.xs" => "$name.c" };
- $self->{'clean'}{'FILES'} .= join(' ',@files);
- open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
- print XS <<'END';
-#include <EXTERN.h>
-#include <perl.h>
-#include <XSUB.h>
-#define U8 U8
-#include "encode.h"
-END
- foreach my $table (keys %tables) {
- print XS qq[#include "${table}.h"\n];
- }
- print XS <<"END";
-
-static void
-Encode_XSEncoding(pTHX_ encode_t *enc)
-{
- dSP;
- HV *stash = gv_stashpv("Encode::XS", TRUE);
- SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
- int i = 0;
- PUSHMARK(sp);
- XPUSHs(sv);
- while (enc->name[i])
- {
- const char *name = enc->name[i++];
- XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
- }
- PUTBACK;
- call_pv("Encode::define_encoding",G_DISCARD);
- SvREFCNT_dec(sv);
-}
-
-MODULE = Encode::$name PACKAGE = Encode::$name
-PROTOTYPES: DISABLE
-BOOT:
-{
-END
- foreach my $table (keys %tables) {
- print XS qq[#include "${table}.exh"\n];
- }
- print XS "}\n";
- close(XS);
- return "# Built $name.xs\n\n";
-}
-
-sub postamble
-{
- my $self = shift;
- my $dir = $self->catdir($self->updir,'ucm');
- my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
- $str .= "$name.c : $name.xs ";
- foreach my $table (keys %tables)
- {
- $str .= " $table.c";
- }
- $str .= "\n\n";
- $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
-
- my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
- foreach my $table (keys %tables)
- {
- my $numlines = 1;
- my $lengthsofar = length($str);
- my $continuator = '';
- $str .= "$table.c : $enc2xs Makefile.PL";
- foreach my $file (@{$tables{$table}})
- {
- $str .= $continuator.' '.$self->catfile($dir,$file);
- if ( length($str)-$lengthsofar > 128*$numlines )
- {
- $continuator .= " \\\n\t";
- $numlines++;
- } else {
- $continuator = '';
- }
- }
- my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
- $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
- my $ucopts = '-"Q"';
- $str .=
- qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
- open (FILELIST, ">$table.fnm")
- || die "Could not open $table.fnm: $!";
- foreach my $file (@{$tables{$table}})
- {
- print FILELIST $self->catfile($dir,$file) . "\n";
- }
- close(FILELIST);
- }
- return $str;
-}
-