aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/nsppkern/gktclear.x
blob: 4132d37110d9bb5e9691ff8c3c6e318c0b66abc9 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<mach.h>
include	"gkt.h"

# GKT_CLEAR -- Advance a frame on the plotter.  All attribute packets are
# initialized to their default values.  Redundant calls or calls immediately
# after a workstation open (before anything has been drawn) are ignored.

procedure gkt_clear (dummy)

int	dummy			# not used at present

int	gkt_mfopen()
errchk	gkt_mfopen
include	"gkt.com"

begin
	# This is a no-op if nothing has been drawn.
	if (g_kt == NULL || g_ndraw == 0)
	    return

	# Start a new frame.  This is done either by calling NSPP to do a frame
	# advance or by starting a new metafile.  Close the output file and 
	# start a new metafile if the maximum frame count has been reached.
	# This disposes of the metafile to the system, causing the actual
	# plots to be drawn.  Open a new metafile ready to receive next frame.

	g_nframes = g_nframes + 1
	if (g_nframes >= g_maxframes) {

	    # Does this device require a frame advance at end of metafile?
	    if (GKT_ENDFRAME(g_kt) == YES)
		call frame()

	    # The call to the NSPP flush procedure must be escaped to avoid
	    # interpretation as the FIO flush procedure.

%	    call mcflsh

	    g_nframes = 0
	    call close (g_out)

	    g_out = gkt_mfopen (g_tty, NEW_FILE)

	    # Does this device require a frame advance at beginning of metafile?
	    if (GKT_STARTFRAME(g_kt) == YES)
		call frame()

	} else {
	    # Merely output NSPP frame instruction to start a new frame in
	    # the same metafile.

	    call frame()
	}

	# Init kernel data structures.
	call gkt_reset()
	g_ndraw = 0
end