Lines Matching refs:stack

39 	register STACK			stack;  in stackalloc()  local
43 if (!(stack = newof(0, struct stacktable, 1, 0))) return(0); in stackalloc()
46 free(stack); in stackalloc()
49 if (!(b->stack = newof(0, void*, size, 0))) in stackalloc()
52 free(stack); in stackalloc()
55 stack->blocks = b; in stackalloc()
56 stack->size = size; in stackalloc()
57 stack->error = error; in stackalloc()
58 stack->position.block = b; in stackalloc()
59 stack->position.index = -1; in stackalloc()
62 return(stack); in stackalloc()
70 stackfree(register STACK stack) in stackfree() argument
75 b = stack->blocks; in stackfree()
79 free(p->stack); in stackfree()
82 free(stack); in stackfree()
90 stackclear(register STACK stack) in stackclear() argument
92 stack->position.block = stack->blocks; in stackclear()
93 stack->position.index = -1; in stackclear()
101 stackget(register STACK stack) in stackget() argument
103 if (stack->position.index < 0) return(stack->error); in stackget()
104 else return(stack->position.block->stack[stack->position.index]); in stackget()
112 stackpush(register STACK stack, void* value) in stackpush() argument
116 if (++stack->position.index >= stack->size) in stackpush()
118 b = stack->position.block; in stackpush()
125 if (!(b->stack = newof(0, void*, stack->size, 0))) in stackpush()
127 b->prev = stack->position.block; in stackpush()
130 stack->position.block = b; in stackpush()
131 stack->position.index = 0; in stackpush()
133 stack->position.block->stack[stack->position.index] = value; in stackpush()
142 stackpop(register STACK stack) in stackpop() argument
152 if (stack->position.index < 0) return(-1); in stackpop()
153 else if (--stack->position.index < 0) in stackpop()
155 if (!stack->position.block->prev) return(0); in stackpop()
156 stack->position.block = stack->position.block->prev; in stackpop()
157 stack->position.index = stack->size - 1; in stackpop()
168 stacktell(register STACK stack, int set, STACKPOS* position) in stacktell() argument
170 if (set) stack->position = *position; in stacktell()
171 else *position = stack->position; in stacktell()