throw.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* classes: h_files */
  2. #ifndef SCM_THROW_H
  3. #define SCM_THROW_H
  4. /* Copyright (C) 1995,1996,1998,2000, 2006 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
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but 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 02110-1301 USA
  19. */
  20. #include "libguile/__scm.h"
  21. typedef SCM (*scm_t_catch_body) (void *data);
  22. typedef SCM (*scm_t_catch_handler) (void *data,
  23. SCM tag, SCM throw_args);
  24. SCM_API SCM scm_c_catch (SCM tag,
  25. scm_t_catch_body body,
  26. void *body_data,
  27. scm_t_catch_handler handler,
  28. void *handler_data,
  29. scm_t_catch_handler pre_unwind_handler,
  30. void *pre_unwind_handler_data);
  31. SCM_API SCM scm_c_with_throw_handler (SCM tag,
  32. scm_t_catch_body body,
  33. void *body_data,
  34. scm_t_catch_handler handler,
  35. void *handler_data,
  36. int lazy_catch_p);
  37. SCM_API SCM scm_internal_catch (SCM tag,
  38. scm_t_catch_body body,
  39. void *body_data,
  40. scm_t_catch_handler handler,
  41. void *handler_data);
  42. SCM_API SCM scm_internal_lazy_catch (SCM tag,
  43. scm_t_catch_body body,
  44. void *body_data,
  45. scm_t_catch_handler handler,
  46. void *handler_data);
  47. SCM_API SCM scm_internal_stack_catch (SCM tag,
  48. scm_t_catch_body body,
  49. void *body_data,
  50. scm_t_catch_handler handler,
  51. void *handler_data);
  52. /* The first argument to scm_body_thunk should be a pointer to one of
  53. these. See the implementation of catch in throw.c. */
  54. struct scm_body_thunk_data
  55. {
  56. /* The tag being caught. We only use it to figure out what
  57. arguments to pass to the body procedure; see scm_catch_thunk_body for
  58. details. */
  59. SCM tag;
  60. /* The Scheme procedure object constituting the catch body.
  61. scm_body_by_proc invokes this. */
  62. SCM body_proc;
  63. };
  64. SCM_API SCM scm_body_thunk (void *);
  65. SCM_API SCM scm_handle_by_proc (void *, SCM, SCM);
  66. SCM_API SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
  67. SCM_API SCM scm_handle_by_message (void *, SCM, SCM);
  68. SCM_API SCM scm_handle_by_message_noexit (void *, SCM, SCM);
  69. SCM_API SCM scm_handle_by_throw (void *, SCM, SCM);
  70. SCM_API int scm_exit_status (SCM args);
  71. SCM_API SCM scm_catch_with_pre_unwind_handler (SCM tag, SCM thunk, SCM handler, SCM lazy_handler);
  72. SCM_API SCM scm_catch (SCM tag, SCM thunk, SCM handler);
  73. SCM_API SCM scm_with_throw_handler (SCM tag, SCM thunk, SCM handler);
  74. SCM_API SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
  75. SCM_API SCM scm_ithrow (SCM key, SCM args, int noreturn);
  76. SCM_API SCM scm_throw (SCM key, SCM args);
  77. SCM_API void scm_init_throw (void);
  78. #endif /* SCM_THROW_H */
  79. /*
  80. Local Variables:
  81. c-file-style: "gnu"
  82. End:
  83. */