1 |
– |
/* Copyright (c) 1987 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 |
|
* aed.c - driver for AED 512 terminal. |
9 |
– |
* |
10 |
– |
* 2/2/87 |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
|
#include <stdio.h> |
11 |
|
|
12 |
|
#include "driver.h" |
49 |
|
#define MINPIX 8 /* minimum hardware color */ |
50 |
|
|
51 |
|
#define NCOLS 512 /* maximum # columns for output */ |
52 |
< |
#define NROWS 512-COMHT /* maximum # rows for output */ |
52 |
> |
#define NROWS 483-COMHT /* maximum # rows for output */ |
53 |
|
#define COMHT 16 /* height of command line */ |
54 |
|
#define COMCW 63 /* maximum chars on command line */ |
55 |
|
|
59 |
– |
int anewcolr(); |
60 |
– |
|
56 |
|
int aed_close(), aed_clear(), aed_paintr(), |
57 |
|
aed_getcur(), aed_comout(), aed_errout(); |
58 |
|
|
59 |
|
static struct driver aed_driver = { |
60 |
|
aed_close, aed_clear, aed_paintr, aed_getcur, |
61 |
< |
aed_comout, NULL, |
62 |
< |
NCOLS, NROWS |
61 |
> |
aed_comout, NULL, NULL, |
62 |
> |
1.0, NCOLS, NROWS |
63 |
|
}; |
64 |
|
|
65 |
|
|
66 |
|
struct driver * |
67 |
< |
aed_init(name) /* open AED */ |
68 |
< |
char *name; |
67 |
> |
aed_init(name, id) /* open AED */ |
68 |
> |
char *name, *id; |
69 |
|
{ |
70 |
|
if (ttyset(&aed_driver, fileno(stdin)) < 0) { /* set tty driver */ |
71 |
< |
stderr_v("cannot access terminal\n"); |
71 |
> |
eputs("cannot access terminal\n"); |
72 |
|
return(NULL); |
73 |
|
} |
74 |
|
command(RST); /* reset AED */ |
83 |
|
byte(BLK); byte(WHT); byte(15); |
84 |
|
command(SCP); |
85 |
|
byte('+'); byte(0); byte(1); |
86 |
< |
make_cmap(GAMMA); /* make color map */ |
87 |
< |
errvec = aed_errout; /* set error vector */ |
88 |
< |
cmdvec = aed_errout; |
89 |
< |
if (wrnvec != NULL) |
90 |
< |
wrnvec = aed_errout; |
86 |
> |
make_gmap(GAMMA); /* make color map */ |
87 |
> |
erract[USER].pf = /* set error vector */ |
88 |
> |
erract[SYSTEM].pf = |
89 |
> |
erract[INTERNAL].pf = |
90 |
> |
erract[CONSISTENCY].pf = aed_errout; |
91 |
> |
erract[COMMAND].pf = aed_errout; |
92 |
> |
if (erract[WARNING].pf != NULL) |
93 |
> |
erract[WARNING].pf = aed_errout; |
94 |
|
return(&aed_driver); |
95 |
|
} |
96 |
|
|
98 |
|
static |
99 |
|
aed_close() /* close AED */ |
100 |
|
{ |
101 |
< |
errvec = stderr_v; /* reset error vector */ |
102 |
< |
cmdvec = NULL; |
103 |
< |
if (wrnvec != NULL) |
104 |
< |
wrnvec = stderr_v; |
101 |
> |
erract[USER].pf = /* reset error vector */ |
102 |
> |
erract[SYSTEM].pf = |
103 |
> |
erract[INTERNAL].pf = |
104 |
> |
erract[CONSISTENCY].pf = eputs; |
105 |
> |
erract[COMMAND].pf = NULL; |
106 |
> |
if (erract[WARNING].pf != NULL) |
107 |
> |
erract[WARNING].pf = wputs; |
108 |
|
aedsetcap(0, 0); /* go to bottom */ |
109 |
|
command(SEC); |
110 |
|
byte(WHT); /* white text */ |
120 |
|
int x, y; |
121 |
|
{ |
122 |
|
command(FFD); |
123 |
< |
new_ctab(NCOLORS, anewcolr); /* init color table */ |
123 |
> |
new_ctab(NCOLORS); /* init color table */ |
124 |
|
flush(); |
125 |
|
} |
126 |
|
|
130 |
|
COLOR col; |
131 |
|
int xmin, ymin, xmax, ymax; |
132 |
|
{ |
133 |
+ |
extern int anewcolr(); |
134 |
|
int ndx; |
135 |
|
|
136 |
< |
ndx = get_pixel(col); /* may call anewcolr() */ |
136 |
> |
ndx = get_pixel(col, anewcolr); /* calls anewcolr() */ |
137 |
|
command(SEC); /* draw rectangle */ |
138 |
|
byte(ndx+MINPIX); |
139 |
|
aedsetcap(xmin, ymin+COMHT); |