5 |
|
* Radiance picture to PostScript file translator -- one way! |
6 |
|
*/ |
7 |
|
|
8 |
– |
#include <stdio.h> |
9 |
– |
#include <string.h> |
8 |
|
#include <math.h> |
9 |
|
#include <ctype.h> |
10 |
|
|
11 |
|
#include "platform.h" |
12 |
+ |
#include "paths.h" |
13 |
|
#include "rtio.h" |
14 |
|
#include "color.h" |
15 |
|
#include "resolu.h" |
59 |
|
static gethfunc headline; |
60 |
|
static putprimf_t Aputprim, Bputprim, Cputprim; |
61 |
|
|
62 |
< |
static double unit2inch(register char *s); |
62 |
> |
static double unit2inch(char *s); |
63 |
|
static int matchid(char *name, char *id); |
64 |
|
static void parsepaper(char *ps); |
65 |
|
static void quiterr(char *err); |
79 |
|
void *p |
80 |
|
) |
81 |
|
{ |
82 |
< |
char fmt[32]; |
82 |
> |
char fmt[MAXFMTLEN]; |
83 |
|
|
84 |
|
if (isformat(s)) { |
85 |
|
formatval(fmt, s); |
95 |
|
int i; |
96 |
|
double d; |
97 |
|
|
98 |
< |
progname = argv[0]; |
98 |
> |
progname = fixargv0(argv[0]); |
99 |
|
|
100 |
|
for (i = 1; i < argc; i++) |
101 |
|
if (argv[i][0] == '-') |
197 |
|
|
198 |
|
static double |
199 |
|
unit2inch( /* determine unit */ |
200 |
< |
register char *s |
200 |
> |
char *s |
201 |
|
) |
202 |
|
{ |
203 |
|
static struct unit {char n; float f;} u[] = { |
205 |
|
{'m', 1./25.4}, |
206 |
|
{'c', 1./2.54}, |
207 |
|
{'\0',0} }; |
208 |
< |
register struct unit *up; |
208 |
> |
struct unit *up; |
209 |
|
|
210 |
|
while (*s && !isalpha(*s)) |
211 |
|
s++; |
219 |
|
static int |
220 |
|
matchid( /* see if name matches id (case insensitive) */ |
221 |
|
char *name, |
222 |
< |
register char *id |
222 |
> |
char *id |
223 |
|
) |
224 |
|
{ |
225 |
< |
register char *s = name; |
225 |
> |
char *s = name; |
226 |
|
|
227 |
|
while (*s) { |
228 |
|
if (isalpha(*s)) { |
262 |
|
{"DL", 4.33, 8.66}, |
263 |
|
{"hagaki", 3.94, 5.83}, |
264 |
|
{"",0.0,0.0} }; |
265 |
< |
register struct psize *pp; |
266 |
< |
register char *s = ps; |
265 |
> |
struct psize *pp; |
266 |
> |
char *s = ps; |
267 |
|
double d; |
268 |
|
|
269 |
|
if (isdigit(*s)) { /* check for WWxHH specification */ |
426 |
|
) |
427 |
|
{ |
428 |
|
short itab[128]; |
429 |
< |
register int i; |
429 |
> |
int i; |
430 |
|
/* assign code values */ |
431 |
|
for (i = 0; i < 128; i++) /* clear */ |
432 |
|
itab[i] = -1; |
465 |
|
static void |
466 |
|
ra2ps(void) /* convert Radiance scanlines to 6-bit */ |
467 |
|
{ |
468 |
< |
register COLR *scanin; |
468 |
> |
COLR *scanin; |
469 |
|
int y; |
470 |
|
/* allocate scanline */ |
471 |
|
scanin = (COLR *)malloc(xmax*sizeof(COLR)); |
504 |
|
{ |
505 |
|
static char hexdigit[] = "0123456789ABCDEF"; |
506 |
|
static int col = 0; |
507 |
< |
register int x, c; |
507 |
> |
int x, c; |
508 |
|
|
509 |
|
for (x = 0; x < xmax; x++) { |
510 |
|
if (pri == GRY) |
528 |
|
int pri |
529 |
|
) |
530 |
|
{ |
531 |
< |
register int x, c; |
531 |
> |
int x, c; |
532 |
|
|
533 |
|
for (x = 0; x < xmax; x++) { |
534 |
|
if (pri == GRY) |
547 |
|
int pri |
548 |
|
) |
549 |
|
{ |
550 |
< |
register int c; |
551 |
< |
register int x; |
550 |
> |
int c; |
551 |
> |
int x; |
552 |
|
int lastc, cnt; |
553 |
|
|
554 |
|
lastc = -1; cnt = 0; |
573 |
|
|
574 |
|
static void |
575 |
|
putrle( /* put out cnt of cod */ |
576 |
< |
register int cnt, |
577 |
< |
register int cod |
576 |
> |
int cnt, |
577 |
> |
int cod |
578 |
|
) |
579 |
|
{ |
580 |
|
static int col = 0; |