summaryrefslogtreecommitdiff
path: root/perly.c.diff
blob: 06a8b6ca1e41794089676ae34e106ec4054947b2 (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
*** perly.c.byacc	Tue Oct  5 15:44:31 1993
--- perly.c	Tue Oct  5 16:23:53 1993
***************
*** 1396,1408 ****
  int yynerrs;
  int yyerrflag;
  int yychar;
- short *yyssp;
- YYSTYPE *yyvsp;
  YYSTYPE yyval;
  YYSTYPE yylval;
- short yyss[YYSTACKSIZE];
- YYSTYPE yyvs[YYSTACKSIZE];
- #define yystacksize YYSTACKSIZE
  #line 573 "perly.y"
   /* PROGRAM */
  #line 1409 "y.tab.c"
--- 1396,1403 ----
***************
*** 1413,1418 ****
--- 1408,1426 ----
  yyparse()
  {
      register int yym, yyn, yystate;
+     register short *yyssp;
+     register YYSTYPE *yyvsp;
+     short* yyss;
+     YYSTYPE* yyvs;
+     unsigned yystacksize = YYSTACKSIZE;
+     int oldyydebug	= yydebug;
+     int oldyynerrs	= yynerrs;
+     int oldyyerrflag	= yyerrflag;
+     int oldyychar	= yychar;
+     YYSTYPE oldyyval	= yyval;
+     YYSTYPE oldyylval	= yylval;
+     int retval = 0;
+ 
  #if YYDEBUG
      register char *yys;
      extern char *getenv();
***************
*** 1429,1434 ****
--- 1437,1450 ----
      yyerrflag = 0;
      yychar = (-1);
  
+     /*
+     ** Initialize private stacks (yyparse may be called from an action)
+     */
+     yyss = (short*)malloc(yystacksize*sizeof(short));
+     yyvs = (YYSTYPE*)malloc(yystacksize*sizeof(YYSTYPE));
+     if (!yyvs || !yyss)
+ 	goto yyoverflow;
+ 
      yyssp = yyss;
      yyvsp = yyvs;
      *yyssp = yystate = 0;
***************
*** 1459,1465 ****
  #endif
          if (yyssp >= yyss + yystacksize - 1)
          {
!             goto yyoverflow;
          }
          *++yyssp = yystate = yytable[yyn];
          *++yyvsp = yylval;
--- 1475,1493 ----
  #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;
! 	    yyvs = (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
! 	    yyss = (short*)realloc((char*)yyss,yystacksize * sizeof(short));
! 	    if (!yyvs || !yyss)
! 		goto yyoverflow;
! 	    yyssp = yyss + yyps_index;
! 	    yyvsp = yyvs + yypv_index;
          }
          *++yyssp = yystate = yytable[yyn];
          *++yyvsp = yylval;
***************
*** 1500,1506 ****
  #endif
                  if (yyssp >= yyss + yystacksize - 1)
                  {
!                     goto yyoverflow;
                  }
                  *++yyssp = yystate = yytable[yyn];
                  *++yyvsp = yylval;
--- 1528,1548 ----
  #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;
! 		    yyvs = (YYSTYPE*)realloc((char*)yyvs,
! 			yystacksize * sizeof(YYSTYPE));
! 		    yyss = (short*)realloc((char*)yyss,
! 			yystacksize * sizeof(short));
! 		    if (!yyvs || !yyss)
! 			goto yyoverflow;
! 		    yyssp = yyss + yyps_index;
! 		    yyvsp = yyvs + yypv_index;
                  }
                  *++yyssp = yystate = yytable[yyn];
                  *++yyvsp = yylval;
***************
*** 2281,2295 ****
  #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);
  }
--- 2323,2357 ----
  #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;
! 	yyvs = (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
! 	yyss = (short*)realloc((char*)yyss,yystacksize * sizeof(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:
!     if (yyss) free(yyss);
!     if (yyvs) free(yyvs);
!     yydebug	= oldyydebug;
!     yynerrs	= oldyynerrs;
!     yyerrflag	= oldyyerrflag;
!     yychar	= oldyychar;
!     yyval	= oldyyval;
!     yylval	= oldyylval;
!     return retval;
  }