#ifndef LIBRARIES_PATCHTAGS_H
#define LIBRARIES_PATCHTAGS_H
/*****************************************************************************/
/*
**	Filename:	libraries/patchtags.h
**	Release:	5.0 BETA
**	Date:		17.08.96
**
**	definition of patch.library tags
**
**	(C) Copyright 1993-96 Stefan Fuchs
**	All Rights Reserved
*/
/*****************************************************************************/

#ifndef	UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif


/*----------------------------------------------------------------------------*/
/* I: InstalPatchTags() */
/* R: RemovePatchTags() */
/* F: FindPatchTags()   */
/* S: SetPatch()        */
/* G: GetPatch()        */
/* N: AddPatchNotify()  */

#define PATT_TagBase		TAG_USER + 0x5000


#define PATT_LibraryName	PATT_TagBase+0	/* I:  STRPTR Pointer to a library name */
#define PATT_DeviceName		PATT_TagBase+1	/* I:  STRPTR Pointer to a device name */
#define PATT_LibraryBase	PATT_TagBase+2	/* I:  (struct Library *) Pointer to a library, */
						/*     device or resource base structure */

#define PATT_LibVersion		PATT_TagBase+3	/* I:  ULONG Versionnumber for exec.library/OpenLibrary */
						/*     Default: (any version) */
#define PATT_Reserved01		PATT_TagBase+4	/* as it says */
#define PATT_DevFlags		PATT_TagBase+5  /* I:  ULONG Flags for exec.library/OpenDevice() */
						/*     Default: NULL */
#define	PATT_DevUnit		PATT_TagBase+6	/* I:  ULONG Unit for exec.library/OpenDevice() */
						/*     Default: NULL */
#define PATT_PatchName		PATT_TagBase+7	/* IF: STRPTR pointer to an IDString for the patch */
						/*     Default: No ID-String */
						/* G:  BOOL */
						/*     TRUE: Return the name of the patch */
#define	PATT_Priority		PATT_TagBase+8	/* I:  BYTE Priority (-127...+126) of the patch */
						/*     Positive priorities indicate that the patchcode will be run before the Original */
						/*     Negative priorities indicate that the patchcode will be run after the Original */
						/*     the priority NULL (default) indicates that the patchcode will be run */
						/*     instead of the Original */
						/*     Default: NULL */
						/* N:  BYTE (V5) Priority for notifying other tasks */
						/*     Default: NULL */
						/* S:  BYTE (V5) Priority (-127...+126) of the patch */
						/* G:  BOOL (V5) */
						/*     TRUE: Get the priority of a patch */
#define PATT_NewCodeSize	PATT_TagBase+9	/* I:  ULONG Size of code in bytes starting at funcEntry */
						/*     Default: NULL (no copy) */
#define PATT_Result2		PATT_TagBase+10	/* IG: APTR Pointer to longword for errorcodes */
						/*     (see patch.h) */

#define	PATT_CreateTaskList	PATT_TagBase+11	/* IS: ULONG (V3) */
						/*     Create a TaskList of the given type */
						/*     (TL_TYPE_INCLUDE / TL_TYPE_EXCLUDE)  */
						/*     (see patch.h) */
#define PATT_DeleteTaskList	PATT_TagBase+12	/* IS: BOOL (V3) */
						/*     TRUE: Delete any existing TaskList */
						/*     This will be done implicitly, when a patch is removed */
#define	PATT_AddTaskID		PATT_TagBase+13	/* IS: (struct Task *) (V3) */
						/*     Add a task address to the patch TaskList */
#define	PATT_AddTaskName	PATT_TagBase+14	/* IS: STRPTR (V3) */
						/*     Add a task of the given name to the */
						/*     patch TaskList */
#define PATT_AddTaskPattern	PATT_TagBase+15 /* IS: STRPTR (V5)
						/*     Add a pattern of tasknames to the patch TaskList */
#define PATT_RemTaskID		PATT_TagBase+16	/* S:  (struct Task *) (V3) */
						/*     Remove a task address from the patch TaskList */
#define	PATT_RemTaskName	PATT_TagBase+17	/* S:  STRPTR (V3) */
						/*     Remove a task of the given name from the */
						/*     patch TaskList */
#define PATT_TaskListType	PATT_TagBase+18	/* G:  BOOL (V3) */
						/*     TRUE: Get the type of the TaskList */
#define PATT_TaskList		PATT_TagBase+19 /* G:  BOOL (V3) */
						/*     TRUE: Return a taglist containing all TaskIDs and */
						/*     TaskNames attached to a patch */

