/*
 * Everyone should use a slight modification of this .h for the WordMap.
 *
 *    written by J Dean Brock, Nov 2010
 *
 */

#ifndef _WORDMAP_H
#define _WORDMAP_H

/*
 * You must give the definition of the struct used to represent
 * the WordMap here.  It is very likely that your code will
 * need supporting struct definitions which also must be here.
 */

/*
 * Definitions for supporting struct's must go here.
 */

/*
 * Define your top-level struct right here.
 * If should contain references to the supporting struct's.
 */

struct WordMapNode {
    /* put your fields here */
} ;

typedef struct WordMapNode *WordMap ;

/*
 * Create an empty WordMap.  
 * Return a NULL if this operation cannot be performed
 * due to lack of dynamic storage.
 */
WordMap CreateWM (void) ;

/*
 * Insert a new key,value pair into the WordMap.
 * If the key is already in use, update it with the new value.
 * Your program must copy word.  The value is assumed to
 * be a generic pointer (void *).
 * Return a non-zero value if this operation cannot be
 * performed due to lack of dynamic storage.
 */
int     InsertWM(WordMap, const char *key, const void *value) ;
/*
 * Because the generic pointer is used, you will probably have
 * to cast your MapLoop into a (void *) in your argument list.
 * Your call will look something like the following.
 *      InsertWM(aWordMap, aKey, (void *)aWordLoop)
 */

/*
 * Obtain the value (a generic pointer) associate with a key.
 * If the key is not in the map, just return NULL.
 */
void *  LookupWM(WordMap, const char *key) ;
/* Because the generic pointer is used, you call should resemble
 *   WordLoop res = (WordLoop)LookupWM(aWordMap, aKey) ;
 */

/*
 * Delete all space used by the WordMap key index.
 * Do *not* try to delete the values!
 * Obviously WordMap should not be used after this call.
 */
void    DestroyWM (WordMap) ;

#endif   /* _WORDMAP_H */
