hooks.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef SCM_HOOKS_H
  2. #define SCM_HOOKS_H
  3. /* Copyright 1995-1996,1999,2000-2001,2006,2008-2009,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/smob.h>
  19. /*
  20. * Scheme level hooks
  21. */
  22. SCM_API scm_t_bits scm_tc16_hook;
  23. #define SCM_HOOKP(x) SCM_SMOB_PREDICATE (scm_tc16_hook, x)
  24. #define SCM_HOOK_ARITY(hook) SCM_SMOB_FLAGS (hook)
  25. #define SCM_HOOK_PROCEDURES(hook) SCM_SMOB_OBJECT (hook)
  26. #define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SET_SMOB_OBJECT ((hook), (procs))
  27. #define SCM_VALIDATE_HOOK(pos, a) SCM_MAKE_VALIDATE_MSG (pos, a, HOOKP, "hook")
  28. SCM_API SCM scm_make_hook (SCM n_args);
  29. SCM_API SCM scm_hook_p (SCM x);
  30. SCM_API SCM scm_hook_empty_p (SCM hook);
  31. SCM_API SCM scm_add_hook_x (SCM hook, SCM thunk, SCM appendp);
  32. SCM_API SCM scm_remove_hook_x (SCM hook, SCM thunk);
  33. SCM_API SCM scm_reset_hook_x (SCM hook);
  34. SCM_API SCM scm_run_hook (SCM hook, SCM args);
  35. SCM_API void scm_c_run_hook (SCM hook, SCM args);
  36. SCM_API void scm_c_run_hookn (SCM hook, SCM *argv, size_t nargs);
  37. SCM_API SCM scm_hook_to_list (SCM hook);
  38. SCM_INTERNAL void scm_init_hooks (void);
  39. #endif /* SCM_HOOKS_H */