15 |
|
int (*getcur)(); /* get cursor position */ |
16 |
|
int (*comout)(); /* command line output */ |
17 |
|
int (*comin)(); /* command line input */ |
18 |
+ |
double pixaspect; /* pixel aspect ratio */ |
19 |
|
int xsiz, ysiz; /* device size */ |
20 |
|
int inpready; /* input ready on device */ |
21 |
|
}; |
24 |
|
extern int (*wrnvec)(), (*errvec)(), (*cmdvec)(); |
25 |
|
|
26 |
|
extern struct driver *comm_init(); /* stream interface */ |
27 |
+ |
/* magic numbers for verification */ |
28 |
+ |
#define COM_SENDM 0x6f37 |
29 |
+ |
#define COM_RECVM 0x51da |
30 |
|
/* stream commands */ |
31 |
|
#define COM_CLEAR 0 |
32 |
|
#define COM_PAINTR 1 |
35 |
|
#define COM_COMIN 4 |
36 |
|
#define NREQUESTS 5 /* number of valid requests */ |
37 |
|
|
38 |
< |
struct device { /* interactive device */ |
38 |
> |
extern struct device { /* interactive device */ |
39 |
|
char *name; /* device name */ |
40 |
|
char *descrip; /* description */ |
41 |
|
struct driver *(*init)(); /* initialize device */ |
42 |
< |
}; |
42 |
> |
} devtable[]; /* supported devices */ |
43 |
|
|
40 |
– |
extern struct device devtable[]; /* supported devices */ |
41 |
– |
|
44 |
|
#define MB1 ('\n') /* mouse button 1 */ |
45 |
|
#define MB2 ('\r') /* mouse button 2 */ |
46 |
|
#define MB3 (' ') /* mouse button 3 */ |
47 |
|
#define ABORT ('C'-'@') /* abort key */ |
48 |
|
|
47 |
– |
#define MAXRES 4000 /* preposterous display resolution */ |
48 |
– |
|
49 |
|
/* |
50 |
|
* struct driver * |
51 |
< |
* dname_init(name) |
52 |
< |
* char *name; |
51 |
> |
* dname_init(name, id) |
52 |
> |
* char *name, *id; |
53 |
|
* { |
54 |
|
* Initialize device and return pointer to driver |
55 |
|
* functions. Returns NULL if an error occurred. |
56 |
< |
* The name string is used to identify the client. |
56 |
> |
* The name string identifies the driver, |
57 |
> |
* and the id string identifies the client. |
58 |
|
* A device can be open by at most one client. |
59 |
|
* Be verbose in error reports; call stderr_v(). |
60 |
< |
* If device has its own error output, set errvec. |
60 |
> |
* If device has its own error output, set errvec, |
61 |
> |
* cmdvec and wrnvec. |
62 |
|
* } |
63 |
|
* (*dev->close)() |
64 |
|
* { |
65 |
< |
* Close the device. Reset errvec to stderr_v. |
65 |
> |
* Close the device. Reset error vectors. |
66 |
|
* } |
67 |
|
* (*dev->clear)(xres, yres) |
68 |
|
* int xres, yres; |
69 |
|
* { |
70 |
< |
* Clear the device for xres by yres output. This call must |
70 |
> |
* Clear the device for xres by yres output. This call will |
71 |
|
* be made prior to any output. |
72 |
|
* } |
73 |
|
* (*dev->paintr)(col, xmin, ymin, xmax, ymax) |
98 |
|
* Read an edited input string from the command line. If |
99 |
|
* an unrecognized control character is entered, terminate |
100 |
|
* input and return the string with only that character. |
101 |
< |
* The input string should not contain a newline ('\n'). |
101 |
> |
* The input string should not contain a newline. |
102 |
|
* Must work in consort with comout. |
103 |
|
* } |
104 |
|
* xsiz, ysiz |
105 |
|
* The maximum allowable x and y dimensions. If any |
106 |
|
* size is allowable, these should be set to MAXRES. |
107 |
|
* inpready |
108 |
< |
* This variable should be positive |
109 |
< |
* when characters are ready on the input. |
108 |
> |
* This variable should be made positive asynchronously |
109 |
> |
* when characters are ready on the input. (Often easiest |
110 |
> |
* to check for input during calls to paintr.) |
111 |
|
*/ |