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.7 by gwlarson, Thu Jun 4 13:29:27 1998 UTC vs.
Revision 2.10 by greg, Tue Feb 25 02:47:21 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 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   *  Routines for loading and checking variables from file.
6   */
7  
8 + #include "copyright.h"
9 +
10   #include <stdio.h>
11 + #include <stdlib.h>
12   #include <ctype.h>
13   #include "vars.h"
14  
15   #define NOCHAR  127             /* constant for character to delete */
16  
17 #ifndef malloc
18 extern char  *malloc(), *realloc();
19 #endif
20
17   extern char  *fgetline();
18  
19  
20 + void
21   loadvars(rfname)                /* load variables into vv from file */
22   char    *rfname;
23   {
# Line 97 | Line 94 | VARIABLE       *(*mv)();
94                          while (*cp++)
95                                  ;
96                  i = cp - vp->value;
97 <                vp->value = realloc(vp->value, i+n+1);
97 >                vp->value = (char *)realloc(vp->value, i+n+1);
98          } else
99 <                vp->value = malloc(n+1);
99 >                vp->value = (char *)malloc(n+1);
100          if (vp->value == NULL) {
101                  perror(progname);
102                  quit(1);
# Line 151 | Line 148 | register int   n;
148   }
149  
150  
151 + void
152   checkvalues()                   /* check assignments */
153   {
154          register int    i;
# Line 161 | Line 159 | checkvalues()                  /* check assignments */
159   }
160  
161  
162 + void
163   onevalue(vp)                    /* only one assignment for this variable */
164   register VARIABLE       *vp;
165   {
# Line 176 | Line 175 | register VARIABLE      *vp;
175   }
176  
177  
178 + void
179   catvalues(vp)                   /* concatenate variable values */
180   register VARIABLE       *vp;
181   {
# Line 204 | Line 204 | register char  *tv, *cv;
204   }
205  
206  
207 + void
208   boolvalue(vp)                   /* check boolean for legal values */
209   register VARIABLE       *vp;
210   {
# Line 223 | Line 224 | register VARIABLE      *vp;
224   }
225  
226  
227 + void
228   qualvalue(vp)                   /* check qualitative var. for legal values */
229   register VARIABLE       *vp;
230   {
# Line 245 | Line 247 | register VARIABLE      *vp;
247   }
248  
249  
250 + void
251   intvalue(vp)                    /* check integer variable for legal values */
252   register VARIABLE       *vp;
253   {
# Line 257 | Line 260 | register VARIABLE      *vp;
260   }
261  
262  
263 + void
264   fltvalue(vp)                    /* check float variable for legal values */
265   register VARIABLE       *vp;
266   {
# Line 269 | Line 273 | register VARIABLE      *vp;
273   }
274  
275  
276 + void
277   printvars(fp)                   /* print variable values */
278   register FILE   *fp;
279   {
# Line 279 | Line 284 | register FILE  *fp;
284              for (j = 0; j < vdef(i); j++) {     /* print each assignment */
285                  fputs(vnam(i), fp);
286                  fputs("= ", fp);
287 <                k = clipline = ( vv[i].fixval == catvalues ? 64 : 120 )
287 >                k = clipline = ( vv[i].fixval == catvalues ? 64 : 236 )
288                                  - strlen(vnam(i)) ;
289                  cp = nvalue(i, j);
290                  while (*cp) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines