#ifndef PATCH_BASE_PRIVATE_H
#define PATCH_BASE_PRIVATE_H
/*****************************************************************************/
/*
**	Filename:	libraries/patchbasePRIVATE.h
**	Release:	6.0
**	Date:		13.12.97
**
**	definition of patch.library PRIVATE base node fields
**
**	(C) Copyright 1993-97 Stefan Fuchs
**	All Rights Reserved
*/
/*****************************************************************************/

#ifndef	EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef	EXEC_LISTS_H
#include	<exec/lists.h>
#endif	/* EXEC_LISTS_H */

#ifndef	EXEC_LIBRARIES_H
#include	<exec/libraries.h>
#endif	/* EXEC_LIBRARIES_H */

#ifndef	EXEC_SEMAPHORES_H
#include	<exec/semaphores.h>
#endif	/* EXEC_SEMAPHORES_H */

#ifndef	DOS_DOS_H
#include	<dos/dos.h>
#endif	/* DOS_DOS_H */



struct PatchBase
{
	struct Library PB_LibNode;
	UBYTE PB_Flags;		/* see below */
	UBYTE PB_pad;
	BPTR  PB_SegList;

	struct	SignalSemaphore PB_Semaphore;		/* Semaphore to protect MasterPatchList */
	struct	List		PB_MasterPatchHeader;	/* Listheader for MasterPatch structures */

/* Private stuff follows down here */
	struct Library *PB_DosBase;
	struct ExecBase *PB_SysBase;
	LONG PB_PatchFunctionCounter;	/* The Support Program PatchSetFunction */
					/* may only be removed, if this Counter is */
					/* zero */
	struct List	PB_NotifyListHeader;	/* Header of a double linked list */
						/* containing pointers to MsgPorts to */
						/* notify in the ln_Name fields */
/* Fields new for V4: */
	WORD PB_PatchSVActive;		/* If > 0 the support program PatchSupervisor */
					/* is active within the system */
	WORD PB_PatchSVRemoveable;	/* If 0 the support program PatchSupervisor */
					/* may remove itself from the system */
	APTR PB_MemoryPool;		/* >0, if memory pools are available */
	struct List	PB_ProjectHeader;	/* Header of a double linked list */
						/* containing pointers to PatchProjects */
/* Fields new for V5: */
	WORD PB_OffsetCodeStart;	/* This contains the number of Bytes between PS_PatchCode */
					/* and the first Assembler Instruction for use by PatchSetFunc */
/* Fields new for V6: */
	WORD PB_StackExtensions;	/* Number of tasks, which can have a stackextension active for a function */
					/* Higher values mean higher memory usage */
					/* Default: 5 */
	struct Library *PB_UtilityBase;
	WORD PB_PSFVersion;		/* Version of installed PatchSetFunc (for work-arounds only) */
					/* PatchSetFunc 2.2 is the first version setting this value */
	WORD PB_PSFRevision;		/* Revision of installed PatchSetFunc (for work-arounds only) */
					/* PatchSetFunc 2.2 is the first version setting this value */

};


/* PB_Flags: */

#define PBF_CheckPC	(1L<<0)	    	/* If TRUE: Enable safe removal of patches! */
					/* Patch.library will use a hack, which */
					/* is highly dependent on OS versions and installed */
					/* processors and may therefore not work with */
					/* certain configurations */
					/* It's unlikly to crash the machine though */
					/* New with V4, default: TRUE */
#define	PBF_PatchSetFuncActive (1L<<1)	/* If TRUE: A program redirects SetFunction() to patch.library */
					/* (older versions of PatchSetFunc do not set this bit) */
					/* New with V4, default: FALSE */
#define PBF_BreakForbid (1L<<2)		/* If TRUE: Break forbid and disable, when */
					/* trying to get the global semaphore */
					/* New with V6, default: FALSE */
#define PBF_NoStackAllocmem (1L<<3)	/* If TRUE: Do not call Allocmem for stack extension */
					/* New with V6, default: TRUE */



#endif	/* PATCH_BASE_PRIVATE_H */
