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