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

Comparing ray/src/rt/func.c (file contents):
Revision 1.19 by greg, Wed Jun 19 15:08:39 1991 UTC vs.
Revision 2.1 by greg, Tue Nov 12 17:08:46 1991 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  "otypes.h"
16  
17  
18 + #define  INITFILE       "rayinit.cal"
19 + #define  DEFVNAME       "`FILE_LOADED"
20 +
21   XF  unitxf = {                  /* identity transform */
22          1.0, 0.0, 0.0, 0.0,
23          0.0, 1.0, 0.0, 0.0,
# Line 33 | Line 36 | OBJREC  *m;
36   register RAY  *r;
37   XF  *bx;
38   {
36        extern double  l_arg(), l_erf(), l_erfc();
39          extern long  eclock;
38        static char  *initfile = "rayinit.cal";
40          static long  lastrno = -1;
41                                          /* check to see if already set */
42          if (m == fobj && r->rno == lastrno)
43                  return(0);
43                                        /* initialize if first call */
44        if (initfile != NULL) {
45                loadfunc(initfile);
46                scompile("Dx=$1;Dy=$2;Dz=$3;", NULL, 0);
47                scompile("Nx=$4;Ny=$5;Nz=$6;", NULL, 0);
48                scompile("Px=$7;Py=$8;Pz=$9;", NULL, 0);
49                scompile("T=$10;Rdot=$11;", NULL, 0);
50                scompile("S=$12;Tx=$13;Ty=$14;Tz=$15;", NULL, 0);
51                scompile("Ix=$16;Iy=$17;Iz=$18;", NULL, 0);
52                scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0);
53                scompile("Kx=$22;Ky=$23;Kz=$24;", NULL, 0);
54                funset("arg", 1, '=', l_arg);
55                funset("erf", 1, ':', l_erf);
56                funset("erfc", 1, ':', l_erfc);
57                setnoisefuncs();
58                initfile = NULL;
59        }
44          fobj = m;
45          fray = r;
46          if (r->rox != NULL)
# Line 153 | Line 137 | l_erfc()                       /* cumulative error function */
137          extern double  erfc();
138  
139          return(erfc(argument(1)));
140 + }
141 +
142 +
143 + funcfile(fname)                 /* set context, load file if necessary */
144 + register char  *fname;
145 + {
146 +        extern char  *setcontext();
147 +        static char  initfile[] = INITFILE;
148 +
149 +        if (initfile[0]) {              /* initialize on first call */
150 +                setcontext("");
151 +                scompile("Dx=$1;Dy=$2;Dz=$3;", NULL, 0);
152 +                scompile("Nx=$4;Ny=$5;Nz=$6;", NULL, 0);
153 +                scompile("Px=$7;Py=$8;Pz=$9;", NULL, 0);
154 +                scompile("T=$10;Rdot=$11;", NULL, 0);
155 +                scompile("S=$12;Tx=$13;Ty=$14;Tz=$15;", NULL, 0);
156 +                scompile("Ix=$16;Iy=$17;Iz=$18;", NULL, 0);
157 +                scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0);
158 +                scompile("Kx=$22;Ky=$23;Kz=$24;", NULL, 0);
159 +                funset("arg", 1, '=', l_arg);
160 +                funset("erf", 1, ':', l_erf);
161 +                funset("erfc", 1, ':', l_erfc);
162 +                setnoisefuncs();
163 +                loadfunc(initfile);
164 +                initfile[0] = '\0';
165 +        }
166 +        if (fname[0] == '.' && fname[1] == '\0')
167 +                setcontext("");                 /* "." means no file */
168 +        else {
169 +                setcontext(fname);
170 +                if (!vardefined(DEFVNAME)) {
171 +                        loadfunc(fname);
172 +                        varset(DEFVNAME, ':', 1.0);
173 +                }
174 +        }
175   }
176  
177  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines