pascal OSErr SetDragImage ( DragReference theDragRef, PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags ) { enum { uppSetDragImageInfo = kD0DispatchedPascalStackBased | RESULT_SIZE (SIZE_CODE (sizeof(OSErr))) | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (SIZE_CODE (sizeof (unsigned long))) | DISPATCHED_STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (theDragRef))) | DISPATCHED_STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (imagePixMap))) | DISPATCHED_STACK_ROUTINE_PARAMETER (3, SIZE_CODE (sizeof (imageRgn))) | DISPATCHED_STACK_ROUTINE_PARAMETER (4, SIZE_CODE (sizeof (imageOffsetPt))) | DISPATCHED_STACK_ROUTINE_PARAMETER (5, SIZE_CODE (sizeof (theImageFlags))) }; return CallUniversalProc ( GetToolTrapAddress (_DragDispatch), uppSetDragImageInfo, 0x27L, theDragRef, imagePixMap, imageRgn, imageOffsetPt, theImageFlags); }
static pascal OSStatus MakeDataPowerPCExecutableFromClassic(void *address, ByteCount count) { OSErr err; Ptr junkMain; Str255 junkMessage; CFragSymbolClass junkClass; ProcPtr routinePtr; assert(GetToolTrapAddress(_CodeFragmentDispatch) != GetToolTrapAddress(_Unimplemented)); assert(GetToolTrapAddress(_MixedModeDispatch) != GetToolTrapAddress(_Unimplemented)); err = noErr; if (gMakeDataExecutable == NULL) { // We're not connected to InterfaceLib let, let's connect, find the MakeDataExecutable // symbol, and build a routine descriptor for it. err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kLoadCFrag, &gInterfaceLib, &junkMain, junkMessage); if (err == noErr) { err = FindSymbol(gInterfaceLib, "\pMakeDataExecutable", (Ptr *) &routinePtr, &junkClass); }
pascal OSErr GetDragHiliteColor (WindowPtr window, RGBColor *color) { enum { uppGetDragHiliteColorInfo = kD0DispatchedPascalStackBased | RESULT_SIZE (SIZE_CODE (sizeof(OSErr))) | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (SIZE_CODE (sizeof (unsigned long))) | DISPATCHED_STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (window))) | DISPATCHED_STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (color))) }; return CallUniversalProc ( GetToolTrapAddress (_DragDispatch), uppGetDragHiliteColorInfo, 0x26L, window, color); }
extern pascal OSStatus MakeData68KExecutable(void *address, ByteCount count) // See comment in interface part. { OSErr err; #if TARGET_CPU_PPC assert(GetOSTrapAddress(_HWPriv) != GetToolTrapAddress(_Unimplemented)); #endif // Step 1. If we have _HWPriv, try calling FlushCodeCacheRange. If that // returns an error, call FlushCodeCache. Two important assumptions: // // a) any machine that has FlushCodeCacheRange implemented will necessarily // implement FlushCodeCache. // b) PowerPC computers always have FlushCodeCacheRange implemented, so // we don't need Mixed Mode glue for FlushCodeCache because we'll never // need it on a PowerPC. if ( GetOSTrapAddress(_HWPriv) != GetToolTrapAddress(_Unimplemented) ) { err = MoreFlushCodeCacheRange(address, count); #if TARGET_CPU_68K if (err != noErr) { assert(GetOSTrapAddress(_vCacheFlush) != GetToolTrapAddress(_Unimplemented)); FlushCodeCache(); } #else assert(err == noErr); #endif // Step 2. If we don't have _HWPriv, look to see whether _vCacheFlush // (ie FlushCodeCache) is implemented. If it is, we'll just call it. } else if ( GetOSTrapAddress(_vCacheFlush) != GetToolTrapAddress(_Unimplemented) ) { // The call to FlushCodeCache is conditionalised because // Universal Interfaces does not export the call unless // you're generating 68K code. *sigh* But that's OK because // all PowerPC machines have _HWPriv implemented, so this // code won't run. #if TARGET_CPU_68K FlushCodeCache(); #else assert(false); #endif // Step 3. Finally, if neither of these traps is implemented, we're just // going to execute 680x0 instructions directly. Note that we have to // execute different instructions based on the 680x0 variant. } else { // Obviously, this is only going to work (or indeed compile) if we're // generating 68K code. That's cool, because if we're generating PowerPC // code, we must end up running on a PowerPC, and that always has // FlushCodeCacheRange so we never get here. #if TARGET_CPU_68K { UInt32 gestaltResponse; if (Gestalt(gestaltProcessorType, (SInt32 *) &gestaltResponse) == noErr) { if (gestaltResponse >= gestalt68020) { if (gestaltResponse <= gestalt68030) { FlushCacheViaCACR(); } else { FlushCacheWithCPushA(); } } } } #else assert(false); #endif } // Basically this routine can't fail or, more accurately, // there are no expected failure cases. So we always return // noErr. In fact, the only reason this routine is defined to // return an error code is for symmetry with MakeDataPowerPCExecutable, // which has to return an error code in the classic 68K case. return noErr; }