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.
TumblerSource/Tumbler_traps.c
// Simple framework for Macintosh sample code |
// |
// Nick Thompson, DEVSUPPORT |
// |
// This file contains the trap detection related code code for the framework. |
// |
// 9/16/94 nick first cut |
#include <Types.h> |
#include <Traps.h> |
#include <OSUtils.h> |
#include <Gestalt.h> |
#include "Tumbler_Traps.h" |
#include "Tumbler_traps.h" |
short myNumToolboxTraps(void); |
TrapType myGetTrapType(short theTrap); |
short myNumToolboxTraps(void) |
{ |
if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap)) |
return 0x0200; |
else |
return 0x0400; |
} |
TrapType myGetTrapType(short theTrap) |
{ |
if ((theTrap & 0x0800) > 0) |
return ToolTrap; |
else |
return OSTrap; |
} |
Boolean myTrapAvailable(short theTrap) |
{ |
TrapType tType; |
Boolean isAvail; |
tType = myGetTrapType(theTrap); |
if (tType == ToolTrap) |
{ |
theTrap &= 0x07FF; |
if (theTrap >= myNumToolboxTraps()) |
theTrap = _Unimplemented; |
} |
isAvail = NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap); |
return isAvail; |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14