doxygen docu added, cleaned up a bit
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 27 May 2004 11:52:13 +0000 (11:52 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 27 May 2004 11:52:13 +0000 (11:52 +0000)
[r2959]

ir/adt/eset.c
ir/adt/eset.h

index 0538884..9bfe45e 100644 (file)
@@ -23,8 +23,8 @@ struct eset {
 static const int INITIAL_SLOTS = 64;
 
 
-static int pcmp(const void * * p1, const void * * p2, size_t size) {
-  return *p1 == *p2 ? 0 : 1;
+static int pcmp(const void ** p1, const void ** p2, size_t size) {
+  return *p1 != *p2;
 }
 
 
index 3f86aea..a4cbb00 100644 (file)
 
 #include <stdbool.h>
 
+/**
+ * "eset" is a set of addresses. The addresses are used for element
+ * compare and hash calculation.
+ * The value "NULL" could not be stored, as it is used as internal sentinel.
+ */
+typedef struct eset eset;
 
-/* "eset" ist eine Menge von Adressen. Der Vergleich und das Hashen
- * wird über die Adresse gemacht. "NULL" sollte nicht gespeichert
- * werden. */
+/** Creates a new empty set. */
+eset * eset_create(void);
 
-typedef struct eset eset;
+/**
+ * Creates a copy of the given set. Did NOT work if NULL is contained in source. */
+eset * eset_copy(eset *source);
 
+/** Deletes a set. */
+void eset_destroy(eset *s);
 
-/* Erzeugt eine neue leere Menge. */
-eset * eset_create(void);
+/** Inserts an address into the set. */
+void eset_insert(eset *s, void *p);
 
-/* Erzeugt eine Kopie der übergebenen Menge. Das Kopieren funktioniert
- * nur, wenn in der übergebenen Menge "NULL" nicht enthalten ist. */
-eset * eset_copy(eset *);
-
-/* Löscht die Menge. */
-void eset_destroy(eset *);
-
-/* Fügt ein Adresse in die Menge ein, wenn es nicht bereits in der
- * Menge enthalten ist. */
-void eset_insert(eset *, void *);
-
-/* Prüft ob eine Adresse in der Menge enthalten ist. */
-bool eset_contains(eset *, void *);
-
-/* 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
- * einfuegen!! */
-void * eset_first(eset *);
-void * eset_next(eset *);
-
-/* 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);
+/** Checks, wheater an address is element of a set. */
+bool eset_contains(eset *s, void *p);
 
+/**
+ * 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);
+
+/**
+ * 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). Did NOT work if NULL is contained in source. */
+void eset_insert_all(eset * target, eset * source);
 
 #endif /* _ESET_H_ */