2002-12-31 10:41:10 +00:00
/** Interface for NSException for GNUStep
1996-09-02 13:55:45 +00:00
Copyright ( C ) 1995 , 1996 Free Software Foundation , Inc .
1995-07-01 19:01:11 +00:00
Written by : Adam Fedor < fedor @ boulder . colorado . edu >
Date : 1995
1995-03-23 03:47:56 +00:00
1996-05-12 00:56:10 +00:00
This file is part of the GNUstep Base Library .
1995-03-23 03:47:56 +00:00
This library is free software ; you can redistribute it and / or
2007-09-14 11:36:11 +00:00
modify it under the terms of the GNU Lesser General Public
1995-03-23 03:47:56 +00:00
License as published by the Free Software Foundation ; either
2008-06-08 10:38:33 +00:00
version 2 of the License , or ( at your option ) any later version .
1995-03-23 03:47:56 +00:00
This library is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Library General Public License for more details .
2007-09-14 11:36:11 +00:00
You should have received a copy of the GNU Lesser General Public
1995-03-23 03:47:56 +00:00
License along with this library ; if not , write to the Free
2006-10-31 07:05:46 +00:00
Software Foundation , Inc . , 51 Franklin Street , Fifth Floor ,
Boston , MA 02111 USA .
2002-12-31 10:41:10 +00:00
2002-12-31 11:29:59 +00:00
< title > NSException and NSAssertionHandler class reference < / title >
2002-12-31 10:41:10 +00:00
AutogsdocSource : NSAssertionHandler . m
AutogsdocSource : NSException . m
1995-03-23 03:47:56 +00:00
*/
1996-04-17 19:36:35 +00:00
# ifndef __NSException_h_GNUSTEP_BASE_INCLUDE
# define __NSException_h_GNUSTEP_BASE_INCLUDE
2006-10-31 07:05:46 +00:00
# import <GNUstepBase / GSVersionMacros.h>
2010-03-11 07:22:10 +00:00
# import <GNUstepBase / GSConfig.h>
# if defined(_NATIVE_OBJC_EXCEPTIONS)
2012-07-20 12:39:13 +00:00
# define USER_NATIVE_OBJC_EXCEPTIONS 1
# elif defined(BASE_NATIVE_OBJC_EXCEPTIONS) && defined(OBJC_ZEROCOST_EXCEPTIONS)
# define USER_NATIVE_OBJC_EXCEPTIONS 1
# define _NATIVE_OBJC_EXCEPTIONS 1
2010-03-11 07:22:10 +00:00
# endif
2012-07-20 12:39:13 +00:00
2012-01-12 10:10:33 +00:00
# if !BASE_NATIVE_OBJC_EXCEPTIONS && USER_NATIVE_OBJC_EXCEPTIONS
2012-03-20 17:35:04 +00:00
# error "There are two separate exception handling mechanisms available ... one based on the standard setjmp() function (which does not require special compiler support), and one 'native' version where the compiler manages the exception handling. If you try to use both in the same executable, exception handlers will not work... which can be pretty disastrous. This error is telling you that the gnustep-base library was built using one form of exception handling, but that the gnustep-make package you are using is building code to use the other form of exception handling ... with the consequence that exception handling would be broken in the program you are building. So, somehow your gnustep-base and gnustep-make package are incompatible, and you need to replace one of them with a version configured to match the other."
2012-03-20 15:09:42 +00:00
# if BASE_NATIVE_OBJC_EXCEPTIONS
2012-03-20 17:35:04 +00:00
# error "gnustep-base is configured to use 'native' exceptions, but you are building for 'traditional' exceptions."
2012-03-20 15:09:42 +00:00
# else
2012-03-20 17:35:04 +00:00
# error "gnustep-base is configured to use 'traditional' exceptions, but you are building for 'native' exceptions."
2012-03-20 15:09:42 +00:00
# endif
2010-03-11 07:22:10 +00:00
# endif
1995-03-18 17:15:15 +00:00
2006-10-31 07:05:46 +00:00
# import <Foundation / NSString.h>
1995-03-18 17:15:15 +00:00
# include <setjmp.h>
1995-03-23 03:47:56 +00:00
# include <stdarg.h>
1995-03-18 17:15:15 +00:00
2006-09-13 10:20:49 +00:00
# if defined(__cplusplus)
extern " C " {
# endif
1995-03-18 17:15:15 +00:00
@ class NSDictionary ;
2005-12-01 19:51:45 +00:00
/**
< p >
The < code > NSException < / code > class helps manage errors in a program . It
provides a mechanism for lower - level methods to provide information about
problems to higher - level methods , which more often than not , have a
better ability to decide what to do about the problems .
< / p >
< p >
Exceptions are typically handled by enclosing a sensitive section
of code inside the macros < code > NS_DURING < / code > and < code > NS_HANDLER < / code > ,
and then handling any problems after this , up to the
< code > NS_ENDHANDLER < / code > macro :
< / p >
< example >
NS_DURING
code that might cause an exception
NS_HANDLER
code that deals with the exception . If this code cannot deal with
it , you can re - raise the exception like this
[ localException raise ]
so the next higher level of code can handle it
NS_ENDHANDLER
< / example >
< p >
The local variable < code > localException < / code > is the name of the exception
object you can use in the < code > NS_HANDLER < / code > section .
The easiest way to cause an exception is using the + raise : format : , . . .
method .
< / p >
< p >
If there is no NS_HANDLER . . . NS_ENDHANDLER block enclosing ( directly or
indirectly ) code where an exception is raised , then control passes to
the < em > uncaught exception handler < / em > function and the program is
then terminated . < br / >
The uncaught exception handler is set using NSSetUncaughtExceptionHandler ( )
and if not set , defaults to a function which will simply print an error
message before the program terminates .
< / p >
*/
1995-03-18 17:15:15 +00:00
@ interface NSException : NSObject < NSCoding , NSCopying >
{
2010-02-14 10:48:10 +00:00
# if GS_EXPOSE(NSException)
2007-12-05 16:13:24 +00:00
@ private
1999-09-16 07:21:34 +00:00
NSString * _e_name ;
NSString * _e_reason ;
2007-12-05 16:13:24 +00:00
void * _reserved ;
2010-02-14 10:48:10 +00:00
# endif
1995-03-18 17:15:15 +00:00
}
2005-12-01 19:51:45 +00:00
/**
2007-02-06 09:29:30 +00:00
* Create an an exception object with a name , reason and a dictionary
* userInfo which can be used to provide additional information or
* access to objects needed to handle the exception . After the
* exception is created you must - raise it .
*/
2000-04-05 14:21:05 +00:00
+ ( NSException * ) exceptionWithName : ( NSString * ) name
reason : ( NSString * ) reason
userInfo : ( NSDictionary * ) userInfo ;
2005-12-01 19:51:45 +00:00
/**
2007-02-06 09:29:30 +00:00
* Creates an exception with a name and a reason using the
* format string and any additional arguments . The exception is then
* < em > raised < / em > using the - raise method .
2005-12-01 19:51:45 +00:00
*/
2000-04-05 14:21:05 +00:00
+ ( void ) raise : ( NSString * ) name
format : ( NSString * ) format , . . . ;
2005-12-01 19:51:45 +00:00
/**
2007-02-06 09:29:30 +00:00
* Creates an exception with a name and a reason string using the
* format string and additional arguments specified as a variable
* argument list argList . The exception is then < em > raised < / em >
* using the - raise method .
2005-12-01 19:51:45 +00:00
*/
2000-04-05 14:21:05 +00:00
+ ( void ) raise : ( NSString * ) name
format : ( NSString * ) format
arguments : ( va_list ) argList ;
2009-09-12 07:37:00 +00:00
# if OS_API_VERSION(100500,GS_API_LATEST) && GS_API_VERSION( 11501,GS_API_LATEST)
2007-12-05 16:13:24 +00:00
/** Returns an array of the call stack return addresses at the point when
* the exception was raised . Re - raising the exception does not change
* this value .
*/
- ( NSArray * ) callStackReturnAddresses ;
2009-09-12 07:37:00 +00:00
# endif
# if OS_API_VERSION(100600,GS_API_LATEST) && GS_API_VERSION( 11903,GS_API_LATEST)
2009-09-11 16:14:45 +00:00
/**
* Returns an array of the symbolic names of the call stack return addresses .
* Note that , on some platforms , symbols are only exported in
* position - independent code and so these may only return numeric addresses for
* code in static libraries or the main application .
*/
2009-09-12 07:37:00 +00:00
- ( NSArray * ) callStackSymbols ;
2007-12-05 16:13:24 +00:00
# endif
2005-12-01 19:51:45 +00:00
/**
2007-02-06 09:29:30 +00:00
* < init / > Initializes a newly allocated NSException object with a
* name , reason and a dictionary userInfo .
*/
2000-04-05 14:21:05 +00:00
- ( id ) initWithName : ( NSString * ) name
reason : ( NSString * ) reason
userInfo : ( NSDictionary * ) userInfo ;
1995-03-18 17:15:15 +00:00
2005-12-01 19:51:45 +00:00
/** Returns the name of the exception. */
2000-04-05 14:21:05 +00:00
- ( NSString * ) name ;
2005-12-01 19:51:45 +00:00
/**
2007-02-06 09:29:30 +00:00
* Raises the exception . All code following the raise will not be
* executed and program control will be transfered to the closest
* calling method which encapsulates the exception code in an
* NS_DURING macro . < br / >
* If the exception was not caught in a macro , the currently set
* uncaught exception handler is called to perform final logging
* and the program is then terminated . < br / >
* If the uncaught exception handler fails to terminate the program ,
* then the default behavior is to terminate the program as soon as
* the uncaught exception handler function returns . < br / >
* NB . all other exception raising methods call this one , so if you
* want to set a breakpoint when debugging , set it in this method .
*/
2005-12-01 19:51:45 +00:00
- ( void ) raise ;
/** Returns the exception reason. */
2000-04-05 14:21:05 +00:00
- ( NSString * ) reason ;
2005-12-01 19:51:45 +00:00
2007-02-06 09:29:30 +00:00
/** Returns the exception userInfo dictionary.<br />
*/
2000-04-05 14:21:05 +00:00
- ( NSDictionary * ) userInfo ;
1995-03-18 17:15:15 +00:00
@ end
2008-03-17 05:45:55 +00:00
/** An exception when character set conversion fails.
*/
GS_EXPORT NSString * const NSCharacterConversionException ;
/** Attempt to use an invalidated destination.
*/
GS_EXPORT NSString * const NSDestinationInvalidException ;
/** A generic exception for general purpose usage.
2005-12-01 19:51:45 +00:00
*/
2002-06-09 11:47:45 +00:00
GS_EXPORT NSString * const NSGenericException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** An exception for cases where unexpected state is detected within an object.
2005-12-01 19:51:45 +00:00
*/
2002-06-09 11:47:45 +00:00
GS_EXPORT NSString * const NSInternalInconsistencyException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** An exception used when an invalid argument is passed to a method
2005-12-01 19:51:45 +00:00
* or function .
*/
2002-06-09 11:47:45 +00:00
GS_EXPORT NSString * const NSInvalidArgumentException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** Attempt to use a receive port which has been invalidated.
2005-12-01 19:51:45 +00:00
*/
2008-03-17 05:45:55 +00:00
GS_EXPORT NSString * const NSInvalidReceivePortException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** Attempt to use a send port which has been invalidated.
2005-12-01 19:51:45 +00:00
*/
2008-03-17 05:45:55 +00:00
GS_EXPORT NSString * const NSInvalidSendPortException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** An exception used when the system fails to allocate required memory.
2005-12-01 19:51:45 +00:00
*/
2008-03-17 05:45:55 +00:00
GS_EXPORT NSString * const NSMallocException ;
2005-12-01 19:51:45 +00:00
2008-03-17 05:45:55 +00:00
/** An exception when a remote object is sent a message from a thread
2006-11-28 01:20:46 +00:00
* unable to access the object .
*/
GS_EXPORT NSString * const NSObjectInaccessibleException ;
2008-03-17 05:45:55 +00:00
/** Attempt to send to an object which is no longer available.
*/
2008-03-16 22:43:43 +00:00
GS_EXPORT NSString * const NSObjectNotAvailableException ;
2008-03-17 05:45:55 +00:00
/** UNused ... for MacOS-X compatibility.
*/
GS_EXPORT NSString * const NSOldStyleException ;
2006-10-31 07:05:46 +00:00
# if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
2008-03-17 05:45:55 +00:00
/** An exception used when some form of parsing fails.
2005-12-01 19:51:45 +00:00
*/
2002-06-09 11:47:45 +00:00
GS_EXPORT NSString * const NSParseErrorException ;
2002-06-09 11:36:13 +00:00
# endif
1995-03-18 17:15:15 +00:00
2008-03-17 05:45:55 +00:00
/** Some failure to receive on a port.
*/
GS_EXPORT NSString * const NSPortReceiveException ;
/** Some failure to send on a port.
*/
GS_EXPORT NSString * const NSPortSendException ;
/**
* Exception raised by [ NSPort ] , [ NSConnection ] , and friends if sufficient
* time elapses while waiting for a response , or if the receiving port is
* invalidated before a request can be received . See
* [ NSConnection - setReplyTimeout : ] .
*/
GS_EXPORT NSString * const NSPortTimeoutException ; /* OPENSTEP */
/** An exception used when an illegal range is encountered ... usually this
* is used to provide more information than an invalid argument exception .
*/
GS_EXPORT NSString * const NSRangeException ;
2004-07-29 15:30:47 +00:00
/**
* The actual structure for an NSHandler . You shouldn ' t need to worry about it .
*/
1995-03-18 17:15:15 +00:00
typedef struct _NSHandler
{
jmp_buf jumpState ; /* place to longjmp to */
struct _NSHandler * next ; /* ptr to next handler */
2011-06-29 11:50:26 +00:00
__unsafe_unretained NSException * exception ;
1995-03-18 17:15:15 +00:00
} NSHandler ;
2004-07-29 15:30:47 +00:00
/**
2004-08-02 18:10:58 +00:00
* This is the type of the exception handler called when an exception is
* generated and not caught by the programmer . See
* NSGetUncaughtExceptionHandler ( ) , NSSetUncaughtExceptionHandler ( ) .
2004-07-29 15:30:47 +00:00
*/
2000-04-05 14:21:05 +00:00
typedef void NSUncaughtExceptionHandler ( NSException * exception ) ;
1995-03-18 17:15:15 +00:00
2004-08-02 18:10:58 +00:00
/**
* Returns the exception handler called when an exception is generated and
* not caught by the programmer ( by enclosing in < code > NS_DURING < / code > and
* < code > NS_HANDLER < / code > . . . < code > NS_ENDHANDLER < / code > ) . The default prints
* an error message and exits the program . You can change this behavior by
* calling NSSetUncaughtExceptionHandler ( ) .
*/
2008-06-23 07:15:10 +00:00
GS_EXPORT NSUncaughtExceptionHandler *
NSGetUncaughtExceptionHandler ( ) ;
2004-08-02 18:10:58 +00:00
/**
2005-12-01 19:51:45 +00:00
* < p > Sets the exception handler called when an exception is generated and
2004-08-02 18:10:58 +00:00
* not caught by the programmer ( by enclosing in < code > NS_DURING < / code > and
* < code > NS_HANDLER < / code > . . . < code > NS_ENDHANDLER < / code > ) . The default prints
* an error message and exits the program . proc should take a single argument
* of type < code > NSException * < / code > .
2005-12-01 19:51:45 +00:00
* < / p >
* < p > NB . If the exception handler set by this function does not terminate
* the process , the process will be terminateed anyway . This is a safety
2008-06-23 06:34:54 +00:00
* precaution to ensure that , in the event of an exception being raised
2005-12-01 19:51:45 +00:00
* and not handled , the program does not try to continue running in a
* confused state ( possibly doing horrible things like billing customers
* who shouldn ' t be billed etc ) , but shuts down as cleanly as possible .
* < / p >
* < p > Process termination is normally accomplished by calling the standard
2008-06-23 06:35:54 +00:00
* exit function of the C runtime library , but if the environment variable
2005-12-01 19:51:45 +00:00
* CRASH_ON_ABORT is set to YES or TRUE or 1 the termination will be
* accomplished by calling the abort function instead , which should cause
* a core dump to be made for debugging .
* < / p >
2008-06-23 06:34:54 +00:00
* < p > The value of proc should be a pointer to a function taking an
* [ NSException ] instance as an argument .
* < / p >
2004-08-02 18:10:58 +00:00
*/
2008-06-23 07:15:10 +00:00
GS_EXPORT void
NSSetUncaughtExceptionHandler ( NSUncaughtExceptionHandler * handler ) ;
1995-03-18 17:15:15 +00:00
2000-04-05 14:21:05 +00:00
/* NS_DURING, NS_HANDLER and NS_ENDHANDLER are always used like:
1995-03-18 17:15:15 +00:00
NS_DURING
some code which might raise an error
NS_HANDLER
code that will be jumped to if an error occurs
NS_ENDHANDLER
If any error is raised within the first block of code , the second block
of code will be jumped to . Typically , this code will clean up any
resources allocated in the routine , possibly case on the error code
and perform special processing , and default to RERAISE the error to
the next handler . Within the scope of the handler , a local variable
2006-04-26 14:15:03 +00:00
called " localException " holds information about the exception raised .
1995-03-18 17:15:15 +00:00
It is illegal to exit the first block of code by any other means than
NS_VALRETURN , NS_VOIDRETURN , or just falling out the bottom .
*/
2012-01-12 10:10:33 +00:00
# if USER_NATIVE_OBJC_EXCEPTIONS
2006-04-26 14:15:03 +00:00
# define NS_DURING @try {
# define NS_HANDLER } @catch (NSException * localException) {
# define NS_ENDHANDLER }
# define NS_VALRETURN(val) return (val)
# define NS_VALUERETURN(object, id) return (object)
# define NS_VOIDRETURN return
2012-01-12 10:10:33 +00:00
# elif !USER_NATIVE_OBJC_EXCEPTIONS && !BASE_NATIVE_OBJC_EXCEPTIONS
1995-03-18 17:15:15 +00:00
2004-07-29 15:30:47 +00:00
/** Private support routine. Do not call directly. */
2000-06-14 04:03:56 +00:00
GS_EXPORT void _NSAddHandler ( NSHandler * handler ) ;
2004-07-29 15:30:47 +00:00
/** Private support routine. Do not call directly. */
2000-06-14 04:03:56 +00:00
GS_EXPORT void _NSRemoveHandler ( NSHandler * handler ) ;
1995-03-18 17:15:15 +00:00
# define NS_DURING { NSHandler NSLocalHandler; \
_NSAddHandler ( & NSLocalHandler ) ; \
if ( ! setjmp ( NSLocalHandler . jumpState ) ) {
# define NS_HANDLER _NSRemoveHandler(&NSLocalHandler); } else { \
2013-04-15 09:07:19 +00:00
NSException __attribute__ ( ( unused ) ) * localException \
= NSLocalHandler . exception ; \
1999-02-25 22:42:58 +00:00
{
1995-03-18 17:15:15 +00:00
1999-02-25 22:42:58 +00:00
# define NS_ENDHANDLER }}}
1995-03-18 17:15:15 +00:00
2007-07-31 12:09:42 +00:00
# define NS_VALRETURN(val) do { __typeof__(val) temp = (val); \
1995-03-18 17:15:15 +00:00
_NSRemoveHandler ( & NSLocalHandler ) ; \
return ( temp ) ; } while ( 0 )
1999-03-10 05:01:03 +00:00
# define NS_VALUERETURN(object, id) do { id temp = object; \
_NSRemoveHandler ( & NSLocalHandler ) ; \
return ( temp ) ; } while ( 0 )
1995-03-18 17:15:15 +00:00
# define NS_VOIDRETURN do { _NSRemoveHandler(&NSLocalHandler); \
return ; } while ( 0 )
2006-04-26 14:15:03 +00:00
# endif // _NATIVE_OBJC_EXCEPTIONS
1995-04-10 00:11:24 +00:00
/* ------------------------------------------------------------------------ */
/* Assertion Handling */
/* ------------------------------------------------------------------------ */
@ interface NSAssertionHandler : NSObject
2000-04-05 14:21:05 +00:00
+ ( NSAssertionHandler * ) currentHandler ;
1995-04-10 00:11:24 +00:00
2000-04-05 14:21:05 +00:00
- ( void ) handleFailureInFunction : ( NSString * ) functionName
file : ( NSString * ) fileName
2009-02-23 20:42:32 +00:00
lineNumber : ( NSInteger ) line
2011-02-10 12:15:09 +00:00
description : ( NSString * ) format , . . . GS_NORETURN_METHOD ;
1995-04-10 00:11:24 +00:00
2000-04-05 14:21:05 +00:00
- ( void ) handleFailureInMethod : ( SEL ) aSelector
object : object
file : ( NSString * ) fileName
2009-02-23 20:42:32 +00:00
lineNumber : ( NSInteger ) line
2011-02-10 12:15:09 +00:00
description : ( NSString * ) format , . . . GS_NORETURN_METHOD ;
1995-04-10 00:11:24 +00:00
@ end
2010-11-07 15:37:19 +00:00
extern NSString * const NSAssertionHandlerKey ;
1995-04-10 00:11:24 +00:00
1998-11-19 17:07:37 +00:00
# ifdef NS_BLOCK_ASSERTIONS
# define _NSAssertArgs(condition, desc, args...)
# define _NSCAssertArgs(condition, desc, args...)
# else
# define _NSAssertArgs(condition, desc, args...) \
1995-04-10 00:11:24 +00:00
do { \
if ( ! ( condition ) ) { \
[ [ NSAssertionHandler currentHandler ] \
2000-04-05 14:21:05 +00:00
handleFailureInMethod : _cmd \
object : self \
2006-10-09 14:00:01 +00:00
file : [ NSString stringWithUTF8String : __FILE__ ] \
2000-04-05 14:21:05 +00:00
lineNumber : __LINE__ \
description : ( desc ) , # # args ] ; \
1995-04-10 00:11:24 +00:00
} \
} while ( 0 )
# define _NSCAssertArgs(condition, desc, args...) \
do { \
if ( ! ( condition ) ) { \
[ [ NSAssertionHandler currentHandler ] \
2006-10-09 14:00:01 +00:00
handleFailureInFunction : [ NSString stringWithUTF8String : __PRETTY_FUNCTION__ ] \
file : [ NSString stringWithUTF8String : __FILE__ ] \
2000-04-05 14:21:05 +00:00
lineNumber : __LINE__ \
description : ( desc ) , # # args ] ; \
1995-04-10 00:11:24 +00:00
} \
} while ( 0 )
1998-11-19 17:07:37 +00:00
# endif
1995-04-10 00:11:24 +00:00
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 , arg4 , arg5 */
1995-04-10 00:11:24 +00:00
# define NSAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) \
_NSAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) , ( arg4 ) , ( arg5 ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 , arg4 */
1995-04-10 00:11:24 +00:00
# define NSAssert4(condition, desc, arg1, arg2, arg3, arg4) \
_NSAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) , ( arg4 ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 */
1995-04-10 00:11:24 +00:00
# define NSAssert3(condition, desc, arg1, arg2, arg3) \
_NSAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 */
1995-04-10 00:11:24 +00:00
# define NSAssert2(condition, desc, arg1, arg2) \
_NSAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 */
1995-04-10 00:11:24 +00:00
# define NSAssert1(condition, desc, arg1) \
_NSAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc */
1995-04-10 00:11:24 +00:00
# define NSAssert(condition, desc) \
_NSAssertArgs ( ( condition ) , ( desc ) )
2002-12-31 10:41:10 +00:00
/** Used in an ObjC method body.<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception saying that an invalid
* parameter was supplied to the method . */
1995-04-10 00:11:24 +00:00
# define NSParameterAssert(condition) \
_NSAssertArgs ( ( condition ) , @ " Invalid parameter not satisfying: %s " , # condition )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 , arg4 , arg5 */
1995-04-10 00:11:24 +00:00
# define NSCAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) \
_NSCAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) , ( arg4 ) , ( arg5 ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 , arg4 */
1995-04-10 00:11:24 +00:00
# define NSCAssert4(condition, desc, arg1, arg2, arg3, arg4) \
_NSCAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) , ( arg4 ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2 ,
* arg3 */
1995-04-10 00:11:24 +00:00
# define NSCAssert3(condition, desc, arg1, arg2, arg3) \
_NSCAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) , ( arg3 ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1 , arg2
*/
1995-04-10 00:11:24 +00:00
# define NSCAssert2(condition, desc, arg1, arg2) \
_NSCAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) , ( arg2 ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc and arg1
*/
1995-04-10 00:11:24 +00:00
# define NSCAssert1(condition, desc, arg1) \
_NSCAssertArgs ( ( condition ) , ( desc ) , ( arg1 ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception using desc
*/
1995-04-10 00:11:24 +00:00
# define NSCAssert(condition, desc) \
_NSCAssertArgs ( ( condition ) , ( desc ) )
2002-12-31 10:41:10 +00:00
/** Used in plain C code (not in an ObjC method body).<br />
* See [ NSAssertionHandler ] for details . < br / >
* When condition is false , raise an exception saying that an invalid
* parameter was supplied to the method . */
1995-04-10 00:11:24 +00:00
# define NSCParameterAssert(condition) \
_NSCAssertArgs ( ( condition ) , @ " Invalid parameter not satisfying: %s " , # condition )
2006-09-13 10:20:49 +00:00
# if defined(__cplusplus)
}
# endif
1996-04-17 19:36:35 +00:00
# endif /* __NSException_h_GNUSTEP_BASE_INCLUDE */