8 |
|
*/ |
9 |
|
|
10 |
|
#include <stdio.h> |
11 |
+ |
#include <string.h> |
12 |
|
#include <signal.h> |
13 |
|
|
14 |
+ |
#include "paths.h" |
15 |
|
#include "rterror.h" |
16 |
|
#include "color.h" |
17 |
|
|
116 |
|
}; |
117 |
|
|
118 |
|
|
117 |
– |
#define TEMPLATE "/tmp/dXXXXXX" |
118 |
– |
|
119 |
|
int docolor = 1; /* color? */ |
120 |
|
|
121 |
|
int cftype = C_35FFRA; /* configuration type */ |
122 |
|
|
123 |
|
char *progname; /* program name */ |
124 |
|
|
125 |
+ |
static void settype(char *cname); |
126 |
+ |
static void dofile(char *fname); |
127 |
+ |
static void d_init(void); |
128 |
+ |
static void scanout(COLOR *scan, int y); |
129 |
+ |
static void d_done(void); |
130 |
+ |
static void runlength(COLOR *scan, int f); |
131 |
+ |
static double mapfilter(COLOR col, int f); |
132 |
+ |
static void transfer(FILE *fin, FILE *fout); |
133 |
|
|
134 |
< |
main(argc, argv) |
135 |
< |
int argc; |
136 |
< |
char *argv[]; |
134 |
> |
|
135 |
> |
int |
136 |
> |
main( |
137 |
> |
int argc, |
138 |
> |
char *argv[] |
139 |
> |
) |
140 |
|
{ |
141 |
|
int i; |
142 |
|
|
184 |
|
dofile(NULL); |
185 |
|
|
186 |
|
quit(0); |
187 |
+ |
return 0; /* pro forma return */ |
188 |
|
} |
189 |
|
|
190 |
|
|
191 |
< |
settype(cname) /* set configuration type */ |
192 |
< |
char *cname; |
191 |
> |
static void |
192 |
> |
settype( /* set configuration type */ |
193 |
> |
char *cname |
194 |
> |
) |
195 |
|
{ |
196 |
|
for (cftype = 0; cftype < NCONF; cftype++) |
197 |
|
if (!strcmp(cname, ctab[cftype].name)) |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
< |
dofile(fname) /* convert file to dicomed format */ |
218 |
< |
char *fname; |
217 |
> |
static void |
218 |
> |
dofile( /* convert file to dicomed format */ |
219 |
> |
char *fname |
220 |
> |
) |
221 |
|
{ |
222 |
|
FILE *fin; |
223 |
|
char sbuf[128]; |
273 |
|
} |
274 |
|
|
275 |
|
|
276 |
< |
d_init() /* set up dicomed, files */ |
276 |
> |
static void |
277 |
> |
d_init(void) /* set up dicomed, files */ |
278 |
|
{ |
279 |
< |
char *mktemp(); |
279 |
> |
//char *mktemp(); |
280 |
|
/* initial condition select */ |
281 |
|
putw(O_ICS|ctab[cftype].icsfield, stdout); |
282 |
|
/* configuration code */ |
334 |
|
} |
335 |
|
|
336 |
|
|
337 |
< |
scanout(scan, y) /* output scan line */ |
338 |
< |
COLOR *scan; |
339 |
< |
int y; |
337 |
> |
static void |
338 |
> |
scanout( /* output scan line */ |
339 |
> |
COLOR *scan, |
340 |
> |
int y |
341 |
> |
) |
342 |
|
{ |
343 |
|
int i; |
344 |
|
/* uses horiz. flyback */ |
350 |
|
} |
351 |
|
|
352 |
|
|
353 |
< |
d_done() /* flush files, finish frame */ |
353 |
> |
static void |
354 |
> |
d_done(void) /* flush files, finish frame */ |
355 |
|
{ |
356 |
|
if (docolor) { |
357 |
|
transfer(ftab[RED].fp, stdout); |
366 |
|
} |
367 |
|
|
368 |
|
|
369 |
< |
runlength(scan, f) /* do scanline for filter f */ |
370 |
< |
COLOR *scan; |
371 |
< |
int f; |
369 |
> |
static void |
370 |
> |
runlength( /* do scanline for filter f */ |
371 |
> |
COLOR *scan, |
372 |
> |
int f |
373 |
> |
) |
374 |
|
{ |
375 |
< |
double mapfilter(); |
375 |
> |
//double mapfilter(); |
376 |
|
BYTE ebuf[2*HSIZE]; |
377 |
|
register int j; |
378 |
|
register BYTE *ep; |
404 |
|
} |
405 |
|
|
406 |
|
|
407 |
< |
double |
408 |
< |
mapfilter(col, f) /* map filter value */ |
409 |
< |
COLOR col; |
410 |
< |
register int f; |
407 |
> |
static double |
408 |
> |
mapfilter( /* map filter value */ |
409 |
> |
COLOR col, |
410 |
> |
register int f |
411 |
> |
) |
412 |
|
{ |
413 |
|
static float *mp[4] = {neumap, neumap, neumap, neumap}; |
414 |
|
double x, y; |
429 |
|
} |
430 |
|
|
431 |
|
|
432 |
< |
putw(w, fp) /* output a (short) word */ |
433 |
< |
int w; |
434 |
< |
register FILE *fp; |
432 |
> |
/* XXX replaces putw() from stdio.h. Do we really need this? */ |
433 |
> |
int |
434 |
> |
putw( /* output a (short) word */ |
435 |
> |
int w, |
436 |
> |
register FILE *fp |
437 |
> |
) |
438 |
|
{ |
439 |
|
putc(w&0377, fp); /* in proper order! */ |
440 |
|
putc(w>>8, fp); |
441 |
+ |
return 0; |
442 |
|
} |
443 |
|
|
444 |
|
|
445 |
< |
transfer(fin, fout) /* transfer fin contents to fout, close fin */ |
446 |
< |
register FILE *fin, *fout; |
445 |
> |
static void |
446 |
> |
transfer( /* transfer fin contents to fout, close fin */ |
447 |
> |
register FILE *fin, |
448 |
> |
register FILE *fout |
449 |
> |
) |
450 |
|
{ |
451 |
|
register int c; |
452 |
|
|