This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(and _5x I expect) VMS config procedure patch
[perl5.git] / perly_c.diff
1 *** perly.c.orig        Thu Sep 24 00:32:28 1998
2 --- perly.c     Thu Sep 24 00:18:13 1998
3 ***************
4 *** 7,10 ****
5 --- 7,27 ----
6   #include "perl.h"
7   
8 + #define yydebug           PL_yydebug
9 + #define yynerrs           PL_yynerrs
10 + #define yyerrflag   PL_yyerrflag
11 + #define yychar            PL_yychar
12 + #define yyssp     PL_yyssp
13 + #define yyvsp     PL_yyvsp
14 + #define yyval     PL_yyval
15 + #define yylval            PL_yylval
16
17 + #ifdef PERL_OBJECT
18 + static void
19 + Dep(CPerlObj *pPerl)
20 + {
21 +     pPerl->deprecate("\"do\" to call subroutines");
22 + }
23 + #define dep() Dep(this)
24 + #else
25   static void
26   dep(void)
27 ***************
28 *** 12,86 ****
29       deprecate("\"do\" to call subroutines");
30   }
31   
32   #line 30 "perly.y"
33 - #ifndef OEMVS
34 - #line 33 "perly.y"
35 - typedef union {
36 -     I32       ival;
37 -     char *pval;
38 -     OP *opval;
39 -     GV *gvval;
40 - } YYSTYPE;
41 - #line 41 "perly.y"
42 - #endif /* OEMVS */
43 - #line 27 "y.tab.c"
44 - #define WORD 257
45 - #define METHOD 258
46 - #define FUNCMETH 259
47 - #define THING 260
48 - #define PMFUNC 261
49 - #define PRIVATEREF 262
50 - #define FUNC0SUB 263
51 - #define UNIOPSUB 264
52 - #define LSTOPSUB 265
53 - #define LABEL 266
54 - #define FORMAT 267
55 - #define SUB 268
56 - #define ANONSUB 269
57 - #define PACKAGE 270
58 - #define USE 271
59 - #define WHILE 272
60 - #define UNTIL 273
61 - #define IF 274
62 - #define UNLESS 275
63 - #define ELSE 276
64 - #define ELSIF 277
65 - #define CONTINUE 278
66 - #define FOR 279
67 - #define LOOPEX 280
68 - #define DOTDOT 281
69 - #define FUNC0 282
70 - #define FUNC1 283
71 - #define FUNC 284
72 - #define UNIOP 285
73 - #define LSTOP 286
74 - #define RELOP 287
75 - #define EQOP 288
76 - #define MULOP 289
77 - #define ADDOP 290
78 - #define DOLSHARP 291
79 - #define DO 292
80 - #define HASHBRACK 293
81 - #define NOAMP 294
82 - #define LOCAL 295
83 - #define MY 296
84 - #define OROP 297
85 - #define ANDOP 298
86 - #define NOTOP 299
87 - #define ASSIGNOP 300
88 - #define OROR 301
89 - #define ANDAND 302
90 - #define BITOROP 303
91 - #define BITANDOP 304
92 - #define SHIFTOP 305
93 - #define MATCHOP 306
94 - #define UMINUS 307
95 - #define REFGEN 308
96 - #define POWOP 309
97 - #define PREINC 310
98 - #define PREDEC 311
99 - #define POSTINC 312
100 - #define POSTDEC 313
101 - #define ARROW 314
102   #define YYERRCODE 256
103   short yylhs[] = {                                        -1,
104 --- 29,35 ----
105       deprecate("\"do\" to call subroutines");
106   }
107 + #endif
108   
109   #line 30 "perly.y"
110   #define YYERRCODE 256
111   short yylhs[] = {                                        -1,
112 ***************
113 *** 1337,1365 ****
114   #endif
115   #endif
116 - int yydebug;
117 - int yynerrs;
118 - int yyerrflag;
119 - int yychar;
120 - short *yyssp;
121 - YYSTYPE *yyvsp;
122 - YYSTYPE yyval;
123 - YYSTYPE yylval;
124 - short yyss[YYSTACKSIZE];
125 - YYSTYPE yyvs[YYSTACKSIZE];
126 - #define yystacksize YYSTACKSIZE
127   #line 643 "perly.y"
128    /* PROGRAM */
129 ! #line 1353 "y.tab.c"
130   #define YYABORT goto yyabort
131   #define YYACCEPT goto yyaccept
132   #define YYERROR goto yyerrlab
133   int
134 ! yyparse()
135   {
136       register int yym, yyn, yystate;
137   #if YYDEBUG
138       register char *yys;
139       extern char *getenv();
140   
141       if (yys = getenv("YYDEBUG"))
142       {
143 --- 1286,1350 ----
144   #endif
145   #endif
146   #line 643 "perly.y"
147    /* PROGRAM */
148 ! #line 1353 "perly.c"
149   #define YYABORT goto yyabort
150   #define YYACCEPT goto yyaccept
151   #define YYERROR goto yyerrlab
152
153 + struct ysv {
154 +     short* yyss;
155 +     YYSTYPE* yyvs;
156 +     int oldyydebug;
157 +     int oldyynerrs;
158 +     int oldyyerrflag;
159 +     int oldyychar;
160 +     YYSTYPE oldyyval;
161 +     YYSTYPE oldyylval;
162 + };
163
164 + void
165 + yydestruct(void *ptr)
166 + {
167 +     struct ysv* ysave = (struct ysv*)ptr;
168 +     if (ysave->yyss) Safefree(ysave->yyss);
169 +     if (ysave->yyvs) Safefree(ysave->yyvs);
170 +     yydebug   = ysave->oldyydebug;
171 +     yynerrs   = ysave->oldyynerrs;
172 +     yyerrflag = ysave->oldyyerrflag;
173 +     yychar    = ysave->oldyychar;
174 +     yyval     = ysave->oldyyval;
175 +     yylval    = ysave->oldyylval;
176 +     Safefree(ysave);
177 + }
178
179   int
180 ! yyparse(void)
181   {
182       register int yym, yyn, yystate;
183 +     register short *yyssp;
184 +     register YYSTYPE *yyvsp;
185 +     short* yyss;
186 +     YYSTYPE* yyvs;
187 +     unsigned yystacksize = YYSTACKSIZE;
188 +     int retval = 0;
189   #if YYDEBUG
190       register char *yys;
191 + #ifndef __cplusplus
192       extern char *getenv();
193 + #endif
194 + #endif
195
196 +     struct ysv *ysave;
197 +     New(73, ysave, 1, struct ysv);
198 +     SAVEDESTRUCTOR(yydestruct, ysave);
199 +     ysave->oldyydebug = yydebug;
200 +     ysave->oldyynerrs = yynerrs;
201 +     ysave->oldyyerrflag       = yyerrflag;
202 +     ysave->oldyychar  = yychar;
203 +     ysave->oldyyval   = yyval;
204 +     ysave->oldyylval  = yylval;
205   
206 + #if YYDEBUG
207       if (yys = getenv("YYDEBUG"))
208       {
209 ***************
210 *** 1374,1377 ****
211 --- 1359,1372 ----
212       yychar = (-1);
213   
214 +     /*
215 +     ** Initialize private stacks (yyparse may be called from an action)
216 +     */
217 +     New(73, yyss, yystacksize, short);
218 +     New(73, yyvs, yystacksize, YYSTYPE);
219 +     ysave->yyss = yyss;
220 +     ysave->yyvs = yyvs;
221 +     if (!yyvs || !yyss)
222 +       goto yyoverflow;
223
224       yyssp = yyss;
225       yyvsp = yyvs;
226 ***************
227 *** 1389,1393 ****
228               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
229               if (!yys) yys = "illegal-symbol";
230 !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
231                       yychar, yys);
232           }
233 --- 1384,1388 ----
234               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
235               if (!yys) yys = "illegal-symbol";
236 !             PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate,
237                       yychar, yys);
238           }
239 ***************
240 *** 1399,1408 ****
241   #if YYDEBUG
242           if (yydebug)
243 !             printf("yydebug: state %d, shifting to state %d\n",
244                       yystate, yytable[yyn]);
245   #endif
246           if (yyssp >= yyss + yystacksize - 1)
247           {
248 !             goto yyoverflow;
249           }
250           *++yyssp = yystate = yytable[yyn];
251 --- 1394,1417 ----
252   #if YYDEBUG
253           if (yydebug)
254 !             PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n",
255                       yystate, yytable[yyn]);
256   #endif
257           if (yyssp >= yyss + yystacksize - 1)
258           {
259 !           /*
260 !           ** reallocate and recover.  Note that pointers
261 !           ** have to be reset, or bad things will happen
262 !           */
263 !           int yyps_index = (yyssp - yyss);
264 !           int yypv_index = (yyvsp - yyvs);
265 !           yystacksize += YYSTACKSIZE;
266 !           ysave->yyvs = yyvs =
267 !               (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
268 !           ysave->yyss = yyss =
269 !               (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
270 !           if (!yyvs || !yyss)
271 !               goto yyoverflow;
272 !           yyssp = yyss + yyps_index;
273 !           yyvsp = yyvs + yypv_index;
274           }
275           *++yyssp = yystate = yytable[yyn];
276 ***************
277 *** 1440,1449 ****
278   #if YYDEBUG
279                   if (yydebug)
280 !                     printf("yydebug: state %d, error recovery shifting\
281 !  to state %d\n", *yyssp, yytable[yyn]);
282   #endif
283                   if (yyssp >= yyss + yystacksize - 1)
284                   {
285 !                     goto yyoverflow;
286                   }
287                   *++yyssp = yystate = yytable[yyn];
288 --- 1449,1473 ----
289   #if YYDEBUG
290                   if (yydebug)
291 !                     PerlIO_printf(Perl_debug_log,
292 !                    "yydebug: state %d, error recovery shifting to state %d\n",
293 !                    *yyssp, yytable[yyn]);
294   #endif
295                   if (yyssp >= yyss + yystacksize - 1)
296                   {
297 !                   /*
298 !                   ** reallocate and recover.  Note that pointers
299 !                   ** have to be reset, or bad things will happen
300 !                   */
301 !                   int yyps_index = (yyssp - yyss);
302 !                   int yypv_index = (yyvsp - yyvs);
303 !                   yystacksize += YYSTACKSIZE;
304 !                   ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs,
305 !                       yystacksize * sizeof(YYSTYPE));
306 !                   ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss,
307 !                       yystacksize * sizeof(short));
308 !                   if (!yyvs || !yyss)
309 !                       goto yyoverflow;
310 !                   yyssp = yyss + yyps_index;
311 !                   yyvsp = yyvs + yypv_index;
312                   }
313                   *++yyssp = yystate = yytable[yyn];
314 ***************
315 *** 1455,1460 ****
316   #if YYDEBUG
317                   if (yydebug)
318 !                     printf("yydebug: error recovery discarding state %d\n",
319 !                             *yyssp);
320   #endif
321                   if (yyssp <= yyss) goto yyabort;
322 --- 1479,1485 ----
323   #if YYDEBUG
324                   if (yydebug)
325 !                     PerlIO_printf(Perl_debug_log,
326 !                       "yydebug: error recovery discarding state %d\n",
327 !                       *yyssp);
328   #endif
329                   if (yyssp <= yyss) goto yyabort;
330 ***************
331 *** 1473,1478 ****
332               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
333               if (!yys) yys = "illegal-symbol";
334 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
335 !                     yystate, yychar, yys);
336           }
337   #endif
338 --- 1498,1504 ----
339               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
340               if (!yys) yys = "illegal-symbol";
341 !             PerlIO_printf(Perl_debug_log,
342 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
343 !               yystate, yychar, yys);
344           }
345   #endif
346 ***************
347 *** 1483,1487 ****
348   #if YYDEBUG
349       if (yydebug)
350 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
351                   yystate, yyn, yyrule[yyn]);
352   #endif
353 --- 1509,1513 ----
354   #if YYDEBUG
355       if (yydebug)
356 !         PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n",
357                   yystate, yyn, yyrule[yyn]);
358   #endif
359 ***************
360 *** 2267,2271 ****
361   { yyval.opval = yyvsp[0].opval; }
362   break;
363 ! #line 2270 "y.tab.c"
364       }
365       yyssp -= yym;
366 --- 2293,2297 ----
367   { yyval.opval = yyvsp[0].opval; }
368   break;
369 ! #line 2270 "perly.c"
370       }
371       yyssp -= yym;
372 ***************
373 *** 2277,2282 ****
374   #if YYDEBUG
375           if (yydebug)
376 !             printf("yydebug: after reduction, shifting from state 0 to\
377 !  state %d\n", YYFINAL);
378   #endif
379           yystate = YYFINAL;
380 --- 2303,2309 ----
381   #if YYDEBUG
382           if (yydebug)
383 !             PerlIO_printf(Perl_debug_log,
384 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
385 !               YYFINAL);
386   #endif
387           yystate = YYFINAL;
388 ***************
389 *** 2292,2296 ****
390                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
391                   if (!yys) yys = "illegal-symbol";
392 !                 printf("yydebug: state %d, reading %d (%s)\n",
393                           YYFINAL, yychar, yys);
394               }
395 --- 2319,2323 ----
396                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
397                   if (!yys) yys = "illegal-symbol";
398 !                 PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n",
399                           YYFINAL, yychar, yys);
400               }
401 ***************
402 *** 2307,2316 ****
403   #if YYDEBUG
404       if (yydebug)
405 !         printf("yydebug: after reduction, shifting from state %d \
406 ! to state %d\n", *yyssp, yystate);
407   #endif
408       if (yyssp >= yyss + yystacksize - 1)
409       {
410 !         goto yyoverflow;
411       }
412       *++yyssp = yystate;
413 --- 2334,2358 ----
414   #if YYDEBUG
415       if (yydebug)
416 !         PerlIO_printf(Perl_debug_log,
417 !           "yydebug: after reduction, shifting from state %d to state %d\n",
418 !           *yyssp, yystate);
419   #endif
420       if (yyssp >= yyss + yystacksize - 1)
421       {
422 !       /*
423 !       ** reallocate and recover.  Note that pointers
424 !       ** have to be reset, or bad things will happen
425 !       */
426 !       int yyps_index = (yyssp - yyss);
427 !       int yypv_index = (yyvsp - yyvs);
428 !       yystacksize += YYSTACKSIZE;
429 !       ysave->yyvs = yyvs =
430 !           (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
431 !       ysave->yyss = yyss =
432 !           (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
433 !       if (!yyvs || !yyss)
434 !           goto yyoverflow;
435 !       yyssp = yyss + yyps_index;
436 !       yyvsp = yyvs + yypv_index;
437       }
438       *++yyssp = yystate;
439 ***************
440 *** 2318,2325 ****
441       goto yyloop;
442   yyoverflow:
443 !     yyerror("yacc stack overflow");
444   yyabort:
445 !     return (1);
446   yyaccept:
447 !     return (0);
448   }
449 --- 2360,2367 ----
450       goto yyloop;
451   yyoverflow:
452 !     yyerror("Out of memory for yacc stack");
453   yyabort:
454 !     retval = 1;
455   yyaccept:
456 !     return retval;
457   }