weak-set.h 2.7 KB

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