throw.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* classes: h_files */
  2. #ifndef SCM_THROW_H
  3. #define SCM_THROW_H
  4. /* Copyright (C) 1995,1996,1998,2000, 2006, 2008 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. SCM_API SCM scm_internal_lazy_catch (SCM tag,
  44. scm_t_catch_body body,
  45. void *body_data,
  46. scm_t_catch_handler handler,
  47. void *handler_data);
  48. SCM_API SCM scm_internal_stack_catch (SCM tag,
  49. scm_t_catch_body body,
  50. void *body_data,
  51. scm_t_catch_handler handler,
  52. void *handler_data);
  53. /* The first argument to scm_body_thunk should be a pointer to one of
  54. these. See the implementation of catch in throw.c. */
  55. struct scm_body_thunk_data
  56. {
  57. /* The tag being caught. We only use it to figure out what
  58. arguments to pass to the body procedure; see scm_catch_thunk_body for
  59. details. */
  60. SCM tag;
  61. /* The Scheme procedure object constituting the catch body.
  62. scm_body_by_proc invokes this. */
  63. SCM body_proc;
  64. };
  65. SCM_API SCM scm_body_thunk (void *);
  66. SCM_API SCM scm_handle_by_proc (void *, SCM, SCM);
  67. SCM_API SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
  68. SCM_API SCM scm_handle_by_message (void *, SCM, SCM);
  69. SCM_API SCM scm_handle_by_message_noexit (void *, SCM, SCM);
  70. SCM_API SCM scm_handle_by_throw (void *, SCM, SCM);
  71. SCM_API int scm_exit_status (SCM args);
  72. SCM_API SCM scm_catch_with_pre_unwind_handler (SCM tag, SCM thunk, SCM handler, SCM lazy_handler);
  73. SCM_API SCM scm_catch (SCM tag, SCM thunk, SCM handler);
  74. SCM_API SCM scm_with_throw_handler (SCM tag, SCM thunk, SCM handler);
  75. SCM_API SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
  76. SCM_API SCM scm_ithrow (SCM key, SCM args, int noreturn);
  77. SCM_API SCM scm_throw (SCM key, SCM args);
  78. SCM_INTERNAL void scm_init_throw (void);
  79. #endif /* SCM_THROW_H */
  80. /*
  81. Local Variables:
  82. c-file-style: "gnu"
  83. End:
  84. */