Lines Matching defs:stack
636 statically. Also alloca() is inappropriate due to limited stack
2540 /* A token stack used as a lookahead buffer. */
2553 /* Dumps all resources allocated by stack STACK. */
2555 token_stack_dump (token_stack_ty *stack)
2560 for (i = 0; i < stack->nitems; i++)
2562 token_ty *token = stack->items[i];
2579 /* Pushes the token TOKEN onto the stack STACK. */
2581 token_stack_push (token_stack_ty *stack, token_ty *token)
2583 if (stack->nitems >= stack->nitems_max)
2587 stack->nitems_max = 2 * stack->nitems_max + 4;
2588 nbytes = stack->nitems_max * sizeof (token_ty *);
2589 stack->items = xrealloc (stack->items, nbytes);
2591 stack->items[stack->nitems++] = token;
2594 /* Pops the most recently pushed token from the stack STACK and returns it.
2595 Returns NULL if the stack is empty. */
2597 token_stack_pop (token_stack_ty *stack)
2599 if (stack->nitems > 0)
2600 return stack->items[--(stack->nitems)];
2605 /* Return the top of the stack without removing it from the stack, or
2606 NULL if the stack is empty. */
2608 token_stack_peek (const token_stack_ty *stack)
2610 if (stack->nitems > 0)
2611 return stack->items[stack->nitems - 1];
2616 /* Frees all resources allocated by stack STACK. */
2618 token_stack_free (token_stack_ty *stack)
2622 for (i = 0; i < stack->nitems; i++)
2623 free_token (stack->items[i]);
2624 free (stack->items);
2648 fprintf (stderr, "%s:%d: %s recycled from stack\n",