1 /*-----------------------------------------------------------------
2 SDCCset.h - contains support routines for linked lists.
4 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 In other words, you are welcome to use, share and improve this program.
21 You are forbidden to forbid anyone else to use, share and improve
22 what you give them. Help stamp out software-hoarding!
23 -------------------------------------------------------------------------*/
38 /* linear linked list generic */
47 #define DEFSETFUNC(fname) int fname ( void *item, va_list ap)
48 #define V_ARG(type,var) type var = va_arg(ap,type)
50 /* set related functions */
52 void *addSet (set
**, void *);
53 void *addSetHead (set
**, void *);
54 void *getSet (set
**);
55 void deleteSetItem (set
**, void *);
56 void replaceSetItem (set
*, void *olditem
, void *newitem
);
57 void deleteItemIf (set
**, int (*cond
) (void *, va_list),...);
58 void destructItemIf (set
**, void (*destructor
)(void *), int (*cond
) (void *, va_list),...);
59 int isinSet (const set
*, const void *);
60 typedef int (* insetwithFunc
) (void *, void *);
61 int isinSetWith (set
*, void *, insetwithFunc cfunc
);
62 int applyToSet (set
* list
, int (*somefunc
) (void *, va_list),...);
63 int applyToSetFTrue (set
* list
, int (*somefunc
) (void *, va_list),...);
64 void mergeSets (set
**sset
, set
*list
);
65 set
*unionSets (set
*, set
*, int);
66 set
*unionSetsWith (set
*, set
*, int (*cFunc
) (), int);
67 set
*intersectSets (set
*, set
*, int);
68 void *addSetIfnotP (set
**, void *);
69 set
*setFromSet (const set
*);
70 set
*setFromSetNonRev (const set
*);
71 int isSetsEqual (const set
*, const set
*);
72 set
*subtractFromSet (set
*, set
*, int);
73 int elementsInSet (const set
*);
74 void *indexSet(set
*, int);
75 set
*intersectSetsWith (set
*, set
*, int (*cFunc
) (void *, void *), int);
76 int isSetsEqualWith (set
*, set
*, int (*cFunc
) (void *, void *));
77 void *peekSet (const set
*);
78 void *setFirstItem (set
*);
79 void *setNextItem (set
*);
80 void setToNull (void **);
81 set
*reverseSet (set
*);
82 void deleteSet (set
**s
);