diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /src/SDCCset.h | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'src/SDCCset.h')
| -rw-r--r-- | src/SDCCset.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/SDCCset.h b/src/SDCCset.h new file mode 100644 index 0000000..5df8858 --- /dev/null +++ b/src/SDCCset.h @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------- + SDCCset.h - contains support routines for doubly linked lists. + + Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! +-------------------------------------------------------------------------*/ + +#ifndef SDCCSET_H +#define SDCCSET_H +#include <stdarg.h> + + +#ifndef THROWS +#define THROWS +#define THROW_NONE 0 +#define THROW_SRC 1 +#define THROW_DEST 2 +#define THROW_BOTH 3 +#endif + +/* linear linked list generic */ +typedef struct set + { + void *item; + struct set *curr; + struct set *next; + } +set; + +#define DEFSETFUNC(fname) int fname ( void *item, va_list ap) +#define V_ARG(type,var) type var = va_arg(ap,type) + +/* set related functions */ +set *newSet (void); +void *addSet (set **, void *); +void *addSetHead (set **, void *); +void *getSet (set **); +void deleteSetItem (set **, void *); +void replaceSetItem (set *, void *olditem, void *newitem); +void deleteItemIf (set **, int (*cond) (void *, va_list),...); +void destructItemIf (set **, void (*destructor)(void *), int (*cond) (void *, va_list),...); +int isinSet (const set *, const void *); +typedef int (* insetwithFunc) (void *, void *); +int isinSetWith (set *, void *, insetwithFunc cfunc); +int applyToSet (set * list, int (*somefunc) (void *, va_list),...); +int applyToSetFTrue (set * list, int (*somefunc) (void *, va_list),...); +void mergeSets (set **sset, set *list); +set *unionSets (set *, set *, int); +set *unionSetsWith (set *, set *, int (*cFunc) (), int); +set *intersectSets (set *, set *, int); +void *addSetIfnotP (set **, void *); +set *setFromSet (const set *); +set *setFromSetNonRev (const set *); +int isSetsEqual (const set *, const set *); +set *subtractFromSet (set *, set *, int); +int elementsInSet (const set *); +void *indexSet(set *, int); +set *intersectSetsWith (set *, set *, int (*cFunc) (void *, void *), int); +int isSetsEqualWith (set *, set *, int (*cFunc) (void *, void *)); +void *peekSet (const set *); +void *setFirstItem (set *); +void *setNextItem (set *); +void setToNull (void **); +set *reverseSet (set *); +void deleteSet (set **s); + +#endif |
