Leptonica 1.68
C Image Processing Library
|
Struct for generic expandable stack (L_Stack) More...
Go to the source code of this file.
Data Structures | |
struct | L_Stack |
Typedefs | |
typedef struct L_Stack | L_STACK |
Struct for generic expandable stack (L_Stack)
Expandable pointer stack for arbitrary void* data. The L_Stack is an array of void * ptrs, onto which arbitrary objects can be stored. At any time, the number of stored objects is stack->n. The object at the bottom of the stack is at array[0]; the object at the top of the stack is at array[n-1]. New objects are added to the top of the stack, at the first available location, which is array[n]. Objects are removed from the top of the stack. When an attempt is made to remove an object from an empty stack, the result is null. When the stack becomes filled, so that n = nalloc, the size is doubled. The auxiliary stack can be used to store and remove objects for re-use. It must be created by a separate call to pstackCreate(). [Just imagine the chaos if pstackCreate() created the auxiliary stack!] pstackDestroy() checks for the auxiliary stack and removes it.
Definition in file stack.h.