30 |
|
|
31 |
|
char *progname; /* driver name */ |
32 |
|
|
33 |
< |
int r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(); |
33 |
> |
int r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(), r_flush(); |
34 |
|
|
35 |
|
int (*dev_func[NREQUESTS])() = { /* request handlers */ |
36 |
|
r_clear, r_paintr, |
37 |
< |
r_getcur, r_comout, r_comin |
37 |
> |
r_getcur, r_comout, |
38 |
> |
r_comin, r_flush |
39 |
|
}; |
40 |
|
|
41 |
|
|
58 |
|
quit(1); |
59 |
|
} |
60 |
|
/* open device */ |
61 |
< |
if ((dev = dinit(argv[0], argv[3])) == NULL) { |
61 |
< |
stderr_v("initialization failure\n"); |
61 |
> |
if ((dev = dinit(argv[0], argv[3])) == NULL) |
62 |
|
quit(1); |
63 |
– |
} |
63 |
|
putw(COM_RECVM, devout); /* verify initialization */ |
64 |
+ |
fwrite((char *)&dev->pixaspect, sizeof(dev->pixaspect), 1, devout); |
65 |
|
putw(dev->xsiz, devout); |
66 |
|
putw(dev->ysiz, devout); |
67 |
|
fflush(devout); |
101 |
|
COLOR col; |
102 |
|
int xmin, ymin, xmax, ymax; |
103 |
|
|
104 |
< |
fread(col, sizeof(COLOR), 1, devin); |
104 |
> |
fread((char *)col, sizeof(COLOR), 1, devin); |
105 |
|
xmin = getw(devin); ymin = getw(devin); |
106 |
|
xmax = getw(devin); ymax = getw(devin); |
107 |
|
(*dev->paintr)(col, xmin, ymin, xmax, ymax); |
108 |
|
/* check for input */ |
109 |
< |
if (dev->inpready > notified) { |
109 |
> |
if (!notified && dev->inpready > 0) { |
110 |
> |
notified = 1; |
111 |
|
kill(getppid(), SIGIO); |
111 |
– |
notified = dev->inpready; |
112 |
|
} |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
+ |
r_flush() /* flush output */ |
117 |
+ |
{ |
118 |
+ |
if (dev->flush != NULL) |
119 |
+ |
(*dev->flush)(); |
120 |
+ |
} |
121 |
+ |
|
122 |
+ |
|
123 |
|
r_getcur() /* get and return cursor position */ |
124 |
|
{ |
125 |
|
int c; |
150 |
|
|
151 |
|
r_comin() /* read string from command line */ |
152 |
|
{ |
153 |
< |
char buf[256]; |
153 |
> |
char buf[256], *prompt; |
154 |
> |
/* get prompt */ |
155 |
> |
if (getc(devin)) { |
156 |
> |
mygets(buf, devin); |
157 |
> |
prompt = buf; |
158 |
> |
} else |
159 |
> |
prompt = NULL; |
160 |
|
/* get string */ |
161 |
< |
(*dev->comin)(buf); |
161 |
> |
(*dev->comin)(buf, prompt); |
162 |
|
/* reply */ |
163 |
|
putc(COM_COMIN, devout); |
164 |
|
myputs(buf, devout); |
188 |
|
do |
189 |
|
putc(*s, fp); |
190 |
|
while (*s++); |
178 |
– |
} |
179 |
– |
|
180 |
– |
|
181 |
– |
repaint(xmin, ymin, xmax, ymax) /* repaint section of display */ |
182 |
– |
int xmin, ymin, xmax, ymax; |
183 |
– |
{ |
184 |
– |
stderr_v("repaint called!\n"); /* no can do! */ |
191 |
|
} |
192 |
|
|
193 |
|
|