11 |
|
#include <ctype.h> |
12 |
|
|
13 |
|
#include "platform.h" |
14 |
+ |
#include "rtio.h" |
15 |
|
#include "color.h" |
16 |
|
#include "resolu.h" |
17 |
|
|
52 |
|
int bradj = 0; /* brightness adjustment */ |
53 |
|
int ncopies = 1; /* number of copies */ |
54 |
|
|
54 |
– |
extern int Aputprim(), Bputprim(), Cputprim(); |
55 |
– |
|
56 |
– |
int (*putprim)() = Aputprim; /* function for writing scanline */ |
57 |
– |
|
55 |
|
char *progname; |
59 |
– |
|
56 |
|
int xmax, ymax; /* input image dimensions */ |
57 |
|
|
58 |
< |
extern double unit2inch(); |
58 |
> |
typedef void putprimf_t(COLR *scn, int pri); |
59 |
|
|
60 |
|
static gethfunc headline; |
61 |
+ |
static putprimf_t Aputprim, Bputprim, Cputprim; |
62 |
|
|
63 |
+ |
static double unit2inch(register char *s); |
64 |
+ |
static int matchid(char *name, char *id); |
65 |
+ |
static void parsepaper(char *ps); |
66 |
+ |
static void quiterr(char *err); |
67 |
+ |
static void PSheader(int ac, char **av); |
68 |
+ |
static void PStrailer(void); |
69 |
+ |
static void PSprocdef(char *nam); |
70 |
+ |
static void ra2ps(void); |
71 |
+ |
static void putrle(int cnt, int cod); |
72 |
|
|
73 |
+ |
|
74 |
+ |
putprimf_t *putprim = Aputprim; /* function for writing scanline */ |
75 |
+ |
|
76 |
+ |
|
77 |
|
static int |
78 |
|
headline( /* check header line */ |
79 |
|
char *s, |
80 |
|
void *p |
81 |
|
) |
82 |
|
{ |
83 |
< |
char fmt[32]; |
83 |
> |
char fmt[MAXFMTLEN]; |
84 |
|
|
85 |
|
if (isformat(s)) { |
86 |
|
formatval(fmt, s); |
90 |
|
return(0); |
91 |
|
} |
92 |
|
|
93 |
< |
|
94 |
< |
main(argc, argv) |
85 |
< |
int argc; |
86 |
< |
char *argv[]; |
93 |
> |
int |
94 |
> |
main(int argc, char *argv[]) |
95 |
|
{ |
96 |
|
int i; |
97 |
|
double d; |
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
< |
double |
200 |
< |
unit2inch(s) /* determine unit */ |
201 |
< |
register char *s; |
199 |
> |
static double |
200 |
> |
unit2inch( /* determine unit */ |
201 |
> |
register char *s |
202 |
> |
) |
203 |
|
{ |
204 |
|
static struct unit {char n; float f;} u[] = { |
205 |
|
{'i', 1.}, |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
< |
int |
221 |
< |
matchid(name, id) /* see if name matches id (case insensitive) */ |
222 |
< |
char *name; |
223 |
< |
register char *id; |
220 |
> |
static int |
221 |
> |
matchid( /* see if name matches id (case insensitive) */ |
222 |
> |
char *name, |
223 |
> |
register char *id |
224 |
> |
) |
225 |
|
{ |
226 |
|
register char *s = name; |
227 |
|
|
237 |
|
} |
238 |
|
|
239 |
|
|
240 |
< |
parsepaper(ps) /* determine paper size from name */ |
241 |
< |
char *ps; |
240 |
> |
static void |
241 |
> |
parsepaper( /* determine paper size from name */ |
242 |
> |
char *ps |
243 |
> |
) |
244 |
|
{ |
245 |
|
static struct psize {char n[12]; float w,h;} p[] = { |
246 |
|
{"envelope", 4.12, 9.5}, |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
< |
quiterr(err) /* print message and exit */ |
298 |
< |
char *err; |
297 |
> |
static void |
298 |
> |
quiterr( /* print message and exit */ |
299 |
> |
char *err |
300 |
> |
) |
301 |
|
{ |
302 |
|
if (err != NULL) { |
303 |
|
fprintf(stderr, "%s: %s\n", progname, err); |
307 |
|
} |
308 |
|
|
309 |
|
|
310 |
< |
PSheader(ac, av) /* print PostScript header */ |
311 |
< |
int ac; |
312 |
< |
char **av; |
310 |
> |
static void |
311 |
> |
PSheader( /* print PostScript header */ |
312 |
> |
int ac, |
313 |
> |
char **av |
314 |
> |
) |
315 |
|
{ |
316 |
|
char *rstr; |
317 |
|
int landscape, rotate, n; |
408 |
|
} |
409 |
|
|
410 |
|
|
411 |
< |
PStrailer() /* print PostScript trailer */ |
411 |
> |
static void |
412 |
> |
PStrailer(void) /* print PostScript trailer */ |
413 |
|
{ |
414 |
|
puts("%%Trailer"); |
415 |
|
if (ncopies > 1) |
421 |
|
} |
422 |
|
|
423 |
|
|
424 |
< |
PSprocdef(nam) /* define PS procedure to read image */ |
425 |
< |
char *nam; |
424 |
> |
static void |
425 |
> |
PSprocdef( /* define PS procedure to read image */ |
426 |
> |
char *nam |
427 |
> |
) |
428 |
|
{ |
429 |
|
short itab[128]; |
430 |
|
register int i; |
432 |
|
for (i = 0; i < 128; i++) /* clear */ |
433 |
|
itab[i] = -1; |
434 |
|
for (i = 1; i < 63; i++) /* assign greys */ |
435 |
< |
itab[code[i]] = 256.0*pow((i+.5)/64.0, CODE6GAM/devgam); |
436 |
< |
itab[code[0]] = 0; /* black is black */ |
437 |
< |
itab[code[63]] = 255; /* and white is white */ |
435 |
> |
itab[(int)code[i]] = 256.0*pow((i+.5)/64.0, CODE6GAM/devgam); |
436 |
> |
itab[(int)code[0]] = 0; /* black is black */ |
437 |
> |
itab[(int)code[63]] = 255; /* and white is white */ |
438 |
|
printf("/codetab ["); |
439 |
|
for (i = 0; i < 128; i++) { |
440 |
|
if (!(i & 0xf)) |
463 |
|
} |
464 |
|
|
465 |
|
|
466 |
< |
ra2ps() /* convert Radiance scanlines to 6-bit */ |
466 |
> |
static void |
467 |
> |
ra2ps(void) /* convert Radiance scanlines to 6-bit */ |
468 |
|
{ |
469 |
|
register COLR *scanin; |
470 |
|
int y; |
497 |
|
} |
498 |
|
|
499 |
|
|
500 |
< |
int |
501 |
< |
Aputprim(scn, pri) /* put out hex ASCII primary from scanline */ |
502 |
< |
COLR *scn; |
503 |
< |
int pri; |
500 |
> |
static void |
501 |
> |
Aputprim( /* put out hex ASCII primary from scanline */ |
502 |
> |
COLR *scn, |
503 |
> |
int pri |
504 |
> |
) |
505 |
|
{ |
506 |
|
static char hexdigit[] = "0123456789ABCDEF"; |
507 |
|
static int col = 0; |
523 |
|
} |
524 |
|
|
525 |
|
|
526 |
< |
int |
527 |
< |
Bputprim(scn, pri) /* put out binary primary from scanline */ |
528 |
< |
COLR *scn; |
529 |
< |
int pri; |
526 |
> |
static void |
527 |
> |
Bputprim( /* put out binary primary from scanline */ |
528 |
> |
COLR *scn, |
529 |
> |
int pri |
530 |
> |
) |
531 |
|
{ |
532 |
|
register int x, c; |
533 |
|
|
542 |
|
} |
543 |
|
|
544 |
|
|
545 |
< |
int |
546 |
< |
Cputprim(scn, pri) /* put out compressed primary from scanline */ |
547 |
< |
COLR *scn; |
548 |
< |
int pri; |
545 |
> |
static void |
546 |
> |
Cputprim( /* put out compressed primary from scanline */ |
547 |
> |
COLR *scn, |
548 |
> |
int pri |
549 |
> |
) |
550 |
|
{ |
551 |
|
register int c; |
552 |
|
register int x; |
572 |
|
} |
573 |
|
|
574 |
|
|
575 |
< |
putrle(cnt, cod) /* put out cnt of cod */ |
576 |
< |
register int cnt, cod; |
575 |
> |
static void |
576 |
> |
putrle( /* put out cnt of cod */ |
577 |
> |
register int cnt, |
578 |
> |
register int cod |
579 |
> |
) |
580 |
|
{ |
581 |
|
static int col = 0; |
582 |
|
|