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.
Src/MicrosecondTrapPresent.c
/* MicrosecondTrapPresent.c */ |
/* |
* MicrosecondTrapPresent.c |
* Copyright © 1992-94 Apple Computer Inc. All Rights Reserved. |
*/ |
#include <OSUtils.h> |
#include "MicrosecondTrap.h" |
static Boolean TrapAvailable( |
short theTrap |
); |
Boolean |
MicrosecondTrapPresent(void) |
{ |
return (TrapAvailable(_Microseconds)); |
} |
/* |
* TrapAvailable (see Inside Mac VI 3-8) |
*/ |
#define NumToolboxTraps() ( \ |
(NGetTrapAddress(_InitGraf, ToolTrap) \ |
== NGetTrapAddress(0xAA6E, ToolTrap)) \ |
? 0x200 : 0x400 \ |
) |
#define GetTrapType(theTrap) ( \ |
(((theTrap) & 0x800) != 0) ? ToolTrap : OSTrap \ |
) |
static Boolean |
TrapAvailable( |
short theTrap |
) |
{ |
TrapType trapType; |
trapType = GetTrapType(theTrap); |
if (trapType == ToolTrap) { |
theTrap &= 0x07FF; |
if (theTrap >= NumToolboxTraps()) |
theTrap = _Unimplemented; |
} |
return ( |
NGetTrapAddress(theTrap, trapType) |
!= NGetTrapAddress(_Unimplemented, ToolTrap) |
); |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14