Add `SCM_INTERNAL' macro, use it.
[bpt/guile.git] / libguile / dynwind.h
1 /* classes: h_files */
2
3 #ifndef SCM_DYNWIND_H
4 #define SCM_DYNWIND_H
5
6 /* Copyright (C) 1995,1996,1998,1999,2000,2003,2004, 2006, 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 \f
28
29 typedef void (*scm_t_guard) (void *);
30 typedef SCM (*scm_t_inner) (void *);
31
32 SCM_API SCM scm_dynamic_wind (SCM thunk1, SCM thunk2, SCM thunk3);
33 SCM_API SCM scm_internal_dynamic_wind (scm_t_guard before,
34 scm_t_inner inner,
35 scm_t_guard after,
36 void *inner_data,
37 void *guard_data);
38 SCM_API void scm_dowinds (SCM to, long delta);
39 SCM_INTERNAL void scm_i_dowinds (SCM to, long delta,
40 void (*turn_func) (void *), void *data);
41 SCM_INTERNAL void scm_init_dynwind (void);
42
43 SCM_API void scm_swap_bindings (SCM vars, SCM vals);
44
45 typedef enum {
46 SCM_F_DYNWIND_REWINDABLE = (1 << 0)
47 } scm_t_dynwind_flags;
48
49 typedef enum {
50 SCM_F_WIND_EXPLICITLY = (1 << 0)
51 } scm_t_wind_flags;
52
53 SCM_API void scm_dynwind_begin (scm_t_dynwind_flags);
54 SCM_API void scm_dynwind_end (void);
55
56 SCM_API void scm_dynwind_unwind_handler (void (*func) (void *), void *data,
57 scm_t_wind_flags);
58 SCM_API void scm_dynwind_rewind_handler (void (*func) (void *), void *data,
59 scm_t_wind_flags);
60
61 SCM_API void scm_dynwind_unwind_handler_with_scm (void (*func) (SCM), SCM data,
62 scm_t_wind_flags);
63 SCM_API void scm_dynwind_rewind_handler_with_scm (void (*func) (SCM), SCM data,
64 scm_t_wind_flags);
65
66 SCM_API void scm_dynwind_free (void *mem);
67
68 #ifdef GUILE_DEBUG
69 SCM_API SCM scm_wind_chain (void);
70 #endif /*GUILE_DEBUG*/
71
72 #endif /* SCM_DYNWIND_H */
73
74 /*
75 Local Variables:
76 c-file-style: "gnu"
77 End:
78 */