diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-02-03 00:41:41 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-02-03 00:41:41 +0000 |
commit | ceffab0b64fa0ac35fba1c9bb506cfb98a583f5b (patch) | |
tree | df6dff46b7f6451117bd23d9e09a548d741bd8d3 /gcc/objc/objc-api.h | |
parent | 91e36d94de301e388a67f946d3bf36a44232f4c8 (diff) | |
download | gcc-ceffab0b64fa0ac35fba1c9bb506cfb98a583f5b.tar.gz |
Declare error handling functions and typedef for user specified error
handler function. Define error codes used by the runtime library.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc/objc-api.h')
-rw-r--r-- | gcc/objc/objc-api.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/gcc/objc/objc-api.h b/gcc/objc/objc-api.h index ff452a48c7c..5962f027d53 100644 --- a/gcc/objc/objc-api.h +++ b/gcc/objc/objc-api.h @@ -1,5 +1,5 @@ /* GNU Objective-C Runtime API. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of GNU CC. @@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ #include "objc/hash.h" #include "objc/thr.h" #include <stdio.h> +#include <stdarg.h> /* For functions which return Method_t */ #define METHOD_NULL (Method_t)0 @@ -74,6 +75,57 @@ struct objc_method_description #define _C_STRUCT_E '}' +/* +** Error handling +** +** Call objc_error() or objc_verror() to record an error; this error +** routine will generally exit the program but not necessarily if the +** user has installed his own error handler. +** +** Call objc_set_error_handler to assign your own function for +** handling errors. The function should return YES if it is ok +** to continue execution, or return NO or just abort if the +** program should be stopped. The default error handler is just to +** print a message on stderr. +** +** The error handler function should be of type objc_error_handler +** The first parameter is an object instance of relevance. +** The second parameter is an error code. +** The third parameter is a format string in the printf style. +** The fourth parameter is a variable list of arguments. +*/ +extern void objc_error(id object, int code, const char* fmt, ...); +extern void objc_verror(id object, int code, const char* fmt, va_list ap); +typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap); +objc_error_handler objc_set_error_handler(objc_error_handler func); + +/* +** Error codes +** These are used by the runtime library, and your +** error handling may use them to determine if the error is +** hard or soft thus whether execution can continue or abort. +*/ +#define OBJC_ERR_UNKNOWN 0 /* Generic error */ + +#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */ +#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */ +#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */ +#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */ + +#define OBJC_ERR_MEMORY 10 /* Out of memory */ + +#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root + object more than once. */ +#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */ +#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */ +#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */ +#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */ +#define OBJC_ERR_NO_READ 25 /* Cannot read stream */ +#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */ +#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */ +#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */ + +#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */ /* ** Set this variable nonzero to print a line describing each |