home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / unixtools / util / h / set < prev    next >
Text File  |  1992-07-21  |  1KB  |  45 lines

  1. /*      > H.Set - Set data type header file */
  2.  
  3. #ifndef __set_h
  4.  
  5. #define __set_h
  6.  
  7. struct set
  8. {
  9.         void *first;    /* pointer to first element of set */
  10.         int obj_size;   /* size of one element */
  11. };
  12.  
  13. typedef struct set *set;
  14.  
  15. /* General component routines */
  16.  
  17. set set_new (int obj_len);
  18. void set_free (set s);
  19. void set_clear (set s);
  20. int set_copy (set s1, const set s2);
  21. int set_equal (const set s1, const set s2);
  22. int set_empty (const set s);
  23. int set_size (const set s);
  24.  
  25. /* Iterator */
  26.  
  27. #define STATUS_CONTINUE 0       /* Continue processing */
  28. #define STATUS_STOP     1       /* Stop processing */
  29. #define STATUS_ERROR    (-1)    /* Error - terminate */
  30.  
  31. int set_iterate (const set s, int (*process)(void *));
  32.  
  33. /* Set-specific routines */
  34.  
  35. int set_add (set s, const void *object);
  36. int set_remove (set s, const void *object);
  37. int set_member (const set s, const void *object);
  38. int set_union (set s, const set t, const set u);
  39. int set_intersection (set s, const set t, const set u);
  40. int set_difference (set s, const set t, const set u);
  41. int set_subset (const set s1, const set s2);
  42. int set_proper_subset (const set s1, const set s2);
  43.  
  44. #endif
  45.