Add `SCM_INTERNAL' macro, use it.
[bpt/guile.git] / libguile / throw.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
0527e687
DH
3#ifndef SCM_THROW_H
4#define SCM_THROW_H
5
102dbb6f 6/* Copyright (C) 1995,1996,1998,2000, 2006, 2008 Free Software Foundation, Inc.
0527e687 7 *
73be1d9e
MV
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.
0527e687 12 *
73be1d9e 13 * This library is distributed in the hope that it will be useful,
0f2d19dd 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
0527e687 17 *
73be1d9e
MV
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
92205699 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
73be1d9e 21 */
0527e687 22
0f2d19dd
JB
23\f
24
b4309c3c 25#include "libguile/__scm.h"
0f2d19dd
JB
26
27\f
fec45334 28
92c2555f
MV
29typedef SCM (*scm_t_catch_body) (void *data);
30typedef SCM (*scm_t_catch_handler) (void *data,
7866a09b 31 SCM tag, SCM throw_args);
650fa1ab 32
43e01b1e
NJ
33SCM_API SCM scm_c_catch (SCM tag,
34 scm_t_catch_body body,
35 void *body_data,
36 scm_t_catch_handler handler,
37 void *handler_data,
38 scm_t_catch_handler pre_unwind_handler,
39 void *pre_unwind_handler_data);
40
41SCM_API SCM scm_c_with_throw_handler (SCM tag,
42 scm_t_catch_body body,
43 void *body_data,
44 scm_t_catch_handler handler,
45 void *handler_data,
46 int lazy_catch_p);
47
33b001fd
MV
48SCM_API SCM scm_internal_catch (SCM tag,
49 scm_t_catch_body body,
50 void *body_data,
51 scm_t_catch_handler handler,
52 void *handler_data);
53
54SCM_API SCM scm_internal_lazy_catch (SCM tag,
55 scm_t_catch_body body,
56 void *body_data,
57 scm_t_catch_handler handler,
58 void *handler_data);
59
60SCM_API SCM scm_internal_stack_catch (SCM tag,
61 scm_t_catch_body body,
62 void *body_data,
63 scm_t_catch_handler handler,
64 void *handler_data);
95384717 65
816a6f06
JB
66/* The first argument to scm_body_thunk should be a pointer to one of
67 these. See the implementation of catch in throw.c. */
68struct scm_body_thunk_data
69{
70 /* The tag being caught. We only use it to figure out what
71 arguments to pass to the body procedure; see scm_catch_thunk_body for
72 details. */
73 SCM tag;
74
75 /* The Scheme procedure object constituting the catch body.
76 scm_body_by_proc invokes this. */
77 SCM body_proc;
78};
79
33b001fd 80SCM_API SCM scm_body_thunk (void *);
816a6f06
JB
81
82
33b001fd
MV
83SCM_API SCM scm_handle_by_proc (void *, SCM, SCM);
84SCM_API SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
85SCM_API SCM scm_handle_by_message (void *, SCM, SCM);
86SCM_API SCM scm_handle_by_message_noexit (void *, SCM, SCM);
87SCM_API SCM scm_handle_by_throw (void *, SCM, SCM);
88SCM_API int scm_exit_status (SCM args);
650fa1ab 89
43e01b1e 90SCM_API SCM scm_catch_with_pre_unwind_handler (SCM tag, SCM thunk, SCM handler, SCM lazy_handler);
33b001fd 91SCM_API SCM scm_catch (SCM tag, SCM thunk, SCM handler);
43e01b1e 92SCM_API SCM scm_with_throw_handler (SCM tag, SCM thunk, SCM handler);
33b001fd
MV
93SCM_API SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
94SCM_API SCM scm_ithrow (SCM key, SCM args, int noreturn);
1a36eef2 95
33b001fd 96SCM_API SCM scm_throw (SCM key, SCM args);
102dbb6f 97SCM_INTERNAL void scm_init_throw (void);
0527e687
DH
98
99#endif /* SCM_THROW_H */
89e00824
ML
100
101/*
102 Local Variables:
103 c-file-style: "gnu"
104 End:
105*/