mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +02:00
fix tab completion in repl (doh)
* libguile/hashtab.c: Fix remaining vector hash table support. * module/ice-9/session.scm (apropos-fold): Use a hash table instead of a vector for the completions.
This commit is contained in:
parent
58baff08bc
commit
2dd7d8ce7a
2 changed files with 21 additions and 27 deletions
|
@ -1146,8 +1146,7 @@ SCM_DEFINE (scm_hash_fold, "hash-fold", 3, 0, 0,
|
||||||
#define FUNC_NAME s_scm_hash_fold
|
#define FUNC_NAME s_scm_hash_fold
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_PROC (1, proc);
|
SCM_VALIDATE_PROC (1, proc);
|
||||||
if (!SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (3, table);
|
||||||
SCM_VALIDATE_VECTOR (3, table);
|
|
||||||
return scm_internal_hash_fold ((scm_t_hash_fold_fn) scm_call_3,
|
return scm_internal_hash_fold ((scm_t_hash_fold_fn) scm_call_3,
|
||||||
(void *) SCM_UNPACK (proc), init, table);
|
(void *) SCM_UNPACK (proc), init, table);
|
||||||
}
|
}
|
||||||
|
@ -1168,8 +1167,7 @@ SCM_DEFINE (scm_hash_for_each, "hash-for-each", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_hash_for_each
|
#define FUNC_NAME s_scm_hash_for_each
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_PROC (1, proc);
|
SCM_VALIDATE_PROC (1, proc);
|
||||||
if (!SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (2, table);
|
||||||
SCM_VALIDATE_VECTOR (2, table);
|
|
||||||
|
|
||||||
scm_internal_hash_for_each_handle (for_each_proc,
|
scm_internal_hash_for_each_handle (for_each_proc,
|
||||||
(void *) SCM_UNPACK (proc),
|
(void *) SCM_UNPACK (proc),
|
||||||
|
@ -1185,8 +1183,7 @@ SCM_DEFINE (scm_hash_for_each_handle, "hash-for-each-handle", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_hash_for_each_handle
|
#define FUNC_NAME s_scm_hash_for_each_handle
|
||||||
{
|
{
|
||||||
SCM_ASSERT (scm_is_true (scm_procedure_p (proc)), proc, 1, FUNC_NAME);
|
SCM_ASSERT (scm_is_true (scm_procedure_p (proc)), proc, 1, FUNC_NAME);
|
||||||
if (!SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (2, table);
|
||||||
SCM_VALIDATE_VECTOR (2, table);
|
|
||||||
|
|
||||||
scm_internal_hash_for_each_handle ((scm_t_hash_handle_fn) scm_call_1,
|
scm_internal_hash_for_each_handle ((scm_t_hash_handle_fn) scm_call_1,
|
||||||
(void *) SCM_UNPACK (proc),
|
(void *) SCM_UNPACK (proc),
|
||||||
|
@ -1210,8 +1207,7 @@ SCM_DEFINE (scm_hash_map_to_list, "hash-map->list", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_hash_map_to_list
|
#define FUNC_NAME s_scm_hash_map_to_list
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_PROC (1, proc);
|
SCM_VALIDATE_PROC (1, proc);
|
||||||
if (!SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (2, table);
|
||||||
SCM_VALIDATE_VECTOR (2, table);
|
|
||||||
return scm_internal_hash_fold (map_proc,
|
return scm_internal_hash_fold (map_proc,
|
||||||
(void *) SCM_UNPACK (proc),
|
(void *) SCM_UNPACK (proc),
|
||||||
SCM_EOL,
|
SCM_EOL,
|
||||||
|
@ -1224,15 +1220,13 @@ SCM_DEFINE (scm_hash_map_to_list, "hash-map->list", 2, 0, 0,
|
||||||
SCM
|
SCM
|
||||||
scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
||||||
SCM init, SCM table)
|
SCM init, SCM table)
|
||||||
|
#define FUNC_NAME s_scm_hash_fold
|
||||||
{
|
{
|
||||||
long i, n;
|
long i, n;
|
||||||
SCM buckets, result = init;
|
SCM buckets, result = init;
|
||||||
|
|
||||||
if (SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (0, table);
|
||||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||||
else
|
|
||||||
/* Weak alist vector. */
|
|
||||||
buckets = table;
|
|
||||||
|
|
||||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||||
for (i = 0; i < n; ++i)
|
for (i = 0; i < n; ++i)
|
||||||
|
@ -1246,11 +1240,11 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
|
||||||
if (!scm_is_pair (ls))
|
if (!scm_is_pair (ls))
|
||||||
scm_wrong_type_arg (s_scm_hash_fold, SCM_ARG3, buckets);
|
SCM_WRONG_TYPE_ARG (SCM_ARG3, buckets);
|
||||||
|
|
||||||
handle = SCM_CAR (ls);
|
handle = SCM_CAR (ls);
|
||||||
if (!scm_is_pair (handle))
|
if (!scm_is_pair (handle))
|
||||||
scm_wrong_type_arg (s_scm_hash_fold, SCM_ARG3, buckets);
|
SCM_WRONG_TYPE_ARG (SCM_ARG3, buckets);
|
||||||
|
|
||||||
if (SCM_HASHTABLE_WEAK_P (table))
|
if (SCM_HASHTABLE_WEAK_P (table))
|
||||||
{
|
{
|
||||||
|
@ -1263,9 +1257,8 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
||||||
else
|
else
|
||||||
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls));
|
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls));
|
||||||
|
|
||||||
if (SCM_HASHTABLE_P (table))
|
/* Update the item count. */
|
||||||
/* Update the item count. */
|
SCM_HASHTABLE_DECREMENT (table);
|
||||||
SCM_HASHTABLE_DECREMENT (table);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1277,6 +1270,7 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#undef FUNC_NAME
|
||||||
|
|
||||||
/* The following redundant code is here in order to be able to support
|
/* The following redundant code is here in order to be able to support
|
||||||
hash-for-each-handle. An alternative would have been to replace
|
hash-for-each-handle. An alternative would have been to replace
|
||||||
|
@ -1287,31 +1281,31 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
||||||
void
|
void
|
||||||
scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn, void *closure,
|
scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn, void *closure,
|
||||||
SCM table)
|
SCM table)
|
||||||
|
#define FUNC_NAME s_scm_hash_for_each
|
||||||
{
|
{
|
||||||
long i, n;
|
long i, n;
|
||||||
SCM buckets;
|
SCM buckets;
|
||||||
|
|
||||||
if (SCM_HASHTABLE_P (table))
|
SCM_VALIDATE_HASHTABLE (0, table);
|
||||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||||
else
|
|
||||||
buckets = table;
|
|
||||||
|
|
||||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||||
|
|
||||||
for (i = 0; i < n; ++i)
|
for (i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
SCM ls = SCM_SIMPLE_VECTOR_REF (buckets, i), handle;
|
SCM ls = SCM_SIMPLE_VECTOR_REF (buckets, i), handle;
|
||||||
while (!scm_is_null (ls))
|
while (!scm_is_null (ls))
|
||||||
{
|
{
|
||||||
if (!scm_is_pair (ls))
|
if (!scm_is_pair (ls))
|
||||||
scm_wrong_type_arg (s_scm_hash_for_each, SCM_ARG3, buckets);
|
SCM_WRONG_TYPE_ARG (SCM_ARG3, buckets);
|
||||||
handle = SCM_CAR (ls);
|
handle = SCM_CAR (ls);
|
||||||
if (!scm_is_pair (handle))
|
if (!scm_is_pair (handle))
|
||||||
scm_wrong_type_arg (s_scm_hash_for_each, SCM_ARG3, buckets);
|
SCM_WRONG_TYPE_ARG (SCM_ARG3, buckets);
|
||||||
fn (closure, handle);
|
fn (closure, handle);
|
||||||
ls = SCM_CDR (ls);
|
ls = SCM_CDR (ls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;;; Copyright (C) 1997, 2000, 2001, 2003, 2006, 2009, 2010 Free Software Foundation, Inc.
|
;;;; Copyright (C) 1997, 2000, 2001, 2003, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -355,7 +355,7 @@ Fourth arg FOLDER is one of
|
||||||
apropos-fold-exported ;fold over all exported bindings
|
apropos-fold-exported ;fold over all exported bindings
|
||||||
apropos-fold-all ;fold over all bindings"
|
apropos-fold-all ;fold over all bindings"
|
||||||
(let ((match (make-regexp rgx))
|
(let ((match (make-regexp rgx))
|
||||||
(recorded (make-vector 61 '())))
|
(recorded (make-hash-table)))
|
||||||
(let ((fold-module
|
(let ((fold-module
|
||||||
(lambda (module data)
|
(lambda (module data)
|
||||||
(let* ((obarray-filter
|
(let* ((obarray-filter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue