#ifndef INSPECTOR_INSPECTORBASE_H
#define INSPECTOR_INSPECTORBASE_H
/*
**	$VER: inspectorbase.h 37.2 (04.11.93)
**
**	inspector.library base library structure
**
**	Copyright © 1993 Sebastiano Vigna, Fabrizio Lodi and Reinhard Spisser
**	All Rights Reserved
*/

/*****************************************************************************/

#ifndef INSPECTOR_INSPECTOR_H
#include <libraries/inspector.h>
#endif


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


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


/*****************************************************************************/

/* Maximum length for the file name of an inspector library. */

#define MAX_LIB_NAME_LEN		256


/* This is the base structure of the inspector.library. It contains information
about the global flags and the list of tasks to be checked. */


struct InspectorBase {
	struct	Library Library;
	ULONG		SegList;

	struct DosLibrary		*DOSBase;
	struct ExecBase		*SysBase;
	struct Library			*UtilityBase;
	struct Library			*RexxSysBase;

	/* This semaphore arbitrates the access to the dangerous functions. */

	struct SignalSemaphore InspectorSemaphore;

	ULONG		ForcingMask;	/* These flags are forced over the local flags */
	ULONG		Flags;			/* Flag status */

	/* This function is the current printing function. */

	LONG __stdargs (*print)(STRPTR fmt,...);
	char __stdargs (*get)(void);

	/* This is SetTracker's hunk location function, if present. */

	__asm char (*SegTrack)(register __a0 ULONG Address, register __a1 ULONG *SegNum, register __a2 ULONG *Offset);

	/* Cached versions of all the functions used by Inspector. */

	__asm void (*CachedForbid)(register __a6 struct ExecBase *);
	__asm void (*CachedPermit)(register __a6 struct ExecBase *);
	__asm void (*CachedDisable)(register __a6 struct ExecBase *);
	__asm void (*CachedEnable)(register __a6 struct ExecBase *);
	__asm void (*CachedObtainSemaphore)(register __a0 struct SignalSemaphore *, register __a6 struct ExecBase *);
	__asm void (*CachedReleaseSemaphore)(register __a0 struct SignalSemaphore *, register __a6 struct ExecBase *);
	__asm struct Library *(*CachedOpenLibrary)(register __a1 UBYTE *, register __d0 unsigned long, register __a6 struct ExecBase *);
	__asm void (*CachedCloseLibrary)(register __a1 struct Library *, register __a6 struct ExecBase *);
	__asm APTR (*CachedAllocVec)(register __d0 unsigned long, register __d1 unsigned long, register __a6 struct ExecBase *);
	__asm void (*CachedFreeVec)(register __a1 APTR, register __a6 struct ExecBase *);
	__asm void (*CachedRemove)(register __a1 struct Node *, register __a6 struct ExecBase *);
	__asm void (*CachedAddHead)(register __a0 struct List *, register __a1 struct Node *, register __a6 struct ExecBase *);
	__asm void (*CachedAddTail)(register __a0 struct List *, register __a1 struct Node *, register __a6 struct ExecBase *);
	__asm ULONG (*CachedTypeOfMem)(register __a1 APTR, register __a6 struct ExecBase *);
	__asm struct Task *(*CachedFindTask)(register __a1 UBYTE *, register __a6 struct ExecBase *);
	__asm struct Node *(*CachedFindName)(register __a0 struct List *, register __a1 UBYTE *, register __a6 struct ExecBase *);
	__asm APTR (*CachedSetFunction)(register __a1 struct Library * volatile library, register __a0 long  volatile funcOffset, register __d0 unsigned long (*newFunction)(), register __a6 struct ExecBase *);
	__asm LONG (*CachedParsePattern)(register __d1 STRPTR pat, register __d2 STRPTR buf, register __d3 long buflen, register __a6 struct DosLibrary *);
	__asm BOOL (*CachedMatchPattern)(register __d1 STRPTR pat, register __d2 STRPTR str, register __a6 struct DosLibrary *);
	__asm LONG (*CachedStricmp)(register __a0 STRPTR, register __a1 STRPTR, register __a6 struct Library *);
	__asm UBYTE *(*CachedCreateArgstring)(register __a0 UBYTE *, register __d0 unsigned long, register __a6 struct Library *);

	struct   List TaskInclusionList;			/* These are the only tasks to check if the TaskInclude flag is on */
	struct   List TaskExclusionList;			/* These tasks have to be skipped if the TaskExclude flag is on */

	/* PRIVATE: do not use */

	/* All accesses to this buffer are arbitrated by InspectorSemaphore. Since modifications
	of flags etc. are arbitrated anyway, it was the case to put this in here. */

	char Buffer[MAX_LIB_NAME_LEN];
};


#endif
