7 |
|
* 4/23/86 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include "standard.h" |
10 |
|
#include "platform.h" |
11 |
+ |
#include "standard.h" |
12 |
|
#include "color.h" |
13 |
|
#include "resolu.h" |
14 |
+ |
#include "view.h" |
15 |
|
|
16 |
|
#define min(a,b) ((a)<(b)?(a):(b)) |
17 |
|
|
20 |
|
#define BRIGHT 4 |
21 |
|
|
22 |
|
RESOLU picres; /* resolution of picture */ |
22 |
– |
|
23 |
|
int uniq = 0; /* print only unique values? */ |
24 |
– |
|
24 |
|
int doexposure = 0; /* exposure change? (>100 to print) */ |
26 |
– |
|
25 |
|
int dataonly = 0; /* data only format? */ |
28 |
– |
|
26 |
|
int putprim = ALL; /* what to put out */ |
30 |
– |
|
27 |
|
int reverse = 0; /* reverse conversion? */ |
32 |
– |
|
28 |
|
int format = 'a'; /* input/output format */ |
29 |
|
char *fmtid = "ascii"; /* format identifier for header */ |
35 |
– |
|
30 |
|
int header = 1; /* do header? */ |
37 |
– |
|
31 |
|
long skipbytes = 0; /* skip bytes in input? */ |
39 |
– |
|
32 |
|
int swapbytes = 0; /* swap bytes? */ |
41 |
– |
|
33 |
|
int interleave = 1; /* file is interleaved? */ |
43 |
– |
|
34 |
|
int resolution = 1; /* put/get resolution string? */ |
45 |
– |
|
35 |
|
int original = 0; /* convert to original values? */ |
47 |
– |
|
36 |
|
int wrongformat = 0; /* wrong input format? */ |
49 |
– |
|
37 |
|
double gamcor = 1.0; /* gamma correction */ |
38 |
|
|
39 |
|
int ord[3] = {RED, GRN, BLU}; /* RGB ordering */ |
46 |
|
FILE *fin; |
47 |
|
FILE *fin2 = NULL, *fin3 = NULL; /* for other color channels */ |
48 |
|
|
62 |
– |
int (*getval)(), (*putval)(); |
49 |
|
|
50 |
< |
double |
51 |
< |
rgb_bright(clr) |
52 |
< |
COLOR clr; |
50 |
> |
typedef int getfunc_t(COLOR col); |
51 |
> |
typedef int putfunc_t(COLOR col); |
52 |
> |
typedef double brightfunc_t(COLOR col); |
53 |
> |
|
54 |
> |
getfunc_t *getval; |
55 |
> |
putfunc_t *putval; |
56 |
> |
brightfunc_t *mybright; |
57 |
> |
|
58 |
> |
static gethfunc checkhead; |
59 |
> |
static brightfunc_t rgb_bright, xyz_bright; |
60 |
> |
static getfunc_t getbascii, getbint, getbdouble, getbfloat, getbbyte, getbword; |
61 |
> |
static getfunc_t getcascii, getcint, getcdouble, getcfloat, getcbyte, getcword; |
62 |
> |
static putfunc_t putbascii, putbint, putbdouble, putbfloat, putbbyte, putbword; |
63 |
> |
static putfunc_t putcascii, putcint, putcdouble, putcfloat, putcbyte, putcword; |
64 |
> |
static putfunc_t putpascii, putpint, putpdouble, putpfloat, putpbyte, putpword; |
65 |
> |
|
66 |
> |
static void set_io(void); |
67 |
> |
static void pixtoval(void); |
68 |
> |
static void valtopix(void); |
69 |
> |
|
70 |
> |
|
71 |
> |
static double |
72 |
> |
rgb_bright( |
73 |
> |
COLOR clr |
74 |
> |
) |
75 |
|
{ |
76 |
|
return(bright(clr)); |
77 |
|
} |
78 |
|
|
79 |
< |
double |
80 |
< |
xyz_bright(clr) |
81 |
< |
COLOR clr; |
79 |
> |
static double |
80 |
> |
xyz_bright( |
81 |
> |
COLOR clr |
82 |
> |
) |
83 |
|
{ |
84 |
|
return(clr[CIEY]); |
85 |
|
} |
86 |
|
|
87 |
< |
double (*mybright)() = &rgb_bright; |
88 |
< |
|
89 |
< |
|
90 |
< |
main(argc, argv) |
91 |
< |
int argc; |
83 |
< |
char **argv; |
87 |
> |
int |
88 |
> |
main( |
89 |
> |
int argc, |
90 |
> |
char **argv |
91 |
> |
) |
92 |
|
{ |
85 |
– |
extern int checkhead(); |
86 |
– |
extern long atol(); |
93 |
|
double d, expval = 1.0; |
94 |
|
int i; |
95 |
|
|
96 |
|
progname = argv[0]; |
97 |
+ |
mybright = &rgb_bright; /* default */ |
98 |
|
|
99 |
|
for (i = 1; i < argc; i++) |
100 |
|
if (argv[i][0] == '-' || argv[i][0] == '+') |
357 |
|
} |
358 |
|
|
359 |
|
quit(0); |
360 |
+ |
return 0; /* pro forma return */ |
361 |
|
} |
362 |
|
|
363 |
|
|
364 |
< |
int |
365 |
< |
checkhead(line) /* deal with line from header */ |
366 |
< |
char *line; |
364 |
> |
static int |
365 |
> |
checkhead( /* deal with line from header */ |
366 |
> |
char *line, |
367 |
> |
void *p |
368 |
> |
) |
369 |
|
{ |
370 |
|
char fmt[32]; |
371 |
|
double d; |
372 |
|
COLOR ctmp; |
373 |
|
|
374 |
|
if (formatval(fmt, line)) { |
375 |
< |
if (!strcmp(fmt, CIEFMT)) { |
375 |
> |
if (!strcmp(fmt, CIEFMT)) |
376 |
|
mybright = &xyz_bright; |
377 |
< |
if (original) { |
368 |
< |
scalecolor(exposure, 1./WHTEFFICACY); |
369 |
< |
doexposure++; |
370 |
< |
} |
371 |
< |
} else if (!strcmp(fmt, COLRFMT)) |
377 |
> |
else if (!strcmp(fmt, COLRFMT)) |
378 |
|
mybright = &rgb_bright; |
379 |
|
else |
380 |
|
wrongformat++; |
394 |
|
} |
395 |
|
|
396 |
|
|
397 |
< |
pixtoval() /* convert picture to values */ |
397 |
> |
static void |
398 |
> |
pixtoval(void) /* convert picture to values */ |
399 |
|
{ |
400 |
|
register COLOR *scanln; |
401 |
|
int dogamma; |
468 |
|
} |
469 |
|
|
470 |
|
|
471 |
< |
valtopix() /* convert values to a pixel file */ |
471 |
> |
static void |
472 |
> |
valtopix(void) /* convert values to a pixel file */ |
473 |
|
{ |
474 |
|
int dogamma; |
475 |
|
register COLOR *scanln; |
521 |
|
} |
522 |
|
|
523 |
|
|
524 |
< |
swap16(wp, n) /* swap n 16-bit words */ |
525 |
< |
register uint16 *wp; |
526 |
< |
int n; |
524 |
> |
static int |
525 |
> |
getcascii( /* get an ascii color value from stream(s) */ |
526 |
> |
COLOR col |
527 |
> |
) |
528 |
|
{ |
520 |
– |
while (n-- > 0) { |
521 |
– |
*wp = *wp << 8 | ((*wp >> 8) & 0xff); |
522 |
– |
wp++; |
523 |
– |
} |
524 |
– |
} |
525 |
– |
|
526 |
– |
|
527 |
– |
swap32(wp, n) /* swap n 32-bit words */ |
528 |
– |
register uint32 *wp; |
529 |
– |
int n; |
530 |
– |
{ |
531 |
– |
while (n-- > 0) { |
532 |
– |
*wp = *wp << 24 | ((*wp >> 24) & 0xff) | |
533 |
– |
(*wp & 0xff00) << 8 | (*wp & 0xff0000) >> 8; |
534 |
– |
wp++; |
535 |
– |
} |
536 |
– |
} |
537 |
– |
|
538 |
– |
|
539 |
– |
swap64(wp, n) /* swap n 64-bit words */ |
540 |
– |
register char *wp; |
541 |
– |
int n; |
542 |
– |
{ |
543 |
– |
register int t; |
544 |
– |
|
545 |
– |
while (n-- > 0) { |
546 |
– |
t = wp[0]; wp[0] = wp[7]; wp[7] = t; |
547 |
– |
t = wp[1]; wp[1] = wp[6]; wp[6] = t; |
548 |
– |
t = wp[2]; wp[2] = wp[5]; wp[5] = t; |
549 |
– |
t = wp[3]; wp[3] = wp[4]; wp[4] = t; |
550 |
– |
wp += 8; |
551 |
– |
} |
552 |
– |
} |
553 |
– |
|
554 |
– |
|
555 |
– |
getcascii(col) /* get an ascii color value from stream(s) */ |
556 |
– |
COLOR col; |
557 |
– |
{ |
529 |
|
double vd[3]; |
530 |
|
|
531 |
|
if (fin2 == NULL) { |
542 |
|
} |
543 |
|
|
544 |
|
|
545 |
< |
getcdouble(col) /* get a double color value from stream(s) */ |
546 |
< |
COLOR col; |
545 |
> |
static int |
546 |
> |
getcdouble( /* get a double color value from stream(s) */ |
547 |
> |
COLOR col |
548 |
> |
) |
549 |
|
{ |
550 |
|
double vd[3]; |
551 |
|
|
565 |
|
} |
566 |
|
|
567 |
|
|
568 |
< |
getcfloat(col) /* get a float color value from stream(s) */ |
569 |
< |
COLOR col; |
568 |
> |
static int |
569 |
> |
getcfloat( /* get a float color value from stream(s) */ |
570 |
> |
COLOR col |
571 |
> |
) |
572 |
|
{ |
573 |
|
float vf[3]; |
574 |
|
|
582 |
|
return(-1); |
583 |
|
} |
584 |
|
if (swapbytes) |
585 |
< |
swap32((uint32 *)vf, 3); |
585 |
> |
swap32((char *)vf, 3); |
586 |
|
setcolor(col, vf[rord[RED]], vf[rord[GRN]], vf[rord[BLU]]); |
587 |
|
return(0); |
588 |
|
} |
589 |
|
|
590 |
|
|
591 |
< |
getcint(col) /* get an int color value from stream(s) */ |
592 |
< |
COLOR col; |
591 |
> |
static int |
592 |
> |
getcint( /* get an int color value from stream(s) */ |
593 |
> |
COLOR col |
594 |
> |
) |
595 |
|
{ |
596 |
|
int vi[3]; |
597 |
|
|
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
< |
getcbyte(col) /* get a byte color value from stream(s) */ |
614 |
< |
COLOR col; |
613 |
> |
static int |
614 |
> |
getcbyte( /* get a byte color value from stream(s) */ |
615 |
> |
COLOR col |
616 |
> |
) |
617 |
|
{ |
618 |
|
BYTE vb[3]; |
619 |
|
|
632 |
|
} |
633 |
|
|
634 |
|
|
635 |
< |
getcword(col) /* get a 16-bit color value from stream(s) */ |
636 |
< |
COLOR col; |
635 |
> |
static int |
636 |
> |
getcword( /* get a 16-bit color value from stream(s) */ |
637 |
> |
COLOR col |
638 |
> |
) |
639 |
|
{ |
640 |
|
uint16 vw[3]; |
641 |
|
|
649 |
|
return(-1); |
650 |
|
} |
651 |
|
if (swapbytes) |
652 |
< |
swap16(vw, 3); |
652 |
> |
swap16((char *)vw, 3); |
653 |
|
setcolor(col, (vw[rord[RED]]+.5)/65536., |
654 |
|
(vw[rord[GRN]]+.5)/65536., (vw[rord[BLU]]+.5)/65536.); |
655 |
|
return(0); |
656 |
|
} |
657 |
|
|
658 |
|
|
659 |
< |
getbascii(col) /* get an ascii brightness value from fin */ |
660 |
< |
COLOR col; |
659 |
> |
static int |
660 |
> |
getbascii( /* get an ascii brightness value from fin */ |
661 |
> |
COLOR col |
662 |
> |
) |
663 |
|
{ |
664 |
|
double vd; |
665 |
|
|
670 |
|
} |
671 |
|
|
672 |
|
|
673 |
< |
getbdouble(col) /* get a double brightness value from fin */ |
674 |
< |
COLOR col; |
673 |
> |
static int |
674 |
> |
getbdouble( /* get a double brightness value from fin */ |
675 |
> |
COLOR col |
676 |
> |
) |
677 |
|
{ |
678 |
|
double vd; |
679 |
|
|
686 |
|
} |
687 |
|
|
688 |
|
|
689 |
< |
getbfloat(col) /* get a float brightness value from fin */ |
690 |
< |
COLOR col; |
689 |
> |
static int |
690 |
> |
getbfloat( /* get a float brightness value from fin */ |
691 |
> |
COLOR col |
692 |
> |
) |
693 |
|
{ |
694 |
|
float vf; |
695 |
|
|
696 |
|
if (fread((char *)&vf, sizeof(float), 1, fin) != 1) |
697 |
|
return(-1); |
698 |
|
if (swapbytes) |
699 |
< |
swap32((uint32 *)&vf, 1); |
699 |
> |
swap32((char *)&vf, 1); |
700 |
|
setcolor(col, vf, vf, vf); |
701 |
|
return(0); |
702 |
|
} |
703 |
|
|
704 |
|
|
705 |
< |
getbint(col) /* get an int brightness value from fin */ |
706 |
< |
COLOR col; |
705 |
> |
static int |
706 |
> |
getbint( /* get an int brightness value from fin */ |
707 |
> |
COLOR col |
708 |
> |
) |
709 |
|
{ |
710 |
|
int vi; |
711 |
|
double d; |
718 |
|
} |
719 |
|
|
720 |
|
|
721 |
< |
getbbyte(col) /* get a byte brightness value from fin */ |
722 |
< |
COLOR col; |
721 |
> |
static int |
722 |
> |
getbbyte( /* get a byte brightness value from fin */ |
723 |
> |
COLOR col |
724 |
> |
) |
725 |
|
{ |
726 |
|
BYTE vb; |
727 |
|
double d; |
734 |
|
} |
735 |
|
|
736 |
|
|
737 |
< |
getbword(col) /* get a 16-bit brightness value from fin */ |
738 |
< |
COLOR col; |
737 |
> |
static int |
738 |
> |
getbword( /* get a 16-bit brightness value from fin */ |
739 |
> |
COLOR col |
740 |
> |
) |
741 |
|
{ |
742 |
|
uint16 vw; |
743 |
|
double d; |
745 |
|
if (fread((char *)&vw, sizeof(uint16), 1, fin) != 1) |
746 |
|
return(-1); |
747 |
|
if (swapbytes) |
748 |
< |
swap16(&vw, 1); |
748 |
> |
swap16((char *)&vw, 1); |
749 |
|
d = (vw+.5)/65536.; |
750 |
|
setcolor(col, d, d, d); |
751 |
|
return(0); |
752 |
|
} |
753 |
|
|
754 |
|
|
755 |
< |
putcascii(col) /* put an ascii color to stdout */ |
756 |
< |
COLOR col; |
755 |
> |
static int |
756 |
> |
putcascii( /* put an ascii color to stdout */ |
757 |
> |
COLOR col |
758 |
> |
) |
759 |
|
{ |
760 |
|
fprintf(stdout, "%15.3e %15.3e %15.3e\n", |
761 |
|
colval(col,ord[0]), |
766 |
|
} |
767 |
|
|
768 |
|
|
769 |
< |
putcfloat(col) /* put a float color to stdout */ |
770 |
< |
COLOR col; |
769 |
> |
static int |
770 |
> |
putcfloat( /* put a float color to stdout */ |
771 |
> |
COLOR col |
772 |
> |
) |
773 |
|
{ |
774 |
|
float vf[3]; |
775 |
|
|
777 |
|
vf[1] = colval(col,ord[1]); |
778 |
|
vf[2] = colval(col,ord[2]); |
779 |
|
if (swapbytes) |
780 |
< |
swap32((uint32 *)vf, 3); |
780 |
> |
swap32((char *)vf, 3); |
781 |
|
fwrite((char *)vf, sizeof(float), 3, stdout); |
782 |
|
|
783 |
|
return(ferror(stdout) ? -1 : 0); |
784 |
|
} |
785 |
|
|
786 |
|
|
787 |
< |
putcdouble(col) /* put a double color to stdout */ |
788 |
< |
COLOR col; |
787 |
> |
static int |
788 |
> |
putcdouble( /* put a double color to stdout */ |
789 |
> |
COLOR col |
790 |
> |
) |
791 |
|
{ |
792 |
|
double vd[3]; |
793 |
|
|
802 |
|
} |
803 |
|
|
804 |
|
|
805 |
< |
putcint(col) /* put an int color to stdout */ |
806 |
< |
COLOR col; |
805 |
> |
static int |
806 |
> |
putcint( /* put an int color to stdout */ |
807 |
> |
COLOR col |
808 |
> |
) |
809 |
|
{ |
810 |
|
fprintf(stdout, "%d %d %d\n", |
811 |
|
(int)(colval(col,ord[0])*256.), |
816 |
|
} |
817 |
|
|
818 |
|
|
819 |
< |
putcbyte(col) /* put a byte color to stdout */ |
820 |
< |
COLOR col; |
819 |
> |
static int |
820 |
> |
putcbyte( /* put a byte color to stdout */ |
821 |
> |
COLOR col |
822 |
> |
) |
823 |
|
{ |
824 |
|
long i; |
825 |
|
BYTE vb[3]; |
836 |
|
} |
837 |
|
|
838 |
|
|
839 |
< |
putcword(col) /* put a 16-bit color to stdout */ |
840 |
< |
COLOR col; |
839 |
> |
static int |
840 |
> |
putcword( /* put a 16-bit color to stdout */ |
841 |
> |
COLOR col |
842 |
> |
) |
843 |
|
{ |
844 |
|
long i; |
845 |
|
uint16 vw[3]; |
851 |
|
i = colval(col,ord[2])*65536.; |
852 |
|
vw[2] = min(i,65535); |
853 |
|
if (swapbytes) |
854 |
< |
swap16(vw, 3); |
854 |
> |
swap16((char *)vw, 3); |
855 |
|
fwrite((char *)vw, sizeof(uint16), 3, stdout); |
856 |
|
|
857 |
|
return(ferror(stdout) ? -1 : 0); |
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
< |
putbascii(col) /* put an ascii brightness to stdout */ |
862 |
< |
COLOR col; |
861 |
> |
static int |
862 |
> |
putbascii( /* put an ascii brightness to stdout */ |
863 |
> |
COLOR col |
864 |
> |
) |
865 |
|
{ |
866 |
|
fprintf(stdout, "%15.3e\n", (*mybright)(col)); |
867 |
|
|
869 |
|
} |
870 |
|
|
871 |
|
|
872 |
< |
putbfloat(col) /* put a float brightness to stdout */ |
873 |
< |
COLOR col; |
872 |
> |
static int |
873 |
> |
putbfloat( /* put a float brightness to stdout */ |
874 |
> |
COLOR col |
875 |
> |
) |
876 |
|
{ |
877 |
|
float vf; |
878 |
|
|
879 |
|
vf = (*mybright)(col); |
880 |
|
if (swapbytes) |
881 |
< |
swap32((uint32 *)&vf, 1); |
881 |
> |
swap32((char *)&vf, 1); |
882 |
|
fwrite((char *)&vf, sizeof(float), 1, stdout); |
883 |
|
|
884 |
|
return(ferror(stdout) ? -1 : 0); |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
< |
putbdouble(col) /* put a double brightness to stdout */ |
889 |
< |
COLOR col; |
888 |
> |
static int |
889 |
> |
putbdouble( /* put a double brightness to stdout */ |
890 |
> |
COLOR col |
891 |
> |
) |
892 |
|
{ |
893 |
|
double vd; |
894 |
|
|
901 |
|
} |
902 |
|
|
903 |
|
|
904 |
< |
putbint(col) /* put an int brightness to stdout */ |
905 |
< |
COLOR col; |
904 |
> |
static int |
905 |
> |
putbint( /* put an int brightness to stdout */ |
906 |
> |
COLOR col |
907 |
> |
) |
908 |
|
{ |
909 |
|
fprintf(stdout, "%d\n", (int)((*mybright)(col)*256.)); |
910 |
|
|
912 |
|
} |
913 |
|
|
914 |
|
|
915 |
< |
putbbyte(col) /* put a byte brightness to stdout */ |
916 |
< |
COLOR col; |
915 |
> |
static int |
916 |
> |
putbbyte( /* put a byte brightness to stdout */ |
917 |
> |
COLOR col |
918 |
> |
) |
919 |
|
{ |
920 |
|
register int i; |
921 |
|
BYTE vb; |
928 |
|
} |
929 |
|
|
930 |
|
|
931 |
< |
putbword(col) /* put a 16-bit brightness to stdout */ |
932 |
< |
COLOR col; |
931 |
> |
static int |
932 |
> |
putbword( /* put a 16-bit brightness to stdout */ |
933 |
> |
COLOR col |
934 |
> |
) |
935 |
|
{ |
936 |
|
long i; |
937 |
|
uint16 vw; |
939 |
|
i = (*mybright)(col)*65536.; |
940 |
|
vw = min(i,65535); |
941 |
|
if (swapbytes) |
942 |
< |
swap16(&vw, 1); |
942 |
> |
swap16((char *)&vw, 1); |
943 |
|
fwrite((char *)&vw, sizeof(uint16), 1, stdout); |
944 |
|
|
945 |
|
return(ferror(stdout) ? -1 : 0); |
946 |
|
} |
947 |
|
|
948 |
|
|
949 |
< |
putpascii(col) /* put an ascii primary to stdout */ |
950 |
< |
COLOR col; |
949 |
> |
static int |
950 |
> |
putpascii( /* put an ascii primary to stdout */ |
951 |
> |
COLOR col |
952 |
> |
) |
953 |
|
{ |
954 |
|
fprintf(stdout, "%15.3e\n", colval(col,putprim)); |
955 |
|
|
957 |
|
} |
958 |
|
|
959 |
|
|
960 |
< |
putpfloat(col) /* put a float primary to stdout */ |
961 |
< |
COLOR col; |
960 |
> |
static int |
961 |
> |
putpfloat( /* put a float primary to stdout */ |
962 |
> |
COLOR col |
963 |
> |
) |
964 |
|
{ |
965 |
|
float vf; |
966 |
|
|
967 |
|
vf = colval(col,putprim); |
968 |
|
if (swapbytes) |
969 |
< |
swap32((uint32 *)&vf, 1); |
969 |
> |
swap32((char *)&vf, 1); |
970 |
|
fwrite((char *)&vf, sizeof(float), 1, stdout); |
971 |
|
|
972 |
|
return(ferror(stdout) ? -1 : 0); |
973 |
|
} |
974 |
|
|
975 |
|
|
976 |
< |
putpdouble(col) /* put a double primary to stdout */ |
977 |
< |
COLOR col; |
976 |
> |
static int |
977 |
> |
putpdouble( /* put a double primary to stdout */ |
978 |
> |
COLOR col |
979 |
> |
) |
980 |
|
{ |
981 |
|
double vd; |
982 |
|
|
989 |
|
} |
990 |
|
|
991 |
|
|
992 |
< |
putpint(col) /* put an int primary to stdout */ |
993 |
< |
COLOR col; |
992 |
> |
static int |
993 |
> |
putpint( /* put an int primary to stdout */ |
994 |
> |
COLOR col |
995 |
> |
) |
996 |
|
{ |
997 |
|
fprintf(stdout, "%d\n", (int)(colval(col,putprim)*256.)); |
998 |
|
|
1000 |
|
} |
1001 |
|
|
1002 |
|
|
1003 |
< |
putpbyte(col) /* put a byte primary to stdout */ |
1004 |
< |
COLOR col; |
1003 |
> |
static int |
1004 |
> |
putpbyte( /* put a byte primary to stdout */ |
1005 |
> |
COLOR col |
1006 |
> |
) |
1007 |
|
{ |
1008 |
|
long i; |
1009 |
|
BYTE vb; |
1016 |
|
} |
1017 |
|
|
1018 |
|
|
1019 |
< |
putpword(col) /* put a 16-bit primary to stdout */ |
1020 |
< |
COLOR col; |
1019 |
> |
static int |
1020 |
> |
putpword( /* put a 16-bit primary to stdout */ |
1021 |
> |
COLOR col |
1022 |
> |
) |
1023 |
|
{ |
1024 |
|
long i; |
1025 |
|
uint16 vw; |
1027 |
|
i = colval(col,putprim)*65536.; |
1028 |
|
vw = min(i,65535); |
1029 |
|
if (swapbytes) |
1030 |
< |
swap16(&vw, 1); |
1030 |
> |
swap16((char *)&vw, 1); |
1031 |
|
fwrite((char *)&vw, sizeof(uint16), 1, stdout); |
1032 |
|
|
1033 |
|
return(ferror(stdout) ? -1 : 0); |
1034 |
|
} |
1035 |
|
|
1036 |
|
|
1037 |
< |
set_io() /* set put and get functions */ |
1037 |
> |
static void |
1038 |
> |
set_io(void) /* set put and get functions */ |
1039 |
|
{ |
1040 |
|
switch (format) { |
1041 |
|
case 'a': /* ascii */ |
1163 |
|
} |
1164 |
|
return; |
1165 |
|
} |
1166 |
< |
badopt: |
1166 |
> |
/* badopt: */ /* label not used */ |
1167 |
|
fprintf(stderr, "%s: botched file type\n", progname); |
1168 |
|
quit(1); |
1169 |
|
namerr: |