aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gcancel.x
blob: 30e53ce5c2e0fd7f5f4065f4a57a01043793adc8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<gio.h>

# GCANCEL -- Cancel any buffered graphics output (as far as possible).  Should
# be called by interrupt handlers to avoid leaving GIO in a funny state
# following an interrupt.
#
# As far as possible, GKI instructions are built up in internal storage and
# written to the output file in a single write.  This decreases the likliehood
# of leaving a botched instruction in the output stream in response to an
# interrupt.  Do not call FSETI to cancel the file output because that will
# almost certainly guarantee a botched instruction.  Instead, we discard any
# partially built polylines still in GPL storage and append the GKI_CANCEL to
# the output instruction stream.  The cancel instruction is passed on to the
# graphics kernel which eventually calls FSETI to cancel its output file
# buffer (containing device instructions).  If a metacode reader does detect
# a botched instruction it will scan forward for the next BOI to try to resync
# the instruction stream.

procedure gcancel (gp)

pointer	gp			# graphics descriptor
int	and()

begin
	if (and (GP_GFLAGS(gp), GF_WSOPEN) != 0) {
	    call gki_cancel (GP_FD(gp))
	    call gki_fflush (GP_FD(gp))
	}
	call gfrinit (gp)
end