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

Comparing ray/src/common/loadvars.c (file contents):
Revision 2.19 by greg, Fri Jun 9 22:52:47 2023 UTC vs.
Revision 2.23 by greg, Thu Feb 6 21:45:00 2025 UTC

# Line 116 | Line 116 | setvariable(                   /* assign variable according to string
116                          quote *= (ass[i] != quote);
117                  } else {                /* otherwise, squeeze spaces */
118                          if (isspace(*cp))
119 <                                while (isspace(ass[i]))
119 >                                while (isspace(ass[i])|(ass[i]==NOCHAR))
120                                          i++;
121                          if ((ass[i] == '"') | (ass[i] == '\''))
122                                  quote = ass[i];
# Line 266 | Line 266 | qualvalue(                     /* check qualitative var. for legal value
266          quit(1);
267   }
268  
269 + void
270 + strvalue(                               /* check for single (quoted) string value */
271 +        VARIABLE        *vp
272 + )
273 + {
274 +        if (!vp->nass) return;
275 +        onevalue(vp);
276 +        if ((vp->value[0] == '"') | (vp->value[0] == '\'')) {
277 +                char    *cp = vp->value + strlen(vp->value+1);
278 +                if ((cp != vp->value) & (*cp == vp->value[0])) {
279 +                        vp->value++;    /* elide quotation marks */
280 +                        *cp = '\0';
281 +                }
282 +        }
283 + }
284  
285 +
286   void
287   intvalue(                               /* check integer variable for legal values */
288          VARIABLE        *vp
# Line 295 | Line 311 | fltvalue(                              /* check float variable for legal values
311   }
312  
313  
314 + int
315 + singlevar(                              /* assigned single value? */
316 +        VARIABLE *vp
317 + )
318 + {
319 +        if (vp->fixval == catvalues)
320 +                return(0);
321 +
322 +        return((vp->fixval == strvalue) |
323 +                        (vp->fixval == fltvalue) |
324 +                        (vp->fixval == intvalue) |
325 +                        (vp->fixval == qualvalue) |
326 +                        (vp->fixval == boolvalue));
327 + }
328 +
329   void
330   printvars(                              /* print variable values */
331          FILE    *fp
# Line 306 | Line 337 | printvars(                             /* print variable values */
337          for (i = 0; i < NVARS; i++)             /* print each variable */
338              for (j = 0; j < vdef(i); j++) {     /* print each assignment */
339                  fputs(vnam(i), fp);
340 <                fputs("= ", fp);
340 >                fputc('=', fp);
341 >                if (!singlevar(&vv[i]))
342 >                        fputc(' ', fp);
343                  k = clipline = ( vv[i].fixval == catvalues ? 64 : 236 )
344                                  - strlen(vnam(i)) ;
345                  cp = nvalue(i, j);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines