home *** CD-ROM | disk | FTP | other *** search
/ The Education Master 1994 (4th Edition) / EDUCATIONS_MASTER_4TH_EDITION.bin / files / progmisc / qparser2 / lib / sets.h < prev   
Encoding:
C/C++ Source or Header  |  1992-05-17  |  1.8 KB  |  53 lines

  1. /*  sets.h
  2.  
  3.     A set is an array of char large enough to carry the maximum
  4. elements N.  An element is an int in the range 0..N-1.
  5.     set_union:    set1 = set2 | set3
  6.     intersection: set1 = set2 * set3
  7.  
  8.    */
  9.  
  10. #ifndef SETS_H
  11. #define SETS_H
  12.  
  13. #include "protos.h"
  14.  
  15. #ifndef va_start
  16. #  include <stdarg.h>
  17. #endif
  18.  
  19. /* "size" is maximum number of elements N; SETSIZE returns bytes
  20.     in set array */
  21. #define SETSIZE(size)  ((size-1)/8 + 1)
  22.  
  23. extern void clearset _XX_((char *set, int setbytes));
  24.  
  25. /* fillset should be followed by a TRIMSET call */
  26. extern void fillset _XX_((char *set, int setbytes));
  27. extern int set_member _XX_((const int element, char *set));
  28. extern int set_size _XX_((char *set, int setbytes));
  29. extern int empty_set _XX_((char *set, int setbytes));
  30. extern void set_union _XX_((char *set1, char *set2, 
  31.                          char *set3, int setbytes));
  32. extern void set_merge _XX_((char *set1, char *set2, int setbytes));
  33. extern void intersection _XX_((char *set1, char *set2, 
  34.                          char *set3, int setbytes));
  35. extern int is_intersection _XX_((char *set1, char *set2, int setbytes));
  36.  
  37. /* both sets should be trimmed BEFORE calling this */
  38. extern int set_equal _XX_((char *set1, char *set2, int setbytes));
  39. extern void set_include _XX_((int element, char *set));
  40. extern void set_exclude _XX_((int element, char *set));
  41. extern int set_greater _XX_((char *set1, char *set2, int setbytes));
  42. extern void set_difference _XX_((char *set1, char *set2, 
  43.                          char *set3, int setbytes));    
  44.  
  45. /* set_inverse should be followed by a TRIMSET call! */
  46. extern void set_inverse _XX_((char *set, int setbytes));
  47. extern void trimset _XX_((char *set1, int setbits));
  48. extern void set_incl _XX_((char *set, ...));
  49. extern void set_excl _XX_((char *set, ...));
  50.  
  51. #endif
  52.  
  53.