Show CFMA5.h syntax highlighted
/****************************************************************************************
CFMA5.h $Revision: 1.2 $
<http://rentzsch.com/redshedthreads>
Copyright © 2000-2002 Red Shed Software. All rights reserved.
by Jonathan 'Wolf' Rentzsch (jon at redshed dot net)
Under the Classic Runtime Architecture of the Mac, a5 would hold the application's
globals. It was necessary to save it before calling certain Toolbox functions and
restore it in the callback.
The Code Fragment Manager (either 68K or PowerPC) made this dance pointless. Under
68K, it doesn't hurt anything. Under PowerPC, it invokes the 68K emulator to set
its virtual a5 register. This is an unnecessary and large performance hit.
This file supplies three macros which:
o Give the Toolbox functions better names (call SetCurrentA5() to get the a5??).
o Call upon the Toolbox when necessary (when compiling for the Classic Runtime).
o Do nothing when unnecessary (when compiling either for Code Fragment Manager).
************************************************************************************/
#ifndef _CFMA5_
#define _CFMA5_
#if TARGET_RT_MAC_CFM
#define GetA5() 0
#define SwapA5( NEWA5 ) 0
#define RestoreA5( OLDA5 )
#else
#define GetA5() SetCurrentA5()
#define SwapA5( NEWA5 ) SetA5( (NEWA5) )
#define RestoreA5( OLDA5 ) SetA5( (OLDA5) )
#endif
#endif // _CFMA5_
See more files for this project here