This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove compiler files from their old lib/B locations. The compiler
[perl5.git] / bytecode.pl
index 359110d..8eadbdd 100644 (file)
@@ -20,7 +20,7 @@ while (($from, $tos) = each %alias_to) {
 
 my $c_header = <<'EOT';
 /*
- *      Copyright (c) 1996 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 "Asmdata.pm") {
-    rename("Asmdata.pm", "Asmdata.pm.old");
-}
+unlink "byterun.c", "byterun.h", "ext/B/Asmdata.pm";
 
 #
 # Start with boilerplate for Asmdata.pm
 #
-open(ASMDATA_PM, ">Asmdata.pm") or die "Asmdata.pm: $!";
+open(ASMDATA_PM, ">ext/B/Asmdata.pm") or die "Asmdata.pm: $!";
 print ASMDATA_PM $perl_header, <<'EOT';
 package B::Asmdata;
 use Exporter;
@@ -84,6 +76,7 @@ void byterun(fp)
 FILE *fp;
 #endif /* INDIRECT_BGET_MACROS */
 {
+    dTHR;
     int insn;
     while ((insn = FGETC()) != EOF) {
        switch (insn) {
@@ -168,6 +161,13 @@ void byterun _((struct bytestream));
 void byterun _((FILE *));
 #endif /* INDIRECT_BGET_MACROS */
 
+#ifndef PATCHLEVEL
+#include "patchlevel.h"
+#endif
+#if PATCHLEVEL < 4 || (PATCHLEVEL == 4 && SUBVERSION < 50)
+#define dTHR extern int errno
+#endif
+
 enum {
 EOT
 
@@ -212,13 +212,14 @@ print BYTERUN_H <<'EOT';
 EOT
 
 printf BYTERUN_H <<'EOT', scalar(@specialsv);
-EXT SV * specialsv_list[%d]
-#ifdef DOINIT
+EXT SV * specialsv_list[%d];
+#define INIT_SPECIALSV_LIST STMT_START { \
 EOT
-print BYTERUN_H "= { ", join(", ", @specialsv), " }\n";
+for ($i = 0; $i < @specialsv; $i++) {
+    print BYTERUN_H "specialsv_list[$i] = $specialsv[$i]; \\\n";
+}
 print BYTERUN_H <<'EOT';
-#endif /* DOINIT */
-;
+} STMT_END
 EOT
 
 #
@@ -283,26 +284,26 @@ xio_page  IoPAGE(sv)              long
 xio_page_len   IoPAGE_LEN(sv)          long
 xio_lines_left IoLINES_LEFT(sv)        long
 xio_top_name   IoTOP_NAME(sv)          pvcontents
-xio_top_gv     IoTOP_GV(sv)            svindex
+xio_top_gv     *(SV**)&IoTOP_GV(sv)    svindex
 xio_fmt_name   IoFMT_NAME(sv)          pvcontents
-xio_fmt_gv     IoFMT_GV(sv)            svindex
+xio_fmt_gv     *(SV**)&IoFMT_GV(sv)    svindex
 xio_bottom_name        IoBOTTOM_NAME(sv)       pvcontents
-xio_bottom_gv  IoBOTTOM_GV(sv)         svindex
+xio_bottom_gv  *(SV**)&IoBOTTOM_GV(sv) svindex
 xio_subprocess IoSUBPROCESS(sv)        short
 xio_type       IoTYPE(sv)              char
 xio_flags      IoFLAGS(sv)             char
 xcv_stash      *(SV**)&CvSTASH(sv)     svindex
 xcv_start      CvSTART(sv)             opindex
 xcv_root       CvROOT(sv)              opindex
-xcv_gv         CvGV(sv)                svindex
-xcv_filegv     CvFILEGV(sv)            svindex
+xcv_gv         *(SV**)&CvGV(sv)        svindex
+xcv_filegv     *(SV**)&CvFILEGV(sv)    svindex
 xcv_depth      CvDEPTH(sv)             long
 xcv_padlist    *(SV**)&CvPADLIST(sv)   svindex
 xcv_outside    *(SV**)&CvOUTSIDE(sv)   svindex
 xcv_flags      CvFLAGS(sv)             U8
 av_extend      sv                      SSize_t         x
 av_push                sv                      svindex         x
-xav_fill       AvFILL(sv)              SSize_t
+xav_fill       AvFILLp(sv)             SSize_t
 xav_max                AvMAX(sv)               SSize_t
 xav_flags      AvFLAGS(sv)             U8
 xhv_riter      HvRITER(sv)             I32
@@ -348,12 +349,10 @@ op_pmreplrootgv   *(SV**)&cPMOP->op_pmreplroot    svindex
 op_pmreplstart cPMOP->op_pmreplstart   opindex
 op_pmnext      *(OP**)&cPMOP->op_pmnext        opindex
 pregcomp       op                      pvcontents      x
-op_pmshort     cPMOP->op_pmshort       svindex
 op_pmflags     cPMOP->op_pmflags       U16
 op_pmpermflags cPMOP->op_pmpermflags   U16
-op_pmslen      cPMOP->op_pmslen        char
 op_sv          cSVOP->op_sv            svindex
-op_gv          cGVOP->op_gv            svindex
+op_gv          *(SV**)&cGVOP->op_gv    svindex
 op_pv          cPVOP->op_pv            pvcontents
 op_pv_tr       cPVOP->op_pv            op_tr_array
 op_redoop      cLOOP->op_redoop        opindex
@@ -361,7 +360,7 @@ op_nextop   cLOOP->op_nextop        opindex
 op_lastop      cLOOP->op_lastop        opindex
 cop_label      cCOP->cop_label         pvcontents
 cop_stash      *(SV**)&cCOP->cop_stash         svindex
-cop_filegv     cCOP->cop_filegv        svindex
+cop_filegv     *(SV**)&cCOP->cop_filegv        svindex
 cop_seq                cCOP->cop_seq           U32
 cop_arybase    cCOP->cop_arybase       I32
 cop_line       cCOP->cop_line          line_t