This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate changes#6252..6256,6259..6260
[perl5.git] / perly_c.diff
1 *** y.tab.c.orig        Thu Aug 26 22:31:26 1999
2 --- y.tab.c     Thu Aug 26 22:32:22 1999
3 ***************
4 *** 1447,1456 ****
5   yyparse()
6   {
7       register int yym, yyn, yystate;
8   #if YYDEBUG
9       register char *yys;
10 !     extern char *getenv();
11   
12       if (yys = getenv("YYDEBUG"))
13       {
14           yyn = *yys;
15 --- 1447,1476 ----
16   yyparse()
17   {
18       register int yym, yyn, yystate;
19 +     register short *yyssp;
20 +     register YYSTYPE *yyvsp;
21 +     short* yyss;
22 +     YYSTYPE* yyvs;
23 +     unsigned yystacksize = YYSTACKSIZE;
24 +     int retval = 0;
25   #if YYDEBUG
26       register char *yys;
27 ! #endif
28   
29 +     struct ysv *ysave;
30 + #ifdef USE_ITHREADS
31 +     ENTER;                    /* force yydestruct() before we return */
32 + #endif
33 +     New(73, ysave, 1, struct ysv);
34 +     SAVEDESTRUCTOR_X(yydestruct, ysave);
35 +     ysave->oldyydebug = yydebug;
36 +     ysave->oldyynerrs = yynerrs;
37 +     ysave->oldyyerrflag       = yyerrflag;
38 +     ysave->oldyychar  = yychar;
39 +     ysave->oldyyval   = yyval;
40 +     ysave->oldyylval  = yylval;
41 +   
42 + #if YYDEBUG
43       if (yys = getenv("YYDEBUG"))
44       {
45           yyn = *yys;
46 ***************
47 *** 1463,1468 ****
48 --- 1483,1498 ----
49       yyerrflag = 0;
50       yychar = (-1);
51   
52 +     /*
53 +     ** Initialize private stacks (yyparse may be called from an action)
54 +     */
55 +     New(73, yyss, yystacksize, short);
56 +     New(73, yyvs, yystacksize, YYSTYPE);
57 +     ysave->yyss = yyss;
58 +     ysave->yyvs = yyvs;
59 +     if (!yyvs || !yyss)
60 +       goto yyoverflow;
61
62       yyssp = yyss;
63       yyvsp = yyvs;
64       *yyssp = yystate = 0;
65 ***************
66 *** 1493,1499 ****
67   #endif
68           if (yyssp >= yyss + yystacksize - 1)
69           {
70 !             goto yyoverflow;
71           }
72           *++yyssp = yystate = yytable[yyn];
73           *++yyvsp = yylval;
74 --- 1523,1541 ----
75   #endif
76           if (yyssp >= yyss + yystacksize - 1)
77           {
78 !           /*
79 !           ** reallocate and recover.  Note that pointers
80 !           ** have to be reset, or bad things will happen
81 !           */
82 !           int yyps_index = (yyssp - yyss);
83 !           int yypv_index = (yyvsp - yyvs);
84 !           yystacksize += YYSTACKSIZE;
85 !           ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
86 !           ysave->yyss = Renew(yyss, yystacksize, short);
87 !           if (!yyvs || !yyss)
88 !               goto yyoverflow;
89 !           yyssp = yyss + yyps_index;
90 !           yyvsp = yyvs + yypv_index;
91           }
92           *++yyssp = yystate = yytable[yyn];
93           *++yyvsp = yylval;
94 ***************
95 *** 1534,1540 ****
96   #endif
97                   if (yyssp >= yyss + yystacksize - 1)
98                   {
99 !                     goto yyoverflow;
100                   }
101                   *++yyssp = yystate = yytable[yyn];
102                   *++yyvsp = yylval;
103 --- 1576,1594 ----
104   #endif
105                   if (yyssp >= yyss + yystacksize - 1)
106                   {
107 !                   /*
108 !                   ** reallocate and recover.  Note that pointers
109 !                   ** have to be reset, or bad things will happen
110 !                   */
111 !                   int yyps_index = (yyssp - yyss);
112 !                   int yypv_index = (yyvsp - yyvs);
113 !                   yystacksize += YYSTACKSIZE;
114 !                   ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
115 !                   ysave->yyss = Renew(yyss, yystacksize, short);
116 !                   if (!yyvs || !yyss)
117 !                       goto yyoverflow;
118 !                   yyssp = yyss + yyps_index;
119 !                   yyvsp = yyvs + yypv_index;
120                   }
121                   *++yyssp = yystate = yytable[yyn];
122                   *++yyvsp = yylval;
123 ***************
124 *** 2473,2487 ****
125   #endif
126       if (yyssp >= yyss + yystacksize - 1)
127       {
128 !         goto yyoverflow;
129       }
130       *++yyssp = yystate;
131       *++yyvsp = yyval;
132       goto yyloop;
133   yyoverflow:
134 !     yyerror("yacc stack overflow");
135   yyabort:
136 !     return (1);
137   yyaccept:
138 !     return (0);
139   }
140 --- 2527,2575 ----
141   #endif
142       if (yyssp >= yyss + yystacksize - 1)
143       {
144 !       /*
145 !       ** reallocate and recover.  Note that pointers
146 !       ** have to be reset, or bad things will happen
147 !       */
148 !       int yyps_index = (yyssp - yyss);
149 !       int yypv_index = (yyvsp - yyvs);
150 !       yystacksize += YYSTACKSIZE;
151 !       ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
152 !       ysave->yyss = Renew(yyss, yystacksize, short);
153 !       if (!yyvs || !yyss)
154 !           goto yyoverflow;
155 !       yyssp = yyss + yyps_index;
156 !       yyvsp = yyvs + yypv_index;
157       }
158       *++yyssp = yystate;
159       *++yyvsp = yyval;
160       goto yyloop;
161   yyoverflow:
162 !     yyerror("Out of memory for yacc stack");
163   yyabort:
164 !     retval = 1;
165   yyaccept:
166 ! #ifdef USE_ITHREADS
167 !     LEAVE;                    /* force yydestruct() before we return */
168 ! #endif
169 !     return retval;
170 ! }
171
172 ! #ifdef PERL_OBJECT
173 ! #include "XSUB.h"
174 ! #endif
175
176 ! static void
177 ! yydestruct(pTHXo_ void *ptr)
178 ! {
179 !     struct ysv* ysave = (struct ysv*)ptr;
180 !     if (ysave->yyss) Safefree(ysave->yyss);
181 !     if (ysave->yyvs) Safefree(ysave->yyvs);
182 !     yydebug   = ysave->oldyydebug;
183 !     yynerrs   = ysave->oldyynerrs;
184 !     yyerrflag = ysave->oldyyerrflag;
185 !     yychar    = ysave->oldyychar;
186 !     yyval     = ysave->oldyyval;
187 !     yylval    = ysave->oldyylval;
188 !     Safefree(ysave);
189   }