mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-18 11:41:06 +00:00
Updates for MacOS-X compatibility
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26690 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0f579d5620
commit
18944ced01
5 changed files with 34 additions and 15 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-06-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Headers/Foundation/NSException.h
|
||||||
|
* Source/NSException.h
|
||||||
|
Change macros for setting uncaught handler to be functions (to match
|
||||||
|
MacOS-X) and make the pointer itsself be private.
|
||||||
|
|
||||||
2008-06-18 Richard Frith-Macdonald <rfm@gnu.org>
|
2008-06-18 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSConnection.m: Fix error getting run loop for current
|
* Source/NSConnection.m: Fix error getting run loop for current
|
||||||
|
|
|
@ -251,12 +251,6 @@ typedef struct _NSHandler
|
||||||
*/
|
*/
|
||||||
typedef void NSUncaughtExceptionHandler(NSException *exception);
|
typedef void NSUncaughtExceptionHandler(NSException *exception);
|
||||||
|
|
||||||
/**
|
|
||||||
* Variable used to hold the current uncaught exception handler. Use the
|
|
||||||
* function NSSetUncaughtExceptionHandler() to set this.
|
|
||||||
*/
|
|
||||||
GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exception handler called when an exception is generated and
|
* Returns the exception handler called when an exception is generated and
|
||||||
* not caught by the programmer (by enclosing in <code>NS_DURING</code> and
|
* not caught by the programmer (by enclosing in <code>NS_DURING</code> and
|
||||||
|
@ -264,7 +258,8 @@ GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
||||||
* an error message and exits the program. You can change this behavior by
|
* an error message and exits the program. You can change this behavior by
|
||||||
* calling NSSetUncaughtExceptionHandler().
|
* calling NSSetUncaughtExceptionHandler().
|
||||||
*/
|
*/
|
||||||
#define NSGetUncaughtExceptionHandler() _NSUncaughtExceptionHandler
|
GS_EXPORT NSUncaughtExceptionHandler *
|
||||||
|
NSGetUncaughtExceptionHandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Sets the exception handler called when an exception is generated and
|
* <p>Sets the exception handler called when an exception is generated and
|
||||||
|
@ -290,8 +285,8 @@ GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
||||||
* [NSException] instance as an argument.
|
* [NSException] instance as an argument.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
#define NSSetUncaughtExceptionHandler(proc) \
|
GS_EXPORT void
|
||||||
(_NSUncaughtExceptionHandler = (proc))
|
NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *handler);
|
||||||
|
|
||||||
/* NS_DURING, NS_HANDLER and NS_ENDHANDLER are always used like:
|
/* NS_DURING, NS_HANDLER and NS_ENDHANDLER are always used like:
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
static NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
||||||
|
|
||||||
#define _e_info (((id*)_reserved)[0])
|
#define _e_info (((id*)_reserved)[0])
|
||||||
#define _e_stack (((id*)_reserved)[1])
|
#define _e_stack (((id*)_reserved)[1])
|
||||||
|
|
||||||
|
@ -1051,3 +1053,15 @@ _NSRemoveHandler (NSHandler* handler)
|
||||||
#endif
|
#endif
|
||||||
thread->_exception_handler = handler->next;
|
thread->_exception_handler = handler->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSUncaughtExceptionHandler *
|
||||||
|
NSGetUncaughtExceptionHandler()
|
||||||
|
{
|
||||||
|
return _NSUncaughtExceptionHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *handler)
|
||||||
|
{
|
||||||
|
_NSUncaughtExceptionHandler = handler;
|
||||||
|
}
|
||||||
|
|
|
@ -104,12 +104,6 @@ NSString *const NSIsNotNilTransformerName
|
||||||
NSString *const NSUnarchiveFromDataTransformerName
|
NSString *const NSUnarchiveFromDataTransformerName
|
||||||
= @"NSUnarchiveFromData";
|
= @"NSUnarchiveFromData";
|
||||||
|
|
||||||
/**
|
|
||||||
* Last-resort exception handler, a function taking an NSException and
|
|
||||||
* returning void. Set with NSSetUncaughtExceptionHandler().
|
|
||||||
*/
|
|
||||||
NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
|
||||||
|
|
||||||
/* NSBundle */
|
/* NSBundle */
|
||||||
NSString *NSBundleDidLoadNotification = @"NSBundleDidLoadNotification";
|
NSString *NSBundleDidLoadNotification = @"NSBundleDidLoadNotification";
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
#include "Foundation/Foundation.h"
|
#include "Foundation/Foundation.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
handler(NSException *e)
|
||||||
|
{
|
||||||
|
NSLog(@"Caught %@", e);
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
CREATE_AUTORELEASE_POOL(arp);
|
CREATE_AUTORELEASE_POOL(arp);
|
||||||
|
@ -43,6 +49,9 @@ int main()
|
||||||
|
|
||||||
printf("Second task has completed\n");
|
printf("Second task has completed\n");
|
||||||
|
|
||||||
|
NSSetUncaughtExceptionHandler(handler);
|
||||||
|
[NSException raise: NSGenericException format: @"an exception"];
|
||||||
|
|
||||||
DESTROY(arp);
|
DESTROY(arp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue