OSDN Git Service

2004-02-05 Kelley Cook <kcook@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / hashtable.h
index 5b08fde..8efbf5c 100644 (file)
@@ -1,5 +1,5 @@
 /* Hash tables.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -19,24 +19,21 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define GCC_HASHTABLE_H
 
 #include "obstack.h"
+#define GTY(x) /* nothing */
 
 /* This is what each hash table entry points to.  It may be embedded
    deeply within another object.  */
 typedef struct ht_identifier ht_identifier;
-struct ht_identifier
+struct ht_identifier GTY(())
 {
-  unsigned int len;
   const unsigned char *str;
+  unsigned int len;
+  unsigned int hash_value;
 };
 
 #define HT_LEN(NODE) ((NODE)->len)
 #define HT_STR(NODE) ((NODE)->str)
 
-/* We want code outside cpplib, such as the compiler front-ends, to be
-   able to include this header, and to be able to link with
-   cpphashtbl.o without pulling in any other parts of cpplib.  */
-
-struct cpp_reader;
 typedef struct ht hash_table;
 typedef struct ht_identifier *hashnode;
 
@@ -50,7 +47,7 @@ struct ht
 
   hashnode *entries;
   /* Call back.  */
-  hashnode (*alloc_node) PARAMS ((hash_table *));
+  hashnode (*alloc_node) (hash_table *);
 
   unsigned int nslots;         /* Total slots in the entries array.  */
   unsigned int nelements;      /* Number of live elements.  */
@@ -63,23 +60,22 @@ struct ht
   unsigned int collisions;
 };
 
-extern void gcc_obstack_init PARAMS ((struct obstack *));
-/* Initialise the hashtable with 2 ^ order entries.  */
-extern hash_table *ht_create PARAMS ((unsigned int order));
-extern hashnode ht_lookup PARAMS ((hash_table *, const unsigned char *,
-                                  unsigned int, enum ht_lookup_option));
+/* Initialize the hashtable with 2 ^ order entries.  */
+extern hash_table *ht_create (unsigned int order);
+
+/* Frees all memory associated with a hash table.  */
+extern void ht_destroy (hash_table *);
+
+extern hashnode ht_lookup (hash_table *, const unsigned char *,
+                          size_t, enum ht_lookup_option);
 
 /* For all nodes in TABLE, make a callback.  The callback takes
    TABLE->PFILE, the node, and a PTR, and the callback sequence stops
    if the callback returns zero.  */
-typedef int (*ht_cb) PARAMS ((struct cpp_reader *, hashnode, const void *));
-extern void ht_forall PARAMS ((hash_table *, ht_cb, const void *));
+typedef int (*ht_cb) (struct cpp_reader *, hashnode, const void *);
+extern void ht_forall (hash_table *, ht_cb, const void *);
 
 /* Dump allocation statistics to stderr.  */
-extern void ht_dump_statistics PARAMS ((hash_table *));
-
-/* Approximate positive square root of a host double.  This is for
-   statistical reports, not code generation.  */
-extern double approx_sqrt PARAMS ((double));
+extern void ht_dump_statistics (hash_table *);
 
 #endif /* GCC_HASHTABLE_H */