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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines