throw.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* classes: h_files */
  2. #ifndef SCM_THROW_H
  3. #define SCM_THROW_H
  4. /* Copyright (C) 1995,1996,1998,2000, 2006, 2008, 2010, 2014 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. typedef SCM (*scm_t_catch_body) (void *data);
  23. typedef SCM (*scm_t_catch_handler) (void *data,
  24. SCM tag, SCM throw_args);
  25. SCM_API SCM scm_c_catch (SCM tag,
  26. scm_t_catch_body body,
  27. void *body_data,
  28. scm_t_catch_handler handler,
  29. void *handler_data,
  30. scm_t_catch_handler pre_unwind_handler,
  31. void *pre_unwind_handler_data);
  32. SCM_API SCM scm_c_with_throw_handler (SCM tag,
  33. scm_t_catch_body body,
  34. void *body_data,
  35. scm_t_catch_handler handler,
  36. void *handler_data,
  37. int lazy_catch_p);
  38. SCM_API SCM scm_internal_catch (SCM tag,
  39. scm_t_catch_body body,
  40. void *body_data,
  41. scm_t_catch_handler handler,
  42. void *handler_data);
  43. /* The first argument to scm_body_thunk should be a pointer to one of
  44. these. See the implementation of catch in throw.c. */
  45. struct scm_body_thunk_data
  46. {
  47. /* The tag being caught. We only use it to figure out what
  48. arguments to pass to the body procedure; see scm_catch_thunk_body for
  49. details. */
  50. SCM tag;
  51. /* The Scheme procedure object constituting the catch body.
  52. scm_body_by_proc invokes this. */
  53. SCM body_proc;
  54. };
  55. SCM_API SCM scm_body_thunk (void *);
  56. SCM_API SCM scm_handle_by_proc (void *, SCM, SCM);
  57. SCM_API SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
  58. SCM_API SCM scm_handle_by_message (void *, SCM, SCM);
  59. SCM_API SCM scm_handle_by_message_noexit (void *, SCM, SCM);
  60. SCM_API SCM scm_handle_by_throw (void *, SCM, SCM);
  61. SCM_API int scm_exit_status (SCM args);
  62. SCM_API SCM scm_catch_with_pre_unwind_handler (SCM tag, SCM thunk, SCM handler, SCM lazy_handler);
  63. SCM_API SCM scm_catch (SCM tag, SCM thunk, SCM handler);
  64. SCM_API SCM scm_with_throw_handler (SCM tag, SCM thunk, SCM handler);
  65. SCM_API SCM scm_ithrow (SCM key, SCM args, int no_return);
  66. /* This throws to the `stack-overflow' key, without running pre-unwind
  67. handlers. */
  68. SCM_API void scm_report_stack_overflow (void);
  69. /* This throws to the `out-of-memory' key, without running pre-unwind
  70. handlers. */
  71. SCM_API void scm_report_out_of_memory (void);
  72. SCM_API SCM scm_throw (SCM key, SCM args);
  73. SCM_INTERNAL void scm_init_throw (void);
  74. #endif /* SCM_THROW_H */
  75. /*
  76. Local Variables:
  77. c-file-style: "gnu"
  78. End:
  79. */