home *** CD-ROM | disk | FTP | other *** search
- #include "InsideMac.h"
-
- #include <Events.h>
- #include <GestaltEqu.h>
- #include <OSUtils.h>
- #include <QuickDraw.h>
- #include <PPCToolbox.h>
- #include <Traps.h>
-
-
- #if defined(__MWERKS__)
- #pragma segment __%Main
- #else
- #pragma segment Main
- #endif
-
-
- boolean
- TrapAvailable (short theTrap)
- {
- TrapType tType;
-
- if ((tType = GetTrapType (theTrap)) == ToolTrap)
- {
- theTrap &= 0x7FF;
- if (theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
- }
- return NGetTrapAddress (theTrap, tType) != NGetTrapAddress (_Unimplemented, ToolTrap);
- }
-
-
-
- TrapType
- GetTrapType (short theTrap)
- {
- return theTrap & 0x800 > 0 ? ToolTrap : OSTrap;
- }
-
-
-
- boolean
- GestaltAvailable (void)
- {
- return TrapAvailable (0xA1AD);
- }
-
-
-
- boolean
- System7Available (void)
- {
- boolean available = false;
-
- if (GestaltAvailable())
- {
- long result;
-
- Gestalt (gestaltSystemVersion, & result);
- available = ((result >> 8) & 0xFF) >= 7;
- }
- return available;
- }
-
-
-
- boolean
- ColorQDAvailable (void)
- {
- static boolean firstTime = true;
- static boolean available = false;
-
- if (firstTime)
- {
- long result;
-
- firstTime = false;
- if (GestaltAvailable())
- {
- Gestalt (gestaltQuickdrawVersion, & result);
- available = (result & 0xFFFF) >= gestalt8BitQD;
- }
- }
- return available;
- }
-
-
-
- short
- NumToolboxTraps (void)
- {
- return NGetTrapAddress (0xAA6E, ToolTrap) == NGetTrapAddress (_InitGraf, ToolTrap)
- ? 0X200
- : 0X400;
- }
-
-
- OSErr
- InitPPC (void)
- {
- long PPCAttributes;
- OSErr error;
-
- if ((error = Gestalt (gestaltPPCToolboxAttr, &PPCAttributes)) == noErr)
- {
- if (! (PPCAttributes & gestaltPPCSupportsRealTime))
- {
- error = PPCInit();
- // Next line in IM was an error? Comment did not match code!
- // error = Gestalt (gestaltPPCToolboxAttr, &PPCAttributes);
- }
- if (PPCAttributes & gestaltPPCSupportsOutGoing)
- {
- // Ports can be opened to the outside world
- }
- else
- {
- // Appletalk disabled?
- }
- if (PPCAttributes & gestaltPPCSupportsIncoming)
- {
- // Outside world can see location names
- }
- else
- {
- // Program linking disabled?
- }
- }
- return error;
- }
-