ftp.nice.ch/Attic/openStep/developer/resources/CrashTrap.1.6.s.s.tgz#/CrashTrap/AppDelegate.m

This is AppDelegate.m in view mode; [Download] [Up]

static const char *rcsid = "$Id$ cc: "__DATE__" "__TIME__;

// Suppress compiler warning about rcsid being unused, yet prevent assembler
// code for this function from being produced.
inline extern const char *suppressCompilerWarning(void)
{
    return rcsid;
}

//
// ------------------ AppDelegate Class Implementation ------------------------
//
// Demo for OEObject
//
// AUTHOR: ivo  ivo@hasc.ca  (ported to OPENSTEP by Art Isbell - arti@lava.net)
// ----------------------------------------------------------------------------
//

// ----------------------------- Header Files ---------------------------------

#import <AppKit/AppKit.h>

#import "AppDelegate.h"
#import "OEObject.h"

// ---------------- Typedef, Struct, and Union Declarations -------------------

// --------------------- Constant and Enum Definitions ------------------------

// ------------------------- Function Declarations ----------------------------

/*
@interface AppDelegate(Private)
// ---------------------- Private Method Declarations -------------------------

@end
*/
@implementation AppDelegate
// ----------------------- Class Method Definitions ---------------------------

// ---------------- Overridden Instance Method Definitions --------------------

// -------------------- New Instance Method Definitions -----------------------

- (void)afterCrashMatrixHit:(id)aSender
{
    [OEObject setContinueAfterError:([[aSender selectedCell] tag] ? NO : YES)];
}

- (void)nullCrashHit:(id)aSender
{
    int *nullPtr = NULL;

    NSLog(@"About to crash referencing a NULL ptr.\n");
    *nullPtr = 1;
}

- (void)unimplementedCrashHit:(id)aSender
{
    #warning The following 'does not respond to' warning is intentional!
    [self callSomethingNotImplemented];   // Make me crash!!!
}

- (void)freedObjectCrashHit:(id)aSender
{
    NSObject *freedObject = [[NSObject alloc] init];

    [freedObject release];
    [freedObject hash];
}

// ----------------- Delegate Instance Method Definitions ---------------------

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    NSString *useCrashTrapL = [[NSUserDefaults standardUserDefaults]
        objectForKey:@"UseCrashTrap"];

    // Provide a convenient way to disable OEObject when using gdb.
    if ((useCrashTrapL == nil) || [useCrashTrapL isEqualToString:@"YES"])
    {
        [OEObject setup];
        [OEObject setContinueAfterError:YES];
    }
    if ([NSBundle loadNibNamed:@"CrashTrap" owner:self])
    {
        [window center];
        [window makeKeyAndOrderFront:nil];
    }
}

@end
/*
@implementation AppDelegate(Private)
// ---------------------- Private Method Definitions --------------------------

@end
*/
// ------------------------- Function Definitions -----------------------------

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.