1 |
/* Copyright (C) 1995,1996,1998,2000,2001 Free Software Foundation, Inc. |
/* Copyright (C) 1995,1996,1998,2000,2001, 2003 Free Software Foundation, Inc. |
2 |
* |
* |
3 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
4 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
45 |
#include "libguile/_scm.h" |
#include "libguile/_scm.h" |
46 |
#include "libguile/vectors.h" |
#include "libguile/vectors.h" |
47 |
#include "libguile/lang.h" |
#include "libguile/lang.h" |
48 |
|
#include "libguile/hashtab.h" |
49 |
|
|
50 |
#include "libguile/validate.h" |
#include "libguile/validate.h" |
51 |
#include "libguile/weaks.h" |
#include "libguile/weaks.h" |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
SCM_DEFINE (scm_make_weak_key_hash_table, "make-weak-key-hash-table", 1, 0, 0, |
SCM_DEFINE (scm_make_weak_key_hash_table, "make-weak-key-hash-table", 0, 1, 0, |
174 |
(SCM size), |
(SCM size), |
175 |
"@deffnx {Scheme Procedure} make-weak-value-hash-table size\n" |
"@deffnx {Scheme Procedure} make-weak-value-hash-table size\n" |
176 |
"@deffnx {Scheme Procedure} make-doubly-weak-hash-table size\n" |
"@deffnx {Scheme Procedure} make-doubly-weak-hash-table size\n" |
182 |
"would modify regular hash tables. (@pxref{Hash Tables})") |
"would modify regular hash tables. (@pxref{Hash Tables})") |
183 |
#define FUNC_NAME s_scm_make_weak_key_hash_table |
#define FUNC_NAME s_scm_make_weak_key_hash_table |
184 |
{ |
{ |
185 |
return allocate_weak_vector (1, size, SCM_EOL, FUNC_NAME); |
if (SCM_UNBNDP (size)) |
186 |
|
return scm_vector_to_hash_table (allocate_weak_vector (1, SCM_MAKINUM (37), |
187 |
|
SCM_EOL, FUNC_NAME)); |
188 |
|
else |
189 |
|
return allocate_weak_vector (1, size, SCM_EOL, FUNC_NAME); |
190 |
} |
} |
191 |
#undef FUNC_NAME |
#undef FUNC_NAME |
192 |
|
|
193 |
|
|
194 |
SCM_DEFINE (scm_make_weak_value_hash_table, "make-weak-value-hash-table", 1, 0, 0, |
SCM_DEFINE (scm_make_weak_value_hash_table, "make-weak-value-hash-table", 0, 1, 0, |
195 |
(SCM size), |
(SCM size), |
196 |
"Return a hash table with weak values with @var{size} buckets.\n" |
"Return a hash table with weak values with @var{size} buckets.\n" |
197 |
"(@pxref{Hash Tables})") |
"(@pxref{Hash Tables})") |
198 |
#define FUNC_NAME s_scm_make_weak_value_hash_table |
#define FUNC_NAME s_scm_make_weak_value_hash_table |
199 |
{ |
{ |
200 |
return allocate_weak_vector (2, size, SCM_EOL, FUNC_NAME); |
if (SCM_UNBNDP (size)) |
201 |
|
return scm_vector_to_hash_table (allocate_weak_vector (2, SCM_MAKINUM (37), |
202 |
|
SCM_EOL, FUNC_NAME)); |
203 |
|
else |
204 |
|
return allocate_weak_vector (2, size, SCM_EOL, FUNC_NAME); |
205 |
} |
} |
206 |
#undef FUNC_NAME |
#undef FUNC_NAME |
207 |
|
|
212 |
"buckets. (@pxref{Hash Tables})") |
"buckets. (@pxref{Hash Tables})") |
213 |
#define FUNC_NAME s_scm_make_doubly_weak_hash_table |
#define FUNC_NAME s_scm_make_doubly_weak_hash_table |
214 |
{ |
{ |
215 |
return allocate_weak_vector (3, size, SCM_EOL, FUNC_NAME); |
if (SCM_UNBNDP (size)) |
216 |
|
return scm_vector_to_hash_table (allocate_weak_vector (3, SCM_MAKINUM (37), |
217 |
|
SCM_EOL, FUNC_NAME)); |
218 |
|
else |
219 |
|
return allocate_weak_vector (3, size, SCM_EOL, FUNC_NAME); |
220 |
} |
} |
221 |
#undef FUNC_NAME |
#undef FUNC_NAME |
222 |
|
|