GDB (API)
|
00001 /* Cleanups. 00002 Copyright (C) 1986-2013 Free Software Foundation, Inc. 00003 00004 This file is part of GDB. 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00018 00019 #ifndef CLEANUPS_H 00020 #define CLEANUPS_H 00021 00022 /* Outside of cleanups.c, this is an opaque type. */ 00023 struct cleanup; 00024 00025 /* NOTE: cagney/2000-03-04: This typedef is strictly for the 00026 make_cleanup function declarations below. Do not use this typedef 00027 as a cast when passing functions into the make_cleanup() code. 00028 Instead either use a bounce function or add a wrapper function. 00029 Calling a f(char*) function with f(void*) is non-portable. */ 00030 typedef void (make_cleanup_ftype) (void *); 00031 00032 /* Function type for the dtor in make_cleanup_dtor. */ 00033 typedef void (make_cleanup_dtor_ftype) (void *); 00034 00035 /* WARNING: The result of the "make cleanup" routines is not the intuitive 00036 choice of being a handle on the just-created cleanup. Instead it is an 00037 opaque handle of the cleanup mechanism and represents all cleanups created 00038 from that point onwards. 00039 The result is guaranteed to be non-NULL though. */ 00040 00041 extern struct cleanup *make_cleanup (make_cleanup_ftype *, void *); 00042 00043 extern struct cleanup *make_cleanup_dtor (make_cleanup_ftype *, void *, 00044 make_cleanup_dtor_ftype *); 00045 00046 extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *); 00047 00048 /* A special value to pass to do_cleanups and do_final_cleanups 00049 to tell them to do all cleanups. */ 00050 extern struct cleanup *all_cleanups (void); 00051 00052 extern void do_cleanups (struct cleanup *); 00053 extern void do_final_cleanups (struct cleanup *); 00054 00055 extern void discard_cleanups (struct cleanup *); 00056 extern void discard_final_cleanups (struct cleanup *); 00057 00058 extern struct cleanup *save_cleanups (void); 00059 extern struct cleanup *save_final_cleanups (void); 00060 00061 extern void restore_cleanups (struct cleanup *); 00062 extern void restore_final_cleanups (struct cleanup *); 00063 00064 /* A no-op cleanup. 00065 This is useful when you want to establish a known reference point 00066 to pass to do_cleanups. */ 00067 extern void null_cleanup (void *); 00068 00069 #endif /* CLEANUPS_H */