summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--B.xs1
-rw-r--r--B/Asmdata.pm2
-rw-r--r--bytecode.h25
-rw-r--r--bytecode.pl10
-rw-r--r--byterun.c3
-rw-r--r--byterun.h9
6 files changed, 35 insertions, 15 deletions
diff --git a/B.xs b/B.xs
index 4934b06955..7d20097e29 100644
--- a/B.xs
+++ b/B.xs
@@ -260,6 +260,7 @@ walkoptree(opsv, method)
SV *opsv;
char *method;
{
+ dTHR;
dSP;
OP *o;
diff --git a/B/Asmdata.pm b/B/Asmdata.pm
index bcfa0cc3df..68e1a073f6 100644
--- a/B/Asmdata.pm
+++ b/B/Asmdata.pm
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1996 Malcolm Beattie
+# Copyright (c) 1996, 1997 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.
diff --git a/bytecode.h b/bytecode.h
index 2cdc0289f5..0fcaa979c2 100644
--- a/bytecode.h
+++ b/bytecode.h
@@ -12,7 +12,9 @@ void *bset_obj_store _((void *, I32));
void freadpv _((U32, void *));
EXT SV *sv;
+#ifndef USE_THREADS
EXT OP *op;
+#endif
EXT XPV pv;
EXT void **obj_list;
@@ -135,14 +137,15 @@ EXT I32 obj_list_fill INIT(-1);
#define BSET_hv_store(sv, arg) \
hv_store((HV*)sv, pv.xpv_pv, pv.xpv_cur, arg, 0)
#define BSET_pv_free(pv) Safefree(pv.xpv_pv)
-#define BSET_pregcomp(op, arg) \
- cPMOP->op_pmregexp = arg ? pregcomp(arg, arg + pv.xpv_cur, cPMOP) : 0
+#define BSET_pregcomp(o, arg) \
+ ((PMOP*)o)->op_pmregexp = arg ? \
+ pregcomp(arg, arg + pv.xpv_cur, ((PMOP*)o)) : 0
#define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg)
-#define BSET_newop(op, arg) op = (OP*)safemalloc(optype_size[arg])
-#define BSET_newopn(op, arg) do { \
- OP *oldop = op; \
- BSET_newop(op, arg); \
- oldop->op_next = op; \
+#define BSET_newop(o, arg) o = (OP*)safemalloc(optype_size[arg])
+#define BSET_newopn(o, arg) do { \
+ OP *oldop = o; \
+ BSET_newop(o, arg); \
+ oldop->op_next = o; \
} while (0)
#define BSET_ret(foo) return
@@ -151,11 +154,11 @@ EXT I32 obj_list_fill INIT(-1);
* Kludge special-case workaround for OP_MAPSTART
* which needs the ppaddr for OP_GREPSTART. Blech.
*/
-#define BSET_op_type(op, arg) do { \
- op->op_type = arg; \
- op->op_ppaddr = (arg != OP_MAPSTART) ? ppaddr[arg] : pp_grepstart; \
+#define BSET_op_type(o, arg) do { \
+ o->op_type = arg; \
+ o->op_ppaddr = (arg != OP_MAPSTART) ? ppaddr[arg] : pp_grepstart; \
} while (0)
-#define BSET_op_ppaddr(op, arg) croak("op_ppaddr not yet implemented")
+#define BSET_op_ppaddr(o, arg) croak("op_ppaddr not yet implemented")
#define BSET_curpad(pad, arg) pad = AvARRAY(arg)
#define BSET_OBJ_STORE(obj, ix) \
diff --git a/bytecode.pl b/bytecode.pl
index 0f79e6589a..f24f379006 100644
--- a/bytecode.pl
+++ b/bytecode.pl
@@ -20,7 +20,7 @@ while (($from, $tos) = each %alias_to) {
my $c_header = <<'EOT';
/*
- * Copyright (c) 1996 Malcolm Beattie
+ * Copyright (c) 1996, 1997 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.
@@ -84,6 +84,7 @@ void byterun(fp)
FILE *fp;
#endif /* INDIRECT_BGET_MACROS */
{
+ dTHR;
int insn;
while ((insn = FGETC()) != EOF) {
switch (insn) {
@@ -168,6 +169,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
diff --git a/byterun.c b/byterun.c
index 7eb981e4bd..d478a90d7f 100644
--- a/byterun.c
+++ b/byterun.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996 Malcolm Beattie
+ * Copyright (c) 1996, 1997 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.
@@ -22,6 +22,7 @@ void byterun(fp)
FILE *fp;
#endif /* INDIRECT_BGET_MACROS */
{
+ dTHR;
int insn;
while ((insn = FGETC()) != EOF) {
switch (insn) {
diff --git a/byterun.h b/byterun.h
index fee8eda438..b8c557ccbb 100644
--- a/byterun.h
+++ b/byterun.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996 Malcolm Beattie
+ * Copyright (c) 1996, 1997 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.
@@ -21,6 +21,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 {
INSN_RET, /* 0 */
INSN_LDSV, /* 1 */