diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-13 06:41:07 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-13 06:41:07 +0000 |
commit | 4ee9c6840ad3fc92a9034343278a1e476ad6872a (patch) | |
tree | a2568888a519c077427b133de9ece5879a8484a5 /libbanshee/engine/ufind.h | |
parent | ebb338380ab170c91e64d38038e6b5ce930d69a1 (diff) | |
download | gcc-4ee9c6840ad3fc92a9034343278a1e476ad6872a.tar.gz |
Merge tree-ssa-20020619-branch into mainline.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbanshee/engine/ufind.h')
-rw-r--r-- | libbanshee/engine/ufind.h | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/libbanshee/engine/ufind.h b/libbanshee/engine/ufind.h new file mode 100644 index 00000000000..5068530114e --- /dev/null +++ b/libbanshee/engine/ufind.h @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2000-2001 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef UFIND_H +#define UFIND_H + +#include <regions.h> +#include "linkage.h" +#include "bool.h" + +EXTERN_C_BEGIN + +struct uf_element; + +typedef struct uf_element *uf_element; +typedef void *uf_info; + +typedef uf_info (*combine_fn_ptr)(uf_info,uf_info); + +struct uf_element *new_uf_element(region r,uf_info i); +uf_info uf_get_info(struct uf_element *); +bool uf_unify(combine_fn_ptr,struct uf_element *,struct uf_element *); +bool uf_union(struct uf_element *,struct uf_element *); +bool uf_eq(struct uf_element *,struct uf_element *); +void uf_update(struct uf_element *,uf_info i); + +#define DECLARE_UFIND(name,type) \ +typedef struct name *name; \ +typedef type (* name ## _combine_fn_ptr)(type info1,type info2); \ +name new_ ## name(region r, type info); \ +type name ## _get_info(name); \ +bool name ## _unify(name ## _combine_fn_ptr,name e1, name e2); \ +bool name ## _union(name e1, name e2); \ +bool name ## _eq(name e1, name e2); \ +void name ## _update(name e1, type info); + +#define DEFINE_UFIND(name,type) \ +name new_ ## name(region r, type info) \ +{ \ + return (name)new_uf_element(r,info);\ +}\ +type name ## _get_info(name elem) \ +{ \ + return (type)uf_get_info((struct uf_element *)elem);\ +} \ +bool name ## _unify(name ## _combine_fn_ptr cmb,name e1, name e2) \ +{ \ + return uf_unify((combine_fn_ptr)cmb,(struct uf_element *)e1,(struct uf_element *)e2); \ +} \ +bool name ## _union(name e1, name e2) \ +{ \ + return uf_union((struct uf_element *)e1,(struct uf_element *)e2); \ +}\ +bool name ## _eq(name e1, name e2) \ +{ \ + return uf_eq((struct uf_element *)e1,(struct uf_element *)e2); \ +} \ +void name ##_update(name e1, type info) \ +{ \ + uf_update((struct uf_element *)e1,(uf_info)info); \ +} \ + +EXTERN_C_END + +#endif /* UFIND_H */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |