Changed license terms to the plain LGPL thru-out.
[bpt/guile.git] / libguile / throw.h
1 /* classes: h_files */
2
3 #ifndef SCM_THROW_H
4 #define SCM_THROW_H
5
6 /* Copyright (C) 1995,1996,1998,2000 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but 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.
17 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 \f
28
29 typedef SCM (*scm_t_catch_body) (void *data);
30 typedef SCM (*scm_t_catch_handler) (void *data,
31 SCM tag, SCM throw_args);
32
33 SCM_API SCM scm_internal_catch (SCM tag,
34 scm_t_catch_body body,
35 void *body_data,
36 scm_t_catch_handler handler,
37 void *handler_data);
38
39 SCM_API SCM scm_internal_lazy_catch (SCM tag,
40 scm_t_catch_body body,
41 void *body_data,
42 scm_t_catch_handler handler,
43 void *handler_data);
44
45 SCM_API SCM scm_internal_stack_catch (SCM tag,
46 scm_t_catch_body body,
47 void *body_data,
48 scm_t_catch_handler handler,
49 void *handler_data);
50
51 /* The first argument to scm_body_thunk should be a pointer to one of
52 these. See the implementation of catch in throw.c. */
53 struct scm_body_thunk_data
54 {
55 /* The tag being caught. We only use it to figure out what
56 arguments to pass to the body procedure; see scm_catch_thunk_body for
57 details. */
58 SCM tag;
59
60 /* The Scheme procedure object constituting the catch body.
61 scm_body_by_proc invokes this. */
62 SCM body_proc;
63 };
64
65 SCM_API SCM scm_body_thunk (void *);
66
67
68 SCM_API SCM scm_handle_by_proc (void *, SCM, SCM);
69 SCM_API SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
70 SCM_API SCM scm_handle_by_message (void *, SCM, SCM);
71 SCM_API SCM scm_handle_by_message_noexit (void *, SCM, SCM);
72 SCM_API SCM scm_handle_by_throw (void *, SCM, SCM);
73 SCM_API int scm_exit_status (SCM args);
74
75 SCM_API SCM scm_catch (SCM tag, SCM thunk, SCM handler);
76 SCM_API SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
77 SCM_API SCM scm_ithrow (SCM key, SCM args, int noreturn);
78
79 SCM_API SCM scm_throw (SCM key, SCM args);
80 SCM_API void scm_init_throw (void);
81
82 #endif /* SCM_THROW_H */
83
84 /*
85 Local Variables:
86 c-file-style: "gnu"
87 End:
88 */