/[bison]/bison/src/bison.simple
ViewVC logotype

Diff of /bison/src/bison.simple

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53.2.7 by eggert, Tue Nov 27 23:31:47 2001 UTC revision 1.53.2.8 by eggert, Fri Nov 30 02:47:56 2001 UTC
# Line 76  Line 76 
76  # define YYSTACK_USE_ALLOCA 0  # define YYSTACK_USE_ALLOCA 0
77  #endif  #endif
78    
 /* Realloc WHAT from SIZE to YYSTACKSIZE elements of TYPE.  
    If WHAT was malloc'ed (not the original automatic ARRAY), free it. */  
79  #if YYSTACK_USE_ALLOCA  #if YYSTACK_USE_ALLOCA
80  # define YYSTACK_REALLOC(Type, What, Array)                             \  # define YYSTACK_ALLOC alloca
81  do {                                                                    \  # define YYSTACK_FREE(Ptr) /* empty */
   Type *old = What;                                                     \  
   What = (Type *) alloca (yystacksize * sizeof (Type));                 \  
   __yy_memcpy ((char *) What, (char *) old,                             \  
                (size) * (unsigned int) sizeof (Type));                  \  
 } while (0)  
82  #else  #else
83  # define YYSTACK_REALLOC(Type, What, Array)                             \  # define YYSTACK_ALLOC malloc
84  do {                                                                    \  # define YYSTACK_FREE(Ptr) free (Ptr)
85    Type *old = What;                                                     \  #endif
86    What = (Type *) malloc (yystacksize * sizeof (Type));                 \  
87    __yy_memcpy ((char *) What, (char *) old,                             \  /* A type that is properly aligned for any stack member.  */
88                 (size) * (unsigned int) sizeof (Type));                  \  union yyalloc
89    yyfree_stacks = 1;                                                    \  {
90    if (old != Array)                                                     \    short yys;
91      free (old);                                                         \    YYSTYPE yyv;
92  } while (0)  #if YYLSP_NEEDED
93      YYLTYPE yyl;
94  #endif  #endif
95    };
96    
97    /* The size of the maximum gap between one aligned stack and the next.  */
98    #define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
99    
100    /* The size of an array large to enough to hold all stacks, each with
101       N elements.  */
102    #if YYLSP_NEEDED
103    # define YYSTACK_BYTES(N) \
104        ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))       \
105         + 2 * YYSTACK_GAP_MAX)
106    #else
107    # define YYSTACK_BYTES(N) \
108        ((N) * (sizeof (short) + sizeof (YYSTYPE))                          \
109         + YYSTACK_GAP_MAX)
110    #endif
111    
112    /* Relocate the TYPE STACK from its old location to the new one.  The
113       local variables SIZE and YYSTACKSIZE give the old and new number of
114       elements in the stack, and YYPTR gives the new location of the
115       stack.  Advance YYPTR to a properly aligned location for the next
116       stack.  */
117    #define YYSTACK_RELOCATE(Type, Stack)                                   \
118    do                                                                      \
119      {                                                                     \
120        size_t yynewbytes;                                                  \
121        __yy_memcpy (yyptr, (char *) (Stack), size * sizeof (Type));        \
122        (Stack) = (Type *) yyptr;                                           \
123        yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;         \
124        yynewbytes -= yynewbytes % sizeof (union yyalloc);                  \
125        yyptr += yynewbytes;                                                \
126      }                                                                     \
127    while (0)
128    
129  #define yyerrok         (yyerrstatus = 0)  #define yyerrok         (yyerrstatus = 0)
130  #define yyclearin       (yychar = YYEMPTY)  #define yyclearin       (yychar = YYEMPTY)
# Line 189  int yydebug; Line 216  int yydebug;
216  #endif  #endif
217    
218  /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only  /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
219     if the built-in stack extension method is used).  */     if the built-in stack extension method is used).
220    
221       Do not make this value too large; the results are undefined if
222       SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
223       evaluated with infinite-precision integer arithmetic.  */
224    
225  #if YYMAXDEPTH == 0  #if YYMAXDEPTH == 0
226  # undef YYMAXDEPTH  # undef YYMAXDEPTH
227  #endif  #endif
# Line 198  int yydebug; Line 230  int yydebug;
230  # define YYMAXDEPTH 10000  # define YYMAXDEPTH 10000
231  #endif  #endif
232    
 /* Define __yy_memcpy.  Note that the size argument  
    should be passed with type unsigned int, because that is what the non-GCC  
    definitions require.  With GCC, __builtin_memcpy takes an arg  
    of type size_t, but it can handle unsigned int.  */  
   
