1 |
< |
/* Copyright (c) 1987 Regents of the University of California */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
4 |
< |
|
1 |
> |
/* RCSid $Id$ */ |
2 |
|
/* |
3 |
|
* driver.h - header file for interactive device drivers. |
7 |
– |
* |
8 |
– |
* 2/2/87 |
4 |
|
*/ |
5 |
|
|
6 |
+ |
#include "copyright.h" |
7 |
+ |
|
8 |
|
struct driver { /* driver functions */ |
9 |
< |
int (*close)(); /* close device */ |
10 |
< |
int (*clear)(); /* clear device */ |
11 |
< |
int (*paintr)(); /* paint rectangle */ |
9 |
> |
void (*close)(); /* close device */ |
10 |
> |
void (*clear)(); /* clear device */ |
11 |
> |
void (*paintr)(); /* paint rectangle */ |
12 |
|
int (*getcur)(); /* get cursor position */ |
13 |
< |
int (*comout)(); /* command line output */ |
14 |
< |
int (*comin)(); /* command line input */ |
13 |
> |
void (*comout)(); /* command line output */ |
14 |
> |
void (*comin)(); /* command line input */ |
15 |
> |
void (*flush)(); /* flush output */ |
16 |
|
double pixaspect; /* pixel aspect ratio */ |
17 |
|
int xsiz, ysiz; /* device size */ |
18 |
|
int inpready; /* input ready on device */ |
19 |
|
}; |
22 |
– |
|
23 |
– |
extern int stderr_v(); /* error vectors */ |
24 |
– |
extern int (*wrnvec)(), (*errvec)(), (*cmdvec)(); |
25 |
– |
|
26 |
– |
extern struct driver *comm_init(); /* stream interface */ |
20 |
|
/* magic numbers for verification */ |
21 |
|
#define COM_SENDM 0x6f37 |
22 |
|
#define COM_RECVM 0x51da |
26 |
|
#define COM_GETCUR 2 |
27 |
|
#define COM_COMOUT 3 |
28 |
|
#define COM_COMIN 4 |
29 |
< |
#define NREQUESTS 5 /* number of valid requests */ |
29 |
> |
#define COM_FLUSH 5 |
30 |
> |
#define NREQUESTS 6 /* number of valid requests */ |
31 |
|
|
32 |
|
extern struct device { /* interactive device */ |
33 |
|
char *name; /* device name */ |
35 |
|
struct driver *(*init)(); /* initialize device */ |
36 |
|
} devtable[]; /* supported devices */ |
37 |
|
|
38 |
+ |
extern char dev_default[]; /* default device name */ |
39 |
+ |
|
40 |
|
#define MB1 ('\n') /* mouse button 1 */ |
41 |
|
#define MB2 ('\r') /* mouse button 2 */ |
42 |
|
#define MB3 (' ') /* mouse button 3 */ |
52 |
|
* The name string identifies the driver, |
53 |
|
* and the id string identifies the client. |
54 |
|
* A device can be open by at most one client. |
55 |
< |
* Be verbose in error reports; call stderr_v(). |
56 |
< |
* If device has its own error output, set errvec, |
61 |
< |
* cmdvec and wrnvec. |
55 |
> |
* Be verbose in error reports; call eputs(). |
56 |
> |
* If device has its own error output, set erract. |
57 |
|
* } |
58 |
|
* (*dev->close)() |
59 |
|
* { |
70 |
|
* int xmin, ymin, xmax, ymax; |
71 |
|
* { |
72 |
|
* Paint a half-open rectangle from (xmin,ymin) to (xmax,ymax) |
73 |
< |
* with the color col. Can call repaint() if necessary. |
73 |
> |
* with the color col. |
74 |
|
* } |
75 |
|
* (*dev->getcur)(xp, yp) |
76 |
|
* int *xp, *yp; |
87 |
|
* string ends with '\n', the message is considered complete, |
88 |
|
* and the next call can erase it. |
89 |
|
* } |
90 |
< |
* (*dev->comin)(in) |
91 |
< |
* char *in; |
90 |
> |
* (*dev->comin)(in, prompt) |
91 |
> |
* char *in, *prompt; |
92 |
|
* { |
93 |
< |
* Read an edited input string from the command line. If |
94 |
< |
* an unrecognized control character is entered, terminate |
95 |
< |
* input and return the string with only that character. |
96 |
< |
* The input string should not contain a newline. |
97 |
< |
* Must work in consort with comout. |
93 |
> |
* Print a prompt then read an edited input command line |
94 |
> |
* assuming the in buffer is big enough. Unless prompt is NULL, |
95 |
> |
* the driver may substitute its own rview command. This is |
96 |
> |
* the most reliable way to repaint areas of the screen. |
97 |
> |
* If the user enters an unrecognized control character, |
98 |
> |
* terminate input and return the string with only that character. |
99 |
> |
* The input string should not contain a newline. The routines in |
100 |
> |
* editline.c may be useful. Comin must work in consort with comout. |
101 |
|
* } |
102 |
+ |
* (*dev->flush)() |
103 |
+ |
* { |
104 |
+ |
* Flush output to the display. This is guaranteed to be called |
105 |
+ |
* frequently enough to keep the display up to date. |
106 |
+ |
* This is an ideal time to check for device input. |
107 |
+ |
* This function can be NULL for devices that don't need it. |
108 |
+ |
* } |
109 |
|
* xsiz, ysiz |
110 |
|
* The maximum allowable x and y dimensions. If any |
111 |
|
* size is allowable, these should be set to MAXRES. |
114 |
|
* when characters are ready on the input. (Often easiest |
115 |
|
* to check for input during calls to paintr.) |
116 |
|
*/ |
117 |
+ |
|
118 |
+ |
#ifdef NOPROTO |
119 |
+ |
|
120 |
+ |
extern void editline(); |
121 |
+ |
extern void tocombuf(); |
122 |
+ |
extern int fromcombuf(); |
123 |
+ |
extern struct driver *slave_init(); |
124 |
+ |
extern struct driver *comm_init(); |
125 |
+ |
extern int new_ctab(); |
126 |
+ |
extern int get_pixel(); |
127 |
+ |
extern void make_gmap(); |
128 |
+ |
extern void set_cmap(); |
129 |
+ |
extern void map_color(); |
130 |
+ |
|
131 |
+ |
#else |
132 |
+ |
/* defined in editline.c */ |
133 |
+ |
extern void editline(char *buf, int (*c_get)(), void (*s_put)()); |
134 |
+ |
extern void tocombuf(char *b, struct driver *d); |
135 |
+ |
extern int fromcombuf(char *b, struct driver *d); |
136 |
+ |
/* defined in devcomm.c */ |
137 |
+ |
extern struct driver *slave_init(char *dname, char *id); |
138 |
+ |
extern struct driver *comm_init(char *dname, char *id); |
139 |
+ |
/* defined in colortab.c */ |
140 |
+ |
extern int new_ctab(int ncolors); |
141 |
+ |
extern int get_pixel(COLOR col, void (*set_pixel)()); |
142 |
+ |
extern void make_gmap(double gam); |
143 |
+ |
extern void set_cmap(BYTE *rmap, BYTE *gmap, BYTE *bmap); |
144 |
+ |
extern void map_color(BYTE rgb[3], COLOR col); |
145 |
+ |
|
146 |
+ |
#endif |