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
61
62
63
64
65
66
67
68
69
70
71
72
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <knet.h>
include <fset.h>
include <gset.h>
include <gio.h>
# GACTIVATE -- Perform the initial activation of the workstation, i.e.,
# connect to the graphics kernel and issue the GKI_OPENWS instruction to
# the kernel to physically open the workstation.
procedure gactivate (gp, flags)
pointer gp # graphics descriptor
int flags # AW_ bit flags; zero if no flags
int junk, fd
pointer w, sp, devname
extern zardbf()
int fstati(), grdwcs(), and(), locpr()
errchk gki_openws, gki_getwcs, gki_reactivatews
begin
# If WS has already been opened, just make sure it is activated.
if (and (GP_GFLAGS(gp), GF_WSOPEN) != 0) {
if (and (GP_GFLAGS(gp), GF_WSACTIVE) == 0) {
call gki_reactivatews (GP_FD(gp), flags)
GP_GFLAGS(gp) = GP_GFLAGS(gp) + GF_WSACTIVE
}
return
}
call smark (sp)
call salloc (devname, SZ_PATHNAME, TY_CHAR)
fd = GP_FD(gp)
# Physically open and activate the workstation. NOTE - the flags
# argument is currently ignored; this should be fixed at some point.
# The UI specification file name, if any, is passed as part of the
# logical device specification (a bit of a kludge, but it avoids
# changing the GKI datastream prototcol and hence obsoleting all the
# old graphics kernels).
if (GP_UIFNAME(gp) != EOS) {
# gki_openws device = devname,uifname.
call sprintf (Memc[devname], SZ_PATHNAME, "%s,%s")
call pargstr (GP_DEVNAME(gp))
call pargstr (GP_UIFNAME(gp))
} else
call strcpy (GP_DEVNAME(gp), Memc[devname], SZ_PATHNAME)
call gki_openws (fd, Memc[devname], GP_ACMODE(gp))
# If the device is being opened in APPEND mode retrieve the WCS
# from either the GIO code in the CL process (if talking to a
# process the FIO driver will not be the standard binary file
# driver) or from an auxiliary file if the device output is being
# spooled in a metafile.
if (GP_ACMODE(gp) == APPEND) {
w = GP_WCSPTR(gp,1)
if (fstati (fd, F_DEVICE) != locpr (zardbf))
call gki_getwcs (fd, Memi[w], LEN_WCSARRAY)
else iferr (junk = grdwcs(GP_DEVNAME(gp), Memi[w], LEN_WCSARRAY))
;
}
GP_GFLAGS(gp) = GP_GFLAGS(gp) + (GF_WSOPEN+GF_WSACTIVE)
call sfree (sp)
end
|