233  #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */  #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
234  # define __yy_memcpy(To, From, Count)   __builtin_memcpy (To, From, Count)  # define __yy_memcpy(To, From, Count)   __builtin_memcpy (To, From, Count)
235  #else                           /* not GNU C or C++ */  #else                           /* not GNU C or C++ */
# Line 214  static void Line 241  static void
241  __yy_memcpy (to, from, count)  __yy_memcpy (to, from, count)
242       char *to;       char *to;
243       const char *from;       const char *from;
244       unsigned int count;       size_t count;
245  # else /* __cplusplus */  # else /* __cplusplus */
246  __yy_memcpy (char *to, const char *from, unsigned int count)  __yy_memcpy (char *to, const char *from, size_t count)
247  # endif  # endif
248  {  {
249    register const char *f = from;    register const char *f = from;
250    register char *t = to;    register char *t = to;
251    register int i = count;    register size_t i = count;
252    
253    while (i-- > 0)    while (i-- != 0)
254      *t++ = *f++;      *t++ = *f++;
255  }  }
256    
# Line 301  yyparse (YYPARSE_PARAM_ARG) Line 328  yyparse (YYPARSE_PARAM_ARG)
328    
329    register int yystate;    register int yystate;
330    register int yyn;    register int yyn;
331      int yyresult;
332    /* Number of tokens to shift before error messages enabled.  */    /* Number of tokens to shift before error messages enabled.  */
333    int yyerrstatus;    int yyerrstatus;
334    /* Lookahead token as an internal (translated) token number.  */    /* Lookahead token as an internal (translated) token number.  */
# Line 337  yyparse (YYPARSE_PARAM_ARG) Line 365  yyparse (YYPARSE_PARAM_ARG)
365  # define YYPOPSTACK   (yyvsp--, yyssp--)  # define YYPOPSTACK   (yyvsp--, yyssp--)
366  #endif  #endif
367    
368    int yystacksize = YYINITDEPTH;    size_t yystacksize = YYINITDEPTH;
   int yyfree_stacks = 0;  
