*** 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,1476 ----
  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;
+ #ifdef USE_ITHREADS
+     ENTER;			/* force yydestruct() before we return */
+ #endif
+     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 ****
--- 1483,1498 ----
      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;
--- 1523,1541 ----
  #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;
--- 1576,1594 ----
  #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);
  }
--- 2527,2575 ----
  #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:
! #ifdef USE_ITHREADS
!     LEAVE;			/* force yydestruct() before we return */
! #endif
!     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);
  }
