ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/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.24 by greg, Sat Jun 7 05:09:45 2025 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)