home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / DesktopDoubler / Common / Sources / MetroNubUtils.c < prev    next >
Encoding:
Text File  |  1999-06-22  |  1.3 KB  |  66 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    MetroNubUtils.c                    ©1996 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4.  
  5. #ifndef __MetroNubUtils__
  6. #include "MetroNubUtils.h"
  7. #endif
  8.  
  9. #ifndef __MetroNubUserInterface__
  10. #include "MetroNubUserInterface.h"
  11. #endif
  12.  
  13. #ifndef __GESTALT__
  14. #include <Gestalt.h>
  15. #endif
  16.  
  17.  
  18. static MetroNubUserEntryBlock*    gMetroNubEntry = NULL;
  19.  
  20.  
  21.  
  22. Boolean    IsMetroNubInstalled()
  23. {
  24.     static Boolean lookedForMetroNub = false;
  25.     
  26.     if (! lookedForMetroNub)
  27.     {
  28.         long    result;
  29.         OSErr    err;
  30.         
  31.         // look for MetroNub's Gestalt selector
  32.         if (Gestalt(kMetroNubUserSignature, &result) == noErr)
  33.         {
  34.             MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
  35.             
  36.             // make sure the version of the API is compatible
  37.             if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
  38.                 kMetroNubUserAPIVersion <= block->apiHiVersion)
  39.                 gMetroNubEntry = block;        // success!
  40.         }
  41.         
  42.         lookedForMetroNub = true;
  43.     }
  44.  
  45.     return (gMetroNubEntry != NULL);
  46. }
  47.  
  48.  
  49. Boolean IsMWDebuggerRunning()
  50. {
  51.     if (IsMetroNubInstalled())
  52.         return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
  53.     else
  54.         return false;
  55. }
  56.  
  57.  
  58.  
  59. Boolean AmIBeingMWDebugged()
  60. {
  61.     if (IsMetroNubInstalled())
  62.         return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
  63.     else
  64.         return false;
  65. }
  66.