* libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New
types.
(scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them.
* libguile/hashtab.c (scm_internal_hash_fold): Take an
`scm_t_hash_fold_fn'. Update callers.
(scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'.
Update callers.
This is a followup to d587c9e8b2 ("Use
proper types for hash/assoc functions in `hashtab.h'.").
* libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x,
scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use
`scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate.
Partly fixes bug #23681 ("Function declarators with empty parentheses
should not be used").
* libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'.
* libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions
of type `scm_t_hash_fn' and `scm_t_assoc_fn'. Update callers.
(scm_ihashx): Change to match `scm_t_hash_fn'.
(scm_sloppy_assx): Change to match `scm_t_assoc_fn'.
* libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types.
(scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'.
(scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x,
scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to
take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters.
* libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle,
scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of
`scm_hash_fn_*'.
* libguile/struct.c (scm_struct_ihashq): Change to match
`scm_t_hash_fn'.
(scm_struct_create_handle): Cast `scm_sloppy_assq'.
* libguile/struct.h (scm_struct_ihashq): Update, make internal.
* libguile/hashtab.c (scm_i_rehash): Don't invoke
`SCM_HASHTABLE_DECREMENT ()' when a weak pair is encountered in the
source bucket.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-43
* libguile/hashtab.c (weak_hashtables): Removed.
(SCM_WEAK_CELL_DELETED_P): New macro.
(START_WEAK_BUCKET_FIXUP): Added the HASHFN argument. Invoke
`scm_i_rehash ()' when pairs have been removed.
(END_WEAK_BUCKET_FIXUP): Added the HASHFN argument.
(make_hash_table): Use `SCM_NEWSMOB2 ()' instead of `SCM_NEWSMOB3 ()'
-- last argument used to be WEAK_HASHTABLES.
(scm_i_rehash): Handle weak hash tables.
(to_rehash): Removed.
(scm_internal_hash_fold): Use `SCM_WEAK_CELL_DELETED_P ()' rather than
hand-written equivalent code.
(rehash_after_gc): Removed.
(scm_hashtab_prehistory): Don't add it as an after-gc hook.
* libguile/hashtab.h (SCM_HASHTABLE_NEXT): Removed.
(SCM_HASHTABLE_NEXTLOC): Removed.
(SCM_SET_HASHTABLE_NEXT): Removed.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-38
* libguile/hashtab.c (scm_i_rehash): Return immediately if TABLE is weak.
(scm_hash_fn_create_handle_x): Explicitly mention that we don't support
weak alist vectors.
(scm_internal_hash_fold): Handle weak pairs within buckets.
* libguile/modules.c (scm_module_reverse_lookup): Handle weak alists
(currently, don't do anything if a NULL pair is met).
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-16
* libguile/hashtab.c (scm_fixup_weak_alist): Added a REMOVED_ITEMS
parameter. Fixed a bug in the case where PREV is `SCM_EOL'.
(IS_WEAK_THING): New macro.
(START_WEAK_BUCKET_FIXUP): New macro.
(END_WEAK_BUCKET_FIXUP): New macro.
(scm_hash_fn_get_handle)[buckets]: New variable. Use the above
macros.
(scm_hash_fn_create_handle_x): Likewise.
(scm_hash_fn_remove_x): Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-9
returns neither a pair nor #f, signal a wrong-type-arg error.
(Thanks to Gregory Marton for reporting this.)
* tests/hash.test: New "hashx" test supplied by Gregory Marton;
prior to today's fix in libguile/hashtab.c, this caused a
segmentation fault.
hashtable and guardian machinery but call the relevant functions
directly.
* guardians.h, guardians.c, deprecated.h,
deprecated.c (scm_destroy_guardian_x, scm_guardian_greedy_p,
scm_guardian_destroyed_p, scm_guard, scm_get_one_zombie):
Deprecated and moved into deprecated.[ch].
* guardians.h, guardians.c: Mostly rewritten.
(scm_i_init_guardians_for_gc,
scm_i_identify_inaccessible_guardeds,
scm_i_mark_inaccessible_guardeds): New.
* weaks.h, weaks.c (SCM_I_WVECT_TYPE, SCM_I_SET_WVECT_TYPE): New.
(SCM_I_WVECT_N_ITEMS, SCM_I_SET_WVECT_N_ITEMS): New.
(SCM_WVECTF_NOSCAN, SCM_WVECT_NOSCAN_P): Removed.
(scm_weaks_prehistory): Removed.
(scm_i_init_weak_vectors_for_gc, scm_i_mark_weak_vector,
scm_i_mark_weak_vectors_non_weaks,
scm_i_remove_weaks_from_weak_vectors, scm_i_remove_weaks): New.
(scm_weak_vector_gc_init, scm_mark_weak_vector_spines,
scm_scan_weak_vectors): Removed.
* hashtab.h (scm_i_scan_weak_hashtables): New.
* hashtab.c (make_hash_table, scm_i_rehash): Do not use
SCM_WVECTF_NOSCAN.
(hashtable_print): Use SCM_HASHTABLE_N_ITEMS instead of
t->n_items.
(scan_weak_hashtables, scm_i_scan_weak_hashtables): Renamed former
to latter. Do not scan the alists themselves, this is done by the
weak vector code now. Just update the element count.
* vectors.h (SCM_I_WVECT_TYPE, SCM_I_WVECT_EXTRA): Renamed former
to latter. The type is now only part of the cell word.
(SCM_I_SET_WVECT_TYPE, SCM_I_SET_WVECT_EXTRA): Likewise.
* init.c (scm_i_init_guile): Do not call scm_weaks_prehistory.
mallocating for (unsigned long *bounds).
* hashtab.c (scm_i_rehash): Cast SCM_HASHTABLE_FLAGS (table) to
scm_t_bits before storing them in the type word.
* gc.c (tag_table_to_type_alist): Modified type of c_tag from
scm_t_bits to int.
closure can not be stored since it is no longer valid at GC time.
(make_hash_table): Initialize 'hash_fn' field.
(scm_i_rehash): Only store hash_fn in hash table when closre is
NULL.
(rehash_after_gc): Only call scm_i_rehash when 'hash_fn' is
non-NULL. Always use a NULL closure.
(scm_hash_fn_create_handle_x): Also rehash when table contains too
few entries.
argument; always use scm_delq_x. The delete_fn function works on
the handle, not the key, and it therefore makes no sense to make
it configurable. Changed all callers.
(scm_hashx_remove_x): Likewise. Also, exported to Scheme.
(scm_hash_clear): Accept plain vectors as hashtables.
(scm_delx_x): Removed.
so that no two weak alist vectors share a spine.
(scm_hash_fn_create_handle_x): Deal with a possible rehashing
during GC before inserting the new alist cell.
print.c, ports.c, mallocs.c, hooks.c, hashtab.c, fports.c,
guardians.c, filesys.c, coop-pthreads.c, continuations.c: Use
scm_uintprint to print unsigned integers, raw heap words, and
adresses, using a cast to scm_t_bits to turn pointers into
integers.
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP
and SCM_I_INUM, respectively and adding deprecated versions to
deprecated.h and deprecated.c. Changed all uses to either use the
SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible. Changed all uses to scm_to_size_t
or similar.
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h".
Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and
scm_is_bool, respectively.
code in order to avoid compiler used uninitialized warnings.
* hashtab.c, hashtab.h (scm_hash_map_to_list): Renamed from
scm_hash_map.
(scm_hash_fold): Use scm_call_3 directly in the call to
scm_internal_hash_fold instead of going via fold_proc (which is
now removed).
(scm_hash_for_each): Use a trampoline +
scm_internal_hash_for_each_handle.
(scm_internal_hash_for_each_handle, scm_hash_for_each_handle): New
functions.