16 |
|
|
17 |
|
#include "platform.h" |
18 |
|
#include "rtprocess.h" |
19 |
+ |
#include "rterror.h" |
20 |
|
#include "color.h" |
21 |
|
#include "resolu.h" |
22 |
|
|
23 |
< |
#define MAXFILE 64 |
23 |
> |
#define MAXFILE 512 |
24 |
|
|
25 |
|
#define HASMIN 1 |
26 |
|
#define HASMAX 2 |
52 |
|
int xres, yres; /* picture size */ |
53 |
|
int xloc, yloc; /* anchor point */ |
54 |
|
int flags; /* HASMIN, HASMAX */ |
55 |
< |
COLR thmin, thmax; /* thresholds */ |
55 |
> |
double thmin, thmax; /* thresholds */ |
56 |
|
} input[MAXFILE]; /* our input files */ |
57 |
|
|
58 |
|
int nfile; /* number of files */ |
60 |
|
char ourfmt[LPICFMT+1] = PICFMT; |
61 |
|
int wrongformat = 0; |
62 |
|
|
62 |
– |
FILE *lblopen(); |
63 |
– |
void quit(); |
63 |
|
|
64 |
|
static gethfunc tabputs; |
65 |
+ |
static void compos(void); |
66 |
+ |
static int cmpcolr(COLR c1, double lv2); |
67 |
+ |
static FILE * lblopen(char *s, int *xp, int *yp); |
68 |
|
|
69 |
|
|
70 |
+ |
|
71 |
|
static int |
72 |
|
tabputs( /* print line preceded by a tab */ |
73 |
|
char *s, |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
< |
main(argc, argv) |
96 |
< |
int argc; |
97 |
< |
char *argv[]; |
95 |
> |
int |
96 |
> |
main( |
97 |
> |
int argc, |
98 |
> |
char *argv[] |
99 |
> |
) |
100 |
|
{ |
101 |
|
int ncolumns = 0; |
102 |
|
int autolabel = 0; |
169 |
|
checkthresh = 1; |
170 |
|
if (argv[an][0] == '-') { |
171 |
|
input[nfile].flags |= HASMIN; |
172 |
< |
setcolr(input[nfile].thmin, |
168 |
< |
atof(argv[an+1]), |
169 |
< |
atof(argv[an+1]), |
170 |
< |
atof(argv[an+1])); |
172 |
> |
input[nfile].thmin = atof(argv[an+1]); |
173 |
|
} else if (argv[an][0] == '+') { |
174 |
|
input[nfile].flags |= HASMAX; |
175 |
< |
setcolr(input[nfile].thmax, |
174 |
< |
atof(argv[an+1]), |
175 |
< |
atof(argv[an+1]), |
176 |
< |
atof(argv[an+1])); |
175 |
> |
input[nfile].thmax = atof(argv[an+1]); |
176 |
|
} else |
177 |
|
goto userr; |
178 |
|
an++; |
315 |
|
labelerr: |
316 |
|
fprintf(stderr, "%s: error opening label\n", progname); |
317 |
|
quit(1); |
318 |
+ |
return 1; /* pro forma return */ |
319 |
|
} |
320 |
|
|
321 |
|
|
322 |
< |
compos() /* composite pictures */ |
322 |
> |
static void |
323 |
> |
compos(void) /* composite pictures */ |
324 |
|
{ |
325 |
|
COLR *scanin, *scanout; |
326 |
|
int y; |
386 |
|
} |
387 |
|
|
388 |
|
|
389 |
< |
int |
390 |
< |
cmpcolr(c1, c2) /* compare two colr's (improvisation) */ |
391 |
< |
register COLR c1, c2; |
389 |
> |
static int |
390 |
> |
cmpcolr( /* compare COLR to luminance */ |
391 |
> |
register COLR c1, |
392 |
> |
double lv2 |
393 |
> |
) |
394 |
|
{ |
395 |
< |
register int i, j; |
396 |
< |
|
397 |
< |
j = 4; /* check exponents first! */ |
398 |
< |
while (j--) |
399 |
< |
if ( (i = c1[j] - c2[j]) ) |
400 |
< |
return(i); |
395 |
> |
double lv1 = .0; |
396 |
> |
|
397 |
> |
if (c1[EXP]) |
398 |
> |
lv1 = ldexp((double)normbright(c1), (int)c1[EXP]-(COLXS+8)); |
399 |
> |
if (lv1 < lv2) return(-1); |
400 |
> |
if (lv1 > lv2) return(1); |
401 |
|
return(0); |
402 |
|
} |
403 |
|
|
404 |
|
|
405 |
< |
FILE * |
406 |
< |
lblopen(s, xp, yp) /* open pipe to label generator */ |
407 |
< |
char *s; |
408 |
< |
int *xp, *yp; |
405 |
> |
static FILE * |
406 |
> |
lblopen( /* open pipe to label generator */ |
407 |
> |
char *s, |
408 |
> |
int *xp, |
409 |
> |
int *yp |
410 |
> |
) |
411 |
|
{ |
412 |
|
char com[PATH_MAX]; |
413 |
|
FILE *fp; |