home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
432b.lha
/
EzLib
/
src
/
openlibs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-10
|
2KB
|
74 lines
/* This file contains the routines for opening and closing libraries.
* Notice that all the library bases are defined here. You can access
* them in your code if you wish, but they are defined here.
*
* Oh, it *is* important that they be initialized to zero.
*/
#include "ezlib.h"
struct GfxBase *GfxBase = NULL;
struct IntuitionBase *IntuitionBase = NULL;
struct Library *DiskfontBase = NULL;
struct ArpBase *ArpBase = NULL;
struct Library *TranslatorBase = NULL;
struct RxsLib *RexxSysBase = NULL;
void *OpenLibrary();
openlibs( which_ones )
register int which_ones;
{
register int errs = NULL;
if (which_ones & GFX)
if ( (GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0L)) == NULL)
{ MSG("No Graphics.library.\n"); errs = 1; }
if (which_ones & INTUI)
if ( (IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0L)) == NULL)
{ MSG("No Intuition.library.\n"); errs = 1; }
if (which_ones & ARP)
if ( (ArpBase = (struct ArpBase *)OpenLibrary("arp.library", 34)) == NULL)
{ MSG("No Arp.library in your LIBS directory.\n");errs = 1; }
if (which_ones & DISKFONT)
if ( (DiskfontBase = (struct Library *)OpenLibrary("diskfont.library", 0L)) == NULL)
{ MSG("No Diskfont.library in your LIBS: directory.\n"); errs = 1; }
if (which_ones & TRANSLATOR)
if ( (TranslatorBase = (struct Library *)OpenLibrary("translator.library", 0L)) == NULL)
{ MSG("No Translator.library in your LIBS: directory.\n"); errs = 1; }
if (which_ones & REXX)
if ( (RexxSysBase = (struct RxsLib *)OpenLibrary("rexxsyslib.library", 0L)) == NULL)
{ MSG("No rexxsyslib.library in your LIBS: directory.\n"); errs = 1; }
if ( errs )
{ closelibs(); return NULL; }
return 1;
}
closelibs()
{
if (DiskfontBase > 100)
{ CloseLibrary(DiskfontBase); DiskfontBase = NULL; }
if (ArpBase > 100)
{ CloseLibrary(ArpBase); ArpBase = NULL; }
if (IntuitionBase > 100)
{ CloseLibrary(IntuitionBase); IntuitionBase = NULL; }
if (GfxBase > 100)
{ CloseLibrary(GfxBase); GfxBase = NULL; }
if (TranslatorBase > 100)
{ CloseLibrary(TranslatorBase); TranslatorBase = NULL; }
if (RexxSysBase > 100)
{ CloseLibrary(RexxSysBase); RexxSysBase = NULL; }
}