home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Applications / Musique / PlayMF_VU.lha / PianoMeter / Source / libopen.c < prev    next >
C/C++ Source or Header  |  1998-04-05  |  2KB  |  127 lines

  1.  
  2. #include "PianoMeter.h"
  3. #include "PianoMeter_protos.h"
  4.  
  5.  
  6. /* Library bases */
  7.  
  8. struct ExecBase            *SysBase;
  9. struct DosLibrary        *DOSBase;
  10. struct GfxBase            *GfxBase;
  11. struct IntuitionBase    *IntuitionBase;
  12. struct Library             *GadToolsBase;
  13. struct Library            *UtilityBase;
  14. struct Library            *AslBase;
  15. struct Library            *WorkbenchBase;
  16. struct Library            *CamdBase;
  17.  
  18.  
  19.  
  20. /*----------------*/
  21. /* Open Libraries */
  22. /*----------------*/
  23.  
  24. BOOL OpenLibs(void)
  25. {
  26.     BOOL Success=FALSE;
  27.     
  28.     SysBase = *((struct ExecBase**)(0x4));
  29.     
  30.     if (DOSBase=(struct DosLibrary*)OpenLibrary("dos.library",39L))
  31.     {
  32.         if (GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",39L))
  33.         {
  34.             if (IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library",39L))
  35.             {
  36.                 if (GadToolsBase=OpenLibrary("gadtools.library", 39L))
  37.                 {
  38.                     if (UtilityBase=OpenLibrary("utility.library",39L))
  39.                     {
  40.                         if (!(AslBase=OpenLibrary("asl.library",39L)))
  41.                         {
  42.                             Message("This program requires asl.library!",NULL);
  43.                         }
  44.                         else
  45.                         {
  46.                             if (!(WorkbenchBase=OpenLibrary("workbench.library",39L)))
  47.                             {
  48.                                 Message("This program requires workbench.library!",NULL);
  49.                             }
  50.                             else
  51.                             {
  52.                                 if (!(CamdBase=OpenLibrary("camd.library",0L)))
  53.                                 {
  54.                                     Message("This program requires camd.library!",NULL);
  55.                                 }
  56.                                 else
  57.                                 {
  58.                                     Success=TRUE;
  59.                                 }
  60.                             }
  61.                         }
  62.                     }
  63.                 }
  64.             }
  65.         }
  66.     }
  67.     if (!Success) CloseLibs();
  68.     
  69.     return(Success);
  70. }
  71.  
  72.  
  73. /*-----------------*/
  74. /* Close Libraries */
  75. /*-----------------*/
  76.  
  77. void CloseLibs(void)
  78. {
  79.     if (CamdBase)
  80.     {
  81.         CloseLibrary(CamdBase);
  82.         CamdBase=NULL;
  83.     }
  84.     
  85.     if (WorkbenchBase)
  86.     {
  87.         CloseLibrary(WorkbenchBase);
  88.         WorkbenchBase=NULL;
  89.     }
  90.     
  91.     if (AslBase)
  92.     {
  93.         CloseLibrary(AslBase);
  94.         AslBase=NULL;
  95.     }
  96.     
  97.     if (UtilityBase)
  98.     {
  99.         CloseLibrary(UtilityBase);
  100.         UtilityBase=NULL;
  101.     }
  102.     
  103.     if (GadToolsBase)
  104.     {
  105.         CloseLibrary(GadToolsBase);
  106.         GadToolsBase=NULL;
  107.     }
  108.     
  109.     if (IntuitionBase)
  110.     {
  111.         CloseLibrary((struct Library*)IntuitionBase);
  112.         IntuitionBase=NULL;
  113.     }
  114.     
  115.     if (GfxBase)
  116.     {
  117.         CloseLibrary((struct Library*)GfxBase);
  118.         GfxBase=NULL;
  119.     }
  120.     
  121.     if (DOSBase)
  122.     {
  123.         CloseLibrary((struct Library*)DOSBase);
  124.         DOSBase=NULL;
  125.     }
  126. }
  127.