 CANCEL/ALL qualifier used.
	.PAGE
	.SBTTL	Top-level dispatch
	.PSECT	CODE,I,RO
;
;   Dispatch on CANCEL keyword.
;
CANCEL::
	CLR	CANALL		; CANCEL/ALL qualifier has not been parsed.
	CALL	U$FNXT		; Find qualifier or primary keyword, OK?
	BCS	MISARG		; No, complain.
	MOV	#ALLTBL,R1	; Point to /ALL qualifier table.
	CALL	U$DCOD		; Decode qualifier, OK?
	BCS	10$		; No, assume it must be a primary keyword.
	INC	CANALL		; Indicate CANCEL/ALL has been parsed.
	CALL	U$FNXT		; Find primary keyword, OK?
	BCS	MISARG		; No, complain.
10$:	MOV	#CANTBL,R1	; Point to CANCEL keyword table.
	CALL	U$DCOD		; Decode keyword, OK?
	BCS	ERRXIT		; No, complain.
	CALLR	(R2)		; Process keyword.

;   CANCEL command keyword is missing.
MISARG:	MOV	#E.RAMS,R1	; Point to error message.
ERRXIT:	CALLR	ERROR		; Display error message.
	.PAGE
	.SBTTL	Cancel break, trace and watchpoints.
;
;   Cancel breakpoint.
;
CANBRK:	MOV	#BRKLST,R5	; Point to breakpoint list head.
	BR	.CANPT		; Enter common code.
;
;   Cancel tracepoint.
;
CANTRC:	MOV	#TRCLST,R5	; Point to tracepoint list head.
	BR	.CANPT		; Enter common code.
;
;   Cancel watchpoint.
;
CANWCH:	MOV	#WCHLST,R5	; Point to watchpoint list head.
.CANPT:	TST	CANALL		; Should entire list be cleared?
	BNE	10$		; Yes, get started.
	CALL	U$FNXT		; Find address expression, OK?
	BCS	MISARG		; No, required argument is missing.
5$:	CALL	XPRESS		; Evaluate address expression, all right?
	BCS	ERRXIT		; Nope, defecate on the user.
;   Locate break / watchpoint.
10$:	MOV	(R5),R4		; Get address of next block, zero?
	BEQ	30$		; Yes, there is no such break / watchpoint.
	TST	CANALL		; Is entire list to be freed?
	BNE	20$		; Yes, search criteria are somewhat relaxed.
	CMP	P.ADDR(R4),R1	; Found the correct block?
	BNE	40$		; No, keep looking for it.
;   Unlink and deallocate the current block.
20$:	MOV	(R4),(R5)	; Unlink break/watchpoint block.
	MOV	R4,R2		; Put address where it belongs.
	MOV	R0,-(SP)	; Push command line pointer.
	MOV	#FREMEM,R0	; Point to free memory list header.
	MOV	#P.LEN,R1	; Get block length.
	CALL	$RLCB		; Release memory.
	MOV	(SP)+,R0	; Recover command line pointer.
	TST	CANALL		; Was total deletion specified?
	BNE	10$		; Yes, trash the next one.
	CMPB	#',,(R0)+	; Does a comma follow expression?
	BEQ	5$		; Yes, get next expression.
30$:	RETURN
;   Set up to check next block on list.
40$:	MOV	R4,R5		; Set up for next iteration.
	BR	10$		; Keep searching.
	.PAGE
;
;   Cancel profile.
;
CANPRO:	MOV	PROLST,R5	; Get address of first profile block, zero?
	BEQ	20$		; Yes, just exit.
10$:	MOV	R5,R2		; Copy block address.
	MOV	(R5),R5		; Get address of next block.
	MOV	PR.SIZ(R2),R1	; Get size of block.
	MOV	#FREMEM,R0	; Point to free memory list header.
	CALL	$RLCB		; Deallocate profile range block.
	TST	R5		; Any more blocks to deallocate?
	BNE	10$		; Yes, do next block.
;   All profile ranges have been deallocated.
	CLR	PROLST		; Profile range list is now empty.
20$:	RETURN
	.PAGE
	.SBTTL	Keyword dispatch tables
	.PSECT	RODATA,D,RO
;
;   CANCEL qualifier table.
;
ALLTBL:	KEYWRD	ALL,1		; Delete all list entries.
	.WORD	0

;
;   CANCEL type keyword table.
;
CANTBL:	KEYWRD	BREAK,CANBRK	; Breakpoint.
	KEYWRD	PROFILE,CANPRO	; Profile.
	KEYWRD	TRACE,CANTRC	; Tracepoint.
	KEYWRD	WATCH,CANWCH	; Watchpoint.
	.WORD	0

	.END
