chiark / gitweb /
Allow things to be looked up by just their caller-supplied hashes. This
[mLib] / sym.h
diff --git a/sym.h b/sym.h
index fab69159ee54a9049507d5a931857a376f84c7c9..94d43c51847047348f0d9e6e1765bae0cf122ee9 100644 (file)
--- a/sym.h
+++ b/sym.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sym.h,v 1.6 1999/05/26 21:08:31 mdw Exp $
+ * $Id: sym.h,v 1.7 1999/06/01 09:49:33 mdw Exp $
  *
  * Symbol table management
  *
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: sym.h,v $
+ * Revision 1.7  1999/06/01 09:49:33  mdw
+ * Allow things to be looked up by just their caller-supplied hashes.  This
+ * actually needs to be thought through better.
+ *
  * Revision 1.6  1999/05/26 21:08:31  mdw
  * Rename symbols in line with newer conventions.
  *
 
 #include <stddef.h>
 
+#ifndef BITS_H
+#  include "bits.h"
+#endif
+
 /*----- Type definitions --------------------------------------------------*/
 
 /* --- Symbol table --- *
@@ -89,7 +97,7 @@ typedef struct sym_table {
 
 typedef struct sym_base {
   struct sym_base *next;               /* Next symbol in hash bin */
-  unsigned long hash;                  /* Hash value for symbol's name */
+  uint32 hash;                         /* Hash value for symbol's name */
   union {
     char *p;                           /* Pointer to name string */
     char b[SYM_BUFSZ];                 /* Buffer containing a short name */
@@ -154,7 +162,9 @@ extern void sym_destroy(sym_table */*t*/);
  *             may be given, in which case the name may contain arbitrary
  *             binary data, or it may be given as a negative number, in
  *             which case the length of the name is calculated as
- *             @strlen(n)@.
+ *             @strlen(n) + 1@.  The name pointer @n@ may also be zero; in
+ *             this case, @l@ is taken to be a raw hash, and any element
+ *             with a matching hash is taken to be the one wanted.
  *
  *             The return value is the address of a pointer to a @sym_base@
  *             block (which may have other things on the end, as above).  If