}
#else /* Rest of file is for DEBUGGING */
+#ifdef I_STDARG
+static void dump(char *pat, ...);
+#else
+# if defined(I_VARARGS)
+/*VARARGS0*/
+static void
+dump(pat, va_alist)
+ char *pat;
+ va_dcl
+# else
static void dump();
+# endif
+#endif
void
dump_all()
{
#ifdef HAS_SETLINEBUF
- setlinebuf(stderr);
+ setlinebuf(Perl_debug_log);
#else
- setvbuf(stderr, Nullch, _IOLBF, 0);
+ setvbuf(Perl_debug_log, Nullch, _IOLBF, 0);
#endif
if (main_root)
dump_op(main_root);
if (!HvARRAY(stash))
return;
for (i = 0; i <= (I32) HvMAX(stash); i++) {
- for (entry = HvARRAY(stash)[i]; entry; entry = entry->hent_next) {
- GV *gv = (GV*)entry->hent_val;
+ for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
+ GV *gv = (GV*)HeVAL(entry);
HV *hv;
if (GvCV(gv))
dump_sub(gv);
if (GvFORM(gv))
dump_form(gv);
- if (entry->hent_key[entry->hent_klen-1] == ':' &&
+ if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
(hv = GvHV(gv)) && HvNAME(hv) && hv != defstash)
dump_packsubs(hv); /* nested package */
}
dump("{\n");
if (op->op_seq)
- fprintf(stderr, "%-4d", op->op_seq);
+ fprintf(Perl_debug_log, "%-4d", op->op_seq);
else
- fprintf(stderr, " ");
+ fprintf(Perl_debug_log, " ");
dump("TYPE = %s ===> ", op_name[op->op_type]);
if (op->op_next) {
if (op->op_seq)
- fprintf(stderr, "%d\n", op->op_next->op_seq);
+ fprintf(Perl_debug_log, "%d\n", op->op_next->op_seq);
else
- fprintf(stderr, "(%d)\n", op->op_next->op_seq);
+ fprintf(Perl_debug_log, "(%d)\n", op->op_next->op_seq);
}
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
dumplvl++;
if (op->op_targ) {
if (op->op_type == OP_NULL)
else
dump("TARG = %d\n", op->op_targ);
}
-#ifdef NOTDEF
+#ifdef DUMPADDR
dump("ADDR = 0x%lx => 0x%lx\n",op, op->op_next);
#endif
if (op->op_flags) {
op->op_type == OP_AELEM ||
op->op_type == OP_HELEM )
{
- if (op->op_private & OPpDEREF_DB)
+ if (op->op_private & OPpENTERSUB_AMPER)
+ (void)strcat(buf,"AMPER,");
+ if (op->op_private & OPpENTERSUB_DB)
(void)strcat(buf,"DB,");
if (op->op_private & OPpDEREF_AV)
(void)strcat(buf,"AV,");
case OP_ENTERLOOP:
dump("REDO ===> ");
if (cLOOP->op_redoop)
- fprintf(stderr, "%d\n", cLOOP->op_redoop->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cLOOP->op_redoop->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
dump("NEXT ===> ");
if (cLOOP->op_nextop)
- fprintf(stderr, "%d\n", cLOOP->op_nextop->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cLOOP->op_nextop->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
dump("LAST ===> ");
if (cLOOP->op_lastop)
- fprintf(stderr, "%d\n", cLOOP->op_lastop->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cLOOP->op_lastop->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
break;
case OP_COND_EXPR:
dump("TRUE ===> ");
if (cCONDOP->op_true)
- fprintf(stderr, "%d\n", cCONDOP->op_true->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cCONDOP->op_true->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
dump("FALSE ===> ");
if (cCONDOP->op_false)
- fprintf(stderr, "%d\n", cCONDOP->op_false->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cCONDOP->op_false->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
break;
case OP_MAPWHILE:
case OP_GREPWHILE:
case OP_AND:
dump("OTHER ===> ");
if (cLOGOP->op_other)
- fprintf(stderr, "%d\n", cLOGOP->op_other->op_seq);
+ fprintf(Perl_debug_log, "%d\n", cLOGOP->op_other->op_seq);
else
- fprintf(stderr, "DONE\n");
+ fprintf(Perl_debug_log, "DONE\n");
break;
case OP_PUSHRE:
case OP_MATCH:
SV *sv;
if (!gv) {
- fprintf(stderr,"{}\n");
+ fprintf(Perl_debug_log,"{}\n");
return;
}
sv = sv_newmortal();
dumplvl++;
- fprintf(stderr,"{\n");
+ fprintf(Perl_debug_log,"{\n");
gv_fullname(sv,gv);
dump("GV_NAME = %s", SvPVX(sv));
if (gv != GvEGV(gv)) {
dump("}\n");
}
+
+#if !defined(I_STDARG) && !defined(I_VARARGS)
/* VARARGS1 */
static void dump(arg1,arg2,arg3,arg4,arg5)
char *arg1;
I32 i;
for (i = dumplvl*4; i; i--)
+ (void)putc(' ',Perl_debug_log);
+ fprintf(Perl_debug_log,arg1, arg2, arg3, arg4, arg5);
+}
+
+#else
+
+#ifdef I_STDARG
+static void
+dump(char *pat,...)
+#else
+/*VARARGS0*/
+static void
+dump(pat,va_alist)
+ char *pat;
+ va_dcl
+#endif
+{
+ I32 i;
+ va_list args;
+#ifndef HAS_VPRINTF
+ int vfprintf();
+#endif
+
+#ifdef I_STDARG
+ va_start(args, pat);
+#else
+ va_start(args);
+#endif
+ for (i = dumplvl*4; i; i--)
(void)putc(' ',stderr);
- fprintf(stderr,arg1, arg2, arg3, arg4, arg5);
+ vfprintf(Perl_debug_log,pat,args);
+ va_end(args);
}
#endif
+
+#endif