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

Comparing ray/src/hd/rholo2.c (file contents):
Revision 3.4 by gregl, Mon Dec 1 16:34:36 1997 UTC vs.
Revision 3.5 by gregl, Fri Dec 12 18:23:09 1997 UTC

# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ SGI";
9   */
10  
11   #include "rholo.h"
12 + #include "paths.h"
13   #include "random.h"
14  
15  
# Line 61 | Line 62 | register float *rvl;
62                  rvl += 4;
63          }
64          p->nc += p->nr;
65 + }
66 +
67 +
68 + int
69 + done_rtrace()                   /* clean up and close rtrace calculation */
70 + {
71 +        int     status;
72 +                                        /* already closed? */
73 +        if (!nprocs)
74 +                return;
75 +                                        /* report activity */
76 +        wputs("closing rtrace process...\n");
77 +                                        /* flush beam queue */
78 +        done_packets(flush_queue());
79 +                                        /* close rtrace */
80 +        if ((status = end_rtrace()))
81 +                error(WARNING, "bad exit status from rtrace");
82 +        if (vdef(REPORT))               /* report time */
83 +                report(0);
84 +        return(status);                 /* return status */
85 + }
86 +
87 +
88 + new_rtrace()                    /* restart rtrace calculation */
89 + {
90 +        char    combuf[128];
91 +
92 +        if (nprocs > 0)                 /* already running? */
93 +                return;
94 +        wputs("restarting rtrace process...\n");
95 +        if (vdef(RIF)) {                /* rerun rad to update octree */
96 +                sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF));
97 +                if (system(combuf))
98 +                        error(WARNING, "error running rad");
99 +        }
100 +        if (start_rtrace() < 1)         /* start rtrace */
101 +                error(WARNING, "cannot restart rtrace");
102 +        else if (vdef(REPORT))
103 +                report(0);
104 + }
105 +
106 +
107 + getradfile()                    /* run rad and get needed variables */
108 + {
109 +        static short    mvar[] = {OCTREE,-1};
110 +        static char     tf1[] = TEMPLATE;
111 +        char    tf2[64];
112 +        char    combuf[256];
113 +        char    *pippt;
114 +        register int    i;
115 +        register char   *cp;
116 +                                        /* check if rad file specified */
117 +        if (!vdef(RIF))
118 +                return;
119 +                                        /* create rad command */
120 +        mktemp(tf1);
121 +        sprintf(tf2, "%s.rif", tf1);
122 +        sprintf(combuf,
123 +                "rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH",
124 +                        vval(RIF), tf1);
125 +        cp = combuf;
126 +        while (*cp){
127 +                if (*cp == '|') pippt = cp;
128 +                cp++;
129 +        }                               /* match unset variables */
130 +        for (i = 0; mvar[i] >= 0; i++)
131 +                if (!vdef(mvar[i])) {
132 +                        *cp++ = '|';
133 +                        strcpy(cp, vnam(mvar[i]));
134 +                        while (*cp) cp++;
135 +                        pippt = NULL;
136 +                }
137 +        if (pippt != NULL)
138 +                strcpy(pippt, "> /dev/null");   /* nothing to match */
139 +        else
140 +                sprintf(cp, ")[ \t]*=' > %s", tf2);
141 +        if (system(combuf)) {
142 +                unlink(tf2);                    /* clean up */
143 +                unlink(tf1);
144 +                error(SYSTEM, "cannot execute rad command");
145 +        }
146 +        if (pippt == NULL) {
147 +                loadvars(tf2);                  /* load variables */
148 +                unlink(tf2);
149 +        }
150 +        rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */
151 +        unlink(tf1);                    /* clean up */
152   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines