home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / unixtools / util / h / bitset < prev    next >
Encoding:
Text File  |  1992-07-21  |  961 b   |  42 lines

  1. /*      > H.Bitset - Bitset data type header file */
  2.  
  3. #ifndef __bitset_h
  4.  
  5. #define __bitset_h
  6.  
  7. struct bitset
  8. {
  9.         unsigned bits;  /* number of bits in the map */
  10.         unsigned bytes; /* number of bytes in the map */
  11.         char bitmap[1]; /* bit map */
  12. };
  13.  
  14. typedef struct bitset *bitset;
  15.  
  16. /* General component routines */
  17.  
  18. bitset bset_new (int bits);
  19. void bset_free (bitset b);
  20. void bset_clear (bitset b);
  21. int bset_copy (bitset b1, bitset b2);
  22. int bset_equal (bitset b1, bitset b2);
  23. int bset_empty (bitset b);
  24. int bset_size (bitset b);
  25.  
  26. /* Iterator */
  27.  
  28. #define STATUS_CONTINUE 0       /* Continue processing */
  29. #define STATUS_STOP     1       /* Stop processing */
  30. #define STATUS_ERROR    (-1)    /* Error - terminate */
  31.  
  32. int bset_iterate (bitset b, int (*process)(int));
  33.  
  34. /* Bitset-specific routines */
  35.  
  36. int bset_set (bitset b, int bit);
  37. int bset_clr (bitset b, int bit);
  38. int bset_invert (bitset b, int bit);
  39. int bset_test (bitset b, int bit);
  40.  
  41. #endif
  42.