home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d126 / suplib.lha / Suplib / openlibs.c < prev    next >
C/C++ Source or Header  |  1988-01-02  |  1KB  |  63 lines

  1.  
  2. #include "xmisc.h"
  3.  
  4. long GfxBase;
  5. long IntuitionBase;
  6. long ExpansionBase;
  7. long DiskfontBase;
  8. long TranslatorBase;
  9. long IconBase;
  10. long MathBase;
  11. long MathTransBase;
  12. long MathIeeeDoubBasBase;
  13. long MathIeeeSingBasBase;
  14. long LayersBase;
  15. long ClistBase;
  16. long PotgoBase;
  17. long TimerBase;
  18. long xfiller15;
  19. long xfiller16;
  20.  
  21. struct OLI strvar[] = {
  22.   "graphics",           &GfxBase,
  23.   "intuition",          &IntuitionBase,
  24.   "expansion",          &ExpansionBase,
  25.   "diskfont",           &DiskfontBase,
  26.   "translator",         &TranslatorBase,
  27.   "icon",               &IconBase,
  28.   "mathffp",            &MathBase,
  29.   "mathtrans",          &MathTransBase,
  30.   "mathieeedoubbas",    &MathIeeeDoubBasBase,
  31.   "mathieeesingbas",    &MathIeeeSingBasBase,
  32.   "layers",             &LayersBase,
  33.   "clist",              &ClistBase,
  34.   "potgo",              &PotgoBase,
  35.   "timer",              &TimerBase,
  36.   "x15",                &xfiller15,
  37.   "x16",                &xfiller16,
  38.   0L, 0L       /* end marker for future compatibility */
  39. };
  40.  
  41.  
  42. openlibs(mask)
  43. unsigned short mask;
  44. {
  45.     register struct OLI *sv;
  46.     char buf[64];
  47.     long copymask = mask;
  48.  
  49.     for (sv = &strvar[0]; mask && sv->name; mask >>= 1, ++sv) {
  50.     if (mask & 1) {
  51.         strcpy(buf, sv->name);
  52.         strcat(buf, ".library");
  53.         if (*sv->var == 0 && (*sv->var = OpenLibrary(buf, 0)) == 0)
  54.         goto fail;
  55.     }
  56.     }
  57.     return (1);
  58. fail:
  59.     closelibs(copymask);
  60.     return (0);
  61. }
  62.  
  63.