ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/d48c.c
(Generate patch)

Comparing ray/src/px/d48c.c (file contents):
Revision 1.4 by schorsch, Mon Oct 27 10:24:51 2003 UTC vs.
Revision 1.5 by schorsch, Sun Mar 28 20:33:13 2004 UTC

# Line 8 | Line 8 | static const char      RCSid[] = "$Id$";
8   */
9  
10   #include  <stdio.h>
11 + #include  <string.h>
12   #include  <signal.h>
13  
14 + #include  "paths.h"
15   #include  "rterror.h"
16   #include  "color.h"
17  
# Line 114 | Line 116 | float  neumap[] = {                    /* neutral map, log w/ E6 */
116   };
117  
118  
117 #define  TEMPLATE       "/tmp/dXXXXXX"
118
119   int  docolor = 1;               /* color? */
120  
121   int  cftype = C_35FFRA;         /* configuration type */
122  
123   char  *progname;                /* program name */
124  
125 + static void settype(char  *cname);
126 + static void dofile(char  *fname);
127 + static void d_init(void);
128 + static void scanout(COLOR  *scan, int  y);
129 + static void d_done(void);
130 + static void runlength(COLOR  *scan, int  f);
131 + static double mapfilter(COLOR  col, int  f);
132 + static void transfer(FILE  *fin, FILE  *fout);
133  
134 < main(argc, argv)
135 < int  argc;
136 < char  *argv[];
134 >
135 > int
136 > main(
137 >        int  argc,
138 >        char  *argv[]
139 > )
140   {
141          int  i;
142  
# Line 173 | Line 184 | char  *argv[];
184                  dofile(NULL);
185  
186          quit(0);
187 +        return 0; /* pro forma return */
188   }
189  
190  
191 < settype(cname)                  /* set configuration type */
192 < char  *cname;
191 > static void
192 > settype(                        /* set configuration type */
193 >        char  *cname
194 > )
195   {
196          for (cftype = 0; cftype < NCONF; cftype++)
197                  if (!strcmp(cname, ctab[cftype].name))
# Line 200 | Line 214 | quit(int code)                 /* quit program */
214   }
215  
216  
217 < dofile(fname)                   /* convert file to dicomed format */
218 < char  *fname;
217 > static void
218 > dofile(                 /* convert file to dicomed format */
219 >        char  *fname
220 > )
221   {
222          FILE  *fin;
223          char  sbuf[128];
# Line 257 | Line 273 | char  *fname;
273   }
274  
275  
276 < d_init()                        /* set up dicomed, files */
276 > static void
277 > d_init(void)                    /* set up dicomed, files */
278   {
279 <        char  *mktemp();
279 >        //char  *mktemp();
280                                          /* initial condition select */
281          putw(O_ICS|ctab[cftype].icsfield, stdout);
282                                          /* configuration code */
# Line 317 | Line 334 | d_init()                       /* set up dicomed, files */
334   }
335  
336  
337 < scanout(scan, y)                        /* output scan line */
338 < COLOR  *scan;
339 < int  y;
337 > static void
338 > scanout(                        /* output scan line */
339 >        COLOR  *scan,
340 >        int  y
341 > )
342   {
343          int  i;
344                                                  /* uses horiz. flyback */
# Line 331 | Line 350 | int  y;
350   }
351  
352  
353 < d_done()                                /* flush files, finish frame */
353 > static void
354 > d_done(void)                            /* flush files, finish frame */
355   {
356          if (docolor) {
357                  transfer(ftab[RED].fp, stdout);
# Line 346 | Line 366 | d_done()                               /* flush files, finish frame */
366   }
367  
368  
369 < runlength(scan, f)                      /* do scanline for filter f */
370 < COLOR  *scan;
371 < int  f;
369 > static void
370 > runlength(                      /* do scanline for filter f */
371 >        COLOR  *scan,
372 >        int  f
373 > )
374   {
375 <        double  mapfilter();
375 >        //double  mapfilter();
376          BYTE  ebuf[2*HSIZE];
377          register int  j;
378          register BYTE  *ep;
# Line 382 | Line 404 | int  f;
404   }
405  
406  
407 < double
408 < mapfilter(col, f)                       /* map filter value */
409 < COLOR  col;
410 < register int  f;
407 > static double
408 > mapfilter(                      /* map filter value */
409 >        COLOR  col,
410 >        register int  f
411 > )
412   {
413          static float  *mp[4] = {neumap, neumap, neumap, neumap};
414          double  x, y;
# Line 406 | Line 429 | register int  f;
429   }
430  
431  
432 < putw(w, fp)                     /* output a (short) word */
433 < int  w;
434 < register FILE  *fp;
432 > /* XXX replaces putw() from stdio.h. Do we really need this? */
433 > int
434 > putw(                   /* output a (short) word */
435 >        int  w,
436 >        register FILE  *fp
437 > )
438   {
439          putc(w&0377, fp);               /* in proper order! */
440          putc(w>>8, fp);
441 +        return 0;
442   }
443  
444  
445 < transfer(fin, fout)             /* transfer fin contents to fout, close fin */
446 < register FILE  *fin, *fout;
445 > static void
446 > transfer(               /* transfer fin contents to fout, close fin */
447 >        register FILE  *fin,
448 >        register FILE  *fout
449 > )
450   {
451          register int  c;
452  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines