6 /* Copyright (C) 1995,1996,1998,2000, 2006, 2008 Free Software Foundation, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "libguile/__scm.h"
30 typedef SCM (*scm_t_catch_body
) (void *data
);
31 typedef SCM (*scm_t_catch_handler
) (void *data
,
32 SCM tag
, SCM throw_args
);
34 SCM_API SCM
scm_c_catch (SCM tag
,
35 scm_t_catch_body body
,
37 scm_t_catch_handler handler
,
39 scm_t_catch_handler pre_unwind_handler
,
40 void *pre_unwind_handler_data
);
42 SCM_API SCM
scm_c_with_throw_handler (SCM tag
,
43 scm_t_catch_body body
,
45 scm_t_catch_handler handler
,
49 SCM_API SCM
scm_internal_catch (SCM tag
,
50 scm_t_catch_body body
,
52 scm_t_catch_handler handler
,
55 SCM_API SCM
scm_internal_lazy_catch (SCM tag
,
56 scm_t_catch_body body
,
58 scm_t_catch_handler handler
,
61 SCM_API SCM
scm_internal_stack_catch (SCM tag
,
62 scm_t_catch_body body
,
64 scm_t_catch_handler handler
,
67 /* The first argument to scm_body_thunk should be a pointer to one of
68 these. See the implementation of catch in throw.c. */
69 struct scm_body_thunk_data
71 /* The tag being caught. We only use it to figure out what
72 arguments to pass to the body procedure; see scm_catch_thunk_body for
76 /* The Scheme procedure object constituting the catch body.
77 scm_body_by_proc invokes this. */
81 SCM_API SCM
scm_body_thunk (void *);
84 SCM_API SCM
scm_handle_by_proc (void *, SCM
, SCM
);
85 SCM_API SCM
scm_handle_by_proc_catching_all (void *, SCM
, SCM
);
86 SCM_API SCM
scm_handle_by_message (void *, SCM
, SCM
);
87 SCM_API SCM
scm_handle_by_message_noexit (void *, SCM
, SCM
);
88 SCM_API SCM
scm_handle_by_throw (void *, SCM
, SCM
);
89 SCM_API
int scm_exit_status (SCM args
);
91 SCM_API SCM
scm_catch_with_pre_unwind_handler (SCM tag
, SCM thunk
, SCM handler
, SCM lazy_handler
);
92 SCM_API SCM
scm_catch (SCM tag
, SCM thunk
, SCM handler
);
93 SCM_API SCM
scm_with_throw_handler (SCM tag
, SCM thunk
, SCM handler
);
94 SCM_API SCM
scm_lazy_catch (SCM tag
, SCM thunk
, SCM handler
);
95 SCM_API SCM
scm_ithrow (SCM key
, SCM args
, int noreturn
);
97 SCM_API SCM
scm_throw (SCM key
, SCM args
);
98 SCM_INTERNAL
void scm_init_throw (void);
100 #endif /* SCM_THROW_H */