//S P Y 
//unless vfwheel, just returns
// will SPY on updatedisplay
//
// allocates array space for SPY
// repeats updatedisplay() until vquitSpy is true

//to use this module:
//	1) type X to bravo
//	2) swat
//		↑x
//		[freee] ↑x
//		↑p
//	3) let bravo run for a while
//	4) swat
//		$↑x  -- swat will prompt for filename
//		↑p
//note: vcSpy counts iterations of updatewindow

get "bravo1.df"
get "com.df"
get "rn1.df"
get "char.df"

//incoming procedures
external	[
	blinkscreen
	SetRegionSys
	updatedisplay
	bravochar
	invalidatewindow
	updatewindow
	flushvm
	remakevmtb
	]

//incoming statics
external	[
	vfwheel
	macbp
	rgvpa
	]

//outgoing procedures
external Spy

//local statics
static	[
	vSpy
	]

//local structure
structure VSPY:
	[
	blank	bit 11
	flush	bit
	remake	bit
	inv	bit
	update	bit
	quit	bit
	]

//S P Y
let Spy(cf) = valof
[
unless vfwheel then
	[ blinkscreen()
	SetRegionSys(risyspast,26)
	updatedisplay()
		[ 
		] repeatuntil bravochar() eq chdel
	SetRegionSys(risyspast,15)
	resultis abmsg
	] 

let sel= cf>>CF.sel
let ww= sel>>SEL.ww
vSpy<<VSPY.flush= true
vSpy<<VSPY.remake= true
vSpy<<VSPY.inv= true
vSpy<<VSPY.update= true
vSpy<<VSPY.quit= false

until vSpy<<VSPY.quit do 
	[
	if vSpy<<VSPY.flush then flushvm()
	if vSpy<<VSPY.remake then
		[
		for bp= 0 to macbp-1 do rgvpa!bp= -1
		remakevmtb()
		]
	if vSpy<<VSPY.inv	then invalidatewindow(ww)
	if vSpy<<VSPY.update then updatewindow(ww)
	]

resultis abnil
]