ERRMON	.TITLE	ERROR MONITOR & HANDLING CONTROL
/
/  13 APR 73 - J. FIELD
/
	.GLOBL	SETERR,NERROR
	.GLOBL	.MODEA,.INT1,.INT2
	.GLOBL	.FETCH,.GRAB,.PSHBA
	.GLOBL	.ERROR,.NLIST,.ELIST
/
/	INTEGER FUNCTION NERROR (I)
/
/  RETURNS ERROR COUNT FOR ERROR NUMBER I AND RESETS COUNT.
/  INVALID ARGUMENTS CAUSE ERROR MESSAGE AND RETURN A COUNT OF ZERO.
/
NERROR	XX
	JMS*	.GRAB		/GET ARGUMENT
	JMS	WHO		/GET TABLE ENTRY
	JMP	WHOERR		/NEG. ARG. EXIT
	LAC*	WHERE
	AND	(37777
	DAC*	.INT2		/EXTRACT ERROR COUNT
	DZM*	.INT1		/AND PUT IN ACC A
	DZM*	.MODEA		/AS INTEGER
	XOR*	WHERE
	DAC*	WHERE		/RESET ERROR
	JMP*	NERROR
/
/
WHO	XX
	SZA
	JMP	WHOERR		/NON-INTEGER VARIABLE
	LAC*	.INT1
	SPA
	JMP*	WHO		/NEGATIVE ARGUMENT
	SZA!CLL
	JMP	WHOERR		/ARG. TOO BIG
	LAC*	.NLIST		/ -# OF ERROR LOG ENTRIES
	TAD*	.INT2
	SZL!SNA
	JMP	WHOERR		/ARG TOO BIG
	TAD	.ELIST
WHOTIE	DAC	WHERE		/ADDRESS OF TABLE ENTRY
	ISZ	WHO		/STEP OVER NEG. ARG. EXIT
	JMP*	WHO
/
WHOERR	LAW	101
	JMS*	.ERROR
	LAC	.INT1		/USE .INT1 AS TABLE ENTRY ON ERRORS
	JMP	WHOTIE
	.EJECT
/	SUBROUTINE SETERR (A,N,N,N, . . . A,N,N, . . .)
/
/  SETS ERROR CONTROL FOR ERRORS N (INTEGER) TO CODE SPECIFIED BY
/  PREVIOUS A (CHARACTER) WHERE:
/
/	'I' - IGNORE
/	'L' - LOG
/	'T' - TYPE
/	'Q' - TYPE AND QUIT
/
SETERR	XX
	LAC	(BOMBIT         /DEFAULT SETTING IS 'QUIT'
	DAC	EMASK
	DZM*	.ELIST		/CLOBBERED IF JUST DID 'SETALL'
ELOOP	JMS*	.FETCH		/GET ARGUMENT
	SZL
	JMP*	SETERR		/END OF LIST
	SAD	(7
	JMP	EALPA		/ALPHABETIC
	JMS*	.PSHBA
	JMS	WHO		/GET TABLE ENTRY ADDRESS
	JMP	SETALL		/NEG. ARG.  SET ALL ERRORS
	LAC	EMASK		/SET ENTRY TO SPECIFIED VALUE
	DAC*	WHERE
	JMP	ELOOP
/
EALPA	LAW	774000		/GENERATE MASK BITS
	AND*	AUTO2		/ACCORDING TO CODE TYPE
	SAD	Q.CODE		/ 'Q'  BOMBIT
	JMP	SETERR+1
	SAD	I.CODE		/ 'I'  IGNORE
	LAW	IGNORE/1000
	SAD	T.CODE		/ 'T'  TYPE
	LAW	TYPE/1000
	SAD	L.CODE		/ 'L'  LOG
	LAW	LOG/1000
	CLQ!LLS 11
	SZA
	JMP	ELOOP-2         / OK
	LAW	102		/AFTER ERROR MESSAGE
	JMS*	.ERROR		/TREAT AS 'Q'
	JMP	SETERR+1
/
Q.CODE	.ASCII	'Q'
	.LOC .-1
T.CODE	.ASCII	'T'
	.LOC .-1
I.CODE	.ASCII	'I'
	.LOC .-1
L.CODE	.ASCII	'L'
	.LOC .-1
WHERE;EMASK
/
SETALL	LAC	.NLIST		/SET ALL ERROR  CONTROLS TO
	DAC*	AUTO2		/SAME VALUE
	LAC	EMASK
	DAC*	AUTO2
	SAD*	.ELIST		/STOP WHEN .ELIST OVERWRITTEN & THEN
	JMP	ELOOP-1         /RESET IT TO ZERO
	JMP	.-3
/
IGNORE=400000
LOG=200000
BOMBIT=100000
TYPE=040000
	.END
