dslinux/user/perl/ext/Encode/Encode Changes.e2x ConfigLocal_PM.e2x Makefile_PL.e2x README.e2x _PM.e2x _T.e2x encode.h
cayenne
dslinux_cayenne at user.in-berlin.de
Tue Dec 5 05:26:36 CET 2006
Update of /cvsroot/dslinux/dslinux/user/perl/ext/Encode/Encode
In directory antilope:/tmp/cvs-serv7729/ext/Encode/Encode
Added Files:
Changes.e2x ConfigLocal_PM.e2x Makefile_PL.e2x README.e2x
_PM.e2x _T.e2x encode.h
Log Message:
Adding fresh perl source to HEAD to branch from
--- NEW FILE: _T.e2x ---
use strict;
# Adjust the number here!
use Test::More tests => 2;
use_ok('Encode');
use_ok('Encode::$_Name_');
# Add more test here!
--- NEW FILE: Makefile_PL.e2x ---
#
# This file is auto-generated by:
# enc2xs version $_Version_
# $_Now_
#
use 5.7.2;
use strict;
use ExtUtils::MakeMaker;
use Config;
# Please edit the following to the taste!
my $name = '$_Name_';
my %tables = (
$_Name__t => [ $_TableFiles_ ],
);
#### DO NOT EDIT BEYOND THIS POINT!
require File::Spec;
my ($enc2xs, $encode_h) = ();
PATHLOOP:
for my $d (@Config{qw/bin sitebin vendorbin/},
(split /$Config{path_sep}/o, $ENV{PATH})){
for my $f (qw/enc2xs enc2xs5.7.3/){
my $path = File::Spec->catfile($d, $f);
-r $path and $enc2xs = $path and last PATHLOOP;
}
}
$enc2xs or die "enc2xs not found!";
print "enc2xs is $enc2xs\n";
my %encode_h = ();
for my $d (@INC){
my $dir = File::Spec->catfile($d, "Encode");
my $file = File::Spec->catfile($dir, "encode.h");
-f $file and $encode_h{$dir} = -M $file;
}
%encode_h or die "encode.h not found!";
# find the latest one
($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
print "encode.h is at $encode_h\n";
WriteMakefile(
INC => "-I$encode_h",
#### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! ####
NAME => 'Encode::'.$name,
VERSION_FROM => "$name.pm",
OBJECT => '$(O_FILES)',
'dist' => {
COMPRESS => 'gzip -9f',
SUFFIX => 'gz',
DIST_DEFAULT => 'all tardist',
},
MAN3PODS => {},
PREREQ_PM => {
'Encode' => "1.41",
},
# 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"];
# The next two lines to make MacPerl Happy -- dankogai via pudge
$self->{SOURCE} .= " $name.c"
if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
# $self->{'H'} = [$self->catfile($self->updir,'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->{'XS'} = { "$name.xs" => "$name.c" };
$self->{'clean'}{'FILES'} .= join(' ', at 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('Encode');
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";
foreach my $table (keys %tables)
{
my $numlines = 1;
my $lengthsofar = length($str);
my $continuator = '';
$str .= "$table.c : 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)"' : '';
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;
}
--- NEW FILE: ConfigLocal_PM.e2x ---
#
# Local demand-load module list
#
# You should not edit this file by hand! use "enc2xs -C"
#
package Encode::ConfigLocal;
our $VERSION = $_LocalVer_;
use strict;
$_ModLines_
1;
--- NEW FILE: _PM.e2x ---
package Encode::$_Name_;
our $VERSION = "0.01";
use Encode;
use XSLoader;
XSLoader::load(__PACKAGE__,$VERSION);
1;
__END__
=head1 NAME
Encode::$_Name_ - New Encoding
=head1 SYNOPSIS
You got to fill this in!
=head1 SEE ALSO
L<Encode>
=cut
--- NEW FILE: README.e2x ---
Encode::$_Name_ version 0.1
========
NAME
Encode::$_Name_ - <describe encoding>
SYNOPSIS
use Encode::$_Name_;
#<put more words here>
ABSTRACT
<fill this in>
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires perl version 5.7.3 or later.
COPYRIGHT AND LICENCE
Copyright (C) 2002 Your Name <your at address.domain>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
--- NEW FILE: encode.h ---
#ifndef ENCODE_H
#define ENCODE_H
#ifndef U8
/*
A tad devious this:
perl normally has a #define for U8 - if that isn't present then we
typedef it - leaving it #ifndef so we can do data parts without
getting extern references to the code parts
*/
typedef unsigned char U8;
#endif
typedef struct encpage_s encpage_t;
struct encpage_s
{
/* fields ordered to pack nicely on 32-bit machines */
const U8 *seq; /* Packed output sequences we generate
if we match */
encpage_t *next; /* Page to go to if we match */
U8 min; /* Min value of octet to match this entry */
U8 max; /* Max value of octet to match this entry */
U8 dlen; /* destination length -
size of entries in seq */
U8 slen; /* source length -
number of source octets needed */
};
/*
At any point in a translation there is a page pointer which points
at an array of the above structures.
Basic operation :
get octet from source stream.
if (octet >= min && octet < max) {
if slen is 0 then we cannot represent this character.
if we have less than slen octets (including this one) then
we have a partial character.
otherwise
copy dlen octets from seq + dlen*(octet-min) to output
(dlen may be zero if we don't know yet.)
load page pointer with next to continue.
(is slen is one this is end of a character)
get next octet.
}
else {
increment the page pointer to look at next slot in the array
}
arrays SHALL be constructed so there is an entry which matches
..0xFF at the end, and either maps it or indicates no
representation.
if MSB of slen is set then mapping is an approximate "FALLBACK" entry.
*/
typedef struct encode_s encode_t;
struct encode_s
{
encpage_t *t_utf8; /* Starting table for translation from
the encoding to UTF-8 form */
encpage_t *f_utf8; /* Starting table for translation
from UTF-8 to the encoding */
const U8 *rep; /* Replacement character in this encoding
e.g. "?" */
int replen; /* Number of octets in rep */
U8 min_el; /* Minimum octets to represent a character */
U8 max_el; /* Maximum octets to represent a character */
const char *name[2]; /* name(s) of this encoding */
};
#ifdef U8
/* See comment at top of file for deviousness */
extern int do_encode(encpage_t *enc, const U8 *src, STRLEN *slen,
U8 *dst, STRLEN dlen, STRLEN *dout, int approx,
const U8 *term, STRLEN tlen);
extern void Encode_DefineEncoding(encode_t *enc);
#endif /* U8 */
#define ENCODE_NOSPACE 1
#define ENCODE_PARTIAL 2
#define ENCODE_NOREP 3
#define ENCODE_FALLBACK 4
#define ENCODE_FOUND_TERM 5
#define FBCHAR_UTF8 "\xEF\xBF\xBD"
#define ENCODE_DIE_ON_ERR 0x0001 /* croaks immediately */
#define ENCODE_WARN_ON_ERR 0x0002 /* warn on error; may proceed */
#define ENCODE_RETURN_ON_ERR 0x0004 /* immediately returns on NOREP */
#define ENCODE_LEAVE_SRC 0x0008 /* $src updated unless set */
#define ENCODE_PERLQQ 0x0100 /* perlqq fallback string */
#define ENCODE_HTMLCREF 0x0200 /* HTML character ref. fb mode */
#define ENCODE_XMLCREF 0x0400 /* XML character ref. fb mode */
#define ENCODE_STOP_AT_PARTIAL 0x0800 /* stop at partial explicitly */
#define ENCODE_FB_DEFAULT 0x0000
#define ENCODE_FB_CROAK 0x0001
#define ENCODE_FB_QUIET ENCODE_RETURN_ON_ERR
#define ENCODE_FB_WARN (ENCODE_RETURN_ON_ERR|ENCODE_WARN_ON_ERR)
#define ENCODE_FB_PERLQQ (ENCODE_PERLQQ|ENCODE_LEAVE_SRC)
#define ENCODE_FB_HTMLCREF (ENCODE_HTMLCREF|ENCODE_LEAVE_SRC)
#define ENCODE_FB_XMLCREF (ENCODE_XMLCREF|ENCODE_LEAVE_SRC)
#endif /* ENCODE_H */
--- NEW FILE: Changes.e2x ---
#
# $Id: Changes.e2x,v 1.1 2006-12-05 04:26:34 dslinux_cayenne Exp $
# Revision history for Perl extension Encode::$_Name_.
#
0.01 $_Now_
Autogenerated by enc2xs version $_Version_.
More information about the dslinux-commit
mailing list