freebsd-dev/contrib/perl5/perly_c.diff

184 lines
4.6 KiB
Diff
Raw Normal View History

2000-06-25 11:04:01 +00:00
*** y.tab.c.orig Thu Aug 26 22:31:26 1999
--- y.tab.c Thu Aug 26 22:32:22 1999
***************
2000-06-25 11:04:01 +00:00
*** 1447,1456 ****
yyparse()
{
register int yym, yyn, yystate;
#if YYDEBUG
register char *yys;
2000-06-25 11:04:01 +00:00
! extern char *getenv();
if (yys = getenv("YYDEBUG"))
{
2000-06-25 11:04:01 +00:00
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;
2000-06-25 11:04:01 +00:00
! #endif
+ struct ysv *ysave;
+ New(73, ysave, 1, struct ysv);
2000-06-25 11:04:01 +00:00
+ SAVEDESTRUCTOR_X(yydestruct, ysave);
+ ysave->oldyydebug = yydebug;
+ ysave->oldyynerrs = yynerrs;
+ ysave->oldyyerrflag = yyerrflag;
+ ysave->oldyychar = yychar;
+ ysave->oldyyval = yyval;
+ ysave->oldyylval = yylval;
2000-06-25 11:04:01 +00:00
+
+ #if YYDEBUG
if (yys = getenv("YYDEBUG"))
{
2000-06-25 11:04:01 +00:00
yyn = *yys;
***************
2000-06-25 11:04:01 +00:00
*** 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;
2000-06-25 11:04:01 +00:00
*yyssp = yystate = 0;
***************
2000-06-25 11:04:01 +00:00
*** 1493,1499 ****
#endif
if (yyssp >= yyss + yystacksize - 1)
{
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
2000-06-25 11:04:01 +00:00
*++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;
2000-06-25 11:04:01 +00:00
! 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];
2000-06-25 11:04:01 +00:00
*++yyvsp = yylval;
***************
2000-06-25 11:04:01 +00:00
*** 1534,1540 ****
#endif
if (yyssp >= yyss + yystacksize - 1)
{
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
2000-06-25 11:04:01 +00:00
*++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;
2000-06-25 11:04:01 +00:00
! 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];
2000-06-25 11:04:01 +00:00
*++yyvsp = yylval;
***************
2000-06-25 11:04:01 +00:00
*** 2473,2487 ****
#endif
if (yyssp >= yyss + yystacksize - 1)
{
! goto yyoverflow;
}
*++yyssp = yystate;
2000-06-25 11:04:01 +00:00
*++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;
2000-06-25 11:04:01 +00:00
! 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;
2000-06-25 11:04:01 +00:00
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
! yyerror("Out of memory for yacc stack");
yyabort:
! retval = 1;
yyaccept:
! return retval;
2000-06-25 11:04:01 +00:00
! }
!
! #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);
}