aboutsummaryrefslogtreecommitdiff
path: root/openssl/trunk/MacOS/GetHTTPS.src/ErrorHandling.hpp
blob: 3036df7ee0bf710c9355457827063885f6102f0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#ifdef __cplusplus
extern "C" {
#endif

#ifndef kGenericError
	#define kGenericError		-1
#endif

extern char	*gErrorMessage;


void SetErrorMessage(const char *theErrorMessage);
void SetErrorMessageAndAppendLongInt(const char *theErrorMessage,const long theLongInt);
void SetErrorMessageAndCStrAndLongInt(const char *theErrorMessage,const char * theCStr,const long theLongInt);
void SetErrorMessageAndCStr(const char *theErrorMessage,const char * theCStr);
void AppendCStrToErrorMessage(const char *theErrorMessage);
void AppendLongIntToErrorMessage(const long theLongInt);


char *GetErrorMessage(void);
OSErr GetErrorMessageInNewHandle(Handle *inoutHandle);
OSErr GetErrorMessageInExistingHandle(Handle inoutHandle);
OSErr AppendErrorMessageToHandle(Handle inoutHandle);


#ifdef __EXCEPTIONS_ENABLED__
	void ThrowErrorMessageException(void);
#endif



//	A bunch of evil macros that would be uneccessary if I were always using C++ !

#define SetErrorMessageAndBailIfNil(theArg,theMessage)								\
{																					\
	if (theArg == nil)																\
	{																				\
		SetErrorMessage(theMessage);												\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndBail(theMessage)											\
{																					\
		SetErrorMessage(theMessage);												\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
}


#define SetErrorMessageAndLongIntAndBail(theMessage,theLongInt)						\
{																					\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
}


#define SetErrorMessageAndLongIntAndBailIfError(theErrCode,theMessage,theLongInt)	\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageCStrLongIntAndBailIfError(theErrCode,theMessage,theCStr,theLongInt)	\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessageAndCStrAndLongInt(theMessage,theCStr,theLongInt);			\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndCStrAndBail(theMessage,theCStr)							\
{																					\
	SetErrorMessageAndCStr(theMessage,theCStr);										\
	errCode = kGenericError;														\
	goto EXITPOINT;																	\
}


#define SetErrorMessageAndBailIfError(theErrCode,theMessage)						\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessage(theMessage);												\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndLongIntAndBailIfNil(theArg,theMessage,theLongInt)			\
{																					\
	if (theArg == nil)																\
	{																				\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
	}																				\
}


#define BailIfError(theErrCode)														\
{																					\
	if ((theErrCode) != noErr)														\
	{																				\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrCodeAndBail(theErrCode)												\
{																					\
	errCode = theErrCode;															\
																					\
	goto EXITPOINT;																	\
}


#define SetErrorCodeAndMessageAndBail(theErrCode,theMessage)						\
{																					\
	SetErrorMessage(theMessage);													\
	errCode = theErrCode;															\
	goto EXITPOINT;																	\
}


#define BailNow()																	\
{																					\
	errCode = kGenericError;														\
	goto EXITPOINT;																	\
}


#ifdef __cplusplus
}
#endif
ass="n">NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! #endif /* Unroll the inner loop, this sometimes helps, sometimes hinders. * Very mucy CPU dependant */ #ifndef DES_UNROLL #undef DES_UNROLL #endif /* These default values were supplied by * Peter Gutman <pgut001@cs.auckland.ac.nz> * They are only used if nothing else has been defined */ #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) /* Special defines which change the way the code is built depending on the CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find even newer MIPS CPU's, but at the moment one size fits all for optimization options. Older Sparc's work better with only UNROLL, but there's no way to tell at compile time what it is you're running on */ #if defined( sun ) /* Newer Sparc's */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #elif defined( __ultrix ) /* Older MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined( __osf1__ ) /* Alpha */ # define DES_PTR # define DES_RISC2 #elif defined ( _AIX ) /* RS6000 */ /* Unknown */ #elif defined( __hpux ) /* HP-PA */ /* Unknown */ #elif defined( __aux ) /* 68K */ /* Unknown */ #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ # define DES_UNROLL #elif defined( __sgi ) /* Newer MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #endif /* Systems-specific speed defines */ #endif #endif /* DES_DEFAULT_OPTIONS */ #endif /* HEADER_DES_LOCL_H */