--- ray/src/px/pfilt.c 2003/06/08 12:03:10 2.24 +++ ray/src/px/pfilt.c 2004/03/29 00:34:23 2.30 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pfilt.c,v 2.24 2003/06/08 12:03:10 schorsch Exp $"; +static const char RCSid[] = "$Id: pfilt.c,v 2.30 2004/03/29 00:34:23 schorsch Exp $"; #endif /* * pfilt.c - program to post-process picture file. @@ -8,15 +8,19 @@ static const char RCSid[] = "$Id: pfilt.c,v 2.24 2003/ * 6/23/93 Added additional buffers for value spreading */ +#include "copyright.h" + #include +#include -#include "standard.h" #include "platform.h" +#include "standard.h" +#include "rtio.h" #include "color.h" #include "view.h" #include "paths.h" +#include "pfilt.h" -extern float *matchlamp(); #define FEQ(a,b) ((a) >= .98*(b) && (a) <= 1.02*(b)) @@ -80,12 +84,25 @@ int orad = 0; /* output window radius */ char *progname; +static gethfunc headline; +static brightfunc_t rgb_bright; +static brightfunc_t xyz_bright; +//static double rgb_bright(COLOR clr); +//static double xyz_bright(COLOR clr); +static void copyfile(FILE *in, FILE *out); +static void pass1(FILE *in); +static void pass2(FILE *in); +static void scan2init(void); +static void scan2sync(int r); +static void scan2flush(void); -main(argc, argv) -int argc; -char **argv; + +int +main( + int argc, + char **argv +) { - extern int headline(); FILE *fin; float *lampcolor; char *lamptype = NULL; @@ -303,31 +320,35 @@ char **argv; pass2(fin); quit(estatus); + return estatus; /* pro forma return */ } -double -rgb_bright(clr) -COLOR clr; +static double +rgb_bright( + COLOR clr +) { return(bright(clr)); } -double -xyz_bright(clr) -COLOR clr; +static double +xyz_bright( + COLOR clr +) { return(clr[CIEY]); } -double (*ourbright)() = rgb_bright; +brightfunc_t *ourbright = rgb_bright; - -int -headline(s) /* process line from header */ -char *s; +static int +headline( /* process line from header */ + char *s, + void *p +) { char fmt[32]; @@ -350,8 +371,11 @@ char *s; } -copyfile(in, out) /* copy a file */ -register FILE *in, *out; +static void +copyfile( /* copy a file */ + register FILE *in, + register FILE *out +) { register int c; @@ -365,8 +389,10 @@ register FILE *in, *out; } -pass1(in) /* first pass of picture file */ -FILE *in; +static void +pass1( /* first pass of picture file */ + FILE *in +) { int i; COLOR *scan; @@ -398,8 +424,10 @@ FILE *in; } -pass2(in) /* last pass on file, write to stdout */ -FILE *in; +static void +pass2( /* last pass on file, write to stdout */ + FILE *in +) { int yread; int ycent, xcent; @@ -449,7 +477,8 @@ FILE *in; } -scan2init() /* prepare scanline arrays */ +static void +scan2init(void) /* prepare scanline arrays */ { COLOR ctmp; double d; @@ -487,12 +516,12 @@ scan2init() /* prepare scanline arrays */ if (obarsize > 0) { scoutbar = (COLOR **)malloc(obarsize*sizeof(COLOR *)); greybar = (float **)malloc(obarsize*sizeof(float *)); - if (scoutbar == NULL | greybar == NULL) + if ((scoutbar == NULL) | (greybar == NULL)) goto memerr; for (i = 0; i < obarsize; i++) { scoutbar[i] = (COLOR *)malloc(ncols*sizeof(COLOR)); greybar[i] = (float *)malloc(ncols*sizeof(float)); - if (scoutbar[i] == NULL | greybar[i] == NULL) + if ((scoutbar[i] == NULL) | (greybar[i] == NULL)) goto memerr; } } else { @@ -526,8 +555,10 @@ memerr: } -scan2sync(r) /* synchronize grey averages and output scan */ -int r; +static void +scan2sync( /* synchronize grey averages and output scan */ + int r +) { static int nextrow = 0; COLOR ctmp; @@ -541,7 +572,7 @@ int r; greybar[nextrow%obarsize][c] = (*ourbright)(ctmp); } /* and zero output scanline */ - bzero((char *)scoutbar[nextrow%obarsize], ncols*sizeof(COLOR)); + memset((char *)scoutbar[nextrow%obarsize], '\0', ncols*sizeof(COLOR)); nextrow++; } /* point to top scanline for output */ @@ -552,7 +583,8 @@ int r; } -scan2flush() /* flush output buffer */ +static void +scan2flush(void) /* flush output buffer */ { register int r;