-static MetroNubUserEntryBlock* gMetroNubEntry = NULL;
-
-static long fRunOnce = false;
-
-Boolean IsCompatibleVersion(short inVersion);
-
-/* ---------------------------------------------------------------------------
- IsCompatibleVersion
- --------------------------------------------------------------------------- */
-
-Boolean IsCompatibleVersion(short inVersion)
-{
- Boolean result = false;
-
- if (fRunOnce)
- {
- MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
-
- result = (inVersion <= block->apiHiVersion);
- }
-
- return result;
-}
-
-/* ---------------------------------------------------------------------------
- IsMetroNubInstalled
- --------------------------------------------------------------------------- */
-
-Boolean IsMetroNubInstalled()
-{
- if (!fRunOnce)
- {
- long result, value;
-
- fRunOnce = true;
- gMetroNubEntry = NULL;
-
- if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
- {
- /* look for MetroNub's Gestalt selector */
- if (Gestalt(kMetroNubUserSignature, &result) == noErr)
- {
-
- #if TARGET_API_MAC_CARBON
- if (gCallUniversalProc_Proc == NULL)
- {
- CFragConnectionID connectionID;
- Ptr mainAddress;
- Str255 errorString;
- ProcPtr symbolAddress;
- OSErr err;
- CFragSymbolClass symbolClass;
-
- symbolAddress = NULL;
- err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
- &connectionID, &mainAddress, errorString);
-
- if (err != noErr)
- {
- gCallUniversalProc_Proc = NULL;
- goto end;
- }
-
- err = FindSymbol(connectionID, "\pCallUniversalProc",
- (Ptr *) &gCallUniversalProc_Proc, &symbolClass);
-
- if (err != noErr)
- {
- gCallUniversalProc_Proc = NULL;
- goto end;
- }
- }
- #endif
-
- {
- MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
-
- /* make sure the version of the API is compatible */
- if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
- kMetroNubUserAPIVersion <= block->apiHiVersion)
- gMetroNubEntry = block; /* success! */
- }
-
- }
- }
- }
-
-end:
-
-#if TARGET_API_MAC_CARBON
- return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
-#else
- return (gMetroNubEntry != NULL);
-#endif