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

Comparing ray/src/meta/mgvars.c (file contents):
Revision 1.3 by schorsch, Mon Oct 27 10:28:59 2003 UTC vs.
Revision 1.5 by schorsch, Sat Nov 15 02:13:37 2003 UTC

# Line 12 | Line 12 | static const char      RCSid[] = "$Id$";
12   #include  <stdio.h>
13   #include  <stdlib.h>
14   #include  <math.h>
15 + #include  <string.h>
16   #include  <ctype.h>
17  
18   #include  "rtprocess.h"
19 < #include  "rtmisc.h"
19 > #include  "rterror.h"
20   #include  "rtio.h"
21 + #include  "calcomp.h"
22   #include  "mgvars.h"
23  
24   #define  MAXLINE        512
25  
24 #define  isid(c)  (isalnum(c) || (c) == '_' || (c) == '.')
25
26   #define  isnum(c) (isdigit(c)||(c)=='-'||(c)=='+'||(c)=='.'||(c)=='e'||(c)=='E')
27  
28 < char  *findfile();
28 > static void mgprint(register VARIABLE *vp, FILE *fp);
29 > static void setivar(char *vname, char *fname, char *definition);
30 > static char *findfile(char *fname, register char **pathlist);
31 > static void loaddata(char *fname, FILE *fp, register DARRAY *dp);
32 > static void undefine(register VARIABLE *vp);
33  
34 < extern char  *progname, *libpath[];
34 > extern char *progname, *libpath[];
35  
32 #ifdef  DCL_ATOF
33 double  atof();
34 #endif
35
36   IVAR  *ivhead = NULL;                   /* intermediate variables */
37  
38   VARIABLE  gparam[NVARS] = {             /* standard variables */
# Line 142 | Line 142 | VARIABLE  cparam[MAXCUR][NCVARS] = {   /* curve variable
142   };
143  
144  
145 < mgclearall()                    /* clear all variable settings */
145 > void
146 > mgclearall(void)                        /* clear all variable settings */
147   {
148          int  j;
149          register IVAR  *iv;
# Line 167 | Line 168 | mgclearall()                   /* clear all variable settings */
168   }
169  
170  
171 < mgload(file)                    /* load a file */
172 < char  *file;
171 > void
172 > mgload(                 /* load a file */
173 > char  *file
174 > )
175   {
176          FILE  *fp;
177          char  sbuf[MAXLINE], *fgets();
# Line 235 | Line 238 | char  *file;
238   }
239  
240  
241 < mgsave(file)                            /* save our variables */
242 < char  *file;
241 > void
242 > mgsave(                         /* save our variables */
243 > char  *file
244 > )
245   {
246          FILE  *fp;
247          int  j;
# Line 266 | Line 271 | char  *file;
271   }
272  
273  
274 < setmgvar(fname, fp, string)             /* set a variable */
275 < char  *fname;
276 < FILE  *fp;
277 < char  *string;
274 > void
275 > setmgvar(               /* set a variable */
276 > char  *fname,
277 > FILE  *fp,
278 > char  *string
279 > )
280   {
281          char  name[128];
282          FILE  *fp2;
# Line 359 | Line 366 | char  *string;
366   }
367  
368  
369 < setivar(vname, fname, definition)       /* set an intermediate variable */
370 < char  *vname;
371 < char  *fname;
372 < char  *definition;
369 > static void
370 > setivar(        /* set an intermediate variable */
371 > char  *vname,
372 > char  *fname,
373 > char  *definition
374 > )
375   {
376          IVAR  ivbeg;
377          register IVAR  *iv;
# Line 387 | Line 396 | char  *definition;
396   }
397  
398  
399 < mgtoa(s, vp)                    /* get a variable's value in ascii form */
400 < register char  *s;
401 < VARIABLE  *vp;
399 > void
400 > mgtoa(                  /* get a variable's value in ascii form */
401 > register char  *s,
402 > VARIABLE  *vp
403 > )
404   {
405          register  char  *sv;
406  
# Line 417 | Line 428 | VARIABLE  *vp;
428   }
429  
430  
431 < mgprint(vp, fp)                 /* print a variable definition */
432 < register VARIABLE  *vp;
433 < FILE  *fp;
431 > static void
432 > mgprint(                        /* print a variable definition */
433 > register VARIABLE  *vp,
434 > FILE  *fp
435 > )
436   {
437          register int  i;
438          
# Line 455 | Line 468 | FILE  *fp;
468   }
469  
470  
471 < undefine(vp)                    /* undefine a variable */
472 < register VARIABLE  *vp;
471 > static void
472 > undefine(                       /* undefine a variable */
473 > register VARIABLE  *vp
474 > )
475   {
476          if (vp == NULL || !(vp->flags & DEFINED))
477                  return;
# Line 498 | Line 513 | char  *vname;
513   }
514  
515  
516 < loaddata(fname, fp, dp)                 /* load data from a stream */
517 < char  *fname;
518 < FILE  *fp;
519 < register DARRAY  *dp;
516 > static void
517 > loaddata(                       /* load data from a stream */
518 > char  *fname,
519 > FILE  *fp,
520 > register DARRAY  *dp
521 > )
522   {
523          char  sbuf[MAXLINE], *fgets();
524          register char  *cp;
# Line 533 | Line 550 | register DARRAY  *dp;
550   }
551  
552  
553 < char *
554 < findfile(fname, pathlist)       /* find the file fname, return full path */
555 < char  *fname;
556 < register char  **pathlist;
553 > static char *
554 > findfile(       /* find the file fname, return full path */
555 > char  *fname,
556 > register char  **pathlist
557 > )
558   {
559          static char  ffname[128];
542        char  *strcpy(), *strcat();
560          register int  fd;
561  
562          if (fname[0] == '/')
# Line 559 | Line 576 | register char  **pathlist;
576  
577  
578   int
579 < mgcurve(c, f)                   /* get a curve's (unmapped) values */
580 < int  c;
581 < int  (*f)();
579 > mgcurve(                        /* get a curve's (unmapped) values */
580 >        int  c,
581 >        void (*f)(int c, double x, double y)
582 > )
583   {
584          int  nargs;
585          double  x[2], step;
586          register VARIABLE  *cv;
587          register float  *p;
588 <        register int  npts;
588 >        register int npts = 0;
589  
590          if (c < 0 || c >= MAXCUR)
591                  return(-1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines