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

Comparing ray/src/px/ra_ps.c (file contents):
Revision 2.27 by schorsch, Fri Jan 2 12:47:01 2004 UTC vs.
Revision 2.28 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 51 | Line 51 | int  docolor = 1;                      /* produce color image? */
51   int  bradj = 0;                         /* brightness adjustment */
52   int  ncopies = 1;                       /* number of copies */
53  
54 extern int      Aputprim(), Bputprim(), Cputprim();
55
56 int  (*putprim)() = Aputprim;           /* function for writing scanline */
57
54   char  *progname;
59
55   int  xmax, ymax;                        /* input image dimensions */
56  
57 < extern double   unit2inch();
57 > typedef void putprimf_t(COLR *scn, int pri);
58  
59   static gethfunc headline;
60 + static putprimf_t Aputprim, Bputprim, Cputprim;
61  
62 + static double unit2inch(register char *s);
63 + static int matchid(char *name, char *id);
64 + static void parsepaper(char *ps);
65 + static void quiterr(char *err);
66 + static void PSheader(int ac, char **av);
67 + static void PStrailer(void);
68 + static void PSprocdef(char *nam);
69 + static void ra2ps(void);
70 + static void putrle(int cnt, int cod);
71  
72 +
73 + putprimf_t *putprim = Aputprim;         /* function for writing scanline */
74 +
75 +
76   static int
77   headline(               /* check header line */
78          char    *s,
# Line 80 | Line 89 | headline(              /* check header line */
89          return(0);
90   }
91  
92 <
93 < main(argc, argv)
85 < int  argc;
86 < char  *argv[];
92 > int
93 > main(int  argc, char  *argv[])
94   {
95          int  i;
96          double  d;
# Line 188 | Line 195 | userr:
195   }
196  
197  
198 < double
199 < unit2inch(s)            /* determine unit */
200 < register char   *s;
198 > static double
199 > unit2inch(              /* determine unit */
200 >        register char   *s
201 > )
202   {
203          static struct unit {char n; float f;} u[] = {
204                  {'i', 1.},
# Line 208 | Line 216 | register char  *s;
216   }
217  
218  
219 < int
220 < matchid(name, id)       /* see if name matches id (case insensitive) */
221 < char    *name;
222 < register char   *id;
219 > static int
220 > matchid(        /* see if name matches id (case insensitive) */
221 >        char    *name,
222 >        register char   *id
223 > )
224   {
225          register char   *s = name;
226  
# Line 227 | Line 236 | register char  *id;
236   }
237  
238  
239 < parsepaper(ps)          /* determine paper size from name */
240 < char    *ps;
239 > static void
240 > parsepaper(             /* determine paper size from name */
241 >        char    *ps
242 > )
243   {
244          static struct psize {char n[12]; float w,h;} p[] = {
245                  {"envelope", 4.12, 9.5},
# Line 282 | Line 293 | char   *ps;
293   }
294  
295  
296 < quiterr(err)            /* print message and exit */
297 < char  *err;
296 > static void
297 > quiterr(                /* print message and exit */
298 >        char  *err
299 > )
300   {
301          if (err != NULL) {
302                  fprintf(stderr, "%s: %s\n", progname, err);
# Line 293 | Line 306 | char  *err;
306   }
307  
308  
309 < PSheader(ac, av)                /* print PostScript header */
310 < int  ac;
311 < char  **av;
309 > static void
310 > PSheader(               /* print PostScript header */
311 >        int  ac,
312 >        char  **av
313 > )
314   {
315          char  *rstr;
316          int  landscape, rotate, n;
# Line 392 | Line 407 | char  **av;
407   }
408  
409  
410 < PStrailer()                     /* print PostScript trailer */
410 > static void
411 > PStrailer(void)                 /* print PostScript trailer */
412   {
413          puts("%%Trailer");
414          if (ncopies > 1)
# Line 404 | Line 420 | PStrailer()                    /* print PostScript trailer */
420   }
421  
422  
423 < PSprocdef(nam)                  /* define PS procedure to read image */
424 < char  *nam;
423 > static void
424 > PSprocdef(                      /* define PS procedure to read image */
425 >        char  *nam
426 > )
427   {
428          short  itab[128];
429          register int  i;
# Line 413 | Line 431 | char  *nam;
431          for (i = 0; i < 128; i++)       /* clear */
432                  itab[i] = -1;
433          for (i = 1; i < 63; i++)        /* assign greys */
434 <                itab[code[i]] = 256.0*pow((i+.5)/64.0, CODE6GAM/devgam);
435 <        itab[code[0]] = 0;              /* black is black */
436 <        itab[code[63]] = 255;           /* and white is white */
434 >                itab[(int)code[i]] = 256.0*pow((i+.5)/64.0, CODE6GAM/devgam);
435 >        itab[(int)code[0]] = 0;         /* black is black */
436 >        itab[(int)code[63]] = 255;              /* and white is white */
437          printf("/codetab [");
438          for (i = 0; i < 128; i++) {
439                  if (!(i & 0xf))
# Line 444 | Line 462 | char  *nam;
462   }
463  
464  
465 < ra2ps()                         /* convert Radiance scanlines to 6-bit */
465 > static void
466 > ra2ps(void)                             /* convert Radiance scanlines to 6-bit */
467   {
468          register COLR   *scanin;
469          int     y;
# Line 477 | Line 496 | ra2ps()                                /* convert Radiance scanlines to 6-bit */
496   }
497  
498  
499 < int
500 < Aputprim(scn, pri)              /* put out hex ASCII primary from scanline */
501 < COLR    *scn;
502 < int     pri;
499 > static void
500 > Aputprim(               /* put out hex ASCII primary from scanline */
501 >        COLR    *scn,
502 >        int     pri
503 > )
504   {
505          static char     hexdigit[] = "0123456789ABCDEF";
506          static int      col = 0;
# Line 502 | Line 522 | int    pri;
522   }
523  
524  
525 < int
526 < Bputprim(scn, pri)              /* put out binary primary from scanline */
527 < COLR    *scn;
528 < int     pri;
525 > static void
526 > Bputprim(               /* put out binary primary from scanline */
527 >        COLR    *scn,
528 >        int     pri
529 > )
530   {
531          register int    x, c;
532  
# Line 520 | Line 541 | int    pri;
541   }
542  
543  
544 < int
545 < Cputprim(scn, pri)              /* put out compressed primary from scanline */
546 < COLR    *scn;
547 < int     pri;
544 > static void
545 > Cputprim(               /* put out compressed primary from scanline */
546 >        COLR    *scn,
547 >        int     pri
548 > )
549   {
550          register int    c;
551          register int    x;
# Line 549 | Line 571 | int    pri;
571   }
572  
573  
574 < putrle(cnt, cod)                /* put out cnt of cod */
575 < register int    cnt, cod;
574 > static void
575 > putrle(         /* put out cnt of cod */
576 >        register int    cnt,
577 >        register int    cod
578 > )
579   {
580          static int      col = 0;
581  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines