	IFND	LIBRARIES_ERRORMSG_I
LIBRARIES_ERRORMSG_I	SET	1
**
**	$Filename: libraries/errormsg.i $
**	$Release: 1 $
**	$Revision: 1.0 $
**
**	errormsg.library definitions
**
**	(C) Copyright 1994 Frédéric Delacroix
**	All Rights Reserved
**

	IFND	EXEC_TYPES_I
	include	exec/types.i
	ENDC

	IFND	EXEC_LISTS_I
	include	exec/lists.i
	ENDC

	IFND	EXEC_LIBRARIES_I
	include	exec/libraries.i
	ENDC

	IFND	EXEC_SEMAPHORES_I
	include	exec/semaphores.i
	ENDC

	IFND	UTILITY_TAGITEM_I
	include	utility/tagitem.i
	ENDC

	STRUCTURE	ErrorMsgBase,LIB_SIZE
	ULONG	emb_SegList	; pointer to seglist (PRIVATE)

; These remain valid as long as errormsg.library is open, they are readable
; by your application...
	APTR	emb_DOSBase	; pointer to DOSBase
	APTR	emb_IntuitionBase	; pointer to IntuitionBase
	APTR	emb_LocaleBase	; pointer to LocaleBase
	APTR	emb_UtilityBase	; pointer to UtilityBase

; This is private (subject to changes):
	APTR	emb_Locale
	APTR	emb_Catalog
	STRUCT	emb_FaultSemaphore,SS_SIZE
	STRUCT	emb_FaultCache,MLH_SIZE
	STRUCT	emb_FaultBuffer,100

	LABEL	emb_SIZEOF	; This one is none of your business :-)

*************************************************************************
* System ID values							*
*************************************************************************
; These IDs are to be passed as the "System" argument:

ERMSYS_INVALID	EQU	-1	; internal use
ERMSYS_DOS	EQU	0	; messages from dos.library
ERMSYS_EXEC	EQU	1	; messages from exec.library
ERMSYS_GRAPHICS	EQU	2	; messages from graphics.library
ERMSYS_INTUITION	EQU	3	; messages from intuition.library
ERMSYS_IFFPARSE	EQU	4	; messages from iffparse.library

ERMSYS_AUDIO	EQU	5	; messages from audio.device
ERMSYS_GAMEPORT	EQU	6	; messages from gameport.device
ERMSYS_NARRATOR	EQU	7	; messages from narrator.device
ERMSYS_PARALLEL	EQU	8	; messages from parallel.device
ERMSYS_PRINTER	EQU	9	; messages from printer.device
ERMSYS_SCSIDISK	EQU	10	; messages from scsidisk.device
ERMSYS_SERIAL	EQU	11	; messages from serial.device
ERMSYS_TRACKDISK	EQU	12	; messages from trackdisk.device
ERMSYS_CLIPBOARD	EQU	13	; etc...
ERMSYS_CONSOLE	EQU	14
ERMSYS_INPUT	EQU	15
ERMSYS_KEYBOARD	EQU	16
ERMSYS_TIMER	EQU	17

ERMSYS_AMIGAGUIDE	EQU	18
ERMSYS_ARP	EQU	19
ERMSYS_COMMODITIES	EQU	20
ERMSYS_ERRORMSG	EQU	21	; yes, we can diagnostic our own errors
ERMSYS_EXPANSION	EQU	22
ERMSYS_GADTOOLS	EQU	23
ERMSYS_POWERPACKER	EQU	24
ERMSYS_TRANSLATOR	EQU	25
ERMSYS_DATATYPES	EQU	26
ERMSYS_DISKFONT	EQU	27

*************************************************************************
* Subsystem ID values							*
*************************************************************************
; These values were chosen so that they look significant: they are equal
; to _LVO offsets for libraries, and CMD_ for devices... It's probably
; just as good to implement them as that in your program... A warning
; however: some _LVO are not recognized (for example, ERMSUB_MatchFirst
; is the same value as ERMSUB_IoErr).

; Another note: they may be ignored for some systems...
ERMSUB_Generic	EQU	0	; This is for systems that do not support
	; specific subsystem values. Providing this will protect you from
	; future changes...

; Values for ERMSYS_DOS:
ERMSUB_IoErr	EQU	-132		; internally implemented as a cached
ERMSUB_MatchFirst	EQU	ERMSUB_IoErr	; call to Fault()
ERMSUB_MatchNext	EQU	ERMSUB_IoErr	; (value is _LVOIoErr)
ERMSUB_Fault	EQU	ERMSUB_IoErr
MIN_DOS_ERROR	EQU	100	; Only these codes are supported,
MAX_DOS_ERROR	EQU	310	; to prevent "Error code ..." to be stored
				; in memory hundreds of times

; Values for ERMSYS_EXEC:
; for this value, you may pass the memory requirements (MEMF_...) as the
; error code for a more precise message, or 0 for a standard out of mem.
; ex: GetErrorMsg(ERMSYS_EXEC,ERMSUB_NoMemory,MEMF_CHIP!MEMF_CLEAR) will
; return "Not enough CHIP memory"
ERMSUB_NoMemory	EQU	-198	; (equals _LVOAllocMem)

; Values for ERMSYS_GRAPHICS:
; note: these two are only usable as of V39 of the OS (Release 3.0)
ERMSUB_MakeVPort	EQU	-216	; (equals _LVOMakeVPort)
ERMSUB_MrgCop	EQU	-210	; (_LVOMrgCop)

; Values for ERMSYS_INTUITION:
; note: returned through the SA_ErrorCode TagItem
ERMSUB_OpenScreen	EQU	-198	; (_LVOOpenScreen)
ERMSUB_OpenScreenTagList	EQU	ERMSUB_OpenScreen

; Values for ERMSYS_COMMODITIES:
ERMSUB_CxBroker	EQU	-36	; (_LVOCxBroker)
ERMSUB_CxObjError	EQU	-66	; _LVOCxObjError

; No values are defined for the other systems yet, just provide
; ERMSUB_Generic as the subsystem code. Note: narrator.device does not
; use the standard error codes that are defined in exec/errors.i

****************************************************************************
* Errors that may be returned by errormsg.library itself (returned through *
* the EMT_Error tag):                                                      *
****************************************************************************
ERMERR_Unsupported_System	EQU	1
ERMERR_Unsupported_SubSystem	EQU	2
ERMERR_Unknown_Code	EQU	3
ERMERR_NoMemory	EQU	4

****************************************************************************
* Tag values                                                               *
****************************************************************************
EMT_Dummy	EQU	TAG_USER

; Tag Values for GetErrorMsgA():

EMT_Error	EQU	EMT_Dummy+1
EMT_Length	EQU	EMT_Dummy+2
EMT_ForceCopy	EQU	EMT_Dummy+4

; Tag values for DisplayMsgA():

EMT_Window	EQU	EMT_Dummy+20
EMT_Title	EQU	EMT_Dummy+21
EMT_GadFmt	EQU	EMT_Dummy+22
EMT_IDCMPPtr	EQU	EMT_Dummy+23

****************************************************************************
ERRORMSGNAME	MACRO
	dc.b	'errormsg.library',0
	ENDM

	ENDC	; ERRORMSG_I
