6 #define kGenericError -1
9 extern char *gErrorMessage
;
12 void SetErrorMessage(const char *theErrorMessage
);
13 void SetErrorMessageAndAppendLongInt(const char *theErrorMessage
,const long theLongInt
);
14 void SetErrorMessageAndCStrAndLongInt(const char *theErrorMessage
,const char * theCStr
,const long theLongInt
);
15 void SetErrorMessageAndCStr(const char *theErrorMessage
,const char * theCStr
);
16 void AppendCStrToErrorMessage(const char *theErrorMessage
);
17 void AppendLongIntToErrorMessage(const long theLongInt
);
20 char *GetErrorMessage(void);
21 OSErr
GetErrorMessageInNewHandle(Handle
*inoutHandle
);
22 OSErr
GetErrorMessageInExistingHandle(Handle inoutHandle
);
23 OSErr
AppendErrorMessageToHandle(Handle inoutHandle
);
26 #ifdef __EXCEPTIONS_ENABLED__
27 void ThrowErrorMessageException(void);
32 // A bunch of evil macros that would be unnecessary if I were always using C++ !
34 #define SetErrorMessageAndBailIfNil(theArg,theMessage) \
38 SetErrorMessage(theMessage); \
39 errCode = kGenericError; \
45 #define SetErrorMessageAndBail(theMessage) \
47 SetErrorMessage(theMessage); \
48 errCode = kGenericError; \
53 #define SetErrorMessageAndLongIntAndBail(theMessage,theLongInt) \
55 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
56 errCode = kGenericError; \
61 #define SetErrorMessageAndLongIntAndBailIfError(theErrCode,theMessage,theLongInt) \
63 if (theErrCode != noErr) \
65 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
66 errCode = theErrCode; \
72 #define SetErrorMessageCStrLongIntAndBailIfError(theErrCode,theMessage,theCStr,theLongInt) \
74 if (theErrCode != noErr) \
76 SetErrorMessageAndCStrAndLongInt(theMessage,theCStr,theLongInt); \
77 errCode = theErrCode; \
83 #define SetErrorMessageAndCStrAndBail(theMessage,theCStr) \
85 SetErrorMessageAndCStr(theMessage,theCStr); \
86 errCode = kGenericError; \
91 #define SetErrorMessageAndBailIfError(theErrCode,theMessage) \
93 if (theErrCode != noErr) \
95 SetErrorMessage(theMessage); \
96 errCode = theErrCode; \
102 #define SetErrorMessageAndLongIntAndBailIfNil(theArg,theMessage,theLongInt) \
106 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
107 errCode = kGenericError; \
113 #define BailIfError(theErrCode) \
115 if ((theErrCode) != noErr) \
122 #define SetErrCodeAndBail(theErrCode) \
124 errCode = theErrCode; \
130 #define SetErrorCodeAndMessageAndBail(theErrCode,theMessage) \
132 SetErrorMessage(theMessage); \
133 errCode = theErrCode; \
140 errCode = kGenericError; \