comparison src/elhash.c @ 243:f220cc83d72e r20-5b20

Import from CVS: tag r20-5b20
author cvs
date Mon, 13 Aug 2007 10:17:07 +0200
parents f955c73f5258
children 677f6a0ee643
comparison
equal deleted inserted replaced
242:fc816b73a05f 243:f220cc83d72e
836 CHECK_HASHTABLE (hashtable); 836 CHECK_HASHTABLE (hashtable);
837 ht_copy_to_c (XHASHTABLE (hashtable), &htbl); 837 ht_copy_to_c (XHASHTABLE (hashtable), &htbl);
838 return make_int (htbl.fullness); 838 return make_int (htbl.fullness);
839 } 839 }
840 840
841 DEFUN ("hashtable-type", Fhashtable_type, 1, 1, 0, /*
842 Return type of HASHTABLE.
843 This can be one of `non-weak', `weak', `key-weak' and `value-weak'.
844 */
845 (hashtable))
846 {
847 CHECK_HASHTABLE (hashtable);
848
849 switch (XHASHTABLE (hashtable)->type)
850 {
851 case HASHTABLE_WEAK:
852 return Qweak;
853 break;
854 case HASHTABLE_KEY_WEAK:
855 return Qkey_weak;
856 break;
857 case HASHTABLE_VALUE_WEAK:
858 return Qvalue_weak;
859 break;
860 default:
861 return Qnon_weak;
862 }
863 }
864
865 DEFUN ("hashtable-test-function", Fhashtable_test_function, 1, 1, 0, /*
866 Return test function of HASHTABLE.
867 This can be one of `eq', `eql' or `equal'.
868 */
869 (hashtable))
870 {
871 int (*fun) (CONST void *, CONST void *);
872
873 CHECK_HASHTABLE (hashtable);
874
875 fun = XHASHTABLE (hashtable)->test_function;
876
877 if (fun == lisp_object_eql_equal)
878 return Qeql;
879 else if (fun == lisp_object_equal_equal)
880 return Qequal;
881 else
882 return Qeq;
883 }
841 884
842 static void 885 static void
843 verify_function (Lisp_Object function, CONST char *description) 886 verify_function (Lisp_Object function, CONST char *description)
844 { 887 {
845 /* #### Unused DESCRIPTION? */ 888 /* #### Unused DESCRIPTION? */
898 941
899 /* This function is for mapping a *C* function over the elements of a 942 /* This function is for mapping a *C* function over the elements of a
900 lisp hashtable. 943 lisp hashtable.
901 */ 944 */
902 void 945 void
903 elisp_maphash (void (*function) (CONST void *key, void *contents, 946 elisp_maphash (int (*function) (CONST void *key, void *contents,
904 void *extra_arg), 947 void *extra_arg),
905 Lisp_Object hashtable, void *closure) 948 Lisp_Object hashtable, void *closure)
906 { 949 {
907 struct _C_hashtable htbl; 950 struct _C_hashtable htbl;
908 951
1282 DEFSUBR (Fputhash); 1325 DEFSUBR (Fputhash);
1283 DEFSUBR (Fremhash); 1326 DEFSUBR (Fremhash);
1284 DEFSUBR (Fclrhash); 1327 DEFSUBR (Fclrhash);
1285 DEFSUBR (Fmaphash); 1328 DEFSUBR (Fmaphash);
1286 DEFSUBR (Fhashtable_fullness); 1329 DEFSUBR (Fhashtable_fullness);
1330 DEFSUBR (Fhashtable_type);
1331 DEFSUBR (Fhashtable_test_function);
1287 DEFSUBR (Fmake_weak_hashtable); 1332 DEFSUBR (Fmake_weak_hashtable);
1288 DEFSUBR (Fmake_key_weak_hashtable); 1333 DEFSUBR (Fmake_key_weak_hashtable);
1289 DEFSUBR (Fmake_value_weak_hashtable); 1334 DEFSUBR (Fmake_value_weak_hashtable);
1290 #if 0 1335 #if 0
1291 DEFSUBR (Finternal_hash_value); 1336 DEFSUBR (Finternal_hash_value);