exceptions.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef SCM_EXCEPTIONS_H
  2. #define SCM_EXCEPTIONS_H
  3. /* Copyright 1995-1996,1998,2000,2006,2008,2010,2014,2017-2019
  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/scm.h"
  18. typedef SCM (*scm_t_thunk) (void *data);
  19. typedef SCM (*scm_t_exception_handler) (void *data, SCM exn);
  20. SCM_INTERNAL SCM scm_c_make_thunk (scm_t_thunk body,
  21. void *body_data);
  22. SCM_INTERNAL SCM scm_c_make_exception_handler (scm_t_exception_handler h,
  23. void *handler_data);
  24. SCM_INTERNAL SCM scm_c_with_exception_handler (SCM type,
  25. scm_t_exception_handler handler,
  26. void *handler_data,
  27. scm_t_thunk thunk,
  28. void *thunk_data);
  29. SCM_INTERNAL SCM scm_c_with_default_exception_handler (scm_t_thunk thunk,
  30. void *data);
  31. SCM_INTERNAL SCM scm_with_exception_handler (SCM type, SCM handler, SCM thunk);
  32. SCM_INTERNAL SCM scm_with_pre_unwind_exception_handler (SCM handler, SCM thunk);
  33. SCM_INTERNAL SCM scm_raise_exception (SCM exn) SCM_NORETURN;
  34. SCM_INTERNAL SCM scm_exception_kind (SCM exn);
  35. SCM_INTERNAL SCM scm_exception_args (SCM exn);
  36. SCM_INTERNAL void scm_dynwind_throw_handler (void);
  37. /* This raises a `stack-overflow' exception, without running pre-unwind
  38. handlers. */
  39. SCM_API void scm_report_stack_overflow (void);
  40. /* This raises an `out-of-memory' exception, without running pre-unwind
  41. handlers. */
  42. SCM_API void scm_report_out_of_memory (void);
  43. SCM_INTERNAL void scm_init_exceptions (void);
  44. #endif /* SCM_EXCEPTIONS_H */