2001-03-30 15:03:23 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
|
* any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
|
|
|
|
|
#include "libguile/alist.h"
|
|
|
|
|
|
#include "libguile/hash.h"
|
|
|
|
|
|
#include "libguile/eval.h"
|
2001-06-26 15:46:40 +00:00
|
|
|
|
#include "libguile/root.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/vectors.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "libguile/validate.h"
|
|
|
|
|
|
#include "libguile/hashtab.h"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2001-02-02 04:56:25 +00:00
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_c_make_hash_table (unsigned long k)
|
2001-02-02 04:56:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
return scm_c_make_vector (k, SCM_EOL);
|
|
|
|
|
|
}
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
2001-03-30 15:03:23 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_hash_fn_get_handle (SCM table,SCM obj,unsigned long (*hash_fn)(),SCM (*assoc_fn)(),void * closure)
|
2001-03-30 15:03:23 +00:00
|
|
|
|
#define FUNC_NAME "scm_hash_fn_get_handle"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
unsigned long k;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM h;
|
|
|
|
|
|
|
2001-03-30 15:03:23 +00:00
|
|
|
|
SCM_VALIDATE_VECTOR (1, table);
|
2000-10-09 14:37:36 +00:00
|
|
|
|
if (SCM_VECTOR_LENGTH (table) == 0)
|
2001-03-30 15:03:23 +00:00
|
|
|
|
return SCM_BOOL_F;
|
2000-10-09 14:37:36 +00:00
|
|
|
|
k = hash_fn (obj, SCM_VECTOR_LENGTH (table), closure);
|
|
|
|
|
|
if (k >= SCM_VECTOR_LENGTH (table))
|
2000-06-30 10:46:35 +00:00
|
|
|
|
scm_out_of_range ("hash_fn_get_handle", scm_ulong2num (k));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
h = assoc_fn (obj, SCM_VELTS (table)[k], closure);
|
|
|
|
|
|
return h;
|
|
|
|
|
|
}
|
2001-03-30 15:03:23 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_hash_fn_create_handle_x (SCM table,SCM obj,SCM init,unsigned long (*hash_fn)(),
|
|
|
|
|
|
SCM (*assoc_fn)(),void * closure)
|
2000-07-07 15:28:56 +00:00
|
|
|
|
#define FUNC_NAME "scm_hash_fn_create_handle_x"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
unsigned long k;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM it;
|
|
|
|
|
|
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_VECTORP (table), table, SCM_ARG1, "hash_fn_create_handle_x");
|
2000-10-09 14:37:36 +00:00
|
|
|
|
if (SCM_VECTOR_LENGTH (table) == 0)
|
2000-07-07 15:28:56 +00:00
|
|
|
|
SCM_MISC_ERROR ("void hashtable", SCM_EOL);
|
|
|
|
|
|
|
2000-10-09 14:37:36 +00:00
|
|
|
|
k = hash_fn (obj, SCM_VECTOR_LENGTH (table), closure);
|
|
|
|
|
|
if (k >= SCM_VECTOR_LENGTH (table))
|
2000-06-30 10:46:35 +00:00
|
|
|
|
scm_out_of_range ("hash_fn_create_handle_x", scm_ulong2num (k));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_REDEFER_INTS;
|
|
|
|
|
|
it = assoc_fn (obj, SCM_VELTS (table)[k], closure);
|
|
|
|
|
|
if (SCM_NIMP (it))
|
|
|
|
|
|
{
|
2000-05-21 20:49:20 +00:00
|
|
|
|
SCM_REALLOW_INTS;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return it;
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM new_bucket;
|
|
|
|
|
|
SCM old_bucket;
|
|
|
|
|
|
old_bucket = SCM_VELTS (table)[k];
|
|
|
|
|
|
new_bucket = scm_acons (obj, init, old_bucket);
|
|
|
|
|
|
SCM_VELTS(table)[k] = new_bucket;
|
|
|
|
|
|
SCM_REALLOW_INTS;
|
|
|
|
|
|
return SCM_CAR (new_bucket);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2000-07-07 15:28:56 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_hash_fn_ref (SCM table,SCM obj,SCM dflt,unsigned long (*hash_fn)(),
|
|
|
|
|
|
SCM (*assoc_fn)(),void * closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-03-30 15:03:23 +00:00
|
|
|
|
SCM it = scm_hash_fn_get_handle (table, obj, hash_fn, assoc_fn, closure);
|
|
|
|
|
|
if (SCM_CONSP (it))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_CDR (it);
|
2001-03-30 15:03:23 +00:00
|
|
|
|
else
|
|
|
|
|
|
return dflt;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_hash_fn_set_x (SCM table,SCM obj,SCM val,unsigned long (*hash_fn)(),
|
|
|
|
|
|
SCM (*assoc_fn)(),void * closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM it;
|
|
|
|
|
|
|
|
|
|
|
|
it = scm_hash_fn_create_handle_x (table, obj, SCM_BOOL_F, hash_fn, assoc_fn, closure);
|
|
|
|
|
|
SCM_SETCDR (it, val);
|
|
|
|
|
|
return val;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
2001-05-26 20:51:22 +00:00
|
|
|
|
scm_hash_fn_remove_x (SCM table,SCM obj,unsigned long (*hash_fn)(),SCM (*assoc_fn)(),
|
|
|
|
|
|
SCM (*delete_fn)(),void * closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
unsigned long k;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM h;
|
|
|
|
|
|
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_VECTORP (table), table, SCM_ARG1, "hash_fn_remove_x");
|
2000-10-09 14:37:36 +00:00
|
|
|
|
if (SCM_VECTOR_LENGTH (table) == 0)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_EOL;
|
2000-10-09 14:37:36 +00:00
|
|
|
|
k = hash_fn (obj, SCM_VECTOR_LENGTH (table), closure);
|
|
|
|
|
|
if (k >= SCM_VECTOR_LENGTH (table))
|
2000-06-30 10:46:35 +00:00
|
|
|
|
scm_out_of_range ("hash_fn_remove_x", scm_ulong2num (k));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
h = assoc_fn (obj, SCM_VELTS (table)[k], closure);
|
|
|
|
|
|
SCM_VELTS(table)[k] = delete_fn (h, SCM_VELTS(table)[k]);
|
|
|
|
|
|
return h;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashq_get_handle, "hashq-get-handle", 2, 0, 0,
|
2001-03-30 15:03:23 +00:00
|
|
|
|
(SCM table, SCM key),
|
|
|
|
|
|
"This procedure returns the @code{(key . value)} pair from the\n"
|
|
|
|
|
|
"hash table @var{table}. If @var{table} does not hold an\n"
|
|
|
|
|
|
"associated value for @var{key}, @code{#f} is returned.\n"
|
|
|
|
|
|
"Uses @code{eq?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashq_get_handle
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-03-30 15:03:23 +00:00
|
|
|
|
return scm_hash_fn_get_handle (table, key, scm_ihashq, scm_sloppy_assq, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashq_create_handle_x, "hashq-create-handle!", 3, 0, 0,
|
2000-03-02 23:41:22 +00:00
|
|
|
|
(SCM table, SCM key, SCM init),
|
|
|
|
|
|
"This function looks up @var{key} in @var{table} and returns its handle.\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"If @var{key} is not already present, a new handle is created which\n"
|
|
|
|
|
|
"associates @var{key} with @var{init}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashq_create_handle_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-03-02 23:41:22 +00:00
|
|
|
|
return scm_hash_fn_create_handle_x (table, key, init, scm_ihashq, scm_sloppy_assq, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashq_ref, "hashq-ref", 2, 1, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM dflt),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
|
|
|
|
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
|
|
|
|
|
"is supplied). Uses @code{eq?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashq_ref
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-03 08:47:51 +00:00
|
|
|
|
if (SCM_UNBNDP (dflt))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
dflt = SCM_BOOL_F;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_ref (table, key, dflt, scm_ihashq, scm_sloppy_assq, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashq_set_x, "hashq-set!", 3, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM val),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Find the entry in @var{table} associated with @var{key}, and\n"
|
|
|
|
|
|
"store @var{value} there. Uses @code{eq?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashq_set_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_set_x (table, key, val, scm_ihashq, scm_sloppy_assq, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashq_remove_x, "hashq-remove!", 2, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Remove @var{key} (and any value associated with it) from\n"
|
|
|
|
|
|
"@var{table}. Uses @code{eq?} for equality tests.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashq_remove_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_remove_x (table, key, scm_ihashq, scm_sloppy_assq,
|
|
|
|
|
|
scm_delq_x, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashv_get_handle, "hashv-get-handle", 2, 0, 0,
|
2001-03-30 15:03:23 +00:00
|
|
|
|
(SCM table, SCM key),
|
|
|
|
|
|
"This procedure returns the @code{(key . value)} pair from the\n"
|
|
|
|
|
|
"hash table @var{table}. If @var{table} does not hold an\n"
|
|
|
|
|
|
"associated value for @var{key}, @code{#f} is returned.\n"
|
|
|
|
|
|
"Uses @code{eqv?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashv_get_handle
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-03-30 15:03:23 +00:00
|
|
|
|
return scm_hash_fn_get_handle (table, key, scm_ihashv, scm_sloppy_assv, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashv_create_handle_x, "hashv-create-handle!", 3, 0, 0,
|
2000-03-02 23:41:22 +00:00
|
|
|
|
(SCM table, SCM key, SCM init),
|
|
|
|
|
|
"This function looks up @var{key} in @var{table} and returns its handle.\n"
|
|
|
|
|
|
"If @var{key} is not already present, a new handle is created which\n"
|
|
|
|
|
|
"associates @var{key} with @var{init}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashv_create_handle_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_create_handle_x (table, key, init, scm_ihashv,
|
|
|
|
|
|
scm_sloppy_assv, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashv_ref, "hashv-ref", 2, 1, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM dflt),
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
|
|
|
|
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
|
|
|
|
|
"is supplied). Uses @code{eqv?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashv_ref
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-03 08:47:51 +00:00
|
|
|
|
if (SCM_UNBNDP (dflt))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
dflt = SCM_BOOL_F;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_ref (table, key, dflt, scm_ihashv, scm_sloppy_assv, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashv_set_x, "hashv-set!", 3, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM val),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Find the entry in @var{table} associated with @var{key}, and\n"
|
|
|
|
|
|
"store @var{value} there. Uses @code{eqv?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashv_set_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_set_x (table, key, val, scm_ihashv, scm_sloppy_assv, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashv_remove_x, "hashv-remove!", 2, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Remove @var{key} (and any value associated with it) from\n"
|
|
|
|
|
|
"@var{table}. Uses @code{eqv?} for equality tests.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashv_remove_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_remove_x (table, key, scm_ihashv, scm_sloppy_assv,
|
|
|
|
|
|
scm_delv_x, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_get_handle, "hash-get-handle", 2, 0, 0,
|
2001-03-30 15:03:23 +00:00
|
|
|
|
(SCM table, SCM key),
|
|
|
|
|
|
"This procedure returns the @code{(key . value)} pair from the\n"
|
|
|
|
|
|
"hash table @var{table}. If @var{table} does not hold an\n"
|
|
|
|
|
|
"associated value for @var{key}, @code{#f} is returned.\n"
|
|
|
|
|
|
"Uses @code{equal?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_get_handle
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-03-30 15:03:23 +00:00
|
|
|
|
return scm_hash_fn_get_handle (table, key, scm_ihash, scm_sloppy_assoc, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_create_handle_x, "hash-create-handle!", 3, 0, 0,
|
2000-03-02 23:41:22 +00:00
|
|
|
|
(SCM table, SCM key, SCM init),
|
|
|
|
|
|
"This function looks up @var{key} in @var{table} and returns its handle.\n"
|
|
|
|
|
|
"If @var{key} is not already present, a new handle is created which\n"
|
|
|
|
|
|
"associates @var{key} with @var{init}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_create_handle_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-03-02 23:41:22 +00:00
|
|
|
|
return scm_hash_fn_create_handle_x (table, key, init, scm_ihash, scm_sloppy_assoc, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_ref, "hash-ref", 2, 1, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM dflt),
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
|
|
|
|
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
|
|
|
|
|
"is supplied). Uses @code{equal?} for equality testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_ref
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-03 08:47:51 +00:00
|
|
|
|
if (SCM_UNBNDP (dflt))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
dflt = SCM_BOOL_F;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_ref (table, key, dflt, scm_ihash, scm_sloppy_assoc, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_set_x, "hash-set!", 3, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key, SCM val),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Find the entry in @var{table} associated with @var{key}, and\n"
|
|
|
|
|
|
"store @var{value} there. Uses @code{equal?} for equality\n"
|
|
|
|
|
|
"testing.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_set_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_set_x (table, key, val, scm_ihash, scm_sloppy_assoc, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_remove_x, "hash-remove!", 2, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM table, SCM key),
|
* list.c (scm_list, scm_cons_star, scm_null_p, scm_list_p),
(scm_length, scm_append, scm_reverse, scm_list_ref),
(scm_memq, scm_memv, scm_member, scm_delv_x, scm_delete_x),
(scm_delq, scm_delv, scm_delete, scm_delq1_x, scm_delv1_x),
(scm_delete1_x), gc.c (scm_map_free_list),
(scm_free_list_length), hash.c (scm_hashq, scm_hashv),
(scm_hash), hashtab.c (scm_hashq_ref, scm_hashq_set_x),
(scm_hashq_remove_x, scm_hashv_ref, scm_hashv_set_x),
(scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x),
(scm_hash_remove_x), ports.c (scm_pt_size, scm_pt_member), print.c
(scm_current_pstate), scmsigs.c (scm_usleep), goops.c
(scm_get_keyword, scm_sys_compute_slots): Added texinfo markup.
* weaks.c (scm_weak_vector_p, scm_weak_key_hash_table_p),
(scm_weak_value_hash_table_p, scm_doubly_weak_hash_table_p),
rdelim.c (scm_read_delimited_x), strop.c (scm_string_index),
symbols.c (scm_symbol_interned_p), numbers.c
(scm_string_to_number), ports.c (scm_port_p): Corrected texinfo
markup.
2001-03-16 10:00:17 +00:00
|
|
|
|
"Remove @var{key} (and any value associated with it) from\n"
|
|
|
|
|
|
"@var{table}. Uses @code{equal?} for equality tests.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_remove_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_remove_x (table, key, scm_ihash, scm_sloppy_assoc,
|
|
|
|
|
|
scm_delete_x, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-14 19:50:43 +00:00
|
|
|
|
typedef struct scm_t_ihashx_closure
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM hash;
|
|
|
|
|
|
SCM assoc;
|
|
|
|
|
|
SCM delete;
|
2001-06-14 19:50:43 +00:00
|
|
|
|
} scm_t_ihashx_closure;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
2001-05-26 20:51:22 +00:00
|
|
|
|
static unsigned long
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_ihashx (SCM obj, unsigned long n, scm_t_ihashx_closure *closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM answer;
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_DEFER_INTS;
|
2001-06-26 15:46:40 +00:00
|
|
|
|
answer = scm_call_2 (closure->hash, obj, scm_ulong2num ((unsigned long) n));
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_ALLOW_INTS;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_INUM (answer);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static SCM
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_sloppy_assx (SCM obj, SCM alist, scm_t_ihashx_closure *closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM answer;
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_DEFER_INTS;
|
2001-06-26 15:46:40 +00:00
|
|
|
|
answer = scm_call_2 (closure->assoc, obj, alist);
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_ALLOW_INTS;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return answer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static SCM
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_delx_x (SCM obj, SCM alist, scm_t_ihashx_closure *closure)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM answer;
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_DEFER_INTS;
|
2001-06-26 15:46:40 +00:00
|
|
|
|
answer = scm_call_2 (closure->delete, obj, alist);
|
2000-05-05 11:10:57 +00:00
|
|
|
|
SCM_ALLOW_INTS;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return answer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashx_get_handle, "hashx-get-handle", 4, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM hash, SCM assoc, SCM table, SCM key),
|
|
|
|
|
|
"This behaves the same way as the corresponding\n"
|
|
|
|
|
|
"@code{-get-handle} function, but uses @var{hash} as a hash\n"
|
|
|
|
|
|
"function and @var{assoc} to compare keys. @code{hash} must be\n"
|
|
|
|
|
|
"a function that takes two arguments, a key to be hashed and a\n"
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"table size. @code{assoc} must be an associator function, like\n"
|
|
|
|
|
|
"@code{assoc}, @code{assq} or @code{assv}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashx_get_handle
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ihashx_closure closure;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
closure.hash = hash;
|
|
|
|
|
|
closure.assoc = assoc;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_get_handle (table, key, scm_ihashx, scm_sloppy_assx,
|
|
|
|
|
|
(void *)&closure);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashx_create_handle_x, "hashx-create-handle!", 5, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM hash, SCM assoc, SCM table, SCM key, SCM init),
|
|
|
|
|
|
"This behaves the same way as the corresponding\n"
|
|
|
|
|
|
"@code{-create-handle} function, but uses @var{hash} as a hash\n"
|
|
|
|
|
|
"function and @var{assoc} to compare keys. @code{hash} must be\n"
|
|
|
|
|
|
"a function that takes two arguments, a key to be hashed and a\n"
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"table size. @code{assoc} must be an associator function, like\n"
|
|
|
|
|
|
"@code{assoc}, @code{assq} or @code{assv}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashx_create_handle_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ihashx_closure closure;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
closure.hash = hash;
|
|
|
|
|
|
closure.assoc = assoc;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_create_handle_x (table, key, init, scm_ihashx,
|
|
|
|
|
|
scm_sloppy_assx, (void *)&closure);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashx_ref, "hashx-ref", 4, 1, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM hash, SCM assoc, SCM table, SCM key, SCM dflt),
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"This behaves the same way as the corresponding @code{ref}\n"
|
2001-04-03 13:19:05 +00:00
|
|
|
|
"function, but uses @var{hash} as a hash function and\n"
|
|
|
|
|
|
"@var{assoc} to compare keys. @code{hash} must be a function\n"
|
|
|
|
|
|
"that takes two arguments, a key to be hashed and a table size.\n"
|
|
|
|
|
|
"@code{assoc} must be an associator function, like @code{assoc},\n"
|
|
|
|
|
|
"@code{assq} or @code{assv}.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"By way of illustration, @code{hashq-ref table key} is\n"
|
|
|
|
|
|
"equivalent to @code{hashx-ref hashq assq table key}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashx_ref
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ihashx_closure closure;
|
2000-04-03 08:47:51 +00:00
|
|
|
|
if (SCM_UNBNDP (dflt))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
dflt = SCM_BOOL_F;
|
|
|
|
|
|
closure.hash = hash;
|
|
|
|
|
|
closure.assoc = assoc;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_ref (table, key, dflt, scm_ihashx, scm_sloppy_assx,
|
|
|
|
|
|
(void *)&closure);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hashx_set_x, "hashx-set!", 5, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM hash, SCM assoc, SCM table, SCM key, SCM val),
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"This behaves the same way as the corresponding @code{set!}\n"
|
2001-04-03 13:19:05 +00:00
|
|
|
|
"function, but uses @var{hash} as a hash function and\n"
|
|
|
|
|
|
"@var{assoc} to compare keys. @code{hash} must be a function\n"
|
|
|
|
|
|
"that takes two arguments, a key to be hashed and a table size.\n"
|
|
|
|
|
|
"@code{assoc} must be an associator function, like @code{assoc},\n"
|
|
|
|
|
|
"@code{assq} or @code{assv}.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
" By way of illustration, @code{hashq-set! table key} is\n"
|
|
|
|
|
|
"equivalent to @code{hashx-set! hashq assq table key}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hashx_set_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ihashx_closure closure;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
closure.hash = hash;
|
|
|
|
|
|
closure.assoc = assoc;
|
2001-04-03 13:19:05 +00:00
|
|
|
|
return scm_hash_fn_set_x (table, key, val, scm_ihashx, scm_sloppy_assx,
|
|
|
|
|
|
(void *)&closure);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
* validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.
* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.
* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.
* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.
* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.
* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.
* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.
* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.
* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.
* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t
* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.
* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.
* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.
* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x
* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.
* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.
* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.
* gsubr.c: various int -> scm_bits_t changes.
* gh_data.c (gh_scm2double): no loss of precision any more.
* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.
* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.
* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t
* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.
* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t
* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t
* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.
* extensions.c: extension -> extension_t (and made a typedef).
* eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.
* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t
* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t
* dynwind.c (scm_dowinds): delta: long -> scm_bits_t
* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t
* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.
* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t
* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.
* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.
* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.
* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
|
|
|
|
scm_hashx_remove_x (SCM hash, SCM assoc, SCM delete, SCM table, SCM obj)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ihashx_closure closure;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
closure.hash = hash;
|
|
|
|
|
|
closure.assoc = assoc;
|
|
|
|
|
|
closure.delete = delete;
|
|
|
|
|
|
return scm_hash_fn_remove_x (table, obj, scm_ihashx, scm_sloppy_assx, scm_delx_x, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1999-07-31 09:04:46 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
fold_proc (void *proc, SCM key, SCM data, SCM value)
|
|
|
|
|
|
{
|
2001-06-26 15:46:40 +00:00
|
|
|
|
return scm_call_3 (SCM_PACK (proc), key, data, value);
|
1999-07-31 09:04:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_hash_fold, "hash-fold", 3, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM proc, SCM init, SCM table),
|
2000-03-02 23:41:22 +00:00
|
|
|
|
"An iterator over hash-table elements.\n"
|
|
|
|
|
|
"Accumulates and returns a result by applying PROC successively.\n"
|
|
|
|
|
|
"The arguments to PROC are \"(key value prior-result)\" where key\n"
|
|
|
|
|
|
"and value are successive pairs from the hash table TABLE, and\n"
|
|
|
|
|
|
"prior-result is either INIT (for the first application of PROC)\n"
|
|
|
|
|
|
"or the return value of the previous application of PROC.\n"
|
|
|
|
|
|
"For example, @code{(hash-fold acons () tab)} will convert a hash\n"
|
|
|
|
|
|
"table into an a-list of key-value pairs.\n")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_hash_fold
|
1999-07-31 09:04:46 +00:00
|
|
|
|
{
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_PROC (1,proc);
|
|
|
|
|
|
SCM_VALIDATE_VECTOR (3,table);
|
2000-04-03 08:47:51 +00:00
|
|
|
|
return scm_internal_hash_fold (fold_proc, (void *) SCM_UNPACK (proc), init, table);
|
1999-07-31 09:04:46 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-03-14 16:48:50 +00:00
|
|
|
|
|
|
|
|
|
|
SCM
|
1999-03-21 05:02:42 +00:00
|
|
|
|
scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM table)
|
1999-03-14 16:48:50 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long i, n = SCM_VECTOR_LENGTH (table);
|
1999-03-14 16:48:50 +00:00
|
|
|
|
SCM result = init;
|
|
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM ls = SCM_VELTS (table)[i], handle;
|
2001-03-30 15:03:23 +00:00
|
|
|
|
while (!SCM_NULLP (ls))
|
1999-03-14 16:48:50 +00:00
|
|
|
|
{
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (ls),
|
2001-05-28 12:36:41 +00:00
|
|
|
|
table, SCM_ARG3, s_scm_hash_fold);
|
1999-03-14 16:48:50 +00:00
|
|
|
|
handle = SCM_CAR (ls);
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (handle),
|
2001-05-28 12:36:41 +00:00
|
|
|
|
table, SCM_ARG3, s_scm_hash_fold);
|
1999-03-14 16:48:50 +00:00
|
|
|
|
result = fn (closure, SCM_CAR (handle), SCM_CDR (handle), result);
|
|
|
|
|
|
ls = SCM_CDR (ls);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_init_hashtab ()
|
|
|
|
|
|
{
|
* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file. Thanks
to Lars J. Aas!
* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions. Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
|
|
|
|
#ifndef SCM_MAGIC_SNARFER
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/hashtab.x"
|
* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file. Thanks
to Lars J. Aas!
* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions. Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
|
|
|
|
#endif
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|