move FIRM_NOTHROW, FIRM_PRINTF to obstack.h header
[libfirm] / include / libfirm / adt / set.h
index b9f9617..6491fa7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -21,7 +21,6 @@
  * @file
  * @brief       hashset: datastructure containing objects accessible by their key
  * @author      Markus Armbruster
- * @version     $Id$
  */
 #ifndef FIRM_ADT_SET_H
 #define FIRM_ADT_SET_H
  */
 typedef struct set set;
 
-/** The entry of a set, representing an element in the set and it's meta-information */
+/** The entry of a set, representing an element in the set and its meta-information */
 typedef struct set_entry {
-  unsigned hash;    /**< the hash value of the element */
-  size_t size;      /**< the size of the element */
-  int dptr[1];     /**< the element itself, data copied in must not need more
-                         alignment than this */
+       unsigned hash;  /**< the hash value of the element */
+       size_t size;    /**< the size of the element */
+       int dptr[1];    /**< the element itself, data copied in must not need more
+                            alignment than this */
 } set_entry;
 
 /**
@@ -75,7 +74,7 @@ typedef int (*set_cmp_fun) (const void *elt, const void *key, size_t size);
  * @returns
  *    created set
  */
-FIRM_API set *new_set(set_cmp_fun func, int slots);
+FIRM_API set *new_set(set_cmp_fun func, size_t slots);
 
 /**
  * Deletes a set and all elements of it.
@@ -89,7 +88,7 @@ FIRM_API void del_set(set *set);
  *
  * @param set   the set
  */
-FIRM_API int set_count(set *set);
+FIRM_API size_t set_count(set *set);
 
 /**
  * Searches an element in a set.
@@ -187,12 +186,13 @@ FIRM_API void set_break(set *set);
  * Iterates over an set.
  *
  * @param set    the set
+ * @param type   type of iterator variable
  * @param entry  the iterator
  */
-#define foreach_set(set, entry) for (entry = set_first(set); entry; entry = set_next(set))
+#define foreach_set(set, type, entry) for (entry = (type) set_first(set); entry; entry = (type) set_next(set))
 
 /* implementation specific */
-#define new_set(cmp, slots) (SET_TRACE (new_set) ((cmp), (slots)))
+#define new_set(cmp, slots) ((new_set) ((cmp), (slots)))
 #define set_find(set, key, size, hash) \
   _set_search ((set), (key), (size), (hash), _set_find)
 #define set_insert(set, key, size, hash) \
@@ -202,50 +202,12 @@ FIRM_API void set_break(set *set);
 #define set_hinsert0(set, key, size, hash) \
   ((set_entry *)_set_search ((set), (key), (size), (hash), _set_hinsert0))
 
-#define SET_VRFY(set) (void)0
-
-#ifdef STATS
-/**
- * Prints statistics on a set to stdout.
- *
- * @param set  the set
- */
-void set_stats (set *set);
-#else
-# define set_stats(s) ((void)0)
-#endif
-
-#ifdef DEBUG
-/**
- * Describe a set.
- *
- * Writes a description of a set to stdout. The description includes:
- * - a header telling how many elements (nkey) and segments (nseg) are in use
- * - for every collision chain the number of element with its hash values
- *
- * @param set  the set
- */
-FIRM_API void set_describe (set *set);
-#endif
-
-
 /* Private */
 
 typedef enum { _set_find, _set_insert, _set_hinsert, _set_hinsert0 } _set_action;
 
 FIRM_API void *_set_search(set *, const void *, size_t, unsigned, _set_action);
 
-#if defined(DEBUG) && defined(HAVE_GNU_MALLOC)
-extern const char *set_tag;
-# ifdef SET_ID
-#   define SET_TRACE set_tag = SET_ID,
-# else
-#   define SET_TRACE set_tag = __FILE__,
-# endif
-#else /* !(DEBUG && HAVE_GNU_MALLOC) */
-#   define SET_TRACE
-#endif /* !(DEBUG && HAVE_GNU_MALLOC) */
-
 #include "../end.h"
 
 #endif