#ifndef FRAC_HEAP_H #define FRAC_HEAP_H typedef struct { signed char sign; unsigned int numerator; unsigned int denominator; } fraction; /* * init_heap(): * must be called once by the program using your * functions before calls to any other functions are made. This * allows you to set up any housekeeping needed for your memory * allocator. For example, this is when you can initialize * your free block list. */ void init_heap(void); /* * new_frac(): * must return a pointer to fractions. * It should be an item taken from the list of free blocks. * (Don't forget to remove it from the list of free blocks!) * If the free list is empty, you need to get more using malloc() * (Number of blocks to malloc each time is specified in the project * description) */ fraction *new_frac(void); /* * del_frac(): * takes a pointer to a fraction and adds that item to the free block list. * The programmer using your functions promises to never use that item again, * unless the item is given to her/him by a subsequent call to new_frac(). */ void del_frac(fraction *frac); /* * dump_heap(): * For debugging/diagnostic purposes. * It should print out the entire contents of the free list, * printing out the address for each item. */ void dump_heap(void); #endif /* FRAC_HEAP_H */