summaryrefslogtreecommitdiff
path: root/run.c
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1993-10-07 23:00:00 +0000
committerLarry Wall <lwall@netlabs.com>1993-10-07 23:00:00 +0000
commit79072805bf63abe5b5978b5928ab00d360ea3e7f (patch)
tree96688fcd69f9c8d2110e93c350b4d0025eaf240d /run.c
parente334a159a5616cab575044bafaf68f75b7bb3a16 (diff)
downloadperl-79072805bf63abe5b5978b5928ab00d360ea3e7f.tar.gz
perl 5.0 alpha 2perl-5a2
[editor's note: from history.perl.org. The sparc executables originally included in the distribution are not in this commit.]
Diffstat (limited to 'run.c')
-rw-r--r--run.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/run.c b/run.c
new file mode 100644
index 0000000000..d1c9aca7f8
--- /dev/null
+++ b/run.c
@@ -0,0 +1,74 @@
+#include "EXTERN.h"
+#include "perl.h"
+
+char **watchaddr = 0;
+char *watchok;
+
+#ifndef DEBUGGING
+
+run() {
+ while ( op = (*op->op_ppaddr)() ) ;
+}
+
+#else
+
+run() {
+ if (!op) {
+ warn("NULL OP IN RUN");
+ return;
+ }
+ do {
+ if (debug) {
+ if (watchaddr != 0 && *watchaddr != watchok)
+ fprintf(stderr, "WARNING: %lx changed from %lx to %lx\n",
+ watchaddr, watchok, *watchaddr);
+ DEBUG_s(debstack());
+ DEBUG_t(debop(op));
+ }
+ } while ( op = (*op->op_ppaddr)() );
+}
+
+#endif
+
+I32
+getgimme(op)
+OP *op;
+{
+ return cxstack[cxstack_ix].blk_gimme;
+}
+
+I32
+debop(op)
+OP *op;
+{
+ SV *sv;
+ deb("%s", op_name[op->op_type]);
+ switch (op->op_type) {
+ case OP_CONST:
+ fprintf(stderr, "(%s)", SvPEEK(cSVOP->op_sv));
+ break;
+ case OP_GVSV:
+ case OP_GV:
+ if (cGVOP->op_gv) {
+ sv = NEWSV(0,0);
+ gv_fullname(sv, cGVOP->op_gv);
+ fprintf(stderr, "(%s)", SvPVn(sv));
+ sv_free(sv);
+ }
+ else
+ fprintf(stderr, "(NULL)");
+ break;
+ }
+ fprintf(stderr, "\n");
+ return 0;
+}
+
+void
+watch(addr)
+char **addr;
+{
+ watchaddr = addr;
+ watchok = *addr;
+ fprintf(stderr, "WATCHING, %lx is currently %lx\n",
+ watchaddr, watchok);
+}