31 |
|
float gamcor = 2.0; |
32 |
|
int bradj = 0; |
33 |
|
|
34 |
< |
/* First some utility routines */ |
34 |
> |
static void putrect(int xorg, int yorg, int xsize, int ysize); |
35 |
> |
static void putfprect(int xorg, int yorg, int xsize, int ysize); |
36 |
> |
static void putalong(long l); |
37 |
> |
static void putashort(short s); |
38 |
> |
static void putbyte(int b); |
39 |
> |
static void putbytes(unsigned char *buf, int n ); |
40 |
> |
static void putpict(int xsize, int ysize); |
41 |
> |
static void getrow(FILE *in, char *cbuf, int xsize); |
42 |
> |
static int packbits(unsigned char *ibits, unsigned char *pbits, int nbits); |
43 |
> |
static void usage(void); |
44 |
|
|
45 |
< |
putrect(xorg,yorg,xsize,ysize) |
46 |
< |
int xorg, yorg, xsize, ysize; |
45 |
> |
|
46 |
> |
/* First some utility routines */ |
47 |
> |
static void |
48 |
> |
putrect( |
49 |
> |
int xorg, |
50 |
> |
int yorg, |
51 |
> |
int xsize, |
52 |
> |
int ysize |
53 |
> |
) |
54 |
|
{ |
55 |
|
putashort(yorg); |
56 |
|
putashort(xorg); |
58 |
|
putashort(xsize); |
59 |
|
} |
60 |
|
|
61 |
< |
putfprect(xorg,yorg,xsize,ysize) |
62 |
< |
int xorg, yorg, xsize, ysize; |
61 |
> |
static void |
62 |
> |
putfprect( |
63 |
> |
int xorg, |
64 |
> |
int yorg, |
65 |
> |
int xsize, |
66 |
> |
int ysize |
67 |
> |
) |
68 |
|
{ |
69 |
|
putalong(yorg<<16); |
70 |
|
putalong(xorg<<16); |
72 |
|
putalong(xsize<<16); |
73 |
|
} |
74 |
|
|
75 |
< |
putalong(l) |
76 |
< |
long l; |
75 |
> |
static void |
76 |
> |
putalong( |
77 |
> |
long l |
78 |
> |
) |
79 |
|
{ |
80 |
|
putbyte((l>>24)&0xff); |
81 |
|
putbyte((l>>16)&0xff); |
83 |
|
putbyte((l>>0)&0xff); |
84 |
|
} |
85 |
|
|
86 |
< |
putashort(s) |
87 |
< |
short s; |
86 |
> |
static void |
87 |
> |
putashort( |
88 |
> |
short s |
89 |
> |
) |
90 |
|
{ |
91 |
|
putbyte((s>>8)&0xff); |
92 |
|
putbyte((s>>0)&0xff); |
93 |
|
} |
94 |
|
|
95 |
< |
putbyte(b) |
96 |
< |
int b; |
95 |
> |
static void |
96 |
> |
putbyte( |
97 |
> |
int b |
98 |
> |
) |
99 |
|
{ |
100 |
|
if (putc(b,stdout) == EOF && ferror(stdout)) { |
101 |
|
fprintf(stderr,"%s: error on write\n", progname); |
104 |
|
outbytes++; |
105 |
|
} |
106 |
|
|
107 |
< |
putbytes(buf,n) |
108 |
< |
unsigned char *buf; |
109 |
< |
int n; |
107 |
> |
static void |
108 |
> |
putbytes( |
109 |
> |
unsigned char *buf, |
110 |
> |
int n |
111 |
> |
) |
112 |
|
{ |
113 |
|
if(!fwrite(buf,n,1,stdout)) { |
114 |
|
fprintf(stderr,"%s: error on write\n", progname); |
117 |
|
outbytes+=n; |
118 |
|
} |
119 |
|
|
120 |
< |
main(argc,argv) |
121 |
< |
int argc; |
122 |
< |
char **argv; |
120 |
> |
int |
121 |
> |
main( |
122 |
> |
int argc, |
123 |
> |
char **argv |
124 |
> |
) |
125 |
|
{ |
126 |
|
int xsize, ysize; |
127 |
|
int i, picsize; |
154 |
|
goto outofparse; |
155 |
|
break; /* NOTREACHED */ |
156 |
|
|
157 |
< |
otherwise: usage(); |
157 |
> |
default: |
158 |
> |
usage(); |
159 |
|
break; |
160 |
|
} |
161 |
|
else |
239 |
|
return 0; /* lint fodder */ |
240 |
|
} |
241 |
|
|
242 |
< |
putpict(xsize, ysize) |
243 |
< |
int xsize; |
244 |
< |
int ysize; |
242 |
> |
static void |
243 |
> |
putpict( |
244 |
> |
int xsize, |
245 |
> |
int ysize |
246 |
> |
) |
247 |
|
{ |
248 |
|
int y; |
249 |
|
int nbytes, rowbytes; |
314 |
|
free(pbuf); |
315 |
|
} |
316 |
|
|
317 |
< |
int getrow(in, cbuf, xsize) |
318 |
< |
FILE *in; |
319 |
< |
char *cbuf; |
320 |
< |
int xsize; |
317 |
> |
static void |
318 |
> |
getrow( |
319 |
> |
FILE *in, |
320 |
> |
char *cbuf, |
321 |
> |
int xsize |
322 |
> |
) |
323 |
|
{ |
324 |
|
extern char *tempbuffer(); /* defined in color.c */ |
325 |
|
COLR *scanin = NULL; |
350 |
|
} |
351 |
|
|
352 |
|
|
353 |
< |
packbits(ibits,pbits,nbits) |
354 |
< |
unsigned char *ibits, *pbits; |
355 |
< |
int nbits; |
353 |
> |
static int |
354 |
> |
packbits( |
355 |
> |
unsigned char *ibits, |
356 |
> |
unsigned char *pbits, |
357 |
> |
int nbits |
358 |
> |
) |
359 |
|
{ |
321 |
– |
int bytes; /* UNUSED */ |
360 |
|
unsigned char *sptr; |
361 |
|
unsigned char *ibitsend; |
362 |
|
unsigned char *optr = pbits; |
397 |
|
return optr-pbits; |
398 |
|
} |
399 |
|
|
400 |
< |
usage() |
400 |
> |
static void |
401 |
> |
usage(void) |
402 |
|
{ |
403 |
|
fprintf(stderr, "Usage: %s [-v] [-g gamma] [infile [outfile]]\n", |
404 |
|
progname); |