nakedmudv3.6/
nakedmudv3.6/lib/
nakedmudv3.6/lib/help/A/
nakedmudv3.6/lib/help/B/
nakedmudv3.6/lib/help/C/
nakedmudv3.6/lib/help/D/
nakedmudv3.6/lib/help/G/
nakedmudv3.6/lib/help/H/
nakedmudv3.6/lib/help/J/
nakedmudv3.6/lib/help/L/
nakedmudv3.6/lib/help/M/
nakedmudv3.6/lib/help/O/
nakedmudv3.6/lib/help/P/
nakedmudv3.6/lib/help/R/
nakedmudv3.6/lib/help/S/
nakedmudv3.6/lib/help/W/
nakedmudv3.6/lib/logs/
nakedmudv3.6/lib/misc/
nakedmudv3.6/lib/players/
nakedmudv3.6/lib/txt/
nakedmudv3.6/lib/world/
nakedmudv3.6/lib/world/examples/
nakedmudv3.6/lib/world/examples/mproto/
nakedmudv3.6/lib/world/examples/oproto/
nakedmudv3.6/lib/world/examples/reset/
nakedmudv3.6/lib/world/examples/rproto/
nakedmudv3.6/lib/world/examples/trigger/
nakedmudv3.6/lib/world/limbo/
nakedmudv3.6/lib/world/limbo/room/
nakedmudv3.6/lib/world/limbo/rproto/
nakedmudv3.6/src/alias/
nakedmudv3.6/src/dyn_vars/
nakedmudv3.6/src/editor/
nakedmudv3.6/src/example_module/
nakedmudv3.6/src/help2/
nakedmudv3.6/src/set_val/
nakedmudv3.6/src/socials/
nakedmudv3.6/src/time/
#ifndef NEAR_MAP_H
#define NEAR_MAP_H
//*****************************************************************************
//
// near_map.h
//
// hash tables (and maps, more broadly speaking) map a key to a value. The
// value can only be retreived by using the key. However, there's some cases
// where we'd like to be lazy about providing the proper key and instead be
// provided with the "best match". For instance, looking up help files or
// commands. For the north command, we'd like "n", "no", "nor", nort", and 
// "north" to all be viable commands. This is what a near-map tries to
// accomplish.
//
//*****************************************************************************

typedef struct near_map           NEAR_MAP;
typedef struct near_iterator NEAR_ITERATOR;

NEAR_MAP        *newNearMap(void);
void          deleteNearMap(NEAR_MAP *map);
void            *nearMapGet(NEAR_MAP *map, const char *key, bool abbrev_ok);
void             nearMapPut(NEAR_MAP *map, const char *key, 
			    const char *min_abbrev, void *data);
bool       nearMapKeyExists(NEAR_MAP *map, const char *key);
void         *nearMapRemove(NEAR_MAP *map, const char *key);
LIST  *nearMapGetAllMatches(NEAR_MAP *map, const char *key);



//*****************************************************************************
// an iterator for going over all entries in a near-map
//*****************************************************************************

// iterate across all the elements in a near map
#define ITERATE_NEARMAP(abbrev, val, it) \
  for(abbrev = nearIteratorCurrentAbbrev(it), val = nearIteratorCurrentVal(it);\
      abbrev != NULL; \
      nearIteratorNext(it), \
      abbrev = nearIteratorCurrentAbbrev(it), val = nearIteratorCurrentVal(it))

NEAR_ITERATOR        *newNearIterator(NEAR_MAP *map);
void               deleteNearIterator(NEAR_ITERATOR *I);
void                nearIteratorReset(NEAR_ITERATOR *I);
void                 nearIteratorNext(NEAR_ITERATOR *I);
const char    *nearIteratorCurrentKey(NEAR_ITERATOR *I);
const char *nearIteratorCurrentAbbrev(NEAR_ITERATOR *I);
void          *nearIteratorCurrentVal(NEAR_ITERATOR *I);

#endif // NEAR_MAP_H