1 #ifndef SCM_EXCEPTIONS_H
2 #define SCM_EXCEPTIONS_H
3 
4 /* Copyright 1995-1996,1998,2000,2006,2008,2010,2014,2017-2019
5      Free Software Foundation, Inc.
6 
7    This file is part of Guile.
8 
9    Guile is free software: you can redistribute it and/or modify it
10    under the terms of the GNU Lesser General Public License as published
11    by the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13 
14    Guile is distributed in the hope that it will be useful, but WITHOUT
15    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17    License for more details.
18 
19    You should have received a copy of the GNU Lesser General Public
20    License along with Guile.  If not, see
21    <https://www.gnu.org/licenses/>.  */
22 
23 
24 
25 #include "libguile/scm.h"
26 
27 
28 
29 typedef SCM (*scm_t_thunk) (void *data);
30 typedef SCM (*scm_t_exception_handler) (void *data, SCM exn);
31 
32 SCM_INTERNAL SCM scm_c_make_thunk (scm_t_thunk body,
33                                    void *body_data);
34 SCM_INTERNAL SCM scm_c_make_exception_handler (scm_t_exception_handler h,
35                                                void *handler_data);
36 
37 SCM_INTERNAL SCM scm_c_with_exception_handler (SCM type,
38                                                scm_t_exception_handler handler,
39                                                void *handler_data,
40                                                scm_t_thunk thunk,
41                                                void *thunk_data);
42 
43 SCM_INTERNAL SCM scm_c_with_default_exception_handler (scm_t_thunk thunk,
44                                                        void *data);
45 
46 SCM_INTERNAL SCM scm_with_exception_handler (SCM type, SCM handler, SCM thunk);
47 SCM_INTERNAL SCM scm_with_pre_unwind_exception_handler (SCM handler, SCM thunk);
48 SCM_INTERNAL SCM scm_raise_exception (SCM exn) SCM_NORETURN;
49 
50 SCM_INTERNAL SCM scm_exception_kind (SCM exn);
51 SCM_INTERNAL SCM scm_exception_args (SCM exn);
52 
53 SCM_INTERNAL void scm_dynwind_throw_handler (void);
54 
55 /* This raises a `stack-overflow' exception, without running pre-unwind
56    handlers.  */
57 SCM_API void scm_report_stack_overflow (void);
58 
59 /* This raises an `out-of-memory' exception, without running pre-unwind
60    handlers.  */
61 SCM_API void scm_report_out_of_memory (void);
62 
63 SCM_INTERNAL void scm_init_exceptions (void);
64 
65 #endif  /* SCM_EXCEPTIONS_H */
66