/* UnwindProtect.h       -*-objc-*-
 *
 * Copyright Niels Möller <nisse@lysator.liu.se> 1995
 *
 * Freely distributable under the terms and conditions of the
 * GNU General Public License.
 */

#ifndef UNWINDPROTECT_H_INCLUDED
#define UNWINDPROTECT_H_INCLUDED

#include <StackFrame.h>


/* UnwindProtect
 * -------------
 *
 * id tag = [UnwindProtect new];
 *
 * [tag cleanupByCalling: someFunction];
 * [tag cleanupBySending: someSelector to: someObject];
 * ...
 * [tag cleanup];
 */

@interface UnwindProtect : StackFrame

/* By default, freeing this object itself is done automatically when
 * cleaning up. If you don't want this, use
 * [[UnwindProtect alloc] initDontFree] instead of [UnwindProtect new].
 */
 
- initDontFree;
- cleanupByCalling: ( void (*)(void)) function;
- cleanupBySending: (SEL) message to: rec;
- (void) cleanup;
@end

#endif UNWINDPROTECT_H_INCLUDED
