|
From: Andre R. <and...@us...> - 2005-01-15 16:47:14
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23494/Common/source Modified Files: FastTimes.c Log Message: For Carbon, UpTime() and AbsoluteToNanoseconds() can be found in CoreServices.framework rather than DriverServicesLib. Looking up the functions in the framework means we don't have to run a 1-second callibration loop on startup except on very old Macs in Classic. Index: FastTimes.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/FastTimes.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FastTimes.c 14 Jan 2005 16:58:57 -0000 1.4 --- FastTimes.c 15 Jan 2005 16:47:03 -0000 1.5 *************** *** 24,27 **** --- 24,31 ---- #endif + #if TARGET_API_MAC_CARBON + #include "CallMachOFrameWork.h" /*2005-01-15 aradke*/ + #endif + #include "FastTimes.h" *************** *** 120,124 **** --- 124,148 ---- "\pDriverServicesLib", "\pAbsoluteToNanoseconds"); if (!gA2NS) gUpTime = nil; /* Pedantic but necessary */ + + #if TARGET_API_MAC_CARBON + + /* 2005-01-15 aradke: On OS X, DriverServicesLib is no longer present, + but the functions we want are available in the CoreServices framework. */ + + if (!gUpTime) { + + gUpTime = (UpTimeProcPtr) getframeworkfuncptr ( + CFSTR("CoreServices.framework"), CFSTR("UpTime")); + + if (gUpTime) + gA2NS = (A2NSProcPtr) getframeworkfuncptr ( + CFSTR("CoreServices.framework"), CFSTR("AbsoluteToNanoseconds")); + if (!gA2NS) + gUpTime = nil; /* Pedantic but necessary */ + } + + #endif + if (gUpTime) { /* If we loaded UpTime(), then we need to know if the system has *************** *** 349,353 **** static Ptr FindFunctionInSharedLib(StringPtr libName, StringPtr funcName) { - OSErr error = noErr; Str255 errorStr; Ptr func = NULL; --- 373,376 ---- *************** *** 357,363 **** /* Find CFM containers for the current archecture -- CFM-PPC or CFM-68K */ ! if (/* error = */ GetSharedLibrary(libName, kCompiledCFragArch, ! kLoadCFrag, &connID, &entry, errorStr)) return(NULL); ! if (/* error = */ FindSymbol(connID, funcName, &func, &symClass)) return(NULL); --- 380,387 ---- /* Find CFM containers for the current archecture -- CFM-PPC or CFM-68K */ ! if (GetSharedLibrary(libName, kCompiledCFragArch, kLoadCFrag, &connID, &entry, errorStr) != noErr) ! return(NULL); ! ! if (FindSymbol(connID, funcName, &func, &symClass) != noErr) return(NULL); |