aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/src/cv.x
blob: a169a402e6c5c89b09ac5ae2c01ae9d2a2dcb612 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <fio.h>
include <fset.h>
include "../lib/ids.h"
include <gki.h>
include <ctotok.h>
include <error.h>
include "cv.h"

# Captain Video

procedure t_cv()

pointer	gp
char	device[SZ_FNAME]
char	command[SZ_LINE]

pointer	gopen(), sp
int	dd[LEN_GKIDD]

int	scan, tok, envgets()

include	"cv.com"

begin
	call smark (sp)
	call salloc (cv_stack, CVLEN, TY_SHORT)

	if (envgets ("stdimage", device, SZ_FNAME) == 0)
	    call error (EA_FATAL,
		"variable 'stdimage' not defined in environment")

	call ids_open (device, dd)
	call gki_inline_kernel (STDIMAGE, dd)
	gp = gopen ( device, READ_WRITE, STDIMAGE)

	call fseti (STDIMAGE, F_TYPE, SPOOL_FILE)
	call fseti (STDIMAGE, F_CANCEL, OK)
	call ids_grstream (STDIMAGE)

	# to do:
	# initialize local variables: image display size, etc
	# instead of defines such as MCXSCALE, etc
	cv_maxframes = CV_MAXF
	cv_maxgraph  = CV_MAXG
	cv_xcen	     = CV_XCEN
	cv_ycen	     = CV_YCEN
	cv_xres	     = CV_XRES
	cv_yres	     = CV_YRES
	cv_zres	     = CV_ZRES
	cv_gp	     = gp
	cv_xcon	     = real(GKI_MAXNDC+1)/CV_XRES
	cv_ycon	     = real(GKI_MAXNDC+1)/CV_YRES
	cv_grch	     = CV_GRCHNUM
	cv_xwinc     = -1.			# Flag: Don't know what lut is

        repeat {
	    call printf (":-) ")
	    call flush (STDOUT)
	    if (scan() == EOF)
		break
	    call gargtok(tok, command, SZ_LINE)
	    if ((tok == TOK_EOS) || (tok == TOK_NEWLINE))
		next
	    # decode next command
	    call strlwr(command)
	    switch (command[1]) {
	        case 'x', 'q':
		    break
		    
		
		case 'b':
		    call blink

		case 'c':
		    if (command[2] == 'l')
		        call clear
		    else
		        call rdcur
		    
		case 'd':
		    call display(command[2])

		case 'e':		# erase means clear
		    call clear

		case 'h', '?':
		    call help

		# case 'l':
		#   call load

		case 'm':
		    call match

		case 'o':
		    call offset

		case 'p':
		    if ( command[2] == 's')
			call map(command[2])		# pseudo color
		    else
		        call pan

		case 'r':
		    if (command[2] == 'e')
			call reset
		    else
		        call range

		case 's':
		    if (command[2] == 'n')
		        call snap
		    else
		        call split
		
		case 't':
		    call tell

		case 'w':
		    if (command[2] == 'r')
			call text
		    else
		        call window

		case 'z':
		    call zoom
		    
		default:
		    call eprintf("unknown command: %s\n")
		        call pargstr(command[1])
			     
	    }  # end switch statement

	} # end repeat statment

	# all done

	call gclose ( gp )
	call ids_close
	call sfree (sp)
end


# HELP -- print informative message

procedure help()

begin
	call eprintf ("--- () : optional; [] : select one; N : number; C/F/Q : see below\n")
	call eprintf ("b(link) N F (C Q) (F (C Q)..)	blink		N = 10 is one second\n")
	call eprintf ("c(ursor) [on off F]		cursor\n")
	call eprintf ("di F (C Q) [on off]		display image\n")
	call eprintf ("dg C (F Q) [on off]		display graphics\n")
	call eprintf ("e(rase) [N a(ll) g(raphics) F]	erase (clear)\n")
	#call eprintf ("l(oad)				load a frame\n")
	call eprintf ("m(atch) (o) F (C) (to) (F) (C)	match (output) lookup table\n")
	call eprintf ("o(ffset)  C N			offset color	N: 0 to +- 4095\n")
	call eprintf ("p(an) (F) 			pan images\n")
	call eprintf ("ps(eudo) (o) (F C) (rn sn)	pseudo color mapping   rn/sn: random n/seed n\n")
	call eprintf ("r(ange) N (C) (N C ...)		scale image	N: 1-8\n")
	call eprintf ("re(set) [r i t a]		reset display	registers/image/tables/all\n")
	call eprintf ("sn(ap) (C)			snap a picture\n")
	call eprintf ("s(plit) [c o px,y nx,y]		split picture\n")
	call eprintf ("t(ell)				tell display state\n")
	call eprintf ("w(indow) (o) (F C)		window (output) frames\n")
	call eprintf ("wr(ite) [F C] text		write text to frame/graphics\n")
	call eprintf ("z(oom) N (F) 			zoom frames	N: 1-8\n")
	call eprintf ("x   or   q			exit/quit\n")
	call eprintf ("--- C: letter c followed by r/g/b/a or, for snap r,g,b,m,bw,rgb,\n")
	call eprintf ("---   or for dg r/g/b/y/p/m/w, as 'cr', 'ca', or 'cgb'\n")
	call eprintf ("--- F: f followed by a frame number or 'a' for all\n")
	call eprintf ("--- Q: q followed by quadrant number or t,b,l,r for top, bottom,...\n")
end