| 12 |
|
|
| 13 |
|
#include <stdio.h> |
| 14 |
|
#include <math.h> |
| 15 |
< |
#ifdef MSDOS |
| 16 |
< |
#include <fcntl.h> |
| 17 |
< |
#endif |
| 18 |
< |
#include <time.h> |
| 15 |
> |
#include <time.h> |
| 16 |
> |
|
| 17 |
> |
#include "platform.h" |
| 18 |
> |
#include "rtprocess.h" |
| 19 |
|
#include "color.h" |
| 20 |
|
#include "resolu.h" |
| 21 |
|
#include "pmap.h" |
| 99 |
|
#define RG_CORR 04 /* corrected color region */ |
| 100 |
|
|
| 101 |
|
#ifndef DISPCOM |
| 102 |
< |
#define DISPCOM "ximage -op %s" |
| 102 |
> |
#define DISPCOM "ximage -op \"%s\"" |
| 103 |
|
#endif |
| 104 |
|
|
| 105 |
|
int scanning = 1; /* scanned input (or recorded output)? */ |
| 141 |
|
perror(argv[i]); |
| 142 |
|
exit(1); |
| 143 |
|
} |
| 144 |
< |
#ifdef MSDOS |
| 145 |
< |
setmode(fileno(debugfp), O_BINARY); |
| 146 |
< |
#endif |
| 144 |
> |
SET_FILE_BINARY(debugfp); |
| 145 |
|
newheader("RADIANCE", debugfp); /* start */ |
| 146 |
|
printargs(argc, argv, debugfp); /* header */ |
| 147 |
|
break; |
| 186 |
|
exit(1); |
| 187 |
|
} |
| 188 |
|
if (scanning) { /* load input picture header */ |
| 189 |
< |
#ifdef MSDOS |
| 192 |
< |
setmode(fileno(stdin), O_BINARY); |
| 193 |
< |
#endif |
| 189 |
> |
SET_FILE_BINARY(stdin); |
| 190 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
| 191 |
|
fgetresolu(&xmax, &ymax, stdin) < 0) { |
| 192 |
|
fprintf(stderr, "%s: bad input picture\n", progname); |
| 242 |
|
printf("}\n"); |
| 243 |
|
putmapping(); /* put out color mapping */ |
| 244 |
|
} |
| 245 |
< |
if (debugfp != NULL) /* put out debug picture */ |
| 245 |
> |
if (debugfp != NULL) { /* put out debug picture */ |
| 246 |
|
if (scanning) |
| 247 |
|
picdebug(); |
| 248 |
|
else |
| 249 |
|
clrdebug(); |
| 250 |
+ |
} |
| 251 |
|
exit(0); |
| 252 |
|
userr: |
| 253 |
|
fprintf(stderr, |
| 367 |
|
float xyYin[3]; |
| 368 |
|
|
| 369 |
|
while (fgetval(stdin, 'i', &n) == 1) { /* read colors */ |
| 370 |
< |
if (n < 0 | n > 24 || |
| 370 |
> |
if ((n < 0) | (n > 24) || |
| 371 |
|
fgetval(stdin, 'f', &xyYin[0]) != 1 || |
| 372 |
|
fgetval(stdin, 'f', &xyYin[1]) != 1 || |
| 373 |
|
fgetval(stdin, 'f', &xyYin[2]) != 1 || |
| 374 |
< |
xyYin[0] < 0. | xyYin[1] < 0. || |
| 374 |
> |
(xyYin[0] < 0.) | (xyYin[1] < 0.) || |
| 375 |
|
xyYin[0] + xyYin[1] > 1.) { |
| 376 |
|
fprintf(stderr, "%s: bad color input data\n", |
| 377 |
|
progname); |
| 799 |
|
pickchartpos(pfn) /* display picture and pick chart location */ |
| 800 |
|
char *pfn; |
| 801 |
|
{ |
| 802 |
< |
char combuf[512]; |
| 802 |
> |
char combuf[PATH_MAX]; |
| 803 |
|
FILE *pfp; |
| 804 |
|
|
| 805 |
|
sprintf(combuf, DISPCOM, pfn); |