#define PATT_Disabled		PATT_TagBase+20	/* IS: BOOL (V4) */
						/*     TRUE: Disable a patch */
						/*     FALSE: Enable a patch */
						/* G:  BOOL (V4) */
						/*     TRUE: Return the disable nesting counter */
						/*	     0: Means enabled */
#define	PATT_NoCase		PATT_TagBase+21 /* F:  BOOL (V4) */
						/*     TRUE: Compare case-independent */
#define PATT_AddRemoveHook	PATT_TagBase+22	/* S:  (struct Hook *) (V4) */
						/*     Add a Hook, which is called by patch.library */
						/*     whenever a patch is removed from memory */
#define PATT_RemRemoveHook	PATT_TagBase+23	/* S:  (struct Hook *) (V4) */
						/*     Remove a Hook installed with PATT_AddRemoveTag */
#define	PATT_SaveRegisters	PATT_TagBase+24 /* I:  ULONG (V4) Register Mask */
						/*     Save all registers specified in the register mask */
						/*     before entering the patchcode and */
						/*     restore them when it has completed. This tag */
						/*     has been mainly implemented to improve support */
						/*     for programming languages other than Assembler, */
						/*     which destroy the contents of the registers d0/d1/a0/a1, */
						/*     when executing functions. */
						/*     WARNING: This tag does not currently work together */
						/*     with the Assembler macro FALLBACK! */
#define	PATT_ProjectID		PATT_TagBase+25 /* I:  APTR (V4) pointer to project the patch belongs to */
						/* G:  BOOL (V4) if true, return ProjectID of a patch */
#define	PATT_LastObject		PATT_TagBase+26 /* F:  APTR (V4) Pointer to an object after, which */
						/*     the search starts. This object must be of the */
						/*     same type as the object normally returned. */
#define	PATT_ProjectName	PATT_TagBase+27 /* F:  APTR (V4) Find project with the given name */

#define PATT_UserData		PATT_TagBase+28	/* S:  ULONG (V5) Add UserData to patch structure */
						/* G:  BOOL (V5) if true, return UserData */
#define PATT_RemTaskPattern	PATT_TagBase+29 /* S:  STRPTR (V5)
						/*     Remove a pattern of tasknames from the patch TaskList */


#define	PATT_TimeOut		PATT_TagBase+30	/* R:  ULONG Number of ticks (1/50 seconds) */
						/*     the function should keep trying to remove */
						/*     the patch, if another task is running in the */
						/*     patchcode. */
						/*     Default: NULL */
#define PATT_DelayedExpunge	PATT_TagBase+31	/* R:  BOOL Default: TRUE */
						/*     TRUE:If a non-patch.library patch */
						/*     was installed after the patch.library */
						/*     patch for a specific library function */
						/*     the specified patch will nevertheless */
						/*     be removed. */
						/*     BUT some resources will still be kept */
						/*     allocated by patch.library (e.g.: the */
						/*     Library Offset Vector will not be restored */
						/*     to it's old state). */
						/*     Patch.library will try to deallocate */
						/*     those resources automatically, if the */
						/*     system is getting low on memory or */
						/*     if you call a patch.library function */
						/*     that removes or installs patches. */
#define PATT_StackSize		PATT_TagBase+32 /* S:  ULONG (V5) Minimum stacksize (in bytes) your function */
						/*     requires. This value should be a multiple of 4. */
						/*     If a taskpattern (see PATT_AddtaskPattern) is active, */
						/*     at least 1500 Bytes should be specified. */
						/*     DO NOT USE this tag, if you patch one of the following */
						/*     exec-functions: FindTask(), AllocMem(), FreeMem() or */
						/*     StackSwap() */
						/*     Default: NULL:  Do not extend stack */

/*----------------------------------------------------------------------------*/
/* types for PATT_CreateTaskList: */
#define TL_TYPE_INCLUDE	1	/* Type of TaskList is include */
				/* (all specified tasks will use the patchroutine, all others will ignore it) */
#define TL_TYPE_EXCLUDE 2	/* Type of TaskList is exclude */
				/* (all specified tasks will ignore the patchroutine, all others will use it) */
/*----------------------------------------------------------------------------*/
/* Register definitions for PATT_SaveRegisters */

#define PATREG_D0	0x8000
#define PATREG_D1	0x4000
#define PATREG_D2	0x2000
#define PATREG_D3	0x1000
#define PATREG_D4	0x0800
#define PATREG_D5	0x0400
#define PATREG_D6	0x0200
#define PATREG_D7	0x0100
#define PATREG_A0	0x0080
#define PATREG_A1	0x0040
#define PATREG_A2	0x0020
#define PATREG_A3	0x0010
#define PATREG_A4	0x0008
#define PATREG_A5	0x0004
#define PATREG_A6	0x0002


#endif	/* LIBRARIES_PATCHTAGS_H */
