aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/iism70/iismatch.x
blob: a2435fdc804e5eda59405f375f89dc06bb7bb191 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<mach.h>
include "iis.h"
include "../lib/ids.h"

# IISMATCH -- copy (match) a set of look up tables to a given table;
# frames/color specify the given table, data gives frame/color for
# set to be changed.

procedure iismatch (code, frames, color, n, data)

short	code			# which table type
short	frames[ARB]		# reference frame
short	color[ARB]		# reference color
short	n			# count of data items
short	data[ARB]		# frame/color to be changed.

pointer	sp, ldata
int	len, x,y,z,t
int	unit, i
int	mapcolor(), ids_dcopy()
short	temp[IDS_MAXIMPL+1]
short	iispack()

include	"../lib/ids.com"

begin
	switch (code) {
	    case IDS_FRAME_LUT:
		len = LEN_LUT
		x = ADVXONTC
		y = 0
		z = mapcolor (color)
		t = iispack (frames)
		if (t == GRCHAN)
		    return
		unit = LUT

	    case IDS_OUTPUT_LUT:
		len = LEN_OFM
		x = ADVXONTC
		y = ADVYONXOV
		z = mapcolor (color)
		t = 0

	    default:
		return
	}

	call smark (sp)
	call salloc (ldata, len, TY_SHORT)

	call iishdr (IREAD+VRETRACE, len, unit, x, y, z, t)
	call iisio (Mems[ldata], len * SZB_CHAR)

	i = ids_dcopy (data, temp)
	switch (code) {
	    case IDS_FRAME_LUT:
		call ids_expand (temp, i_maxframes, true)
		t = iispack (temp)
		i = ids_dcopy (data[i+1], temp)
		call ids_expand (temp, 3, false)	# 3...max colors
		z = mapcolor (temp)

	    case IDS_OUTPUT_LUT:
		i = ids_dcopy (data[i+1], temp)
		call ids_expand (temp, 3, false)
		z = mapcolor (temp)
	}

	call iishdr (IWRITE+VRETRACE, len, unit, x, y, z, t)
	call iisio (Mems[ldata], len * SZB_CHAR)

	call sfree (sp)
end