1
|
1 // unwind-prot.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (_unwind_prot_h) |
|
25 #define _unwind_prot_h 1 |
|
26 |
|
27 #ifdef __GNUG__ |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #include <stddef.h> |
|
32 |
|
33 typedef void (*cleanup_func)(void *ptr); |
|
34 |
|
35 void add_unwind_protect (cleanup_func fptr, void *ptr); |
|
36 void run_unwind_protect (void); |
|
37 void discard_unwind_protect (void); |
|
38 void begin_unwind_frame (char *tag); |
|
39 void run_unwind_frame (char *tag); |
|
40 void discard_unwind_frame (char *tag); |
|
41 void run_all_unwind_protects (void); |
|
42 void discard_all_unwind_protects (void); |
|
43 |
|
44 void matrix_cleanup (void *m); |
|
45 void complex_matrix_cleanup (void *cm); |
|
46 |
|
47 void unwind_protect_int_internal (int *ptr, int value); |
|
48 void unwind_protect_ptr_internal (void **ptr, void *value); |
|
49 void unwind_protect_var_internal (void *ptr, void *value, size_t size); |
|
50 |
|
51 #define unwind_protect_int(i) \ |
|
52 unwind_protect_int_internal (&(i), (i)) |
|
53 |
|
54 #define unwind_protect_ptr(p) \ |
|
55 unwind_protect_ptr_internal ((void **) &(p), (void *) (p)) |
|
56 |
|
57 #define unwind_protect_var(i) \ |
|
58 unwind_protect_var_internal ((void *) &(i), (void *) &(i), sizeof (int)) |
|
59 |
|
60 #endif |
|
61 |
|
62 /* |
|
63 ;;; Local Variables: *** |
|
64 ;;; mode: C++ *** |
|
65 ;;; page-delimiter: "^/\\*" *** |
|
66 ;;; End: *** |
|
67 */ |