/* * llist.h * Dan Wallach * 29 February 1996 * * Header file for a linked list of integers */ #ifndef __LLIST_H__ #define __LLIST_H__ typedef void* List; /* opaque type */ /* * Allocate a new, empty List and return it. */ List LNew(); /* * Free all the memory associated with a list - further references * to the List handle are undefined */ void LFree(List list); /* * Insert an integer into the List. If that integer is already * present, insert it anyway, so the number will occur twice. */ void LInsert(List list, int value); /* * If the given integer exists in the List, remove it. * If it occurs more than once, only one occurance will be removed. */ void LDelete(List list, int value); /* * Return true or false (1 or 0) if the integer is a member * of the list */ int LQuery(List list, int value); /* * Print the integers in the list, separated by commas and * followed by a newline. */ void LPrint(FILE* file, List list); /* * Invoke the function once per integer in the list. The function, * in addition to receiving the integer, receives an arbitrary * pointer, which is the third argument to LMap() */ void LMap(List list, void (*)(void* data, int value), void* data); #endif /* __LLIST_H__ */