--- ray/src/px/pfilt.c 2003/07/27 22:12:03 2.26 +++ ray/src/px/pfilt.c 2019/12/28 18:05:14 2.34 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pfilt.c,v 2.26 2003/07/27 22:12:03 schorsch Exp $"; +static const char RCSid[] = "$Id: pfilt.c,v 2.34 2019/12/28 18:05:14 greg Exp $"; #endif /* * pfilt.c - program to post-process picture file. @@ -11,15 +11,15 @@ static const char RCSid[] = "$Id: pfilt.c,v 2.26 2003/ #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)) @@ -83,12 +83,23 @@ int orad = 0; /* output window radius */ char *progname; +static gethfunc headline; +static brightfunc_t rgb_bright; +static brightfunc_t xyz_bright; +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; @@ -306,33 +317,37 @@ 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]; + char fmt[MAXFMTLEN]; fputs(s, stdout); /* copy to output */ if (isaspect(s)) /* get aspect ratio */ @@ -353,10 +368,13 @@ char *s; } -copyfile(in, out) /* copy a file */ -register FILE *in, *out; +static void +copyfile( /* copy a file */ + FILE *in, + FILE *out +) { - register int c; + int c; while ((c = getc(in)) != EOF) putc(c, out); @@ -368,8 +386,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; @@ -401,8 +421,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; @@ -452,11 +474,12 @@ FILE *in; } -scan2init() /* prepare scanline arrays */ +static void +scan2init(void) /* prepare scanline arrays */ { COLOR ctmp; double d; - register int i; + int i; xbrad = xres/ncols/2 + 1; ybrad = yres/nrows/2 + 1; @@ -529,13 +552,15 @@ 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; int ybot; - register int c; + int c; /* average input scanlines */ while (nextrow <= r+orad && nextrow < nrows) { ybot = (nextrow+.5)*yres/nrows; @@ -555,9 +580,10 @@ int r; } -scan2flush() /* flush output buffer */ +static void +scan2flush(void) /* flush output buffer */ { - register int r; + int r; for (r = nrows-orad; r < nrows; r++) if (fwritescan(scoutbar[r%obarsize], ncols, stdout) < 0)