Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Source/ErrorHandler.c
/* |
File: ErrorHandler.c |
Contains: xxx put contents here xxx |
Version: xxx put version here xxx |
Copyright: © 1998-1999 by Apple Computer, Inc., all rights reserved. |
File Ownership: |
DRI: xxx put dri here xxx |
Other Contact: xxx put other contact here xxx |
Technology: xxx put technology here xxx |
Writers: |
(cjd) Chris De Salvo |
(sjb) Steve Bollinger |
(BWS) Brent Schorsch |
Change History (most recent first): |
<SP10> 1/21/99 cjd Make sure that ISpSuspend is defined before calling it |
<9> 6/18/98 sjb InputSprocket.h comes from <> place |
<8> 6/12/98 BWS Now uses InputSprocket 68k |
*/ |
//¥ ------------------------------------------------------------------------------------------ ¥ |
//¥ |
//¥ Copyright © 1996 Apple Computer, Inc., All Rights Reserved |
//¥ |
//¥ |
//¥ You may incorporate this sample code into your applications without |
//¥ restriction, though the sample code has been provided "AS IS" and the |
//¥ responsibility for its operation is 100% yours. However, what you are |
//¥ not permitted to do is to redistribute the source as "DSC Sample Code" |
//¥ after having made changes. If you're going to re-distribute the source, |
//¥ we require that you make it clear in the source that the code was |
//¥ descended from Apple Sample Code, but that you've made changes. |
//¥ |
//¥ Authors: |
//¥ Chris De Salvo |
//¥ |
//¥ ------------------------------------------------------------------------------------------ ¥ |
//¥ ------------------------------ Includes |
#include <Dialogs.h> |
#include <Processes.h> |
#include <TextUtils.h> |
#include <string.h> |
#include <InputSprocket.h> |
#include "ErrorHandler.h" |
#include "SIResources.h" |
//¥ ------------------------------ Private Definitions |
//¥ ------------------------------ Private Constants |
//¥ ------------------------------ Private Types |
//¥ ------------------------------ Private Structs |
//¥ ------------------------------ Private Variables |
//¥ ------------------------------ Private Functions |
//¥ ------------------------------ Public Variables |
//¥ ------------------------------ FatalError |
void |
FatalError(char *error) |
{ |
Str255 errorHeader; |
UInt8 errorString[256]; |
strcpy((char *) errorString + 1, error); |
errorString[0] = strlen((char *) errorString + 1); |
GetIndString(errorHeader, kSTRMessageStrings, kSTRiFatal); |
if (nil != ISpSuspend) |
ISpSuspend(); |
ParamText(errorHeader, errorString, "\p", "\p"); |
if (Alert(kALRTFatal, nil) == cancel) |
Debugger(); |
ExitToShell(); |
} |
//¥ ------------------------------ NonFatalError |
void |
NonFatalError(char *error) |
{ |
Str255 errorHeader; |
UInt8 errorString[256]; |
strcpy((char *) errorString + 1, error); |
errorString[0] = strlen((char *) errorString + 1); |
GetIndString(errorHeader, kSTRMessageStrings, kSTRiNonFatal); |
if (nil != ISpSuspend) |
ISpSuspend(); |
ParamText(errorHeader, errorString, "\p", "\p"); |
Alert(kALRTNonFatal, nil); |
} |
//¥ ------------------------------ MessageError |
short |
MessageError(char *error1, char *error2) |
{ |
UInt8 errorString1[256]; |
UInt8 errorString2[256]; |
strcpy((char *) errorString1 + 1, error1); |
errorString1[0] = strlen((char *) errorString1 + 1); |
strcpy((char *) errorString2 + 1, error2); |
errorString2[0] = strlen((char *) errorString2 + 1); |
if (nil != ISpSuspend) |
ISpSuspend(); |
ParamText(errorString1, errorString2, "\p", "\p"); |
return (Alert(kALRTMessage, nil)); |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-10-14