Home | History | Annotate | Download | only in src

Lines Matching refs:stack

79 // Interface functions for Stack
81 static void antlr3StackFree (pANTLR3_STACK stack);
82 static void * antlr3StackPop (pANTLR3_STACK stack);
83 static void * antlr3StackGet (pANTLR3_STACK stack, ANTLR3_INTKEY key);
84 static ANTLR3_BOOLEAN antlr3StackPush (pANTLR3_STACK stack, void * element, void (ANTLR3_CDECL *freeptr)(void *));
85 static ANTLR3_UINT32 antlr3StackSize (pANTLR3_STACK stack);
86 static void * antlr3StackPeek (pANTLR3_STACK stack);
966 pANTLR3_STACK stack;
970 stack = (pANTLR3_STACK)ANTLR3_MALLOC((size_t)sizeof(ANTLR3_STACK));
972 if (stack == NULL)
979 stack->vector = antlr3VectorNew(sizeHint);
980 stack->top = NULL;
982 if (stack->vector == (pANTLR3_VECTOR)ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM))
989 stack->get = antlr3StackGet;
990 stack->free = antlr3StackFree;
991 stack->pop = antlr3StackPop;
992 stack->push = antlr3StackPush;
993 stack->size = antlr3StackSize;
994 stack->peek = antlr3StackPeek;
996 return stack;
999 static ANTLR3_UINT32 antlr3StackSize (pANTLR3_STACK stack)
1001 return stack->vector->count;
1006 antlr3StackFree (pANTLR3_STACK stack)
1008 /* Free the list that supports the stack
1010 stack->vector->free(stack->vector);
1011 stack->vector = NULL;
1012 stack->top = NULL;
1014 ANTLR3_FREE(stack);
1018 antlr3StackPop (pANTLR3_STACK stack)
1020 // Delete the element that is currently at the top of the stack
1022 stack->vector->del(stack->vector, stack->vector->count - 1);
1024 // And get the element that is the now the top of the stack (if anything)
1025 // NOTE! This is not quite like a 'real' stack, which would normally return you
1026 // the current top of the stack, then remove it from the stack.
1028 // but is not as obvious when using it as a 'real'stack.
1030 stack->top = stack->vector->get(stack->vector, stack->vector->count - 1);
1031 return stack->top;
1035 antlr3StackGet (pANTLR3_STACK stack, ANTLR3_INTKEY key)
1037 return stack->vector->get(stack->vector, (ANTLR3_UINT32)key);
1041 antlr3StackPeek (pANTLR3_STACK stack)
1043 return stack->top;
1047 antlr3StackPush (pANTLR3_STACK stack, void * element, void (ANTLR3_CDECL *freeptr)(void *))
1049 stack->top = element;
1050 return (ANTLR3_BOOLEAN)(stack->vector->add(stack->vector, element, freeptr));
1468 // Create a stack to accumulate reusable vectors
1484 // We have a free stack available so we can add the vector we were
1491 // TODO: remove this line once happy printf("Returned vector %08X to the pool, stack size is %d\n", vector, factory->freeStack->size(factory->freeStack));
1533 // First see if we have a free chain stack to release?
1642 // If we have anything on the re claim stack, reuse it
1652 // TODO: remove this line once happy printf("Reused vector %08X from stack, size is now %d\n", vector, factory->freeStack->size(factory->freeStack));
1684 // TODO: remove this line once happy printf("Used a new vector at %08X from the pools as nothing on the reusue stack\n", vector);
2429 // current cycle stack and see if we find this node already in the stack.
2438 // stack so that it only contains the cycle and set the cycle flag
2461 // so this node needs to go into the cycle stack before we continue
2462 // then we will take it out of the stack once we have descended all its
2544 // has no edges, we pop back up the stack adding the nodes we traversed in reverse