8 |
|
*/ |
9 |
|
|
10 |
|
#include <stdio.h> |
11 |
+ |
#ifndef _WIN32 |
12 |
+ |
#include <unistd.h> |
13 |
+ |
#endif |
14 |
|
|
15 |
|
#include "color.h" |
16 |
|
|
22 |
|
|
23 |
|
char *progname; |
24 |
|
|
25 |
+ |
static void plotscan(COLOR scan[], int len, int y); |
26 |
+ |
static int colormap(COLOR col); |
27 |
+ |
static void vector(int x0, int y0, int x1, int y1); |
28 |
+ |
static void setdcolr(int col); |
29 |
+ |
static void printpat(int p); |
30 |
+ |
static int rorb(int b); |
31 |
|
|
32 |
< |
main(argc, argv) |
33 |
< |
int argc; |
34 |
< |
char **argv; |
32 |
> |
|
33 |
> |
int |
34 |
> |
main( |
35 |
> |
int argc, |
36 |
> |
char **argv |
37 |
> |
) |
38 |
|
{ |
39 |
|
int xres, yres; |
40 |
|
COLOR scanline[NCOLS]; |
77 |
|
} |
78 |
|
fclose(fp); |
79 |
|
|
80 |
+ |
#ifndef _WIN32 /* XXX extract console functions */ |
81 |
|
if (isatty(fileno(stdout))) { |
82 |
|
printf("Hit return when done: "); |
83 |
|
fflush(stdout); |
87 |
|
printf("%cMON34", COM); |
88 |
|
} |
89 |
|
putchar('\r'); |
90 |
+ |
#endif |
91 |
|
|
92 |
|
exit(0); |
93 |
+ |
return 0; /* pro forma return */ |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
< |
plotscan(scan, len, y) /* plot a scanline */ |
98 |
< |
COLOR scan[]; |
99 |
< |
int len; |
100 |
< |
int y; |
97 |
> |
static void |
98 |
> |
plotscan( /* plot a scanline */ |
99 |
> |
COLOR scan[], |
100 |
> |
int len, |
101 |
> |
int y |
102 |
> |
) |
103 |
|
{ |
104 |
|
int color, lastcolor = -1; |
105 |
|
int lastpos = -1; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
< |
int |
126 |
< |
colormap(col) /* compute 4027 color value for col */ |
127 |
< |
COLOR col; |
125 |
> |
static int |
126 |
> |
colormap( /* compute 4027 color value for col */ |
127 |
> |
COLOR col |
128 |
> |
) |
129 |
|
{ |
130 |
|
register int red, grn, blu; |
131 |
|
|
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
< |
vector(x0, y0, x1, y1) /* output a vector */ |
141 |
< |
int x0, y0, x1, y1; |
140 |
> |
static void |
141 |
> |
vector( /* output a vector */ |
142 |
> |
int x0, |
143 |
> |
int y0, |
144 |
> |
int x1, |
145 |
> |
int y1 |
146 |
> |
) |
147 |
|
{ |
148 |
|
printf("%cVEC%d %d %d %d", COM, x0, y0, x1, y1); |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
< |
setdcolr(col) /* set dithered pattern for terminal */ |
153 |
< |
int col; |
152 |
> |
static void |
153 |
> |
setdcolr( /* set dithered pattern for terminal */ |
154 |
> |
int col |
155 |
> |
) |
156 |
|
{ |
157 |
|
static int cmask[3][4] = { |
158 |
|
{ 0, 0x88, 0xca, 0xff }, |
215 |
|
} |
216 |
|
|
217 |
|
|
218 |
< |
printpat(p) /* print out a pattern */ |
219 |
< |
register int p; |
218 |
> |
static void |
219 |
> |
printpat( /* print out a pattern */ |
220 |
> |
register int p |
221 |
> |
) |
222 |
|
{ |
223 |
|
register int i; |
224 |
|
|
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
< |
int |
234 |
< |
rorb(b) /* rotate a byte to the right */ |
235 |
< |
register int b; |
233 |
> |
static int |
234 |
> |
rorb( /* rotate a byte to the right */ |
235 |
> |
register int b |
236 |
> |
) |
237 |
|
{ |
238 |
|
b |= (b&01) << 8; |
239 |
|
b >>= 1; |