This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Namespace cleanup: Does SDBM need binary compatibility?
[perl5.git] / perly.c.diff
1 Index: perly.c
2 ***************
3 *** 13,82 ****
4   }
5   
6 - #line 29 "perly.y"
7 - typedef union {
8 -     I32       ival;
9 -     char *pval;
10 -     OP *opval;
11 -     GV *gvval;
12 - } YYSTYPE;
13 - #line 23 "y.tab.c"
14 - #define WORD 257
15 - #define METHOD 258
16 - #define FUNCMETH 259
17 - #define THING 260
18 - #define PMFUNC 261
19 - #define PRIVATEREF 262
20 - #define FUNC0SUB 263
21 - #define UNIOPSUB 264
22 - #define LSTOPSUB 265
23 - #define LABEL 266
24 - #define FORMAT 267
25 - #define SUB 268
26 - #define ANONSUB 269
27 - #define PACKAGE 270
28 - #define USE 271
29 - #define WHILE 272
30 - #define UNTIL 273
31 - #define IF 274
32 - #define UNLESS 275
33 - #define ELSE 276
34 - #define ELSIF 277
35 - #define CONTINUE 278
36 - #define FOR 279
37 - #define LOOPEX 280
38 - #define DOTDOT 281
39 - #define FUNC0 282
40 - #define FUNC1 283
41 - #define FUNC 284
42 - #define RELOP 285
43 - #define EQOP 286
44 - #define MULOP 287
45 - #define ADDOP 288
46 - #define DOLSHARP 289
47 - #define DO 290
48 - #define HASHBRACK 291
49 - #define NOAMP 292
50 - #define LOCAL 293
51 - #define MY 294
52 - #define OROP 295
53 - #define ANDOP 296
54 - #define NOTOP 297
55 - #define LSTOP 298
56 - #define ASSIGNOP 299
57 - #define OROR 300
58 - #define ANDAND 301
59 - #define BITOROP 302
60 - #define BITANDOP 303
61 - #define UNIOP 304
62 - #define SHIFTOP 305
63 - #define MATCHOP 306
64 - #define UMINUS 307
65 - #define REFGEN 308
66 - #define POWOP 309
67 - #define PREINC 310
68 - #define PREDEC 311
69 - #define POSTINC 312
70 - #define POSTDEC 313
71 - #define ARROW 314
72   #define YYERRCODE 256
73   short yylhs[] = {                                        -1,
74 --- 13,16 ----
75 ***************
76 *** 1357,1367 ****
77   int yyerrflag;
78   int yychar;
79 - short *yyssp;
80 - YYSTYPE *yyvsp;
81   YYSTYPE yyval;
82   YYSTYPE yylval;
83 - short yyss[YYSTACKSIZE];
84 - YYSTYPE yyvs[YYSTACKSIZE];
85 - #define yystacksize YYSTACKSIZE
86   #line 616 "perly.y"
87    /* PROGRAM */
88 --- 1291,1296 ----
89 ***************
90 *** 1370,1381 ****
91 --- 1299,1355 ----
92   #define YYACCEPT goto yyaccept
93   #define YYERROR goto yyerrlab
94
95 + struct ysv {
96 +     short* yyss;
97 +     YYSTYPE* yyvs;
98 +     int oldyydebug;
99 +     int oldyynerrs;
100 +     int oldyyerrflag;
101 +     int oldyychar;
102 +     YYSTYPE oldyyval;
103 +     YYSTYPE oldyylval;
104 + };
105
106 + void
107 + yydestruct(ptr)
108 + void* ptr;
109 + {
110 +     struct ysv* ysave = (struct ysv*)ptr;
111 +     if (ysave->yyss) Safefree(ysave->yyss);
112 +     if (ysave->yyvs) Safefree(ysave->yyvs);
113 +     yydebug   = ysave->oldyydebug;
114 +     yynerrs   = ysave->oldyynerrs;
115 +     yyerrflag = ysave->oldyyerrflag;
116 +     yychar    = ysave->oldyychar;
117 +     yyval     = ysave->oldyyval;
118 +     yylval    = ysave->oldyylval;
119 +     Safefree(ysave);
120 + }
121
122   int
123   yyparse()
124   {
125       register int yym, yyn, yystate;
126 +     register short *yyssp;
127 +     register YYSTYPE *yyvsp;
128 +     short* yyss;
129 +     YYSTYPE* yyvs;
130 +     unsigned yystacksize = YYSTACKSIZE;
131 +     int retval = 0;
132   #if YYDEBUG
133       register char *yys;
134       extern char *getenv();
135 + #endif
136
137 +     struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
138 +     SAVEDESTRUCTOR(yydestruct, ysave);
139 +     ysave->oldyydebug = yydebug;
140 +     ysave->oldyynerrs = yynerrs;
141 +     ysave->oldyyerrflag       = yyerrflag;
142 +     ysave->oldyychar  = yychar;
143 +     ysave->oldyyval   = yyval;
144 +     ysave->oldyylval  = yylval;
145   
146 + #if YYDEBUG
147       if (yys = getenv("YYDEBUG"))
148       {
149 ***************
150 *** 1390,1393 ****
151 --- 1364,1375 ----
152       yychar = (-1);
153   
154 +     /*
155 +     ** Initialize private stacks (yyparse may be called from an action)
156 +     */
157 +     ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
158 +     ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
159 +     if (!yyvs || !yyss)
160 +       goto yyoverflow;
161
162       yyssp = yyss;
163       yyvsp = yyvs;
164 ***************
165 *** 1405,1409 ****
166               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
167               if (!yys) yys = "illegal-symbol";
168 !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
169                       yychar, yys);
170           }
171 --- 1387,1391 ----
172               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
173               if (!yys) yys = "illegal-symbol";
174 !             fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
175                       yychar, yys);
176           }
177 ***************
178 *** 1415,1424 ****
179   #if YYDEBUG
180           if (yydebug)
181 !             printf("yydebug: state %d, shifting to state %d\n",
182                       yystate, yytable[yyn]);
183   #endif
184           if (yyssp >= yyss + yystacksize - 1)
185           {
186 !             goto yyoverflow;
187           }
188           *++yyssp = yystate = yytable[yyn];
189 --- 1397,1420 ----
190   #if YYDEBUG
191           if (yydebug)
192 !             fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
193                       yystate, yytable[yyn]);
194   #endif
195           if (yyssp >= yyss + yystacksize - 1)
196           {
197 !           /*
198 !           ** reallocate and recover.  Note that pointers
199 !           ** have to be reset, or bad things will happen
200 !           */
201 !           int yyps_index = (yyssp - yyss);
202 !           int yypv_index = (yyvsp - yyvs);
203 !           yystacksize += YYSTACKSIZE;
204 !           ysave->yyvs = yyvs =
205 !               (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
206 !           ysave->yyss = yyss =
207 !               (short*)realloc((char*)yyss,yystacksize * sizeof(short));
208 !           if (!yyvs || !yyss)
209 !               goto yyoverflow;
210 !           yyssp = yyss + yyps_index;
211 !           yyvsp = yyvs + yypv_index;
212           }
213           *++yyssp = yystate = yytable[yyn];
214 ***************
215 *** 1456,1465 ****
216   #if YYDEBUG
217                   if (yydebug)
218 !                     printf("yydebug: state %d, error recovery shifting\
219 !  to state %d\n", *yyssp, yytable[yyn]);
220   #endif
221                   if (yyssp >= yyss + yystacksize - 1)
222                   {
223 !                     goto yyoverflow;
224                   }
225                   *++yyssp = yystate = yytable[yyn];
226 --- 1452,1476 ----
227   #if YYDEBUG
228                   if (yydebug)
229 !                     fprintf(stderr,
230 !                    "yydebug: state %d, error recovery shifting to state %d\n",
231 !                    *yyssp, yytable[yyn]);
232   #endif
233                   if (yyssp >= yyss + yystacksize - 1)
234                   {
235 !                   /*
236 !                   ** reallocate and recover.  Note that pointers
237 !                   ** have to be reset, or bad things will happen
238 !                   */
239 !                   int yyps_index = (yyssp - yyss);
240 !                   int yypv_index = (yyvsp - yyvs);
241 !                   yystacksize += YYSTACKSIZE;
242 !                   ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
243 !                       yystacksize * sizeof(YYSTYPE));
244 !                   ysave->yyss = yyss = (short*)realloc((char*)yyss,
245 !                       yystacksize * sizeof(short));
246 !                   if (!yyvs || !yyss)
247 !                       goto yyoverflow;
248 !                   yyssp = yyss + yyps_index;
249 !                   yyvsp = yyvs + yypv_index;
250                   }
251                   *++yyssp = yystate = yytable[yyn];
252 ***************
253 *** 1471,1476 ****
254   #if YYDEBUG
255                   if (yydebug)
256 !                     printf("yydebug: error recovery discarding state %d\n",
257 !                             *yyssp);
258   #endif
259                   if (yyssp <= yyss) goto yyabort;
260 --- 1482,1488 ----
261   #if YYDEBUG
262                   if (yydebug)
263 !                     fprintf(stderr,
264 !                       "yydebug: error recovery discarding state %d\n",
265 !                       *yyssp);
266   #endif
267                   if (yyssp <= yyss) goto yyabort;
268 ***************
269 *** 1489,1494 ****
270               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
271               if (!yys) yys = "illegal-symbol";
272 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
273 !                     yystate, yychar, yys);
274           }
275   #endif
276 --- 1501,1507 ----
277               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
278               if (!yys) yys = "illegal-symbol";
279 !             fprintf(stderr,
280 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
281 !               yystate, yychar, yys);
282           }
283   #endif
284 ***************
285 *** 1499,1503 ****
286   #if YYDEBUG
287       if (yydebug)
288 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
289                   yystate, yyn, yyrule[yyn]);
290   #endif
291 --- 1512,1516 ----
292   #if YYDEBUG
293       if (yydebug)
294 !         fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
295                   yystate, yyn, yyrule[yyn]);
296   #endif
297 ***************
298 *** 2268,2273 ****
299   #if YYDEBUG
300           if (yydebug)
301 !             printf("yydebug: after reduction, shifting from state 0 to\
302 !  state %d\n", YYFINAL);
303   #endif
304           yystate = YYFINAL;
305 --- 2281,2287 ----
306   #if YYDEBUG
307           if (yydebug)
308 !             fprintf(stderr,
309 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
310 !               YYFINAL);
311   #endif
312           yystate = YYFINAL;
313 ***************
314 *** 2283,2287 ****
315                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
316                   if (!yys) yys = "illegal-symbol";
317 !                 printf("yydebug: state %d, reading %d (%s)\n",
318                           YYFINAL, yychar, yys);
319               }
320 --- 2297,2301 ----
321                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
322                   if (!yys) yys = "illegal-symbol";
323 !                 fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
324                           YYFINAL, yychar, yys);
325               }
326 ***************
327 *** 2298,2307 ****
328   #if YYDEBUG
329       if (yydebug)
330 !         printf("yydebug: after reduction, shifting from state %d \
331 ! to state %d\n", *yyssp, yystate);
332   #endif
333       if (yyssp >= yyss + yystacksize - 1)
334       {
335 !         goto yyoverflow;
336       }
337       *++yyssp = yystate;
338 --- 2312,2336 ----
339   #if YYDEBUG
340       if (yydebug)
341 !         fprintf(stderr,
342 !           "yydebug: after reduction, shifting from state %d to state %d\n",
343 !           *yyssp, yystate);
344   #endif
345       if (yyssp >= yyss + yystacksize - 1)
346       {
347 !       /*
348 !       ** reallocate and recover.  Note that pointers
349 !       ** have to be reset, or bad things will happen
350 !       */
351 !       int yyps_index = (yyssp - yyss);
352 !       int yypv_index = (yyvsp - yyvs);
353 !       yystacksize += YYSTACKSIZE;
354 !       ysave->yyvs = yyvs =
355 !           (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
356 !       ysave->yyss = yyss =
357 !           (short*)realloc((char*)yyss,yystacksize * sizeof(short));
358 !       if (!yyvs || !yyss)
359 !           goto yyoverflow;
360 !       yyssp = yyss + yyps_index;
361 !       yyvsp = yyvs + yypv_index;
362       }
363       *++yyssp = yystate;
364 ***************
365 *** 2309,2316 ****
366       goto yyloop;
367   yyoverflow:
368 !     yyerror("yacc stack overflow");
369   yyabort:
370 !     return (1);
371   yyaccept:
372 !     return (0);
373   }
374 --- 2338,2345 ----
375       goto yyloop;
376   yyoverflow:
377 !     yyerror("Out of memory for yacc stack");
378   yyabort:
379 !     retval = 1;
380   yyaccept:
381 !     return retval;
382   }