Source/InitMac.c

/*
    9-30-92  ¥ Brigham Stevens
    --------------------------
 
    This file contains the standard witch chant for getting the Mac going
*/
 
/* Need this header file because we set the WNE flag */
#include "EventLoop.h"
 
 
 
#define _Unimplemented 0xA89F
#define _WaitNextEvent 0xA860
 
Boolean TrapAvailable ( short tNum, short tType)
{
    return ( NGetTrapAddress(tNum,tType) != GetTrapAddress(_Unimplemented) );
}
 
Boolean WNEIsImplemented()
{
    SysEnvRec   theWorld;
    
    SysEnvirons(1,&theWorld);
    if (theWorld.machineType < 0)
        return false;
    else
        return TrapAvailable ( _WaitNextEvent, ToolTrap);
}
 
 
 
InitToolBox(short numberOfMasters)
/*
    pass the number of times you want MoreMasters to be called
    if your app has lots of Handles to allocate
    then call MoreMasters lots of times.
*/
{
    
    InitGraf(&thePort);
    InitFonts();
    InitWindows();
    InitMenus();
    InitCursor();
    TEInit();
    FlushEvents(everyEvent, 0);
    InitDialogs(nil);
    
    while(numberOfMasters--)
        MoreMasters();
        
    MaxApplZone();
 
    WNE_available = WNEIsImplemented();
}