# This File keeps the contents of miniperlmain.c. # # It was generated automatically by minimod.PL from the contents # of miniperlmain.c. Don't edit this file! # # ANY CHANGES MADE HERE WILL BE LOST! # package ExtUtils::Miniperl; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(&writemain); $head= <<'EOF!HEAD'; /* * "The Road goes ever on and on, down from the door where it began." */ #include "EXTERN.h" #include "perl.h" static void xs_init _((void)); static PerlInterpreter *my_perl; int main(argc, argv, env) int argc; char **argv; char **env; { int exitstatus; #ifdef VMS getredirection(&argc,&argv); #endif if (!do_undump) { my_perl = perl_alloc(); if (!my_perl) exit(1); perl_construct( my_perl ); } exitstatus = perl_parse( my_perl, xs_init, argc, argv, env ); if (exitstatus) exit( exitstatus ); exitstatus = perl_run( my_perl ); perl_destruct( my_perl ); perl_free( my_perl ); exit( exitstatus ); } /* Register any extra external extensions */ static void xs_init() { EOF!HEAD $tail=<<'EOF!TAIL'; } EOF!TAIL sub writemain{ my(@exts) = @_; my($pname); my($dl) = canon('/','DynaLoader'); print $head; print " char *file = __FILE__;\n"; foreach $_ (@exts){ my($pname) = canon('/', $_); my($mname, $cname); ($mname = $pname) =~ s!/!::!g; ($cname = $pname) =~ s!/!__!g; print "\t{ extern void boot_${cname} _((CV* cv));\n"; if ($pname eq $dl){ # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! # boot_DynaLoader is called directly in DynaLoader.pm print "\t/* DynaLoader is a special case */\n"; print "\tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n" } else { print "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n" } print "\t}\n"; } print $tail; } 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;