15 |
|
int (*getcur)(); /* get cursor position */ |
16 |
|
int (*comout)(); /* command line output */ |
17 |
|
int (*comin)(); /* command line input */ |
18 |
+ |
int (*flush)(); /* flush output */ |
19 |
+ |
double pixaspect; /* pixel aspect ratio */ |
20 |
|
int xsiz, ysiz; /* device size */ |
21 |
|
int inpready; /* input ready on device */ |
22 |
|
}; |
25 |
|
extern int (*wrnvec)(), (*errvec)(), (*cmdvec)(); |
26 |
|
|
27 |
|
extern struct driver *comm_init(); /* stream interface */ |
28 |
+ |
/* magic numbers for verification */ |
29 |
+ |
#define COM_SENDM 0x6f37 |
30 |
+ |
#define COM_RECVM 0x51da |
31 |
|
/* stream commands */ |
32 |
|
#define COM_CLEAR 0 |
33 |
|
#define COM_PAINTR 1 |
34 |
|
#define COM_GETCUR 2 |
35 |
|
#define COM_COMOUT 3 |
36 |
|
#define COM_COMIN 4 |
37 |
< |
#define NREQUESTS 5 /* number of valid requests */ |
37 |
> |
#define COM_FLUSH 5 |
38 |
> |
#define NREQUESTS 6 /* number of valid requests */ |
39 |
|
|
40 |
< |
struct device { /* interactive device */ |
40 |
> |
extern struct device { /* interactive device */ |
41 |
|
char *name; /* device name */ |
42 |
|
char *descrip; /* description */ |
43 |
|
struct driver *(*init)(); /* initialize device */ |
44 |
< |
}; |
44 |
> |
} devtable[]; /* supported devices */ |
45 |
|
|
40 |
– |
extern struct device devtable[]; /* supported devices */ |
41 |
– |
|
46 |
|
#define MB1 ('\n') /* mouse button 1 */ |
47 |
|
#define MB2 ('\r') /* mouse button 2 */ |
48 |
|
#define MB3 (' ') /* mouse button 3 */ |
49 |
|
#define ABORT ('C'-'@') /* abort key */ |
50 |
|
|
47 |
– |
#define MAXRES 4000 /* preposterous display resolution */ |
48 |
– |
|
51 |
|
/* |
52 |
|
* struct driver * |
53 |
< |
* dname_init(name) |
54 |
< |
* char *name; |
53 |
> |
* dname_init(name, id) |
54 |
> |
* char *name, *id; |
55 |
|
* { |
56 |
|
* Initialize device and return pointer to driver |
57 |
|
* functions. Returns NULL if an error occurred. |
58 |
< |
* The name string is used to identify the client. |
58 |
> |
* The name string identifies the driver, |
59 |
> |
* and the id string identifies the client. |
60 |
|
* A device can be open by at most one client. |
61 |
|
* Be verbose in error reports; call stderr_v(). |
62 |
|
* If device has its own error output, set errvec, |
77 |
|
* int xmin, ymin, xmax, ymax; |
78 |
|
* { |
79 |
|
* Paint a half-open rectangle from (xmin,ymin) to (xmax,ymax) |
80 |
< |
* with the color col. Can call repaint() if necessary. |
80 |
> |
* with the color col. |
81 |
|
* } |
82 |
|
* (*dev->getcur)(xp, yp) |
83 |
|
* int *xp, *yp; |
94 |
|
* string ends with '\n', the message is considered complete, |
95 |
|
* and the next call can erase it. |
96 |
|
* } |
97 |
< |
* (*dev->comin)(in) |
98 |
< |
* char *in; |
97 |
> |
* (*dev->comin)(in, prompt) |
98 |
> |
* char *in, *prompt; |
99 |
|
* { |
100 |
< |
* Read an edited input string from the command line. If |
101 |
< |
* an unrecognized control character is entered, terminate |
102 |
< |
* input and return the string with only that character. |
103 |
< |
* The input string should not contain a newline. |
104 |
< |
* Must work in consort with comout. |
100 |
> |
* Print a prompt then read an edited input command line |
101 |
> |
* assuming the in buffer is big enough. Unless prompt is NULL, |
102 |
> |
* the driver may substitute its own rview command. This is |
103 |
> |
* the most reliable way to repaint areas of the screen. |
104 |
> |
* If the user enters an unrecognized control character, |
105 |
> |
* terminate input and return the string with only that character. |
106 |
> |
* The input string should not contain a newline. The routines in |
107 |
> |
* editline.c may be useful. Comin must work in consort with comout. |
108 |
> |
* } |
109 |
> |
* (*dev->flush)() |
110 |
> |
* { |
111 |
> |
* Flush output to the display. This is guaranteed to be called |
112 |
> |
* frequently enough to keep the display up to date. |
113 |
> |
* This is an ideal time to check for device input. |
114 |
> |
* This function can be NULL for devices that don't need it. |
115 |
|
* } |
116 |
|
* xsiz, ysiz |
117 |
|
* The maximum allowable x and y dimensions. If any |