X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Felhash.h;h=7c4fe9c04f970dd3d562fe5dc5bfdfa394133aa1;hb=3a82ca503a2678b75aacb3b4d3ef66897f7fd03c;hp=1551fa3b55782cc8ba04d44ba0b95f84272ba10c;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/src/elhash.h b/src/elhash.h index 1551fa3..7c4fe9c 100644 --- a/src/elhash.h +++ b/src/elhash.h @@ -20,59 +20,79 @@ Boston, MA 02111-1307, USA. */ /* Synched up with: Not in FSF. */ -#ifndef _XEMACS_ELHASH_H_ -#define _XEMACS_ELHASH_H_ +#ifndef INCLUDED_elhash_h_ +#define INCLUDED_elhash_h_ -DECLARE_LRECORD (hashtable, struct hashtable); +typedef struct Lisp_Hash_Table Lisp_Hash_Table; -#define XHASHTABLE(x) XRECORD (x, hashtable, struct hashtable) -#define XSETHASHTABLE(x, p) XSETRECORD (x, p, hashtable) -#define HASHTABLEP(x) RECORDP (x, hashtable) -#define GC_HASHTABLEP(x) GC_RECORDP (x, hashtable) -#define CHECK_HASHTABLE(x) CHECK_RECORD (x, hashtable) -#define CONCHECK_HASHTABLE(x) CONCHECK_RECORD (x, hashtable) +DECLARE_LRECORD (hash_table, Lisp_Hash_Table); -enum hashtable_type +#define XHASH_TABLE(x) XRECORD (x, hash_table, Lisp_Hash_Table) +#define XSETHASH_TABLE(x, p) XSETRECORD (x, p, hash_table) +#define HASH_TABLEP(x) RECORDP (x, hash_table) +#define CHECK_HASH_TABLE(x) CHECK_RECORD (x, hash_table) +#define CONCHECK_HASH_TABLE(x) CONCHECK_RECORD (x, hash_table) + +enum hash_table_weakness { - HASHTABLE_NONWEAK, - HASHTABLE_KEY_WEAK, - HASHTABLE_VALUE_WEAK, - HASHTABLE_KEY_CAR_WEAK, - HASHTABLE_VALUE_CAR_WEAK, - HASHTABLE_WEAK + HASH_TABLE_NON_WEAK, + HASH_TABLE_KEY_WEAK, + HASH_TABLE_VALUE_WEAK, + HASH_TABLE_KEY_VALUE_WEAK, + HASH_TABLE_KEY_CAR_WEAK, + HASH_TABLE_VALUE_CAR_WEAK, + HASH_TABLE_KEY_CAR_VALUE_WEAK, + HASH_TABLE_WEAK }; -enum hashtable_test_fun +enum hash_table_test { - HASHTABLE_EQ, - HASHTABLE_EQL, - HASHTABLE_EQUAL + HASH_TABLE_EQ, + HASH_TABLE_EQL, + HASH_TABLE_EQUAL }; -EXFUN (Fcopy_hashtable, 1); -EXFUN (Fhashtable_fullness, 1); +extern const struct lrecord_description hash_table_description[]; + +EXFUN (Fcopy_hash_table, 1); +EXFUN (Fhash_table_count, 1); +EXFUN (Fgethash, 3); +EXFUN (Fputhash, 3); EXFUN (Fremhash, 2); +EXFUN (Fclrhash, 1); + +typedef unsigned long hashcode_t; +typedef int (*hash_table_test_function_t) (Lisp_Object obj1, Lisp_Object obj2); +typedef unsigned long (*hash_table_hash_function_t) (Lisp_Object obj); +typedef int (*maphash_function_t) (Lisp_Object key, Lisp_Object value, + void* extra_arg); + +Lisp_Object make_standard_lisp_hash_table (enum hash_table_test test, + size_t size, + double rehash_size, + double rehash_threshold, + enum hash_table_weakness weakness); + +Lisp_Object make_general_lisp_hash_table (hash_table_hash_function_t hash_function, + hash_table_test_function_t test_function, + size_t size, + double rehash_size, + double rehash_threshold, + enum hash_table_weakness weakness); -Lisp_Object make_lisp_hashtable (int size, - enum hashtable_type type, - enum hashtable_test_fun test_fun); +Lisp_Object make_lisp_hash_table (size_t size, + enum hash_table_weakness weakness, + enum hash_table_test test); -void elisp_maphash (int (*fn) (CONST void *key, void *contents, - void *extra_arg), - Lisp_Object table, - void *extra_arg); +void elisp_maphash (maphash_function_t function, + Lisp_Object hash_table, void *extra_arg); -void elisp_map_remhash (int (*fn) (CONST void *key, - CONST void *contents, - void *extra_arg), - Lisp_Object table, - void *extra_arg); +void elisp_map_remhash (maphash_function_t predicate, + Lisp_Object hash_table, void *extra_arg); -int finish_marking_weak_hashtables (int (*obj_marked_p) (Lisp_Object), - void (*markobj) (Lisp_Object)); -void prune_weak_hashtables (int (*obj_marked_p) (Lisp_Object)); +int finish_marking_weak_hash_tables (void); +void prune_weak_hash_tables (void); -void *elisp_hvector_malloc (unsigned int, Lisp_Object); -void elisp_hvector_free (void *ptr, Lisp_Object table); +void pdump_reorganize_hash_table (Lisp_Object); -#endif /* _XEMACS_ELHASH_H_ */ +#endif /* INCLUDED_elhash_h_ */