10 |
|
* 5/7/87 |
11 |
|
*/ |
12 |
|
|
13 |
< |
#include <stdio.h> |
14 |
< |
#include <math.h> |
13 |
> |
#include "standard.h" |
14 |
|
|
15 |
|
#include <X/Xlib.h> |
16 |
|
#include <X/cursors/bcross.cursor> |
79 |
|
|
80 |
|
ourdisplay = XOpenDisplay(NULL); |
81 |
|
if (ourdisplay == NULL) { |
82 |
< |
stderr_v("cannot open X-windows; DISPLAY variable set?\n"); |
82 |
> |
eputs("cannot open X-windows; DISPLAY variable set?\n"); |
83 |
|
return(NULL); |
84 |
|
} |
85 |
|
if (DisplayPlanes() < 4) { |
86 |
< |
stderr_v("not enough colors\n"); |
86 |
> |
eputs("not enough colors\n"); |
87 |
|
return(NULL); |
88 |
|
} |
89 |
|
/* make color map */ |
104 |
|
gwind = XCreate("X10 display driver", progname, NULL, defgeom, |
105 |
|
&mainframe, MINWIDTH, MINHEIGHT+COMHEIGHT); |
106 |
|
if (gwind == 0) { |
107 |
< |
stderr_v("can't create window\n"); |
107 |
> |
eputs("can't create window\n"); |
108 |
|
return(NULL); |
109 |
|
} |
110 |
|
XStoreName(gwind, id); |
115 |
|
x_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth; |
116 |
|
x_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight; |
117 |
|
x_driver.inpready = 0; |
118 |
< |
cmdvec = x_comout; /* set error vectors */ |
119 |
< |
if (wrnvec != NULL) |
120 |
< |
wrnvec = x_errout; |
118 |
> |
erract[COMMAND].pf = x_comout; /* set error vectors */ |
119 |
> |
if (erract[WARNING].pf != NULL) |
120 |
> |
erract[WARNING].pf = x_errout; |
121 |
|
return(&x_driver); |
122 |
|
} |
123 |
|
|
125 |
|
static |
126 |
|
x_close() /* close our display */ |
127 |
|
{ |
128 |
< |
cmdvec = NULL; /* reset error vectors */ |
129 |
< |
if (wrnvec != NULL) |
130 |
< |
wrnvec = stderr_v; |
128 |
> |
erract[COMMAND].pf = NULL; /* reset error vectors */ |
129 |
> |
if (erract[WARNING].pf != NULL) |
130 |
> |
erract[WARNING].pf = wputs; |
131 |
|
if (ourdisplay == NULL) |
132 |
|
return; |
133 |
|
if (comline != NULL) { |
157 |
|
XClear(gwind); |
158 |
|
/* reinitialize color table */ |
159 |
|
if (getpixels() == 0) |
160 |
< |
stderr_v("cannot allocate colors\n"); |
160 |
> |
eputs("cannot allocate colors\n"); |
161 |
|
else |
162 |
|
new_ctab(ncolors); |
163 |
|
/* open new command line */ |
165 |
|
xt_close(comline); |
166 |
|
comline = xt_open(gwind, 0, yres, xres, COMHEIGHT, 0, COMFN); |
167 |
|
if (comline == NULL) { |
168 |
< |
stderr_v("Cannot open command line window\n"); |
168 |
> |
eputs("Cannot open command line window\n"); |
169 |
|
quit(1); |
170 |
|
} |
171 |
|
XMapWindow(gwind); /* make sure it's mapped */ |
232 |
|
x_errout(msg) /* output an error message */ |
233 |
|
char *msg; |
234 |
|
{ |
235 |
< |
stderr_v(msg); /* send to stderr also! */ |
235 |
> |
eputs(msg); /* send to stderr also! */ |
236 |
|
x_comout(msg); |
237 |
|
} |
238 |
|
|
368 |
|
} |
369 |
|
/* remap colors */ |
370 |
|
if (getpixels() == 0) { |
371 |
< |
stderr_v("cannot allocate colors\n"); |
371 |
> |
eputs("cannot allocate colors\n"); |
372 |
|
return; |
373 |
|
} |
374 |
|
new_ctab(ncolors); |