369    
370    
371    /* The variables used to return semantic value and location from the    /* The variables used to return semantic value and location from the
# Line 386  yyparse (YYPARSE_PARAM_ARG) Line 413  yyparse (YYPARSE_PARAM_ARG)
413    if (yyssp >= yyss + yystacksize - 1)    if (yyssp >= yyss + yystacksize - 1)
414      {      {
415        /* Get the current used size of the three stacks, in elements.  */        /* Get the current used size of the three stacks, in elements.  */
416        int size = yyssp - yyss + 1;        size_t size = yyssp - yyss + 1;
417    
418  #ifdef yyoverflow  #ifdef yyoverflow
419        {        {
# Line 420  yyparse (YYPARSE_PARAM_ARG) Line 447  yyparse (YYPARSE_PARAM_ARG)
447  #else /* no yyoverflow */  #else /* no yyoverflow */
448        /* Extend the stack our own way.  */        /* Extend the stack our own way.  */
449        if (yystacksize >= YYMAXDEPTH)        if (yystacksize >= YYMAXDEPTH)
450          {          goto yyoverflowlab;
           yyerror ("parser stack overflow");  
           if (yyfree_stacks)  
             {  
               free (yyss);  
               free (yyvs);  
 # if YYLSP_NEEDED  
               free (yyls);  
 # endif  
             }  
           return 2;  
         }  
451        yystacksize *= 2;        yystacksize *= 2;
452        if (yystacksize > YYMAXDEPTH)        if (yystacksize > YYMAXDEPTH)
453          yystacksize = YYMAXDEPTH;          yystacksize = YYMAXDEPTH;
454    
455        YYSTACK_REALLOC (short, yyss, yyssa);        {
456        YYSTACK_REALLOC (YYSTYPE, yyvs, yyvsa);          short *yyss1 = yyss;
457            char *yyptr = (char *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
458            if (! yyptr)
459              goto yyoverflowlab;
460            YYSTACK_RELOCATE (short, yyss);
461            YYSTACK_RELOCATE (YYSTYPE, yyvs);
462  # if YYLSP_NEEDED  # if YYLSP_NEEDED
463        YYSTACK_REALLOC (YYLTYPE, yyls, yylsa);          YYSTACK_RELOCATE (YYLTYPE, yyls);
464  # endif  # endif
465    # undef YYSTACK_RELOCATE
466            if (yyss1 != yyssa)
467              YYSTACK_FREE (yyss1);
468          }
469  #endif /* no yyoverflow */  #endif /* no yyoverflow */
470    
471        yyssp = yyss + size - 1;        yyssp = yyss + size - 1;
# Line 449  yyparse (YYPARSE_PARAM_ARG) Line 474  yyparse (YYPARSE_PARAM_ARG)
474        yylsp = yyls + size - 1;        yylsp = yyls + size - 1;
475  #endif  #endif
476    
477        YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize));        YYDPRINTF ((stderr, "Stack size increased to %lu\n",
478                      (unsigned long int) yystacksize));
479    
480        if (yyssp >= yyss + yystacksize - 1)        if (yyssp >= yyss + yystacksize - 1)
481          YYABORT;          YYABORT;
# Line 666  yyerrlab: Line 692  yyerrlab:
692    
693        if (yyn > YYFLAG && yyn < YYLAST)        if (yyn > YYFLAG && yyn < YYLAST)
694          {          {
695            int size = 0;            size_t size = 0;
696            char *msg;            char *msg;
697            int x, count;            int x, count;
698    
# Line 816  yyerrhandle: Line 842  yyerrhandle:
842  | yyacceptlab -- YYACCEPT comes here.  |  | yyacceptlab -- YYACCEPT comes here.  |
843  `-------------------------------------*/  `-------------------------------------*/
844  yyacceptlab:  yyacceptlab:
845    if (yyfree_stacks)    yyresult = 0;
846      {    goto yyreturn;
       free (yyss);  
       free (yyvs);  
 #if YYLSP_NEEDED  
       free (yyls);  
 #endif  
     }  
   return 0;  
   
847    
848  /*-----------------------------------.  /*-----------------------------------.
849  | yyabortlab -- YYABORT comes here.  |  | yyabortlab -- YYABORT comes here.  |
850  `-----------------------------------*/  `-----------------------------------*/
851  yyabortlab:  yyabortlab:
852    if (yyfree_stacks)    yyresult = 1;
853      {    goto yyreturn;
854        free (yyss);  
855        free (yyvs);  /*---------------------------------------------.
856  #if YYLSP_NEEDED  | yyoverflowab -- parser overflow comes here.  |
857        free (yyls);  `---------------------------------------------*/
858    yyoverflowlab:
859      yyerror ("parser stack overflow");
860      yyresult = 2;
861      /* Fall through.  */
862    
863    yyreturn:
864    #ifndef yyoverflow
865      if (yyss != yyssa)
866        YYSTACK_FREE (yyss);
867  #endif  #endif
868      }    return yyresult;
   return 1;  
869  }  }

Legend:
Removed from v.1.53.2.7  
changed lines
  Added in v.1.53.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26