6 /* Copyright (C) 2011 Free Software Foundation, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "libguile/__scm.h"
30 /* The weak set API is currently only used internally. We could make it
31 public later, after some API review. */
33 /* Function that returns nonzero if the given object is the one we are
35 typedef int (*scm_t_set_predicate_fn
) (SCM obj
, void *closure
);
37 /* Function to fold over the elements of a set. */
38 typedef SCM (*scm_t_set_fold_fn
) (void *closure
, SCM key
, SCM result
);
40 SCM_INTERNAL SCM
scm_c_make_weak_set (unsigned long k
);
41 SCM_INTERNAL SCM
scm_weak_set_p (SCM h
);
42 SCM_INTERNAL SCM
scm_c_weak_set_lookup (SCM set
, unsigned long raw_hash
,
43 scm_t_set_predicate_fn pred
,
44 void *closure
, SCM dflt
);
45 SCM_INTERNAL SCM
scm_c_weak_set_add_x (SCM set
, unsigned long raw_hash
,
46 scm_t_set_predicate_fn pred
,
47 void *closure
, SCM obj
);
48 SCM_INTERNAL
void scm_c_weak_set_remove_x (SCM set
, unsigned long raw_hash
,
49 scm_t_set_predicate_fn pred
,
51 SCM_INTERNAL SCM
scm_weak_set_add_x (SCM set
, SCM obj
);
52 SCM_INTERNAL SCM
scm_weak_set_remove_x (SCM set
, SCM obj
);
53 SCM_INTERNAL SCM
scm_weak_set_clear_x (SCM set
);
54 SCM_INTERNAL SCM
scm_c_weak_set_fold (scm_t_set_fold_fn proc
, void *closure
,
56 SCM_INTERNAL SCM
scm_weak_set_fold (SCM proc
, SCM init
, SCM set
);
57 SCM_INTERNAL SCM
scm_weak_set_for_each (SCM proc
, SCM set
);
58 SCM_INTERNAL SCM
scm_weak_set_map_to_list (SCM proc
, SCM set
);
60 SCM_INTERNAL
void scm_i_weak_set_print (SCM exp
, SCM port
, scm_print_state
*pstate
);
61 SCM_INTERNAL
void scm_init_weak_set (void);
63 #endif /* SCM_WEAK_SET_H */