home *** CD-ROM | disk | FTP | other *** search
- /* > H.Bitset - Bitset data type header file */
-
- #ifndef __bitset_h
-
- #define __bitset_h
-
- struct bitset
- {
- unsigned bits; /* number of bits in the map */
- unsigned bytes; /* number of bytes in the map */
- char bitmap[1]; /* bit map */
- };
-
- typedef struct bitset *bitset;
-
- /* General component routines */
-
- bitset bset_new (int bits);
- void bset_free (bitset b);
- void bset_clear (bitset b);
- int bset_copy (bitset b1, bitset b2);
- int bset_equal (bitset b1, bitset b2);
- int bset_empty (bitset b);
- int bset_size (bitset b);
-
- /* Iterator */
-
- #define STATUS_CONTINUE 0 /* Continue processing */
- #define STATUS_STOP 1 /* Stop processing */
- #define STATUS_ERROR (-1) /* Error - terminate */
-
- int bset_iterate (bitset b, int (*process)(int));
-
- /* Bitset-specific routines */
-
- int bset_set (bitset b, int bit);
- int bset_clr (bitset b, int bit);
- int bset_invert (bitset b, int bit);
- int bset_test (bitset b, int bit);
-
- #endif
-