/tools/Ruby/lib/ruby/1.8/i386-mingw32/st.h

http://github.com/agross/netopenspace · C Header · 72 lines · 55 code · 15 blank · 2 comment · 3 complexity · c7e8653d87d0328098b838b05a53478e MD5 · raw file

  1. /* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
  2. /* @(#) st.h 5.1 89/12/14 */
  3. #ifndef ST_INCLUDED
  4. #define ST_INCLUDED
  5. #if SIZEOF_LONG == SIZEOF_VOIDP
  6. typedef unsigned long st_data_t;
  7. #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
  8. typedef unsigned LONG_LONG st_data_t;
  9. #else
  10. # error ---->> st.c requires sizeof(void*) == sizeof(long) to be compiled. <<---
  11. -
  12. #endif
  13. #define ST_DATA_T_DEFINED
  14. typedef struct st_table st_table;
  15. struct st_hash_type {
  16. int (*compare)();
  17. int (*hash)();
  18. };
  19. struct st_table {
  20. struct st_hash_type *type;
  21. int num_bins;
  22. int num_entries;
  23. struct st_table_entry **bins;
  24. };
  25. #define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
  26. enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
  27. #ifndef _
  28. # define _(args) args
  29. #endif
  30. #ifndef ANYARGS
  31. # ifdef __cplusplus
  32. # define ANYARGS ...
  33. # else
  34. # define ANYARGS
  35. # endif
  36. #endif
  37. st_table *st_init_table _((struct st_hash_type *));
  38. st_table *st_init_table_with_size _((struct st_hash_type *, int));
  39. st_table *st_init_numtable _((void));
  40. st_table *st_init_numtable_with_size _((int));
  41. st_table *st_init_strtable _((void));
  42. st_table *st_init_strtable_with_size _((int));
  43. int st_delete _((st_table *, st_data_t *, st_data_t *));
  44. int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t));
  45. int st_insert _((st_table *, st_data_t, st_data_t));
  46. int st_lookup _((st_table *, st_data_t, st_data_t *));
  47. int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
  48. void st_add_direct _((st_table *, st_data_t, st_data_t));
  49. void st_free_table _((st_table *));
  50. void st_cleanup_safe _((st_table *, st_data_t));
  51. st_table *st_copy _((st_table *));
  52. #define ST_NUMCMP ((int (*)()) 0)
  53. #define ST_NUMHASH ((int (*)()) -2)
  54. #define st_numcmp ST_NUMCMP
  55. #define st_numhash ST_NUMHASH
  56. int st_strhash();
  57. #endif /* ST_INCLUDED */