home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / h / map.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.0 KB  |  58 lines

  1. #ifndef map_h
  2. #define map_h
  3.  
  4. /*
  5.  * Maps are things that map one integer onto another.  There are
  6.  * create, insert, lookup, and destroy operations.
  7.  */
  8.  
  9. typedef struct TE {
  10.     int key;            /* the key for this entry */
  11.     int value;            /* what we want */
  12. } TE, *TEPtr;
  13.  
  14. typedef struct MapRecord {
  15.     TEPtr table;
  16.     int maxIndex, maxCount, count;
  17. } MapRecord, *Map;
  18.  
  19. #define NIL ((unsigned)0x80000000)
  20.  
  21. Map Map_Create();
  22.  
  23. Map Map_CreateSized(/* count */);
  24. /* int count */
  25.  
  26. void Map_Clear(/* map */);
  27. /* Map map; */
  28.  
  29. void Map_Insert(/* map, key, value */);
  30. /* Map map; int key, value; */
  31.  
  32. int Map_Lookup(/* map, key */);
  33. /* Map map; int key; */
  34.  
  35. int Map_InverseLookup(/* map, value */);
  36. /* Map map; int value; */
  37.  
  38. void Map_Delete(/* map, key */);
  39. /* Map map; int key; */
  40.  
  41. void Map_Destroy(/* map */);
  42. /* Map map; */
  43.  
  44. void Map_Print(/* map */);
  45. /* Map map; */
  46.  
  47. #define Map_For(m, key, value) \
  48.   { \
  49.     int zzIndexzz = 0; \
  50.     while (Map_FindNext((m), &zzIndexzz, (int *)&key, (int *)&value)) {
  51. #define Map_Next \
  52.     } \
  53.   }
  54.  
  55. #define Map_Count(m) ((m)->count)
  56.  
  57. #endif
  58.