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.1 by greg, Thu Feb 2 10:49:15 1989 UTC vs.
Revision 1.5 by schorsch, Sun Mar 28 20:33:13 2004 UTC

# Line 1 | Line 1
1 /*
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
4 + /*
5   *  d48c.c - driver for dicomed D48 film recorder w/ color optics.
6   *
7   *     3/26/87
8   */
9  
10   #include  <stdio.h>
11 <
11 > #include  <string.h>
12   #include  <signal.h>
13  
14 + #include  "paths.h"
15 + #include  "rterror.h"
16   #include  "color.h"
17  
18  
# Line 115 | Line 116 | float  neumap[] = {                    /* neutral map, log w/ E6 */
116   };
117  
118  
118 #define  TEMPLATE       "/tmp/dXXXXXX"
119
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   {
131        int  quit();
141          int  i;
142  
143          if (signal(SIGINT, quit) == SIG_IGN)
144                  signal(SIGINT, SIG_IGN);
145 + #ifdef SIGHUP
146          if (signal(SIGHUP, quit) == SIG_IGN)
147                  signal(SIGINT, SIG_IGN);
148 + #endif
149          signal(SIGTERM, quit);
150 + #ifdef SIGPIPE
151          signal(SIGPIPE, quit);
152 + #endif
153 + #ifdef SIGXCPU
154          signal(SIGXCPU, quit);
155 + #endif
156 + #ifdef SIGXFSZ
157          signal(SIGXFSZ, quit);
158 + #endif
159  
160          progname = argv[0];
161  
# Line 167 | 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 182 | Line 202 | char  *cname;
202   }
203  
204  
205 < quit(code)                      /* quit program */
206 < int  code;
205 > void
206 > quit(int code)                  /* quit program */
207   {
208          int  i;
209  
# Line 194 | Line 214 | int  code;
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 251 | 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 311 | 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 325 | 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 340 | 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 376 | 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 400 | 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