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

  1. #ifndef set_h
  2. #define set_h
  3.  
  4. /*
  5.  * Sets are things that store integers without duplicates.
  6.  * There are
  7.  * create, insert, lookup, and destroy operations.
  8.  */
  9.  
  10. typedef struct SETElem {
  11.     int key;            /* the key for this entry */
  12. } SETElem, *SETElemPtr;
  13.  
  14. typedef struct SetRecord {
  15.     SETElemPtr table;
  16.     int maxIndex, maxCount, count;
  17. } SetRecord, *Set;
  18.  
  19. #define NIL ((unsigned)0x80000000)
  20.  
  21. Set Set_Create();
  22.  
  23. Set Set_CreateSized(/* count */);
  24. /* int count */
  25.  
  26. void Set_Insert(/* set, key */);
  27. /* Set set; int key; */
  28.  
  29. int Set_Lookup(/* set, key */);
  30. /* Set set; int key; */
  31.  
  32. int Set_Member(/* set, key */);
  33. /* Set set; int key; */
  34.  
  35. void Set_Delete(/* set, key */);
  36. /* Set set; int key; */
  37.  
  38. void Set_Destroy(/* set */);
  39. /* Set set; */
  40.  
  41. void Set_Print(/* set */);
  42. /* Set set; */
  43.  
  44. #define Set_For(m, key) \
  45.   { \
  46.     int zzIndexzz = 0; \
  47.     while (Set_FindNext((m), &zzIndexzz, (int *)&key )) {
  48. #define Set_Next \
  49.     } \
  50.   }
  51.  
  52. #define Set_Count(m) ((m)->count)
  53.  
  54. #endif
  55.