home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio Version 4.94
/
audioversion4.94knowledgemediaresourcelibraryoctober1994.iso
/
amiga
/
utils
/
exp_iv
/
libraris.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-09
|
3KB
|
129 lines
/* libraries.c */
/*
* Open all needed libraries, manages OS_2.0 and
* all that stuff
*
*/
/*
* $Author: Espie $
* $Date: 91/05/09 17:36:43 $
* $Revision: 1.3 $
* $Log: libraries.c,v $
* Revision 1.3 91/05/09 17:36:43 Espie
* Opens workbench.library.
*
* Revision 1.2 91/05/07 12:12:06 Espie
* Opens icon.library.
*
* Revision 1.1 91/05/06 23:32:48 Espie
* Initial revision
*
*
*/
#include <exec/types.h>
#include <dos/dos.h>
#include <intuition/intuitionbase.h>
#include <exec/libraries.h>
#include <proto/exec.h>
#include <custom/cleanup.h>
#include "proto.h"
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *AslBase, *ArpBase, *IconBase, *WorkbenchBase;
#define MIN_REV 33
#ifdef SIZE_GADGET
struct Library *LayersBase;
#endif
LOCAL BOOL asl_avail, arp_avail, icon_avail, intuition_20, workbench_avail;
LOCAL struct Library *auto_open(char *lib_name, int version)
{
struct Library *base;
base = OpenLibrary(lib_name, version);
if (base)
ToClean(CloseLibrary, base);
return base;
}
struct Library *panic_open(char *lib_name, int version)
{
static char buffer[100];
struct Library *base;
base = auto_open(lib_name, version);
if (!base)
{
sprintf(buffer, "Can't open %s (v %d)", lib_name, version);
mayPanic(buffer);
}
return base;
}
void open_libraries(void)
{
/* open 'em for system version 1.2 */
IntuitionBase = panic_open("intuition.library", MIN_REV);
/* need to use TextLength */
GfxBase = panic_open("graphics.library", MIN_REV);
#ifdef SIZE_GADGET
LayersBase = panic_open("layers.library", MIN_REV);
#endif
intuition_20 = IntuitionBase->LibNode.lib_Version >= 36;
/* for the file requester */
ArpBase = auto_open("arp.library", 39);
if (ArpBase)
arp_avail = TRUE;
else
{
arp_avail = FALSE;
AslBase = auto_open("asl.library", 0);
if (AslBase)
asl_avail = TRUE;
else
asl_avail = FALSE;
}
IconBase = auto_open("icon.library", MIN_REV);
if (IconBase)
icon_avail = TRUE;
else
icon_avail = FALSE;
WorkbenchBase = auto_open("workbench.library", 0);
if (WorkbenchBase)
workbench_avail = TRUE;
else
workbench_avail = FALSE;
}
BOOL running_20(void)
{
return intuition_20;
}
int requester_type(void)
{
if (arp_avail)
return ARP;
if (asl_avail)
return OS_20;
else
return NO_REQ;
}
BOOL icon_around(void)
{
return icon_avail;
}
BOOL wb_around(void)
{
return workbench_avail;
}