aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gki/gkititle.x
blob: 397bd50ab056571ec809c7d8028610e6f9a3403f (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<config.h>
include	<gki.h>

# GKI_MFTITLE -- Write the metafile title.
#
# BOI GKI_MFTITLE L N T
#    
#        L(i)            4 + N
#        N(i)            number of characters in field T
#        T(Nc)           title string identifying metafile

procedure gki_mftitle (fd, title)

int	fd			# output file
char	title[ARB]		# title string

int	epa
int	ip, n
pointer	sp, gki, op
int	strlen()
include	"gki.com"

begin
	call smark (sp)

	n = strlen (title)
	call salloc (gki, GKI_MFTITLE_LEN + n, TY_SHORT)

	# Pack the title name as a SHORT integer array.
	op = gki + GKI_MFTITLE_T - 1
	for (ip=1;  ip <= n;  ip=ip+1) {
	    Mems[op] = title[ip]
	    op = op + 1
	}

	if (IS_INLINE(fd)) {
	    epa = gk_dd[GKI_MFTITLE]
	    if (epa != 0)
		call zcall2 (epa, Mems[gki+GKI_MFTITLE_T-1], n)
	} else {
	    Mems[gki  ] = BOI
	    Mems[gki+1] = GKI_MFTITLE
	    Mems[gki+2] = GKI_MFTITLE_LEN + n
	    Mems[gki+3] = n
	    call write (gk_fd[fd], Mems[gki], (GKI_MFTITLE_LEN + n) * SZ_SHORT)
	}

	call sfree (sp)
end