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.4 by greg, Tue Feb 25 02:47:22 2003 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 + #include <stdlib.h>
14 + #include <time.h>
15  
16   #include "resolu.h"
17  
# Line 16 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   char  resolu_buf[RESOLU_BUFLEN];        /* resolution line buffer */
20  
21  
22 + void
23   fputresolu(ord, sl, ns, fp)             /* put out picture dimensions */
24   int  ord;                       /* scanline ordering */
25   int  sl, ns;                    /* scanline length and number */
# Line 23 | Line 27 | FILE  *fp;
27   {
28          RESOLU  rs;
29  
30 <        if ((rs.or = ord) & YMAJOR) {
30 >        if ((rs.rt = ord) & YMAJOR) {
31                  rs.xr = sl;
32                  rs.yr = ns;
33          } else {
# Line 43 | Line 47 | FILE  *fp;
47  
48          if (!fgetsresolu(&rs, fp))
49                  return(-1);
50 <        if (rs.or & YMAJOR) {
50 >        if (rs.rt & YMAJOR) {
51                  *sl = rs.xr;
52                  *ns = rs.yr;
53          } else {
54                  *sl = rs.yr;
55                  *ns = rs.xr;
56          }
57 <        return(rs.or);
57 >        return(rs.rt);
58   }
59  
60  
# Line 59 | Line 63 | resolu2str(buf, rp)            /* convert resolution struct to l
63   char  *buf;
64   register RESOLU  *rp;
65   {
66 <        if (rp->or&YMAJOR)
66 >        if (rp->rt&YMAJOR)
67                  sprintf(buf, "%cY %d %cX %d\n",
68 <                                rp->or&YDECR ? '-' : '+', rp->yr,
69 <                                rp->or&XDECR ? '-' : '+', rp->xr);
68 >                                rp->rt&YDECR ? '-' : '+', rp->yr,
69 >                                rp->rt&XDECR ? '-' : '+', rp->xr);
70          else
71                  sprintf(buf, "%cX %d %cY %d\n",
72 <                                rp->or&XDECR ? '-' : '+', rp->xr,
73 <                                rp->or&YDECR ? '-' : '+', rp->yr);
72 >                                rp->rt&XDECR ? '-' : '+', rp->xr,
73 >                                rp->rt&YDECR ? '-' : '+', rp->yr);
74          return(buf);
75   }
76  
77  
78 + int
79   str2resolu(rp, buf)             /* convert resolution line to struct */
80   register RESOLU  *rp;
81   char  *buf;
82   {
83 <        char  *xndx, *yndx;
83 >        register char  *xndx, *yndx;
84          register char  *cp;
85  
86          if (buf == NULL)
87                  return(0);
88          xndx = yndx = NULL;
89 <        for (cp = buf+1; *cp; cp++)
89 >        for (cp = buf; *cp; cp++)
90                  if (*cp == 'X')
91                          xndx = cp;
92                  else if (*cp == 'Y')
93                          yndx = cp;
94          if (xndx == NULL || yndx == NULL)
95                  return(0);
96 <        rp->or = 0;
97 <        if (xndx > yndx) rp->or |= YMAJOR;
98 <        if (xndx[-1] == '-') rp->or |= XDECR;
99 <        if (yndx[-1] == '-') rp->or |= YDECR;
96 >        rp->rt = 0;
97 >        if (xndx > yndx) rp->rt |= YMAJOR;
98 >        if (xndx[-1] == '-') rp->rt |= XDECR;
99 >        if (yndx[-1] == '-') rp->rt |= YDECR;
100          if ((rp->xr = atoi(xndx+1)) <= 0)
101                  return(0);
102          if ((rp->yr = atoi(yndx+1)) <= 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines