home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#)map.h 1.2 3/18/87
- */
- #ifndef map_h
- #define map_h
-
- /*
- * Maps are things that map one integer onto another. There are
- * create, insert, lookup, and destroy operations.
- */
-
- typedef struct TE {
- int key; /* the key for this entry */
- int value; /* what we want */
- } TE, *TEPtr;
-
- typedef struct MapRecord {
- TEPtr table;
- int maxIndex, maxCount, count;
- } MapRecord, *Map;
-
- #define NIL ((unsigned)0x80000000)
-
- Map Map_Create();
-
- Map Map_CreateSized(/* count */);
- /* int count */
-
- void Map_Insert(/* map, key, value */);
- /* Map map; int key, value; */
-
- int Map_Lookup(/* map, key */);
- /* Map map; int key; */
-
- void Map_Delete(/* map, key */);
- /* Map map; int key; */
-
- void Map_Destroy(/* map */);
- /* Map map; */
-
- void Map_Print(/* map */);
- /* Map map; */
-
- #define Map_For(m, key, value) \
- { \
- int index = 0; \
- while (Map_FindNext((m), &index, (int *)&key, (int *)&value)) {
- #define Map_Next \
- } \
- }
-
- #define Map_Count(m) ((m)->count)
-
- #endif
-