2 # This file is auto-generated by:
3 # enc2xs version $_Version_
8 use ExtUtils::MakeMaker;
11 # Please edit the following to the taste!
14 $_Name__t => [ $_TableFiles_ ],
17 #### DO NOT EDIT BEYOND THIS POINT!
19 my ($enc2xs, $encode_h) = ();
21 for my $d (@Config{qw/bin sitebin vendorbin/},
22 (split /:/, $ENV{PATH})){
23 for my $f (qw/enc2xs enc2xs5.7.3/){
24 my $path = File::Spec->catfile($d, $f);
25 -x $path and $enc2xs = $path and last PATHLOOP;
28 $enc2xs or die "enc2xs not found!";
29 print "enc2xs is $enc2xs\n";
32 my $dir = File::Spec->catfile($d, "Encode");
33 my $file = File::Spec->catfile($dir, "encode.h");
34 -f $file and $encode_h{$dir} = -M $file;
36 %encode_h or die "encode.h not found!";
38 ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
39 print "encode.h is at $encode_h\n";
43 #### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! ####
44 NAME => 'Encode::'.$name,
45 VERSION_FROM => "$name.pm",
46 OBJECT => '$(O_FILES)',
48 COMPRESS => 'gzip -9f',
50 DIST_DEFAULT => 'all tardist',
56 # OS 390 winges about line numbers > 64K ???
57 XSOPT => '-nolinenumbers',
66 my $x = $self->{'OBJ_EXT'};
67 # Add the table O_FILES
68 foreach my $e (keys %tables)
73 $self->{'O_FILES'} = [sort keys %o];
74 my @files = ("$name.xs");
75 $self->{'C'} = ["$name.c"];
76 # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
78 foreach my $table (keys %tables) {
79 push (@{$self->{'C'}},"$table.c");
80 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
82 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
83 push (@files,$table.$ext);
86 $self->{'XS'} = { "$name.xs" => "$name.c" };
87 $self->{'clean'}{'FILES'} .= join(' ',@files);
88 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
96 foreach my $table (keys %tables) {
97 print XS qq[#include "${table}.h"\n];
102 Encode_XSEncoding(pTHX_ encode_t *enc)
105 HV *stash = gv_stashpv("Encode::XS", TRUE);
106 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
112 const char *name = enc->name[i++];
113 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
116 call_pv("Encode::define_encoding",G_DISCARD);
120 MODULE = Encode::$name PACKAGE = Encode::$name
125 foreach my $table (keys %tables) {
126 print XS qq[#include "${table}.exh"\n];
130 return "# Built $name.xs\n\n";
136 my $dir = "."; # $self->catdir('Encode');
137 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
138 $str .= "$name.c : $name.xs ";
139 foreach my $table (keys %tables)
144 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
146 foreach my $table (keys %tables)
149 my $lengthsofar = length($str);
150 my $continuator = '';
151 $str .= "$table.c : Makefile.PL";
152 foreach my $file (@{$tables{$table}})
154 $str .= $continuator.' '.$self->catfile($dir,$file);
155 if ( length($str)-$lengthsofar > 128*$numlines )
157 $continuator .= " \\\n\t";
163 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
166 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
167 open (FILELIST, ">$table.fnm")
168 || die "Could not open $table.fnm: $!";
169 foreach my $file (@{$tables{$table}})
171 print FILELIST $self->catfile($dir,$file) . "\n";