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

Comparing ray/src/common/resolu.c (file contents):
Revision 2.1 by greg, Tue Nov 12 16:54:21 1991 UTC vs.
Revision 2.5 by greg, Tue Feb 1 01:28:16 2005 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Read and write image resolutions.
6 + *
7 + * Externals declared in resolu.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include <stdio.h>
13  
14   #include "resolu.h"
# Line 16 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17   char  resolu_buf[RESOLU_BUFLEN];        /* resolution line buffer */
18  
19  
20 + void
21   fputresolu(ord, sl, ns, fp)             /* put out picture dimensions */
22   int  ord;                       /* scanline ordering */
23   int  sl, ns;                    /* scanline length and number */
# Line 23 | Line 25 | FILE  *fp;
25   {
26          RESOLU  rs;
27  
28 <        if ((rs.or = ord) & YMAJOR) {
28 >        if ((rs.rt = ord) & YMAJOR) {
29                  rs.xr = sl;
30                  rs.yr = ns;
31          } else {
# Line 43 | Line 45 | FILE  *fp;
45  
46          if (!fgetsresolu(&rs, fp))
47                  return(-1);
48 <        if (rs.or & YMAJOR) {
48 >        if (rs.rt & YMAJOR) {
49                  *sl = rs.xr;
50                  *ns = rs.yr;
51          } else {
52                  *sl = rs.yr;
53                  *ns = rs.xr;
54          }
55 <        return(rs.or);
55 >        return(rs.rt);
56   }
57  
58  
# Line 59 | Line 61 | resolu2str(buf, rp)            /* convert resolution struct to l
61   char  *buf;
62   register RESOLU  *rp;
63   {
64 <        if (rp->or&YMAJOR)
64 >        if (rp->rt&YMAJOR)
65                  sprintf(buf, "%cY %d %cX %d\n",
66 <                                rp->or&YDECR ? '-' : '+', rp->yr,
67 <                                rp->or&XDECR ? '-' : '+', rp->xr);
66 >                                rp->rt&YDECR ? '-' : '+', rp->yr,
67 >                                rp->rt&XDECR ? '-' : '+', rp->xr);
68          else
69                  sprintf(buf, "%cX %d %cY %d\n",
70 <                                rp->or&XDECR ? '-' : '+', rp->xr,
71 <                                rp->or&YDECR ? '-' : '+', rp->yr);
70 >                                rp->rt&XDECR ? '-' : '+', rp->xr,
71 >                                rp->rt&YDECR ? '-' : '+', rp->yr);
72          return(buf);
73   }
74  
75  
76 + int
77   str2resolu(rp, buf)             /* convert resolution line to struct */
78   register RESOLU  *rp;
79   char  *buf;
80   {
81 <        char  *xndx, *yndx;
81 >        register char  *xndx, *yndx;
82          register char  *cp;
83  
84          if (buf == NULL)
85                  return(0);
86          xndx = yndx = NULL;
87 <        for (cp = buf+1; *cp; cp++)
87 >        for (cp = buf; *cp; cp++)
88                  if (*cp == 'X')
89                          xndx = cp;
90                  else if (*cp == 'Y')
91                          yndx = cp;
92          if (xndx == NULL || yndx == NULL)
93                  return(0);
94 <        rp->or = 0;
95 <        if (xndx > yndx) rp->or |= YMAJOR;
96 <        if (xndx[-1] == '-') rp->or |= XDECR;
97 <        if (yndx[-1] == '-') rp->or |= YDECR;
94 >        rp->rt = 0;
95 >        if (xndx > yndx) rp->rt |= YMAJOR;
96 >        if (xndx[-1] == '-') rp->rt |= XDECR;
97 >        if (yndx[-1] == '-') rp->rt |= YDECR;
98          if ((rp->xr = atoi(xndx+1)) <= 0)
99                  return(0);
100          if ((rp->yr = atoi(yndx+1)) <= 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines