hash.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* hash.h - for hash.c
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. #ifndef hashH
  16. #define hashH
  17. struct hash_entry
  18. {
  19. char * hash_string; /* points to where the symbol string is */
  20. /* NULL means slot is not used */
  21. /* DELETED means slot was deleted */
  22. char * hash_value; /* user's datum, associated with symbol */
  23. };
  24. #define HASH_STATLENGTH (6)
  25. struct hash_control
  26. {
  27. struct hash_entry * hash_where; /* address of hash table */
  28. int hash_sizelog; /* Log of ( hash_mask + 1 ) */
  29. int hash_mask; /* masks a hash into index into table */
  30. int hash_full; /* when hash_stat[STAT_USED] exceeds this, */
  31. /* grow table */
  32. struct hash_entry * hash_wall; /* point just after last (usable) entry */
  33. /* here we have some statistics */
  34. int hash_stat[HASH_STATLENGTH]; /* lies & statistics */
  35. /* we need STAT_USED & STAT_SIZE */
  36. };
  37. /* returns */
  38. struct hash_control * hash_new(); /* [control block] */
  39. void hash_die();
  40. void hash_say();
  41. char * hash_delete(); /* previous value */
  42. char * hash_relpace(); /* previous value */
  43. char * hash_insert(); /* error string */
  44. char * hash_apply(); /* 0 means OK */
  45. char * hash_find(); /* value */
  46. char * hash_jam(); /* error text (internal) */
  47. #endif /* #ifdef hashH */
  48. /* end: hash.c */