replaced char* by idents, minor fix in Firm codegen for call
[libfirm] / ir / adt / pset.h
index 3661d65..059005f 100644 (file)
@@ -1,12 +1,13 @@
-/* Declarations for pset.
-   Copyright (C) 1995, 1996 Markus Armbruster */
-
-/* $Id$ */
-
-/**
- * @file pset.h
- *
- * Declarations for pset.
+/*
+ * Project:     libFIRM
+ * File name:   ir/adt/pset.h
+ * Purpose:     Declarations for pset.
+ * Author:      Markus Armbruster
+ * Modified by:
+ * Created:     1999 by getting from fiasco
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 1995, 1996 Markus Armbruster
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
 #ifndef _PSET_H
@@ -44,8 +45,9 @@ typedef int (*pset_cmp_fun) (const void *elt, const void *key);
 /**
  * Creates a new pset.
  *
- * @param func    the compare function of this pset
- * @param slots   number of slots
+ * @param func    The compare function of this pset.
+ * @param slots   Initial number of collision chains.  I.e., #slots
+ *                different keys can be hashed without collisions.
  *
  * @returns
  *    created pset
@@ -55,16 +57,25 @@ pset *new_pset (pset_cmp_fun func, int slots);
 /**
  * Deletes a pset.
  *
+ * @param pset   the pset
+ *
  * @note
  *    This does NOT delete the elements of this pset, just it's pointers!
  */
 void del_pset (pset *pset);
 
+/**
+ * Returns the number of elements in a pset.
+ *
+ * @param pset   the pset
+ */
+int pset_count (pset *pset);
+
 /**
  * Searches an element pointer in a pset.
  *
  * @param pset  the pset to search in
- * @param key   the element to is searched
+ * @param key   the element to search
  * @param hash  the hash value of key
  *
  * @return
@@ -84,7 +95,7 @@ void *pset_find (pset *pset, const void *key, unsigned hash);
  * @note
  *    It is not possible to insert on element more than once. If a element
  *    that should be inserted is already in the set, this functions does
- *    nothing but returning its set_entry.
+ *    nothing but returning its already existing set_entry.
 
  */
 void *pset_insert (pset *pset, const void *key, unsigned hash);
@@ -116,17 +127,38 @@ pset_entry *pset_hinsert (pset *pset, const void *key, unsigned hash);
  *    the pointer to the removed element
  *
  * @remark
- *    The current implementation did not allow to remove non-existing elements
+ *    The current implementation did not allow to remove non-existing elements.
+ *    Further, it is allowed to remove elements during an iteration
+ *    including the current one.
  */
 void *pset_remove (pset *pset, const void *key, unsigned hash);
 
-/** returns the first element of a pset */
+/**
+ * Returns the first element of a pset.
+ *
+ * @param pset  the pset to iterate
+ *
+ * @return a pointer to the element or NULL if the set is empty
+ */
 void *pset_first (pset *pset);
 
-/** returns the next element of a pset */
+/**
+ * Returns the next element of a pset.
+ *
+ * @param pset  the pset to iterate
+ *
+ * @return a pointer to the next element or NULL if the
+ *         iteration is finished
+ */
 void *pset_next (pset *pset);
 
-/** Breaks the iteration of a set. Must be called before the next pset_first() call */
+/**
+ * Breaks the iteration of a set. Must be called before
+ * the next pset_first() call if the iteration was NOT
+ * finished.
+ *
+ * @param pset  the pset
+ */
 void pset_break (pset *pset);
 
 #define new_pset(cmp, slots) (PSET_TRACE (new_pset) ((cmp), (slots)))
@@ -138,12 +170,21 @@ void pset_break (pset *pset);
   ((pset_entry *)_pset_search ((pset), (key), (hash), _pset_hinsert))
 
 #ifdef STATS
-void pset_stats (pset *);
+/**
+ * Prints statistics on a set to stdout.
+ *
+ * @param pset  the pset
+ */
+void pset_stats (pset *pset);
 #else
 # define pset_stats(s) ((void)0)
 #endif
 
 #ifdef DEBUG
+/**
+ * Describe a set by printing all elements
+ * to stdout.
+ */
 void pset_describe (pset *);
 #endif