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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines