home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d498
/
zoomdaemon
/
source
/
zoom-setup.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-06
|
3KB
|
109 lines
/*
* ZOOM-DAEMON A program that implements Zoom gadgets for all Intuition
* windows that are opened while it is running.
*
* Copyright 1989 by Davide P. Cervone.
* You may use this code, provided this copyright notice is kept intact.
*/
#include "Zoom-Handler.h"
struct IntuitionBase *IntuitionBase = NULL;
struct SysBase *SysBase;
/*
* These are the assembly code stubs that replace the Intuition Library
* vectors. Thes stubs in turn call the C-language routines that actually
* do the work.
*/
extern void aOpenWindow();
extern void aCloseWindow();
extern void aAddGadget();
extern void aAddGList();
/*
* These are used by the assembly stubs to call the original routines when
* needed. They also are used to replace the Intution vectors when
* Zoom-Daemon exits.
*/
long OldOpenWindow;
long OldCloseWindow;
long OldAddGadget;
long OldAddGList;
/*
* These are the structures that need to be passed to the loader
* so that it can clean up after Zoom-Handler is removed.
*/
extern struct ExtGadget *FirstZoom;
extern void ZoomHandlerStub();
extern void cOpenWindow();
static struct Interrupt Zoom_Interrupt = /* the Interrupt needed to add a */
{ /* handler to the input chain */
{NULL, NULL, 0, 51, NULL}, /* ln_Pri = 51 (before Intuition) */
NULL,
&ZoomHandlerStub /* the handler to add */
};
/*
* This is the main structure passed from the handler to the loader.
* It is used to exchange variables between the loader and the handler
* (like IntuitionBase, and any application-specific structures that
* need to be initialized or freed by the loader).
*/
static struct Zoom_HandlerInfo Zoom_HandlerData =
{
{ /* the MsgPort is pre-setup */
{NULL,NULL, NT_MSGPORT, 0, PORTNAME}, /* to include the name and */
PA_IGNORE, 0, NULL, /* type so that it can just */
{NULL,NULL,NULL, 0,0} /* be added to the port list */
}, /* so it can be found later */
MAJVERS,MINVERS, MINLOADVER,
NULL,
&IntuitionBase,
&SysBase,
&Zoom_Interrupt,
&aOpenWindow,
&aCloseWindow,
&aAddGadget,
&aAddGList,
&OldOpenWindow,
&OldCloseWindow,
&OldAddGadget,
&OldAddGList,
&cOpenWindow,
&FirstZoom
};
/*
* Setup()
*
* This routine MUST be linked into the Zoom-Handler executable
* as the first routine, so that the loader can find it.
* It should check the version number for compatibility with the loader,
* and should return NULL for an error, or the pointer to the shared
* data structure if everything is OK.
*/
struct Zoom_HandlerInfo *Setup(version)
int version;
{
if (version < MINLOADVER) return(NULL);
return(&Zoom_HandlerData);
}