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.30 by greg, Thu Aug 2 18:33:47 2018 UTC vs.
Revision 2.33 by greg, Fri Oct 4 01:53:45 2024 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   *  Radiance picture to PostScript file translator -- one way!
6   */
7  
8 #include  <stdio.h>
9 #include  <string.h>
8   #include  <math.h>
9   #include  <ctype.h>
10  
11   #include  "platform.h"
12 + #include  "paths.h"
13   #include  "rtio.h"
14   #include  "color.h"
15   #include  "resolu.h"
# Line 60 | Line 59 | typedef void putprimf_t(COLR *scn, int pri);
59   static gethfunc headline;
60   static putprimf_t Aputprim, Bputprim, Cputprim;
61  
62 < static double unit2inch(register char *s);
62 > static double unit2inch(char *s);
63   static int matchid(char *name, char *id);
64   static void parsepaper(char *ps);
65   static void quiterr(char *err);
# Line 82 | Line 81 | headline(              /* check header line */
81   {
82          char  fmt[MAXFMTLEN];
83  
84 <        if (isformat(s)) {
85 <                formatval(fmt, s);
86 <                wrongformat = strcmp(fmt, COLRFMT);
88 <        } else if (isaspect(s))
84 >        if (formatval(fmt, s))
85 >                wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT);
86 >        else if (isaspect(s))
87                  pixaspect *= aspectval(s);
88 +        else if (isncomp(s))
89 +                NCSAMP = ncompval(s);
90 +        else if (iswlsplit(s))
91 +                wlsplitval(WLPART, s);
92          return(0);
93   }
94  
# Line 198 | Line 200 | userr:
200  
201   static double
202   unit2inch(              /* determine unit */
203 <        register char   *s
203 >        char    *s
204   )
205   {
206          static struct unit {char n; float f;} u[] = {
# Line 206 | Line 208 | unit2inch(             /* determine unit */
208                  {'m', 1./25.4},
209                  {'c', 1./2.54},
210                  {'\0',0} };
211 <        register struct unit    *up;
211 >        struct unit     *up;
212  
213          while (*s && !isalpha(*s))
214                  s++;
# Line 220 | Line 222 | unit2inch(             /* determine unit */
222   static int
223   matchid(        /* see if name matches id (case insensitive) */
224          char    *name,
225 <        register char   *id
225 >        char    *id
226   )
227   {
228 <        register char   *s = name;
228 >        char    *s = name;
229  
230          while (*s) {
231                  if (isalpha(*s)) {
# Line 263 | Line 265 | parsepaper(            /* determine paper size from name */
265                  {"DL", 4.33, 8.66},
266                  {"hagaki", 3.94, 5.83},
267                  {"",0.0,0.0} };
268 <        register struct psize   *pp;
269 <        register char   *s = ps;
268 >        struct psize    *pp;
269 >        char    *s = ps;
270          double  d;
271  
272          if (isdigit(*s)) {              /* check for WWxHH specification */
# Line 427 | Line 429 | PSprocdef(                     /* define PS procedure to read image */
429   )
430   {
431          short  itab[128];
432 <        register int  i;
432 >        int  i;
433                                  /* assign code values */
434          for (i = 0; i < 128; i++)       /* clear */
435                  itab[i] = -1;
# Line 466 | Line 468 | PSprocdef(                     /* define PS procedure to read image */
468   static void
469   ra2ps(void)                             /* convert Radiance scanlines to 6-bit */
470   {
471 <        register COLR   *scanin;
471 >        COLR    *scanin;
472          int     y;
473                                                  /* allocate scanline */
474          scanin = (COLR *)malloc(xmax*sizeof(COLR));
# Line 474 | Line 476 | ra2ps(void)                            /* convert Radiance scanlines to 6-bit
476                  quiterr("out of memory in ra2ps");
477                                                  /* convert image */
478          for (y = ymax-1; y >= 0; y--) {
479 <                if (freadcolrs(scanin, xmax, stdin) < 0)
479 >                if (fread2colrs(scanin, xmax, stdin, NCSAMP, WLPART) < 0)
480                          quiterr("error reading Radiance picture");
481 <                if (putprim == Cputprim || devgam != 1.) {
481 >                if ((putprim == Cputprim) | (devgam != 1.)) {
482                          if (bradj)                      /* adjust exposure */
483                                  shiftcolrs(scanin, xmax, bradj);
484                          colrs_gambs(scanin, xmax);      /* gamma compression */
# Line 505 | Line 507 | Aputprim(              /* put out hex ASCII primary from scanline
507   {
508          static char     hexdigit[] = "0123456789ABCDEF";
509          static int      col = 0;
510 <        register int    x, c;
510 >        int     x, c;
511  
512          for (x = 0; x < xmax; x++) {
513                  if (pri == GRY)
# Line 529 | Line 531 | Bputprim(              /* put out binary primary from scanline */
531          int     pri
532   )
533   {
534 <        register int    x, c;
534 >        int     x, c;
535  
536          for (x = 0; x < xmax; x++) {
537                  if (pri == GRY)
# Line 548 | Line 550 | Cputprim(              /* put out compressed primary from scanline
550          int     pri
551   )
552   {
553 <        register int    c;
554 <        register int    x;
553 >        int     c;
554 >        int     x;
555          int     lastc, cnt;
556  
557          lastc = -1; cnt = 0;
# Line 574 | Line 576 | Cputprim(              /* put out compressed primary from scanline
576  
577   static void
578   putrle(         /* put out cnt of cod */
579 <        register int    cnt,
580 <        register int    cod
579 >        int     cnt,
580 >        int     cod
581   )
582   {
583          static int      col = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines