X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bytecode.pl;h=2e3f9c6086d6637a4fcb5871dd3118b3d9940b51;hb=15ee1d8715e28c0c0be2cceb2f9f90d79153090e;hp=2423e3c93a9d77787de54cd43a1e71aa64d3395a;hpb=98b55637d580660d79fad229f9c059fcbf7985c2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/bytecode.pl b/bytecode.pl index 2423e3c..2e3f9c6 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -20,7 +20,7 @@ while (($from, $tos) = each %alias_to) { my $c_header = <<'EOT'; /* - * Copyright (c) 1996, 1997 Malcolm Beattie + * Copyright (c) 1996-1998 Malcolm Beattie * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -34,20 +34,12 @@ EOT my $perl_header; ($perl_header = $c_header) =~ s{[/ ]?\*/?}{#}g; -if (-f "byterun.c") { - rename("byterun.c", "byterun.c.old"); -} -if (-f "byterun.h") { - rename("byterun.h", "byterun.h.old"); -} -if (-f "B/Asmdata.pm") { - rename("B/Asmdata.pm", "B/Asmdata.pm.old"); -} +unlink "byterun.c", "byterun.h", "ext/B/B/Asmdata.pm"; # # Start with boilerplate for Asmdata.pm # -open(ASMDATA_PM, ">B/Asmdata.pm") or die "Asmdata.pm: $!"; +open(ASMDATA_PM, ">ext/B/B/Asmdata.pm") or die "ext/B/B/Asmdata.pm: $!"; print ASMDATA_PM $perl_header, <<'EOT'; package B::Asmdata; use Exporter; @@ -73,20 +65,30 @@ print BYTERUN_C $c_header, <<'EOT'; #include "EXTERN.h" #include "perl.h" -#include "bytecode.h" -#include "byterun.h" + +void * +bset_obj_store(void *obj, I32 ix) +{ + if (ix > obj_list_fill) { + if (obj_list_fill == -1) + New(666, obj_list, ix + 1, void*); + else + Renew(obj_list, ix + 1, void*); + obj_list_fill = ix; + } + obj_list[ix] = obj; + return obj; +} #ifdef INDIRECT_BGET_MACROS -void byterun(bs) -struct bytestream bs; +void byterun(struct bytestream bs) #else -void byterun(fp) -FILE *fp; +void byterun(PerlIO *fp) #endif /* INDIRECT_BGET_MACROS */ { dTHR; int insn; - while ((insn = FGETC()) != EOF) { + while ((insn = BGET_FGETC()) != EOF) { switch (insn) { EOT @@ -163,18 +165,12 @@ struct bytestream { int (*fread)(char *, size_t, size_t, void*); void (*freadpv)(U32, void*); }; -void freadpv _((U32, void *)); void byterun _((struct bytestream)); #else -void byterun _((FILE *)); +void byterun _((PerlIO *)); #endif /* INDIRECT_BGET_MACROS */ -#ifndef PATCHLEVEL -#include "patchlevel.h" -#endif -#if PATCHLEVEL < 4 || (PATCHLEVEL == 4 && SUBVERSION < 50) -#define dTHR extern int errno -#endif +void *bset_obj_store _((void *, I32)); enum { EOT @@ -224,10 +220,10 @@ EXT SV * specialsv_list[%d]; #define INIT_SPECIALSV_LIST STMT_START { \ EOT for ($i = 0; $i < @specialsv; $i++) { - print BYTERUN_H "specialsv_list[$i] = $specialsv[$i]; \\\n"; + print BYTERUN_H "\tspecialsv_list[$i] = $specialsv[$i]; \\\n"; } print BYTERUN_H <<'EOT'; -} STMT_END + } STMT_END EOT #