home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-10-24 | 2.6 KB | 115 lines | [TEXT/KAHL] |
- ///--------------------------------------------------------------------------------------
- // SWApplication.c
- //
- // Portions are Copyright: © 1993 Tony Myles, All rights reserved worldwide.
- ///--------------------------------------------------------------------------------------
-
-
- #include <GestaltEqu.h>
- #include "SWApplication.h"
-
-
- ///--------------------------------------------------------------------------------------
- // Initialize
- ///--------------------------------------------------------------------------------------
-
- pascal void Initialize(short numberOfMasters)
- {
- EventRecord tempEvent;
-
- MaxApplZone();
-
- while (numberOfMasters--)
- {
- MoreMasters();
- }
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(NULL);
- InitCursor();
- FlushEvents(everyEvent, 0);
-
- (void)EventAvail(everyEvent, &tempEvent);
- (void)EventAvail(everyEvent, &tempEvent);
- (void)EventAvail(everyEvent, &tempEvent);
- }
-
-
- ///--------------------------------------------------------------------------------------
- // ErrorAlert
- ///--------------------------------------------------------------------------------------
-
- pascal void ErrorAlert(OSErr err, short errorStringIndex)
- {
- Str255 messageString, errorString;
-
- GetIndString(messageString, kErrorStringListResID, errorStringIndex);
-
- if (messageString[0] == 0)
- {
- BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
- }
-
- NumToString(err, errorString);
-
- ParamText(messageString, errorString, "\p", "\p");
-
- (void)StopAlert(kErrorAlertResID, NULL);
- }
-
-
- ///--------------------------------------------------------------------------------------
- // FatalError
- ///--------------------------------------------------------------------------------------
-
- pascal void FatalError(OSErr err)
- {
- if (err != noErr)
- {
- if (err == memFullErr)
- {
- ErrorAlert(err, kOutOfMemStringIndex);
- }
- else
- {
- ErrorAlert(err, kFatalErrorStringIndex);
- }
- ExitToShell();
- }
- }
-
-
- ///--------------------------------------------------------------------------------------
- // CantFindResource
- ///--------------------------------------------------------------------------------------
-
- pascal void CantFindResource(void)
- {
- OSErr err;
-
- err = ResError();
-
- if (err == noErr)
- {
- err = resNotFound;
- }
-
- ErrorAlert(err, kCantFindResourceStringIndex);
-
- ExitToShell();
- }
-
-
- ///--------------------------------------------------------------------------------------
- // CantRunOnThisMachine
- ///--------------------------------------------------------------------------------------
-
- pascal void CantRunOnThisMachine(void)
- {
- (void)StopAlert(kCantRunAlertResID, NULL);
- }
-