Integrate win32 into ansiperl
[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,1348 ----
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 = (struct ysv*)safemalloc(sizeof(struct ysv));
156 +     SAVEDESTRUCTOR(yydestruct, ysave);
157 +     ysave->oldyydebug = yydebug;
158 +     ysave->oldyynerrs = yynerrs;
159 +     ysave->oldyyerrflag       = yyerrflag;
160 +     ysave->oldyychar  = yychar;
161 +     ysave->oldyyval   = yyval;
162 +     ysave->oldyylval  = yylval;
163   
164 + #if YYDEBUG
165       if (yys = getenv("YYDEBUG"))
166       {
167 ***************
168 *** 1381,1384 ****
169 --- 1357,1368 ----
170       yychar = (-1);
171   
172 +     /*
173 +     ** Initialize private stacks (yyparse may be called from an action)
174 +     */
175 +     ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
176 +     ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
177 +     if (!yyvs || !yyss)
178 +       goto yyoverflow;
179
180       yyssp = yyss;
181       yyvsp = yyvs;
182 ***************
183 *** 1396,1400 ****
184               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
185               if (!yys) yys = "illegal-symbol";
186 !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
187                       yychar, yys);
188           }
189 --- 1380,1384 ----
190               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
191               if (!yys) yys = "illegal-symbol";
192 !             fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
193                       yychar, yys);
194           }
195 ***************
196 *** 1406,1415 ****
197   #if YYDEBUG
198           if (yydebug)
199 !             printf("yydebug: state %d, shifting to state %d\n",
200                       yystate, yytable[yyn]);
201   #endif
202           if (yyssp >= yyss + yystacksize - 1)
203           {
204 !             goto yyoverflow;
205           }
206           *++yyssp = yystate = yytable[yyn];
207 --- 1390,1413 ----
208   #if YYDEBUG
209           if (yydebug)
210 !             fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
211                       yystate, yytable[yyn]);
212   #endif
213           if (yyssp >= yyss + yystacksize - 1)
214           {
215 !           /*
216 !           ** reallocate and recover.  Note that pointers
217 !           ** have to be reset, or bad things will happen
218 !           */
219 !           int yyps_index = (yyssp - yyss);
220 !           int yypv_index = (yyvsp - yyvs);
221 !           yystacksize += YYSTACKSIZE;
222 !           ysave->yyvs = yyvs =
223 !               (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
224 !           ysave->yyss = yyss =
225 !               (short*)realloc((char*)yyss,yystacksize * sizeof(short));
226 !           if (!yyvs || !yyss)
227 !               goto yyoverflow;
228 !           yyssp = yyss + yyps_index;
229 !           yyvsp = yyvs + yypv_index;
230           }
231           *++yyssp = yystate = yytable[yyn];
232 ***************
233 *** 1447,1456 ****
234   #if YYDEBUG
235                   if (yydebug)
236 !                     printf("yydebug: state %d, error recovery shifting\
237 !  to state %d\n", *yyssp, yytable[yyn]);
238   #endif
239                   if (yyssp >= yyss + yystacksize - 1)
240                   {
241 !                     goto yyoverflow;
242                   }
243                   *++yyssp = yystate = yytable[yyn];
244 --- 1445,1469 ----
245   #if YYDEBUG
246                   if (yydebug)
247 !                     fprintf(stderr,
248 !                    "yydebug: state %d, error recovery shifting to state %d\n",
249 !                    *yyssp, yytable[yyn]);
250   #endif
251                   if (yyssp >= yyss + yystacksize - 1)
252                   {
253 !                   /*
254 !                   ** reallocate and recover.  Note that pointers
255 !                   ** have to be reset, or bad things will happen
256 !                   */
257 !                   int yyps_index = (yyssp - yyss);
258 !                   int yypv_index = (yyvsp - yyvs);
259 !                   yystacksize += YYSTACKSIZE;
260 !                   ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
261 !                       yystacksize * sizeof(YYSTYPE));
262 !                   ysave->yyss = yyss = (short*)realloc((char*)yyss,
263 !                       yystacksize * sizeof(short));
264 !                   if (!yyvs || !yyss)
265 !                       goto yyoverflow;
266 !                   yyssp = yyss + yyps_index;
267 !                   yyvsp = yyvs + yypv_index;
268                   }
269                   *++yyssp = yystate = yytable[yyn];
270 ***************
271 *** 1462,1467 ****
272   #if YYDEBUG
273                   if (yydebug)
274 !                     printf("yydebug: error recovery discarding state %d\n",
275 !                             *yyssp);
276   #endif
277                   if (yyssp <= yyss) goto yyabort;
278 --- 1475,1481 ----
279   #if YYDEBUG
280                   if (yydebug)
281 !                     fprintf(stderr,
282 !                       "yydebug: error recovery discarding state %d\n",
283 !                       *yyssp);
284   #endif
285                   if (yyssp <= yyss) goto yyabort;
286 ***************
287 *** 1480,1485 ****
288               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
289               if (!yys) yys = "illegal-symbol";
290 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
291 !                     yystate, yychar, yys);
292           }
293   #endif
294 --- 1494,1500 ----
295               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
296               if (!yys) yys = "illegal-symbol";
297 !             fprintf(stderr,
298 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
299 !               yystate, yychar, yys);
300           }
301   #endif
302 ***************
303 *** 1490,1494 ****
304   #if YYDEBUG
305       if (yydebug)
306 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
307                   yystate, yyn, yyrule[yyn]);
308   #endif
309 --- 1505,1509 ----
310   #if YYDEBUG
311       if (yydebug)
312 !         fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
313                   yystate, yyn, yyrule[yyn]);
314   #endif
315 ***************
316 *** 2279,2284 ****
317   #if YYDEBUG
318           if (yydebug)
319 !             printf("yydebug: after reduction, shifting from state 0 to\
320 !  state %d\n", YYFINAL);
321   #endif
322           yystate = YYFINAL;
323 --- 2294,2300 ----
324   #if YYDEBUG
325           if (yydebug)
326 !             fprintf(stderr,
327 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
328 !               YYFINAL);
329   #endif
330           yystate = YYFINAL;
331 ***************
332 *** 2294,2298 ****
333                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
334                   if (!yys) yys = "illegal-symbol";
335 !                 printf("yydebug: state %d, reading %d (%s)\n",
336                           YYFINAL, yychar, yys);
337               }
338 --- 2310,2314 ----
339                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
340                   if (!yys) yys = "illegal-symbol";
341 !                 fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
342                           YYFINAL, yychar, yys);
343               }
344 ***************
345 *** 2309,2318 ****
346   #if YYDEBUG
347       if (yydebug)
348 !         printf("yydebug: after reduction, shifting from state %d \
349 ! to state %d\n", *yyssp, yystate);
350   #endif
351       if (yyssp >= yyss + yystacksize - 1)
352       {
353 !         goto yyoverflow;
354       }
355       *++yyssp = yystate;
356 --- 2325,2349 ----
357   #if YYDEBUG
358       if (yydebug)
359 !         fprintf(stderr,
360 !           "yydebug: after reduction, shifting from state %d to state %d\n",
361 !           *yyssp, yystate);
362   #endif
363       if (yyssp >= yyss + yystacksize - 1)
364       {
365 !       /*
366 !       ** reallocate and recover.  Note that pointers
367 !       ** have to be reset, or bad things will happen
368 !       */
369 !       int yyps_index = (yyssp - yyss);
370 !       int yypv_index = (yyvsp - yyvs);
371 !       yystacksize += YYSTACKSIZE;
372 !       ysave->yyvs = yyvs =
373 !           (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
374 !       ysave->yyss = yyss =
375 !           (short*)realloc((char*)yyss,yystacksize * sizeof(short));
376 !       if (!yyvs || !yyss)
377 !           goto yyoverflow;
378 !       yyssp = yyss + yyps_index;
379 !       yyvsp = yyvs + yypv_index;
380       }
381       *++yyssp = yystate;
382 ***************
383 *** 2320,2327 ****
384       goto yyloop;
385   yyoverflow:
386 !     yyerror("yacc stack overflow");
387   yyabort:
388 !     return (1);
389   yyaccept:
390 !     return (0);
391   }
392 --- 2351,2358 ----
393       goto yyloop;
394   yyoverflow:
395 !     yyerror("Out of memory for yacc stack");
396   yyabort:
397 !     retval = 1;
398   yyaccept:
399 !     return retval;
400   }