X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Feset.h;h=14a6effabb5fd64785d9fbc32e35f3efb5aeaaaa;hb=d0d85962ef52c14950db90e5981a7bea36023ab3;hp=8cc569646347f12b950d7d63c6e1a273edce1cdd;hpb=f57a7ef2f9c161fc1815dd10098d61bb4259eb5f;p=libfirm diff --git a/ir/adt/eset.h b/ir/adt/eset.h index 8cc569646..14a6effab 100644 --- a/ir/adt/eset.h +++ b/ir/adt/eset.h @@ -1,59 +1,61 @@ -/* ------------------------------------------------------------------- - * $Id$ - * ------------------------------------------------------------------- - * Datentyp: Vereinfachte Menge (hash-set) zum Speichern von - * Zeigern/Adressen. - * - * Erstellt: Hubert Schmid, 09.06.2002 - * ---------------------------------------------------------------- */ - - +/* + * Project: libFIRM + * File name: ir/adt/eset.h + * Purpose: Datentyp: Vereinfachte Menge (hash-set) zum Speichern von + * Zeigern/Adressen. + * Author: Hubert Schmid + * Modified by: + * Created: 09.06.2002 + * CVS-ID: $Id$ + * Copyright: (c) 2002 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ #ifndef _ESET_H_ #define _ESET_H_ - -#include - - -/* "eset" ist eine Menge von Adressen. Der Vergleich und das Hashen - * wird über die Adresse gemacht. "NULL" sollte nicht gespeichert - * werden. */ - +/** + * "eset" is a set of addresses. The addresses are used for element + * compare and hash calculation. + * The value "NULL" can not be stored, as it is used as internal sentinel. + */ typedef struct eset eset; +/** Creates a new empty set. */ +eset *eset_create(void); -/* Erzeugt eine neue leere Menge. */ -eset * eset_create(void); +/** + * Creates a copy of the given set. Does NOT work if NULL is contained in source. */ +eset *eset_copy(eset *source); -/* Erzeugt eine Kopie der übergebenen Menge. Das Kopieren funktioniert - * nur, wenn in der übergebenen Menge "NULL" nicht enthalten ist. */ -eset * eset_copy(eset *); +/** Deletes a set. */ +void eset_destroy(eset *s); -/* Löscht die Menge. */ -void eset_destroy(eset *); +/** Returns the number of elements in the set. */ +int eset_count(eset *s); -/* Fügt ein Adresse in die Menge ein, wenn es nicht bereits in der - * Menge enthalten ist. */ -void eset_insert(eset *, void *); +/** Inserts an address into the set. */ +void eset_insert(eset *s, void *p); -/* Prüft ob eine Adresse in der Menge enthalten ist. */ -bool eset_contains(eset *, void *); +/** Checks, whether an address is element of a set. */ +int eset_contains(eset *s, void *p); -/* Mit den Funktionen "eset_first" und "eset_next" kann man durch die - * Menge iterieren. Die Funktion gibt jeweils die Adresse zurück. Wenn - * keine weiteren Adressen in der Menge sind, geben die Funktionen - * "NULL" zurück. Warnung: Man sollte deshalb "NULL" nicht in der - * Menge speichern, weil man sonst nicht durch die Menge iterieren - * kann. - * ACHTUNG: Waehrend dem iterieren darf man keine neuen Elemente - * einfuergen!! */ -void * eset_first(eset *); -void * eset_next(eset *); +/** + * Starts the iteration over a set and returns the first element or NULL + * if the set is empty. + * + * @note: It is NOT possible to add new elements while iterating through a set. + */ +void *eset_first(eset *s); -/* Fügt alle Elemente der Menge "source" der Menge "target" - * hinzu. Diese Funktion funktioniert nur, wenn in der Menge "source" - * die "NULL"-Adresse nicht enthalten ist. */ -void eset_insert_all(eset * target, eset * source); +/** + * Continues iteration through a set and returns the next element or NULL if the + * iteration is finished. + * + * @note: It is NOT possible to add new elements while iterating through a set. + */ +void *eset_next(eset *s); +/** Inserts all elements of source into target (union). Does NOT work if NULL is contained in source. */ +void eset_insert_all(eset *target, eset *source); #endif /* _ESET_H_ */