comparison src/elhash.h @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents c5d627a313b1
children 74fd4e045ea6
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
21 /* Synched up with: Not in FSF. */ 21 /* Synched up with: Not in FSF. */
22 22
23 #ifndef _XEMACS_ELHASH_H_ 23 #ifndef _XEMACS_ELHASH_H_
24 #define _XEMACS_ELHASH_H_ 24 #define _XEMACS_ELHASH_H_
25 25
26 DECLARE_LRECORD (hashtable, struct hashtable); 26 DECLARE_LRECORD (hash_table, struct Lisp_Hash_Table);
27 27
28 #define XHASHTABLE(x) XRECORD (x, hashtable, struct hashtable) 28 #define XHASH_TABLE(x) XRECORD (x, hash_table, struct Lisp_Hash_Table)
29 #define XSETHASHTABLE(x, p) XSETRECORD (x, p, hashtable) 29 #define XSETHASH_TABLE(x, p) XSETRECORD (x, p, hash_table)
30 #define HASHTABLEP(x) RECORDP (x, hashtable) 30 #define HASH_TABLEP(x) RECORDP (x, hash_table)
31 #define GC_HASHTABLEP(x) GC_RECORDP (x, hashtable) 31 #define GC_HASH_TABLEP(x) GC_RECORDP (x, hash_table)
32 #define CHECK_HASHTABLE(x) CHECK_RECORD (x, hashtable) 32 #define CHECK_HASH_TABLE(x) CHECK_RECORD (x, hash_table)
33 #define CONCHECK_HASHTABLE(x) CONCHECK_RECORD (x, hashtable) 33 #define CONCHECK_HASH_TABLE(x) CONCHECK_RECORD (x, hash_table)
34 34
35 enum hashtable_type 35 enum hash_table_type
36 { 36 {
37 HASHTABLE_NONWEAK, 37 HASH_TABLE_NON_WEAK,
38 HASHTABLE_KEY_WEAK, 38 HASH_TABLE_KEY_WEAK,
39 HASHTABLE_VALUE_WEAK, 39 HASH_TABLE_VALUE_WEAK,
40 HASHTABLE_KEY_CAR_WEAK, 40 HASH_TABLE_KEY_CAR_WEAK,
41 HASHTABLE_VALUE_CAR_WEAK, 41 HASH_TABLE_VALUE_CAR_WEAK,
42 HASHTABLE_WEAK 42 HASH_TABLE_WEAK
43 }; 43 };
44 44
45 enum hashtable_test_fun 45 enum hash_table_test
46 { 46 {
47 HASHTABLE_EQ, 47 HASH_TABLE_EQ,
48 HASHTABLE_EQL, 48 HASH_TABLE_EQL,
49 HASHTABLE_EQUAL 49 HASH_TABLE_EQUAL
50 }; 50 };
51 51
52 EXFUN (Fcopy_hashtable, 1); 52 EXFUN (Fcopy_hash_table, 1);
53 EXFUN (Fhashtable_fullness, 1); 53 EXFUN (Fhash_table_count, 1);
54 EXFUN (Fgethash, 3);
55 EXFUN (Fputhash, 3);
54 EXFUN (Fremhash, 2); 56 EXFUN (Fremhash, 2);
57 EXFUN (Fclrhash, 1);
55 58
56 Lisp_Object make_lisp_hashtable (int size, 59 typedef unsigned long hashcode_t;
57 enum hashtable_type type, 60 typedef int (*hash_table_test_function_t) (Lisp_Object obj1, Lisp_Object obj2);
58 enum hashtable_test_fun test_fun); 61 typedef unsigned long (*hash_table_hash_function_t) (Lisp_Object obj);
62 typedef int (*maphash_function_t) (Lisp_Object key, Lisp_Object value,
63 void* extra_arg);
59 64
60 void elisp_maphash (int (*fn) (CONST void *key, void *contents,
61 void *extra_arg),
62 Lisp_Object table,
63 void *extra_arg);
64 65
65 void elisp_map_remhash (int (*fn) (CONST void *key, 66 Lisp_Object make_general_lisp_hash_table (size_t size,
66 CONST void *contents, 67 enum hash_table_type type,
67 void *extra_arg), 68 enum hash_table_test test,
68 Lisp_Object table, 69 double rehash_threshold,
69 void *extra_arg); 70 double rehash_size);
70 71
71 int finish_marking_weak_hashtables (int (*obj_marked_p) (Lisp_Object), 72 Lisp_Object make_lisp_hash_table (size_t size,
72 void (*markobj) (Lisp_Object)); 73 enum hash_table_type type,
73 void prune_weak_hashtables (int (*obj_marked_p) (Lisp_Object)); 74 enum hash_table_test test);
74 75
75 void *elisp_hvector_malloc (unsigned int, Lisp_Object); 76 void elisp_maphash (maphash_function_t function,
76 void elisp_hvector_free (void *ptr, Lisp_Object table); 77 Lisp_Object hash_table, void *extra_arg);
78
79 void elisp_map_remhash (maphash_function_t predicate,
80 Lisp_Object hash_table, void *extra_arg);
81
82 int finish_marking_weak_hash_tables (int (*obj_marked_p) (Lisp_Object),
83 void (*markobj) (Lisp_Object));
84 void prune_weak_hash_tables (int (*obj_marked_p) (Lisp_Object));
77 85
78 #endif /* _XEMACS_ELHASH_H_ */ 86 #endif /* _XEMACS_ELHASH_H_ */