1 /* $RCSfile: op.c,v $$Revision: 4.1 $$Date: 92/08/07 17:19:16 $
3 * Copyright (c) 1991, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
9 * Revision 4.1 92/08/07 17:19:16 lwall
12 * Revision 4.0.1.5 92/06/08 12:00:39 lwall
13 * patch20: the switch optimizer didn't do anything in subroutines
14 * patch20: removed implicit int declarations on funcions
16 * Revision 4.0.1.4 91/11/11 16:29:33 lwall
17 * patch19: do {$foo ne "bar";} returned wrong value
18 * patch19: some earlier patches weren't propagated to alternate 286 code
20 * Revision 4.0.1.3 91/11/05 16:07:43 lwall
21 * patch11: random cleanup
22 * patch11: "foo\0" eq "foo" was sometimes optimized to true
23 * patch11: foreach on null list could spring memory leak
25 * Revision 4.0.1.2 91/06/07 10:26:45 lwall
26 * patch4: new copyright notice
27 * patch4: made some allowances for "semi-standard" C
29 * Revision 4.0.1.1 91/04/11 17:36:16 lwall
30 * patch1: you may now use "die" and "caller" in a signal handler
32 * Revision 4.0 91/03/20 01:04:18 lwall
42 #if !defined(STANDARD_C) && !defined(I_VARARGS)
45 * Fallback on the old hackers way of doing varargs
50 deb(pat,a1,a2,a3,a4,a5,a6,a7,a8)
55 fprintf(stderr,"(%s:%ld)\t",
56 SvPVX(GvSV(curcop->cop_filegv)),(long)curcop->cop_line);
57 for (i=0; i<dlevel; i++)
58 fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
59 fprintf(stderr,pat,a1,a2,a3,a4,a5,a6,a7,a8);
62 #else /* !defined(STANDARD_C) && !defined(I_VARARGS) */
78 fprintf(stderr,"(%s:%ld)\t",
79 SvPVX(GvSV(curcop->cop_filegv)),(long)curcop->cop_line);
80 for (i=0; i<dlevel; i++)
81 fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
88 (void) vfprintf(stderr,pat,args);
91 #endif /* !defined(STANDARD_C) && !defined(I_VARARGS) */
97 Renew(debname, dlmax, char);
98 Renew(debdelim, dlmax, char);
104 fprintf(stderr, "%8lx %8lx %8ld %8ld %8ld\n",
105 stack, stack_base, *markstack_ptr, stack_sp-stack_base, stack_max-stack_base);
106 fprintf(stderr, "%8lx %8lx %8ld %l8d %8ld\n",
107 mainstack, AvARRAY(stack), mainstack, AvFILL(stack), AvMAX(stack));
115 I32 markoff = markstack_ptr > markstack ? *markstack_ptr : -1;
117 fprintf(stderr, " =>");
118 if (stack_base[0] || stack_sp < stack_base)
119 fprintf(stderr, " [STACK UNDERFLOW!!!]\n");
120 for (i = 1; i <= 30; i++) {
121 if (stack_sp >= &stack_base[i])
123 fprintf(stderr, "\t%-4s%s%s", SvPEEK(stack_base[i]),
124 markoff == i ? " [" : "",
125 stack_sp == &stack_base[i] ?
126 (markoff == i ? "]" : " ]") : "");
129 fprintf(stderr, "\n");