X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Flibfirm%2Fadt%2Fcpset.h;h=80c3c5d19b5ee5a21683aef2ca8dc2016af59dfc;hb=13bb23b1b6c8353b0ca15c13ef70d56d44f4f3c3;hp=60e06d8bad99457c19b9428a269baf535b829aef;hpb=435253f3a8766fec2ac2adf559bb10cfcb5d36f4;p=libfirm diff --git a/include/libfirm/adt/cpset.h b/include/libfirm/adt/cpset.h index 60e06d8ba..80c3c5d19 100644 --- a/include/libfirm/adt/cpset.h +++ b/include/libfirm/adt/cpset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -27,6 +27,8 @@ #ifndef FIRM_ADT_CPSET_H #define FIRM_ADT_CPSET_H +#include "../begin.h" + /** * The type of a cpset compare function. * @@ -39,11 +41,6 @@ typedef int (*cpset_cmp_function) (const void *p1, const void *p2); /** * The type of a cpset hash function. - * - * @param p1 pointer to an element - * @param p2 pointer to another element - * - * @return 1 if the elements are identically, zero else */ typedef unsigned (*cpset_hash_function) (const void *obj); @@ -59,23 +56,28 @@ typedef unsigned (*cpset_hash_function) (const void *obj); #undef HashSetIterator #undef HashSet +typedef struct cpset_t cpset_t; +typedef struct cpset_iterator_t cpset_iterator_t; + /** * Initializes a cpset * - * @param cpset Pointer to allocated space for the cpset - * @param cmp_function The compare function to use + * @param cpset Pointer to allocated space for the cpset + * @param hash_function The hash function to use + * @param cmp_function The compare function to use */ -void cpset_init(cpset_t *cpset, cpset_hash_function hash_function, +FIRM_API void cpset_init(cpset_t *cpset, cpset_hash_function hash_function, cpset_cmp_function cmp_function); /** * Initializes a cpset * - * @param cpset Pointer to allocated space for the cpset - * @param cmp_function The compare function to use - * @param expected_elements Number of elements expected in the cpset (roughly) + * @param cpset Pointer to allocated space for the cpset + * @param hash_function The hash function to use + * @param cmp_function The compare function to use + * @param expected_elements Number of elements expected in the cpset (roughly) */ -void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function, +FIRM_API void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function, cpset_cmp_function cmp_function, size_t expected_elements); @@ -85,7 +87,7 @@ void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function, * * @param cpset Pointer to the cpset */ -void cpset_destroy(cpset_t *cpset); +FIRM_API void cpset_destroy(cpset_t *cpset); /** * Inserts an element into a cpset. @@ -94,7 +96,7 @@ void cpset_destroy(cpset_t *cpset); * @param obj Element to insert into the cpset * @returns The element itself or a pointer to an existing element */ -void* cpset_insert(cpset_t *cpset, void *obj); +FIRM_API void* cpset_insert(cpset_t *cpset, void *obj); /** * Removes an element from a cpset. Does nothing if the cpset doesn't contain the @@ -103,7 +105,7 @@ void* cpset_insert(cpset_t *cpset, void *obj); * @param cpset Pointer to the cpset * @param obj Pointer to remove from the cpset */ -void cpset_remove(cpset_t *cpset, const void *obj); +FIRM_API void cpset_remove(cpset_t *cpset, const void *obj); /** * Tests whether a cpset contains a pointer @@ -112,7 +114,7 @@ void cpset_remove(cpset_t *cpset, const void *obj); * @param obj The pointer to find * @returns An equivalent object to @p obj or NULL */ -void *cpset_find(const cpset_t *cpset, const void *obj); +FIRM_API void *cpset_find(const cpset_t *cpset, const void *obj); /** * Returns the number of pointers contained in the cpset @@ -120,7 +122,7 @@ void *cpset_find(const cpset_t *cpset, const void *obj); * @param cpset Pointer to the cpset * @returns Number of pointers contained in the cpset */ -size_t cpset_size(const cpset_t *cpset); +FIRM_API size_t cpset_size(const cpset_t *cpset); /** * Initializes a cpset iterator. Sets the iterator before the first element in @@ -129,7 +131,7 @@ size_t cpset_size(const cpset_t *cpset); * @param iterator Pointer to already allocated iterator memory * @param cpset Pointer to the cpset */ -void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset); +FIRM_API void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset); /** * Advances the iterator and returns the current element or NULL if all elements @@ -140,7 +142,7 @@ void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset); * @param iterator Pointer to the cpset iterator. * @returns Next element in the cpset or NULL */ -void *cpset_iterator_next(cpset_iterator_t *iterator); +FIRM_API void *cpset_iterator_next(cpset_iterator_t *iterator); /** * Removed the element the iterator currently points to @@ -148,6 +150,8 @@ void *cpset_iterator_next(cpset_iterator_t *iterator); * @param cpset Pointer to the cpset * @param iterator Pointer to the cpset iterator. */ -void cpset_remove_iterator(cpset_t *cpset, const cpset_iterator_t *iterator); +FIRM_API void cpset_remove_iterator(cpset_t *cpset, const cpset_iterator_t *iterator); + +#include "../end.h" -#endif /* FIRM_ADT_CPSET_H */ +#endif