alist.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef SCM_ALIST_H
  2. #define SCM_ALIST_H
  3. /* Copyright 1995-1996,2000,2006,2008,2018
  4. Free Software Foundation, Inc.
  5. This file is part of Guile.
  6. Guile is free software: you can redistribute it and/or modify it
  7. under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Guile is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  13. License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with Guile. If not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include <libguile/error.h>
  18. #include "libguile/pairs.h"
  19. #define SCM_VALIDATE_ALISTCELL(pos, alist) \
  20. do { \
  21. SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \
  22. alist, pos, FUNC_NAME); \
  23. } while (0)
  24. #define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \
  25. do { \
  26. SCM_ASSERT (scm_is_pair (alist), alist, pos, FUNC_NAME); \
  27. cvar = SCM_CAR (alist); \
  28. SCM_ASSERT (scm_is_pair (cvar), alist, pos, FUNC_NAME); \
  29. } while (0)
  30. SCM_API SCM scm_acons (SCM w, SCM x, SCM y);
  31. SCM_API SCM scm_sloppy_assq (SCM x, SCM alist);
  32. SCM_API SCM scm_sloppy_assv (SCM x, SCM alist);
  33. SCM_API SCM scm_sloppy_assoc (SCM x, SCM alist);
  34. SCM_API SCM scm_assq (SCM x, SCM alist);
  35. SCM_API SCM scm_assv (SCM x, SCM alist);
  36. SCM_API SCM scm_assoc (SCM x, SCM alist);
  37. SCM_API SCM scm_assq_ref (SCM alist, SCM key);
  38. SCM_API SCM scm_assv_ref (SCM alist, SCM key);
  39. SCM_API SCM scm_assoc_ref (SCM alist, SCM key);
  40. SCM_API SCM scm_assq_set_x (SCM alist, SCM key, SCM val);
  41. SCM_API SCM scm_assv_set_x (SCM alist, SCM key, SCM val);
  42. SCM_API SCM scm_assoc_set_x (SCM alist, SCM key, SCM val);
  43. SCM_API SCM scm_assq_remove_x (SCM alist, SCM key);
  44. SCM_API SCM scm_assv_remove_x (SCM alist, SCM key);
  45. SCM_API SCM scm_assoc_remove_x (SCM alist, SCM key);
  46. SCM_INTERNAL void scm_init_alist (void);
  47. #endif /* SCM_ALIST_H */