#ifndef STACK_H #define STACK_H /* This module uses the GC of Boehm. Thus, there is no need to specify memory allocation and deallocation. Memory is freed when it is no longer referenced. The push and pop operations are strictly functional in that the do not alter the stack passed as argument. */ /* since stacks are immutable, no copy operation is necessary */ struct stack; typedef struct stack *stack; extern stack stack_create(void); extern stack stack_push(stack s, void *element); extern int stack_empty(stack s); /* Precondition: the stack must not be emtpy, as reported by stack_empty() */ extern stack stack_pop(stack s); /* Precondition: the stack must not be emtpy, as reported by stack_empty() */ extern void *stack_top(stack s); #endif