// --------------------------------------------------------------------------- // NamespaceScope: Stack access // --------------------------------------------------------------------------- unsigned int NamespaceScope::increaseDepth() { // See if we need to expand the stack if (fStackTop == fStackCapacity) expandStack(); // If this element has not been initialized yet, then initialize it if (!fStack[fStackTop]) { fStack[fStackTop] = new (fMemoryManager) StackElem; fStack[fStackTop]->fMapCapacity = 0; fStack[fStackTop]->fMap = 0; } // Set up the new top row fStack[fStackTop]->fMapCount = 0; // Bump the top of stack fStackTop++; return fStackTop-1; }
void push(stack_t* stack_p, int value) { if (stack_p->size == stack_p->capacity) expandStack(stack_p); stack_p->array[stack_p->size++] = value; }
void push(int element) { if (size + 1 > capacity) expandStack(); stackPtr[size++] = element; minElement = element < minElement ? element : minElement; }