This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix broken -DDEBUGGING_OPS (from Spider Boardman
[perl5.git] / perly_c.diff
1 *** perly.c.orig        Mon Jul 26 03:27:57 1999
2 --- perly.c     Mon Jul 26 02:47:03 1999
3 ***************
4 *** 8,91 ****
5   #include "perl.h"
6   
7   #define dep() deprecate("\"do\" to call subroutines")
8   
9 ! #line 27 "perly.y"
10 ! /* I sense a Big Blue pattern here... */
11 ! #if !defined(OEMVS) && !defined(__OPEN_VM) && !defined(POSIX_BC)
12 ! #line 31 "perly.y"
13 ! typedef union {
14 !     I32       ival;
15 !     char *pval;
16 !     OP *opval;
17 !     GV *gvval;
18 ! } YYSTYPE;
19 ! #line 39 "perly.y"
20 ! #endif /* !OEMVS && !__OPEN_VM && !POSIX_BC */
21   
22 ! #ifdef USE_PURE_BISON
23 ! #define YYLEX_PARAM (&yychar)
24 ! #endif
25 ! #line 29 "y.tab.c"
26 ! #define WORD 257
27 ! #define METHOD 258
28 ! #define FUNCMETH 259
29 ! #define THING 260
30 ! #define PMFUNC 261
31 ! #define PRIVATEREF 262
32 ! #define FUNC0SUB 263
33 ! #define UNIOPSUB 264
34 ! #define LSTOPSUB 265
35 ! #define LABEL 266
36 ! #define FORMAT 267
37 ! #define SUB 268
38 ! #define ANONSUB 269
39 ! #define PACKAGE 270
40 ! #define USE 271
41 ! #define WHILE 272
42 ! #define UNTIL 273
43 ! #define IF 274
44 ! #define UNLESS 275
45 ! #define ELSE 276
46 ! #define ELSIF 277
47 ! #define CONTINUE 278
48 ! #define FOR 279
49 ! #define LOOPEX 280
50 ! #define DOTDOT 281
51 ! #define FUNC0 282
52 ! #define FUNC1 283
53 ! #define FUNC 284
54 ! #define UNIOP 285
55 ! #define LSTOP 286
56 ! #define RELOP 287
57 ! #define EQOP 288
58 ! #define MULOP 289
59 ! #define ADDOP 290
60 ! #define DOLSHARP 291
61 ! #define DO 292
62 ! #define HASHBRACK 293
63 ! #define NOAMP 294
64 ! #define LOCAL 295
65 ! #define MY 296
66 ! #define PREC_LOW 297
67 ! #define OROP 298
68 ! #define ANDOP 299
69 ! #define NOTOP 300
70 ! #define ASSIGNOP 301
71 ! #define OROR 302
72 ! #define ANDAND 303
73 ! #define BITOROP 304
74 ! #define BITANDOP 305
75 ! #define SHIFTOP 306
76 ! #define MATCHOP 307
77 ! #define UMINUS 308
78 ! #define REFGEN 309
79 ! #define POWOP 310
80 ! #define PREINC 311
81 ! #define PREDEC 312
82 ! #define POSTINC 313
83 ! #define POSTDEC 314
84 ! #define ARROW 315
85   #define YYERRCODE 256
86 ! short yylhs[] = {                                        -1,
87      46,    0,    9,    7,   10,    8,   11,   11,   11,   12,
88      12,   12,   12,   25,   25,   25,   25,   25,   25,   25,
89 --- 8,25 ----
90   #include "perl.h"
91   
92 + #define yydebug           PL_yydebug
93 + #define yynerrs           PL_yynerrs
94 + #define yyerrflag   PL_yyerrflag
95 + #define yychar            PL_yychar
96 + #define yyval     PL_yyval
97 + #define yylval            PL_yylval
98
99   #define dep() deprecate("\"do\" to call subroutines")
100   
101 ! static void yydestruct(pTHXo_ void *ptr);
102   
103 ! #line 27 "perly.y"
104   #define YYERRCODE 256
105 ! static short yylhs[] = {                                 -1,
106      46,    0,    9,    7,   10,    8,   11,   11,   11,   12,
107      12,   12,   12,   25,   25,   25,   25,   25,   25,   25,
108 ***************
109 *** 107,111 ****
110      24,   19,   20,   21,   22,   23,   36,   36,   36,   36,
111   };
112 ! short yylen[] = {                                         2,
113       0,    2,    4,    0,    4,    0,    0,    2,    2,    2,
114       1,    2,    3,    1,    1,    3,    3,    3,    3,    3,
115 --- 41,45 ----
116      24,   19,   20,   21,   22,   23,   36,   36,   36,   36,
117   };
118 ! static short yylen[] = {                                  2,
119       0,    2,    4,    0,    4,    0,    0,    2,    2,    2,
120       1,    2,    3,    1,    1,    3,    3,    3,    3,    3,
121 ***************
122 *** 127,131 ****
123       2,    2,    2,    2,    2,    2,    1,    1,    1,    1,
124   };
125 ! short yydefred[] = {                                      1,
126       0,    7,    0,   45,   56,   54,    0,   54,    8,   46,
127       9,   11,    0,   47,   48,   49,    0,    0,    0,   63,
128 --- 61,65 ----
129       2,    2,    2,    2,    2,    2,    1,    1,    1,    1,
130   };
131 ! static short yydefred[] = {                               1,
132       0,    7,    0,   45,   56,   54,    0,   54,    8,   46,
133       9,   11,    0,   47,   48,   49,    0,    0,    0,   63,
134 ***************
135 *** 166,170 ****
136       5,    0,   30,    0,    0,   33,    0,   23,
137   };
138 ! short yydgoto[] = {                                       1,
139       9,   66,   10,   18,   96,   17,   87,  344,   90,  333,
140       3,   11,   12,   68,  349,  267,   70,   71,   72,   73,
141 --- 100,104 ----
142       5,    0,   30,    0,    0,   33,    0,   23,
143   };
144 ! static short yydgoto[] = {                                1,
145       9,   66,   10,   18,   96,   17,   87,  344,   90,  333,
146       3,   11,   12,   68,  349,  267,   70,   71,   72,   73,
147 ***************
148 *** 174,178 ****
149     260,
150   };
151 ! short yysindex[] = {                                      0,
152       0,    0,  142,    0,    0,    0,  -57,    0,    0,    0,
153       0,    0,  622,    0,    0,    0, -239, -229,  -10,    0,
154 --- 108,112 ----
155     260,
156   };
157 ! static short yysindex[] = {                               0,
158       0,    0,  142,    0,    0,    0,  -57,    0,    0,    0,
159       0,    0,  622,    0,    0,    0, -239, -229,  -10,    0,
160 ***************
161 *** 213,217 ****
162       0,  228,    0,   92,   92,    0, -204,    0,
163   };
164 ! short yyrindex[] = {                                      0,
165       0,    0,  225,    0,    0,    0,    0,    0,    0,    0,
166       0,    0,    0,    0,    0,    0,  155,    0,    0,    0,
167 --- 147,151 ----
168       0,  228,    0,   92,   92,    0, -204,    0,
169   };
170 ! static short yyrindex[] = {                               0,
171       0,    0,  225,    0,    0,    0,    0,    0,    0,    0,
172       0,    0,    0,    0,    0,    0,  155,    0,    0,    0,
173 ***************
174 *** 252,256 ****
175       0,    0,    0,    0,    0,    0,  168,    0,
176   };
177 ! short yygindex[] = {                                      0,
178       0,    0,    0,  339,  320,    0,  -11,    0,  913,  360,
179     -78,    0,    0,    0, -320,  -13, 4321,    0, 1367,    0,
180 --- 186,190 ----
181       0,    0,    0,    0,    0,    0,  168,    0,
182   };
183 ! static short yygindex[] = {                               0,
184       0,    0,    0,  339,  320,    0,  -11,    0,  913,  360,
185     -78,    0,    0,    0, -320,  -13, 4321,    0, 1367,    0,
186 ***************
187 *** 261,265 ****
188   };
189   #define YYTABLESIZE 4610
190 ! short yytable[] = {                                      69,
191     206,   20,  295,   62,  113,  257,  184,  103,  183,  298,
192     172,   62,  125,  104,  252,  350,  104,   81,  209,  169,
193 --- 195,199 ----
194   };
195   #define YYTABLESIZE 4610
196 ! static short yytable[] = {                               69,
197     206,   20,  295,   62,  113,  257,  184,  103,  183,  298,
198     172,   62,  125,  104,  252,  350,  104,   81,  209,  169,
199 ***************
200 *** 724,728 ****
201       0,    0,    0,    0,    0,    0,    0,    0,    0,  321,
202   };
203 ! short yycheck[] = {                                      13,
204      59,   59,   59,   36,   43,  185,   92,   40,   87,   59,
205      91,   36,   51,   41,   59,  336,   44,  257,   41,   40,
206 --- 658,662 ----
207       0,    0,    0,    0,    0,    0,    0,    0,    0,  321,
208   };
209 ! static short yycheck[] = {                               13,
210      59,   59,   59,   36,   43,  185,   92,   40,   87,   59,
211      91,   36,   51,   41,   59,  336,   44,  257,   41,   40,
212 ***************
213 *** 1193,1197 ****
214   #define YYMAXTOKEN 315
215   #if YYDEBUG
216 ! char *yyname[] = {
217   "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
218   "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
219 --- 1127,1131 ----
220   #define YYMAXTOKEN 315
221   #if YYDEBUG
222 ! static char *yyname[] = {
223   "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
224   "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
225 ***************
226 *** 1210,1214 ****
227   "POSTINC","POSTDEC","ARROW",
228   };
229 ! char *yyrule[] = {
230   "$accept : prog",
231   "$$1 :",
232 --- 1144,1148 ----
233   "POSTINC","POSTDEC","ARROW",
234   };
235 ! static char *yyrule[] = {
236   "$accept : prog",
237   "$$1 :",
238 ***************
239 *** 1408,1436 ****
240   #endif
241   #endif
242 - int yydebug;
243 - int yynerrs;
244 - int yyerrflag;
245 - int yychar;
246 - short *yyssp;
247 - YYSTYPE *yyvsp;
248 - YYSTYPE yyval;
249 - YYSTYPE yylval;
250 - short yyss[YYSTACKSIZE];
251 - YYSTYPE yyvs[YYSTACKSIZE];
252 - #define yystacksize YYSTACKSIZE
253   #line 666 "perly.y"
254    /* PROGRAM */
255 ! #line 1424 "y.tab.c"
256   #define YYABORT goto yyabort
257   #define YYACCEPT goto yyaccept
258   #define YYERROR goto yyerrlab
259   int
260 ! yyparse()
261   {
262       register int yym, yyn, yystate;
263   #if YYDEBUG
264       register char *yys;
265       extern char *getenv();
266   
267       if (yys = getenv("YYDEBUG"))
268       {
269 --- 1342,1391 ----
270   #endif
271   #endif
272   #line 666 "perly.y"
273    /* PROGRAM */
274 ! #line 1427 "perly.c"
275   #define YYABORT goto yyabort
276   #define YYACCEPT goto yyaccept
277   #define YYERROR goto yyerrlab
278
279 + struct ysv {
280 +     short* yyss;
281 +     YYSTYPE* yyvs;
282 +     int oldyydebug;
283 +     int oldyynerrs;
284 +     int oldyyerrflag;
285 +     int oldyychar;
286 +     YYSTYPE oldyyval;
287 +     YYSTYPE oldyylval;
288 + };
289
290   int
291 ! Perl_yyparse(pTHX)
292   {
293       register int yym, yyn, yystate;
294 +     register short *yyssp;
295 +     register YYSTYPE *yyvsp;
296 +     short* yyss;
297 +     YYSTYPE* yyvs;
298 +     unsigned yystacksize = YYSTACKSIZE;
299 +     int retval = 0;
300   #if YYDEBUG
301       register char *yys;
302 + #ifndef __cplusplus
303       extern char *getenv();
304 + #endif
305 + #endif
306
307 +     struct ysv *ysave;
308 +     New(73, ysave, 1, struct ysv);
309 +     SAVEDESTRUCTOR(yydestruct, ysave);
310 +     ysave->oldyydebug = yydebug;
311 +     ysave->oldyynerrs = yynerrs;
312 +     ysave->oldyyerrflag       = yyerrflag;
313 +     ysave->oldyychar  = yychar;
314 +     ysave->oldyyval   = yyval;
315 +     ysave->oldyylval  = yylval;
316   
317 + #if YYDEBUG
318       if (yys = getenv("YYDEBUG"))
319       {
320 ***************
321 *** 1445,1448 ****
322 --- 1400,1413 ----
323       yychar = (-1);
324   
325 +     /*
326 +     ** Initialize private stacks (yyparse may be called from an action)
327 +     */
328 +     New(73, yyss, yystacksize, short);
329 +     New(73, yyvs, yystacksize, YYSTYPE);
330 +     ysave->yyss = yyss;
331 +     ysave->yyvs = yyvs;
332 +     if (!yyvs || !yyss)
333 +       goto yyoverflow;
334
335       yyssp = yyss;
336       yyvsp = yyvs;
337 ***************
338 *** 1470,1479 ****
339   #if YYDEBUG
340           if (yydebug)
341 !             printf("yydebug: state %d, shifting to state %d\n",
342                       yystate, yytable[yyn]);
343   #endif
344           if (yyssp >= yyss + yystacksize - 1)
345           {
346 !             goto yyoverflow;
347           }
348           *++yyssp = yystate = yytable[yyn];
349 --- 1435,1458 ----
350   #if YYDEBUG
351           if (yydebug)
352 !             PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n",
353                       yystate, yytable[yyn]);
354   #endif
355           if (yyssp >= yyss + yystacksize - 1)
356           {
357 !           /*
358 !           ** reallocate and recover.  Note that pointers
359 !           ** have to be reset, or bad things will happen
360 !           */
361 !           int yyps_index = (yyssp - yyss);
362 !           int yypv_index = (yyvsp - yyvs);
363 !           yystacksize += YYSTACKSIZE;
364 !           ysave->yyvs = yyvs =
365 !               (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
366 !           ysave->yyss = yyss =
367 !               (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
368 !           if (!yyvs || !yyss)
369 !               goto yyoverflow;
370 !           yyssp = yyss + yyps_index;
371 !           yyvsp = yyvs + yypv_index;
372           }
373           *++yyssp = yystate = yytable[yyn];
374 ***************
375 *** 1511,1520 ****
376   #if YYDEBUG
377                   if (yydebug)
378 !                     printf("yydebug: state %d, error recovery shifting\
379 !  to state %d\n", *yyssp, yytable[yyn]);
380   #endif
381                   if (yyssp >= yyss + yystacksize - 1)
382                   {
383 !                     goto yyoverflow;
384                   }
385                   *++yyssp = yystate = yytable[yyn];
386 --- 1490,1514 ----
387   #if YYDEBUG
388                   if (yydebug)
389 !                     PerlIO_printf(Perl_debug_log,
390 !                    "yydebug: state %d, error recovery shifting to state %d\n",
391 !                    *yyssp, yytable[yyn]);
392   #endif
393                   if (yyssp >= yyss + yystacksize - 1)
394                   {
395 !                   /*
396 !                   ** reallocate and recover.  Note that pointers
397 !                   ** have to be reset, or bad things will happen
398 !                   */
399 !                   int yyps_index = (yyssp - yyss);
400 !                   int yypv_index = (yyvsp - yyvs);
401 !                   yystacksize += YYSTACKSIZE;
402 !                   ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs,
403 !                       yystacksize * sizeof(YYSTYPE));
404 !                   ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss,
405 !                       yystacksize * sizeof(short));
406 !                   if (!yyvs || !yyss)
407 !                       goto yyoverflow;
408 !                   yyssp = yyss + yyps_index;
409 !                   yyvsp = yyvs + yypv_index;
410                   }
411                   *++yyssp = yystate = yytable[yyn];
412 ***************
413 *** 1526,1531 ****
414   #if YYDEBUG
415                   if (yydebug)
416 !                     printf("yydebug: error recovery discarding state %d\n",
417 !                             *yyssp);
418   #endif
419                   if (yyssp <= yyss) goto yyabort;
420 --- 1520,1526 ----
421   #if YYDEBUG
422                   if (yydebug)
423 !                     PerlIO_printf(Perl_debug_log,
424 !                       "yydebug: error recovery discarding state %d\n",
425 !                       *yyssp);
426   #endif
427                   if (yyssp <= yyss) goto yyabort;
428 ***************
429 *** 1544,1549 ****
430               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
431               if (!yys) yys = "illegal-symbol";
432 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
433 !                     yystate, yychar, yys);
434           }
435   #endif
436 --- 1539,1545 ----
437               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
438               if (!yys) yys = "illegal-symbol";
439 !             PerlIO_printf(Perl_debug_log,
440 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
441 !               yystate, yychar, yys);
442           }
443   #endif
444 ***************
445 *** 1554,1558 ****
446   #if YYDEBUG
447       if (yydebug)
448 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
449                   yystate, yyn, yyrule[yyn]);
450   #endif
451 --- 1550,1554 ----
452   #if YYDEBUG
453       if (yydebug)
454 !         PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n",
455                   yystate, yyn, yyrule[yyn]);
456   #endif
457 ***************
458 *** 2358,2362 ****
459   { yyval.opval = yyvsp[0].opval; }
460   break;
461 ! #line 2361 "y.tab.c"
462       }
463       yyssp -= yym;
464 --- 2354,2358 ----
465   { yyval.opval = yyvsp[0].opval; }
466   break;
467 ! #line 2365 "perly.c"
468       }
469       yyssp -= yym;
470 ***************
471 *** 2368,2373 ****
472   #if YYDEBUG
473           if (yydebug)
474 !             printf("yydebug: after reduction, shifting from state 0 to\
475 !  state %d\n", YYFINAL);
476   #endif
477           yystate = YYFINAL;
478 --- 2364,2370 ----
479   #if YYDEBUG
480           if (yydebug)
481 !             PerlIO_printf(Perl_debug_log,
482 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
483 !               YYFINAL);
484   #endif
485           yystate = YYFINAL;
486 ***************
487 *** 2383,2387 ****
488                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
489                   if (!yys) yys = "illegal-symbol";
490 !                 printf("yydebug: state %d, reading %d (%s)\n",
491                           YYFINAL, yychar, yys);
492               }
493 --- 2380,2384 ----
494                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
495                   if (!yys) yys = "illegal-symbol";
496 !                 PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n",
497                           YYFINAL, yychar, yys);
498               }
499 ***************
500 *** 2398,2407 ****
501   #if YYDEBUG
502       if (yydebug)
503 !         printf("yydebug: after reduction, shifting from state %d \
504 ! to state %d\n", *yyssp, yystate);
505   #endif
506       if (yyssp >= yyss + yystacksize - 1)
507       {
508 !         goto yyoverflow;
509       }
510       *++yyssp = yystate;
511 --- 2395,2419 ----
512   #if YYDEBUG
513       if (yydebug)
514 !         PerlIO_printf(Perl_debug_log,
515 !           "yydebug: after reduction, shifting from state %d to state %d\n",
516 !           *yyssp, yystate);
517   #endif
518       if (yyssp >= yyss + yystacksize - 1)
519       {
520 !       /*
521 !       ** reallocate and recover.  Note that pointers
522 !       ** have to be reset, or bad things will happen
523 !       */
524 !       int yyps_index = (yyssp - yyss);
525 !       int yypv_index = (yyvsp - yyvs);
526 !       yystacksize += YYSTACKSIZE;
527 !       ysave->yyvs = yyvs =
528 !           (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
529 !       ysave->yyss = yyss =
530 !           (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
531 !       if (!yyvs || !yyss)
532 !           goto yyoverflow;
533 !       yyssp = yyss + yyps_index;
534 !       yyvsp = yyvs + yypv_index;
535       }
536       *++yyssp = yystate;
537 ***************
538 *** 2409,2416 ****
539       goto yyloop;
540   yyoverflow:
541 !     yyerror("yacc stack overflow");
542   yyabort:
543 !     return (1);
544   yyaccept:
545 !     return (0);
546   }
547 --- 2421,2448 ----
548       goto yyloop;
549   yyoverflow:
550 !     yyerror("Out of memory for yacc stack");
551   yyabort:
552 !     retval = 1;
553   yyaccept:
554 !     return retval;
555 ! }
556
557 ! #ifdef PERL_OBJECT
558 ! #define NO_XSLOCKS
559 ! #include "XSUB.h"
560 ! #endif
561
562 ! static void
563 ! yydestruct(pTHXo_ void *ptr)
564 ! {
565 !     struct ysv* ysave = (struct ysv*)ptr;
566 !     if (ysave->yyss) Safefree(ysave->yyss);
567 !     if (ysave->yyvs) Safefree(ysave->yyvs);
568 !     yydebug   = ysave->oldyydebug;
569 !     yynerrs   = ysave->oldyynerrs;
570 !     yyerrflag = ysave->oldyyerrflag;
571 !     yychar    = ysave->oldyychar;
572 !     yyval     = ysave->oldyyval;
573 !     yylval    = ysave->oldyylval;
574 !     Safefree(ysave);
575   }