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