home *** CD-ROM | disk | FTP | other *** search
- /* macinit.c
- *
- * A bunch of initialization routines which prepare the mac, ready of operation.
- * The equivalent shutdown routines are also here
- *
- */
-
- #include <MacHeaders>
- #include <Palettes.h>
- #include "common.h"
-
- #define STACK_SIZE (500*1024)
-
- void CantOpen() ;
-
- /*
- * MacInitialize()
- *
- * Initialize all the managers & memory
- *
- */
- void MacInitialize(void)
- {
- /* A nice hefty stack */
- SetApplLimit(ApplicZone()+STACK_SIZE) ;
-
- InitGraf(&thePort);
- InitFonts();
- FlushEvents(everyEvent, 0);
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- if (GetResource('MENU', 1)==0) {
- /* Foul up has occured, no resources ! */
- SysBeep(20);
- CantOpen();
- ExitToShell() ;
- }
- SetUpMenus();
- }
-
- void
- RSGetCpuTime(usertime, systime)
- Float *usertime, *systime;
- {
- *usertime = 0.;
- *systime = (Float)TickCount()/6.;
- }
-
-
- void CantOpen()
- {
- Rect r;
- WindowPtr errorWindow;
-
- SetRect(&r, 152, 60, 356, 132);
- SetPort((errorWindow = NewWindow( (Ptr) 0L, &r, "\p", true, dBoxProc, (WindowPtr) -1L, false, 0L)));
- TextFont(0);
- MoveTo(4, 20);
- DrawString("\pCan't open resource file.");
- MoveTo(4, 40);
- DrawString("\pClick mouse to exit.");
- do {
- } while (!Button());
- }
-