This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 9
[perl5.git] / run.c
CommitLineData
79072805
LW
1#include "EXTERN.h"
2#include "perl.h"
3
4char **watchaddr = 0;
5char *watchok;
6
7#ifndef DEBUGGING
8
9run() {
10 while ( op = (*op->op_ppaddr)() ) ;
11}
12
13#else
14
15run() {
16 if (!op) {
17 warn("NULL OP IN RUN");
18 return;
19 }
20 do {
21 if (debug) {
22 if (watchaddr != 0 && *watchaddr != watchok)
23 fprintf(stderr, "WARNING: %lx changed from %lx to %lx\n",
24 watchaddr, watchok, *watchaddr);
25 DEBUG_s(debstack());
26 DEBUG_t(debop(op));
27 }
28 } while ( op = (*op->op_ppaddr)() );
29}
30
31#endif
32
33I32
79072805
LW
34debop(op)
35OP *op;
36{
37 SV *sv;
38 deb("%s", op_name[op->op_type]);
39 switch (op->op_type) {
40 case OP_CONST:
41 fprintf(stderr, "(%s)", SvPEEK(cSVOP->op_sv));
42 break;
43 case OP_GVSV:
44 case OP_GV:
45 if (cGVOP->op_gv) {
46 sv = NEWSV(0,0);
47 gv_fullname(sv, cGVOP->op_gv);
463ee0b2 48 fprintf(stderr, "(%s)", SvPV(sv, na));
8990e307 49 SvREFCNT_dec(sv);
79072805
LW
50 }
51 else
52 fprintf(stderr, "(NULL)");
53 break;
54 }
55 fprintf(stderr, "\n");
56 return 0;
57}
58
59void
60watch(addr)
61char **addr;
62{
63 watchaddr = addr;
64 watchok = *addr;
65 fprintf(stderr, "WATCHING, %lx is currently %lx\n",
66 watchaddr, watchok);
67}