1 /* unwind_prot.h - Macros and functions for hacking unwind protection. */
3 /* Copyright (C) 1993 Free Software Foundation, Inc.
5 This file is part of GNU Bash, the Bourne Again SHell.
7 Bash is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with Bash; see the file COPYING. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #if !defined (_UNWIND_PROT_H)
22 #define _UNWIND_PROT_H
24 /* Run a function without interrupts. */
26 begin_unwind_frame (), discard_unwind_frame (),
27 run_unwind_frame (), add_unwind_protect (), remove_unwind_protect (),
28 run_unwind_protects ();
30 /* Define for people who like their code to look a certain way. */
31 #define end_unwind_frame()
33 /* How to protect an integer. */
34 #define unwind_protect_int(X) unwind_protect_var (&(X), (char *)(X), sizeof (int))
36 /* How to protect a pointer to a string. */
37 #define unwind_protect_string(X) \
38 unwind_protect_var ((int *)&(X), (X), sizeof (char *))
40 /* How to protect any old pointer. */
41 #define unwind_protect_pointer(X) unwind_protect_string (X)
43 /* How to protect the contents of a jmp_buf. */
44 #define unwind_protect_jmp_buf(X) \
45 unwind_protect_var ((int *)(X), (char *)(X), sizeof (jmp_buf))
47 #endif /* _UNWIND_PROT_H */