GIF89a;
EcchiShell v1.0
/
/
proc/
self/
root/
usr/
share/
perl5/
0).
*
* It is important to have a valid environment for atexit()
* routines that are eventually called.
*/
environ = env;
#endif
#ifdef PERL_GLOBAL_STRUCT
free_global_struct(plvarsp);
#endif /* PERL_GLOBAL_STRUCT */
PERL_SYS_TERM();
exit(exitstatus);
return exitstatus;
}
/* Register any extra external extensions */
EOF!HEAD
$tail=<<'EOF!TAIL';
static void
xs_init(pTHX)
{
PERL_UNUSED_CONTEXT;
}
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*
* ex: set ts=8 sts=4 sw=4 noet:
*/
EOF!TAIL
sub writemain{
my(@exts) = @_;
my($pname);
my($dl) = canon('/','DynaLoader');
print $head;
foreach $_ (@exts){
my($pname) = canon('/', $_);
my($mname, $cname);
($mname = $pname) =~ s!/!::!g;
($cname = $pname) =~ s!/!__!g;
print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
}
my ($tail1,$tail2,$tail3) = ( $tail =~ /\A(.*{\s*\n)(.*\n)(\s*\}.*)\Z/s );
print $tail1;
print "\tconst char file[] = __FILE__;\n";
print "\tdXSUB_SYS;\n" if $] > 5.002;
print $tail2;
foreach $_ (@exts){
my($pname) = canon('/', $_);
my($mname, $cname, $ccode);
($mname = $pname) =~ s!/!::!g;
($cname = $pname) =~ s!/!__!g;
print "\t{\n";
if ($pname eq $dl){
# Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
# boot_DynaLoader is called directly in DynaLoader.pm
$ccode = "\t/* DynaLoader is a special case */\n
\tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n";
print $ccode unless $SEEN{$ccode}++;
} else {
$ccode = "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n";
print $ccode unless $SEEN{$ccode}++;
}
print "\t}\n";
}
print $tail3;
}
sub canon{
my($as, @ext) = @_;
foreach(@ext){
# might be X::Y or lib/auto/X/Y/Y.a
next if s!::!/!g;
s:^(lib|ext)/(auto/)?::;
s:/\w+\.\w+$::;
}
grep(s:/:$as:, @ext) if ($as ne '/');
@ext;
}
1;
__END__
=head1 NAME
ExtUtils::Miniperl, writemain - write the C code for perlmain.c
=head1 SYNOPSIS
C