1 |
– |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* x11.c - driver for X-windows version 11 |
9 |
– |
* |
10 |
– |
* Jan 1990 |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
|
#include "standard.h" |
11 |
|
#include <sys/ioctl.h> |
12 |
|
#ifdef sparc |
79 |
|
|
80 |
|
static int inpcheck; /* whence to check input */ |
81 |
|
|
82 |
< |
extern char *malloc(); |
82 |
> |
static int x11_getcur(); |
83 |
|
|
84 |
< |
static int x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
85 |
< |
x11_getcur(), x11_comout(), x11_comin(), x11_flush(); |
84 |
> |
static void x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
85 |
> |
x11_comout(), x11_comin(), x11_flush(); |
86 |
|
|
87 |
< |
static int std_comin(), std_comout(); |
87 |
> |
static void std_comin(), std_comout(); |
88 |
|
|
89 |
|
static struct driver x11_driver = { |
90 |
|
x11_close, x11_clear, x11_paintr, x11_getcur, |
91 |
|
NULL, NULL, x11_flush, 1.0 |
92 |
|
}; |
93 |
|
|
94 |
< |
static int getpixels(), xnewcolr(), freepixels(), resizewindow(), |
95 |
< |
getevent(), getkey(), fixwindow(), x11_getc(); |
94 |
> |
static int getpixels(), x11_getc(); |
95 |
> |
static void xnewcolr(), freepixels(), resizewindow(), |
96 |
> |
getevent(), getkey(), fixwindow(); |
97 |
|
static unsigned long true_pixel(); |
98 |
|
|
99 |
|
|
101 |
|
x11_init(name, id) /* initialize driver */ |
102 |
|
char *name, *id; |
103 |
|
{ |
106 |
– |
extern char *getenv(); |
104 |
|
char *gv; |
105 |
|
int nplanes; |
106 |
|
XSetWindowAttributes ourwinattr; |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
< |
static |
210 |
> |
static void |
211 |
|
x11_close() /* close our display */ |
212 |
|
{ |
213 |
|
erract[COMMAND].pf = NULL; /* reset error vectors */ |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
< |
static |
233 |
> |
static void |
234 |
|
x11_clear(xres, yres) /* clear our display */ |
235 |
|
int xres, yres; |
236 |
|
{ |
276 |
|
} |
277 |
|
|
278 |
|
|
279 |
< |
static |
279 |
> |
static void |
280 |
|
x11_paintr(col, xmin, ymin, xmax, ymax) /* fill a rectangle */ |
281 |
|
COLOR col; |
282 |
|
int xmin, ymin, xmax, ymax; |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
< |
static |
298 |
> |
static void |
299 |
|
x11_flush() /* flush output */ |
300 |
|
{ |
301 |
|
char buf[256]; |
331 |
|
} |
332 |
|
|
333 |
|
|
334 |
< |
static |
334 |
> |
static void |
335 |
|
x11_comin(inp, prompt) /* read in a command line */ |
336 |
|
char *inp, *prompt; |
337 |
|
{ |
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
< |
static |
350 |
> |
static void |
351 |
|
x11_comout(outp) /* output a string to command line */ |
352 |
|
char *outp; |
353 |
|
{ |
359 |
|
} |
360 |
|
|
361 |
|
|
362 |
< |
static |
362 |
> |
static void |
363 |
|
x11_errout(msg) /* output an error message */ |
364 |
|
char *msg; |
365 |
|
{ |
368 |
|
} |
369 |
|
|
370 |
|
|
371 |
< |
static |
371 |
> |
static void |
372 |
|
std_comin(inp, prompt) /* read in command line from stdin */ |
373 |
|
char *inp, *prompt; |
374 |
|
{ |
378 |
– |
extern char *gets(); |
379 |
– |
|
375 |
|
if (prompt != NULL) { |
376 |
|
if (fromcombuf(inp, &x11_driver)) |
377 |
|
return; |
397 |
|
} |
398 |
|
|
399 |
|
|
400 |
< |
static |
400 |
> |
static void |
401 |
|
std_comout(outp) /* write out string to stdout */ |
402 |
|
char *outp; |
403 |
|
{ |
435 |
|
} |
436 |
|
|
437 |
|
|
438 |
< |
static |
438 |
> |
static void |
439 |
|
xnewcolr(ndx, r, g, b) /* enter a color into hardware table */ |
440 |
|
int ndx; |
441 |
|
int r, g, b; |
475 |
|
return(ncolors = 0); |
476 |
|
if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors)) |
477 |
|
break; |
478 |
< |
free((char *)pixval); |
478 |
> |
free((void *)pixval); |
479 |
|
pixval = NULL; |
480 |
|
} |
481 |
|
if (pixval == NULL) { |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
< |
static |
507 |
> |
static void |
508 |
|
freepixels() /* free our pixels */ |
509 |
|
{ |
510 |
|
if (ncolors == 0) |
511 |
|
return; |
512 |
|
XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L); |
513 |
< |
free((char *)pixval); |
513 |
> |
free((void *)pixval); |
514 |
|
pixval = NULL; |
515 |
|
ncolors = 0; |
516 |
|
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
< |
static |
549 |
> |
static void |
550 |
|
getevent() /* get next event */ |
551 |
|
{ |
552 |
|
XNextEvent(ourdisplay, levptr(XEvent)); |
579 |
|
} |
580 |
|
|
581 |
|
|
582 |
< |
static |
582 |
> |
static void |
583 |
|
getkey(ekey) /* get input key */ |
584 |
|
register XKeyPressedEvent *ekey; |
585 |
|
{ |
592 |
|
} |
593 |
|
|
594 |
|
|
595 |
< |
static |
595 |
> |
static void |
596 |
|
fixwindow(eexp) /* repair damage to window */ |
597 |
|
register XExposeEvent *eexp; |
598 |
|
{ |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
< |
static |
613 |
> |
static void |
614 |
|
resizewindow(ersz) /* resize window */ |
615 |
|
register XConfigureEvent *ersz; |
616 |
|
{ |