Put back the cygwin32 Configure fix of 3582 undone by 3597.
[p5sagit/p5-mst-13.2.git] / bytecode.pl
index 93457ea..1e18d55 100644 (file)
@@ -67,9 +67,20 @@ print BYTERUN_C $c_header, <<'EOT';
 
 #include "EXTERN.h"
 #include "perl.h"
+#define NO_XSLOCKS
+#include "XSUB.h"
+
+#ifdef PERL_OBJECT
+#undef CALL_FPTR
+#define CALL_FPTR(fptr) (pPerl->*fptr)
+#undef PL_ppaddr
+#define PL_ppaddr (*get_ppaddr())
+#endif
+
 #include "byterun.h"
 #include "bytecode.h"
 
+
 static int optype_size[] = {
 EOT
 my $i = 0;
@@ -89,7 +100,7 @@ static void **bytecode_obj_list;
 static I32 bytecode_obj_list_fill = -1;
 
 void *
-bset_obj_store(void *obj, I32 ix)
+bset_obj_store(pTHXo_ void *obj, I32 ix)
 {
     if (ix > bytecode_obj_list_fill) {
        if (bytecode_obj_list_fill == -1)
@@ -102,7 +113,8 @@ bset_obj_store(void *obj, I32 ix)
     return obj;
 }
 
-void byterun(struct bytestream bs)
+void
+byterun(pTHXo_ struct bytestream bs)
 {
     dTHR;
     int insn;
@@ -173,7 +185,7 @@ EOT
 #
 print BYTERUN_C <<'EOT';
          default:
-           croak("Illegal bytecode instruction %d\n", insn);
+           Perl_croak(aTHX_ "Illegal bytecode instruction %d\n", insn);
            /* NOTREACHED */
        }
     }
@@ -187,15 +199,14 @@ open(BYTERUN_H, ">ext/ByteLoader/byterun.h") or die "ext/ByteLoader/byterun.h: $
 print BYTERUN_H $c_header, <<'EOT';
 struct bytestream {
     void *data;
-    int (*fgetc)(void *);
-    int (*fread)(char *, size_t, size_t, void *);
-    void (*freadpv)(U32, void *, XPV *);
+    int (*pfgetc)(void *);
+    int (*pfread)(char *, size_t, size_t, void *);
+    void (*pfreadpv)(U32, void *, XPV *);
 };
 
 enum {
 EOT
 
-my $i = 0;
 my $add_enum_value = 0;
 my $max_insn;
 for ($i = 0; $i < @insn_name; $i++) {
@@ -220,22 +231,10 @@ for ($i = 0; $i < @optype - 1; $i++) {
     printf BYTERUN_H "    OPt_%s,\t\t/* %d */\n", $optype[$i], $i;
 }
 printf BYTERUN_H "    OPt_%s\t\t/* %d */\n};\n\n", $optype[$i], $i;
-print BYTERUN_H <<'EOT';
-EXT int PL_optype_size[]
-#ifdef DOINIT
-= {
-EOT
-for ($i = 0; $i < @optype - 1; $i++) {
-    printf BYTERUN_H "    sizeof(%s),\n", $optype[$i], $i;
-}
-printf BYTERUN_H "    sizeof(%s)\n}\n", $optype[$i], $i;
-print BYTERUN_H <<'EOT';
-#endif /* DOINIT */
-;
-
-EOT
 
 print BYTERUN_H <<'EOT';
+EXT void byterun(pTHXo_ struct bytestream bs);
+
 #define INIT_SPECIALSV_LIST STMT_START { \
 EOT
 for ($i = 0; $i < @specialsv; $i++) {