[win32] enhancements to previous patch for XSUB OUTPUT args
[p5sagit/p5-mst-13.2.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 UNIOP 285
43 ! #define LSTOP 286
44 ! #define RELOP 287
45 ! #define EQOP 288
46 ! #define MULOP 289
47 ! #define ADDOP 290
48 ! #define DOLSHARP 291
49 ! #define DO 292
50 ! #define HASHBRACK 293
51 ! #define NOAMP 294
52 ! #define LOCAL 295
53 ! #define MY 296
54 ! #define OROP 297
55 ! #define ANDOP 298
56 ! #define NOTOP 299
57 ! #define ASSIGNOP 300
58 ! #define OROR 301
59 ! #define ANDAND 302
60 ! #define BITOROP 303
61 ! #define BITANDOP 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,17 ----
75   }
76   
77 ! #line 16 "perly.c"
78   #define YYERRCODE 256
79   short yylhs[] = {                                        -1,
80 ***************
81 *** 1348,1358 ****
82   int yyerrflag;
83   int yychar;
84 - short *yyssp;
85 - YYSTYPE *yyvsp;
86   YYSTYPE yyval;
87   YYSTYPE yylval;
88 - short yyss[YYSTACKSIZE];
89 - YYSTYPE yyvs[YYSTACKSIZE];
90 - #define yystacksize YYSTACKSIZE
91   #line 632 "perly.y"
92    /* PROGRAM */
93 --- 1283,1288 ----
94 ***************
95 *** 1361,1372 ****
96   #define YYACCEPT goto yyaccept
97   #define YYERROR goto yyerrlab
98   int
99 ! yyparse()
100   {
101       register int yym, yyn, yystate;
102   #if YYDEBUG
103       register char *yys;
104       extern char *getenv();
105   
106       if (yys = getenv("YYDEBUG"))
107       {
108 --- 1291,1349 ----
109   #define YYACCEPT goto yyaccept
110   #define YYERROR goto yyerrlab
111
112 + struct ysv {
113 +     short* yyss;
114 +     YYSTYPE* yyvs;
115 +     int oldyydebug;
116 +     int oldyynerrs;
117 +     int oldyyerrflag;
118 +     int oldyychar;
119 +     YYSTYPE oldyyval;
120 +     YYSTYPE oldyylval;
121 + };
122
123 + void
124 + yydestruct(void *ptr)
125 + {
126 +     struct ysv* ysave = (struct ysv*)ptr;
127 +     if (ysave->yyss) Safefree(ysave->yyss);
128 +     if (ysave->yyvs) Safefree(ysave->yyvs);
129 +     yydebug   = ysave->oldyydebug;
130 +     yynerrs   = ysave->oldyynerrs;
131 +     yyerrflag = ysave->oldyyerrflag;
132 +     yychar    = ysave->oldyychar;
133 +     yyval     = ysave->oldyyval;
134 +     yylval    = ysave->oldyylval;
135 +     Safefree(ysave);
136 + }
137
138   int
139 ! yyparse(void)
140   {
141       register int yym, yyn, yystate;
142 +     register short *yyssp;
143 +     register YYSTYPE *yyvsp;
144 +     short* yyss;
145 +     YYSTYPE* yyvs;
146 +     unsigned yystacksize = YYSTACKSIZE;
147 +     int retval = 0;
148   #if YYDEBUG
149       register char *yys;
150 + #ifndef __cplusplus
151       extern char *getenv();
152 + #endif
153 + #endif
154
155 +     struct ysv *ysave;
156 +     New(73, ysave, 1, struct ysv);
157 +     SAVEDESTRUCTOR(yydestruct, ysave);
158 +     ysave->oldyydebug = yydebug;
159 +     ysave->oldyynerrs = yynerrs;
160 +     ysave->oldyyerrflag       = yyerrflag;
161 +     ysave->oldyychar  = yychar;
162 +     ysave->oldyyval   = yyval;
163 +     ysave->oldyylval  = yylval;
164   
165 + #if YYDEBUG
166       if (yys = getenv("YYDEBUG"))
167       {
168 ***************
169 *** 1381,1384 ****
170 --- 1357,1370 ----
171       yychar = (-1);
172   
173 +     /*
174 +     ** Initialize private stacks (yyparse may be called from an action)
175 +     */
176 +     New(73, yyss, yystacksize, short);
177 +     New(73, yyvs, yystacksize, YYSTYPE);
178 +     ysave->yyss = yyss;
179 +     ysave->yyvs = yyvs;
180 +     if (!yyvs || !yyss)
181 +       goto yyoverflow;
182
183       yyssp = yyss;
184       yyvsp = yyvs;
185 ***************
186 *** 1396,1400 ****
187               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
188               if (!yys) yys = "illegal-symbol";
189 !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
190                       yychar, yys);
191           }
192 --- 1380,1384 ----
193               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
194               if (!yys) yys = "illegal-symbol";
195 !             fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
196                       yychar, yys);
197           }
198 ***************
199 *** 1406,1415 ****
200   #if YYDEBUG
201           if (yydebug)
202 !             printf("yydebug: state %d, shifting to state %d\n",
203                       yystate, yytable[yyn]);
204   #endif
205           if (yyssp >= yyss + yystacksize - 1)
206           {
207 !             goto yyoverflow;
208           }
209           *++yyssp = yystate = yytable[yyn];
210 --- 1390,1413 ----
211   #if YYDEBUG
212           if (yydebug)
213 !             fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
214                       yystate, yytable[yyn]);
215   #endif
216           if (yyssp >= yyss + yystacksize - 1)
217           {
218 !           /*
219 !           ** reallocate and recover.  Note that pointers
220 !           ** have to be reset, or bad things will happen
221 !           */
222 !           int yyps_index = (yyssp - yyss);
223 !           int yypv_index = (yyvsp - yyvs);
224 !           yystacksize += YYSTACKSIZE;
225 !           ysave->yyvs = yyvs =
226 !               (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
227 !           ysave->yyss = yyss =
228 !               (short*)realloc((char*)yyss,yystacksize * sizeof(short));
229 !           if (!yyvs || !yyss)
230 !               goto yyoverflow;
231 !           yyssp = yyss + yyps_index;
232 !           yyvsp = yyvs + yypv_index;
233           }
234           *++yyssp = yystate = yytable[yyn];
235 ***************
236 *** 1447,1456 ****
237   #if YYDEBUG
238                   if (yydebug)
239 !                     printf("yydebug: state %d, error recovery shifting\
240 !  to state %d\n", *yyssp, yytable[yyn]);
241   #endif
242                   if (yyssp >= yyss + yystacksize - 1)
243                   {
244 !                     goto yyoverflow;
245                   }
246                   *++yyssp = yystate = yytable[yyn];
247 --- 1445,1469 ----
248   #if YYDEBUG
249                   if (yydebug)
250 !                     fprintf(stderr,
251 !                    "yydebug: state %d, error recovery shifting to state %d\n",
252 !                    *yyssp, yytable[yyn]);
253   #endif
254                   if (yyssp >= yyss + yystacksize - 1)
255                   {
256 !                   /*
257 !                   ** reallocate and recover.  Note that pointers
258 !                   ** have to be reset, or bad things will happen
259 !                   */
260 !                   int yyps_index = (yyssp - yyss);
261 !                   int yypv_index = (yyvsp - yyvs);
262 !                   yystacksize += YYSTACKSIZE;
263 !                   ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
264 !                       yystacksize * sizeof(YYSTYPE));
265 !                   ysave->yyss = yyss = (short*)realloc((char*)yyss,
266 !                       yystacksize * sizeof(short));
267 !                   if (!yyvs || !yyss)
268 !                       goto yyoverflow;
269 !                   yyssp = yyss + yyps_index;
270 !                   yyvsp = yyvs + yypv_index;
271                   }
272                   *++yyssp = yystate = yytable[yyn];
273 ***************
274 *** 1462,1467 ****
275   #if YYDEBUG
276                   if (yydebug)
277 !                     printf("yydebug: error recovery discarding state %d\n",
278 !                             *yyssp);
279   #endif
280                   if (yyssp <= yyss) goto yyabort;
281 --- 1475,1481 ----
282   #if YYDEBUG
283                   if (yydebug)
284 !                     fprintf(stderr,
285 !                       "yydebug: error recovery discarding state %d\n",
286 !                       *yyssp);
287   #endif
288                   if (yyssp <= yyss) goto yyabort;
289 ***************
290 *** 1480,1485 ****
291               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
292               if (!yys) yys = "illegal-symbol";
293 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
294 !                     yystate, yychar, yys);
295           }
296   #endif
297 --- 1494,1500 ----
298               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
299               if (!yys) yys = "illegal-symbol";
300 !             fprintf(stderr,
301 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
302 !               yystate, yychar, yys);
303           }
304   #endif
305 ***************
306 *** 1490,1494 ****
307   #if YYDEBUG
308       if (yydebug)
309 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
310                   yystate, yyn, yyrule[yyn]);
311   #endif
312 --- 1505,1509 ----
313   #if YYDEBUG
314       if (yydebug)
315 !         fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
316                   yystate, yyn, yyrule[yyn]);
317   #endif
318 ***************
319 *** 2279,2284 ****
320   #if YYDEBUG
321           if (yydebug)
322 !             printf("yydebug: after reduction, shifting from state 0 to\
323 !  state %d\n", YYFINAL);
324   #endif
325           yystate = YYFINAL;
326 --- 2294,2300 ----
327   #if YYDEBUG
328           if (yydebug)
329 !             fprintf(stderr,
330 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
331 !               YYFINAL);
332   #endif
333           yystate = YYFINAL;
334 ***************
335 *** 2294,2298 ****
336                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
337                   if (!yys) yys = "illegal-symbol";
338 !                 printf("yydebug: state %d, reading %d (%s)\n",
339                           YYFINAL, yychar, yys);
340               }
341 --- 2310,2314 ----
342                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
343                   if (!yys) yys = "illegal-symbol";
344 !                 fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
345                           YYFINAL, yychar, yys);
346               }
347 ***************
348 *** 2309,2318 ****
349   #if YYDEBUG
350       if (yydebug)
351 !         printf("yydebug: after reduction, shifting from state %d \
352 ! to state %d\n", *yyssp, yystate);
353   #endif
354       if (yyssp >= yyss + yystacksize - 1)
355       {
356 !         goto yyoverflow;
357       }
358       *++yyssp = yystate;
359 --- 2325,2349 ----
360   #if YYDEBUG
361       if (yydebug)
362 !         fprintf(stderr,
363 !           "yydebug: after reduction, shifting from state %d to state %d\n",
364 !           *yyssp, yystate);
365   #endif
366       if (yyssp >= yyss + yystacksize - 1)
367       {
368 !       /*
369 !       ** reallocate and recover.  Note that pointers
370 !       ** have to be reset, or bad things will happen
371 !       */
372 !       int yyps_index = (yyssp - yyss);
373 !       int yypv_index = (yyvsp - yyvs);
374 !       yystacksize += YYSTACKSIZE;
375 !       ysave->yyvs = yyvs =
376 !           (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
377 !       ysave->yyss = yyss =
378 !           (short*)realloc((char*)yyss,yystacksize * sizeof(short));
379 !       if (!yyvs || !yyss)
380 !           goto yyoverflow;
381 !       yyssp = yyss + yyps_index;
382 !       yyvsp = yyvs + yypv_index;
383       }
384       *++yyssp = yystate;
385 ***************
386 *** 2320,2327 ****
387       goto yyloop;
388   yyoverflow:
389 !     yyerror("yacc stack overflow");
390   yyabort:
391 !     return (1);
392   yyaccept:
393 !     return (0);
394   }
395 --- 2351,2358 ----
396       goto yyloop;
397   yyoverflow:
398 !     yyerror("Out of memory for yacc stack");
399   yyabort:
400 !     retval = 1;
401   yyaccept:
402 !     return retval;
403   }