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

Comparing ray/src/gen/mkillum.c (file contents):
Revision 2.21 by greg, Sun Sep 19 08:42:22 2004 UTC vs.
Revision 2.24 by greg, Wed May 25 04:44:25 2005 UTC

# Line 60 | Line 60 | int    doneheader = 0;         /* printed header yet? */
60  
61   int     warnings = 1;           /* print warnings? */
62  
63 + int done_rprocs(struct rtproc *rtp);
64   void init(int np);
65   void filter(register FILE       *infp, char     *name);
66   void xoptions(char      *s, char        *nm);
# Line 169 | Line 170 | killpersist(void)                      /* kill persistent rtrace process
170          fclose(fp);
171   }
172  
173 + int
174 + done_rprocs(struct rtproc *rtp)
175 + {
176 +        int     st0, st1 = 0;
177 +
178 +        if (rtp->next != NULL) {        /* close last opened first! */
179 +                st1 = done_rprocs(rtp->next);
180 +                free((void *)rtp->next);
181 +                rtp->next = NULL;
182 +        }
183 +        st0 = close_process(&rtp->pd);
184 +        if (st0 < 0)
185 +                error(WARNING, "unknown return status from rtrace process");
186 +        else if (st0 > 0)
187 +                return(st0);
188 +        return(st1);
189 + }
190 +
191   void
192   quit(int status)                        /* exit with status */
193   {
175        struct rtproc   *rtp;
194          int     rtstat;
195  
196          if (rt0.next != NULL)           /* terminate persistent rtrace */
197                  killpersist();
198                                          /* clean up rtrace process(es) */
199 <        for (rtp = &rt0; rtp != NULL; rtp = rtp->next) {
200 <                rtstat = close_process(&rtp->pd);
201 <                if (status == 0) {
184 <                        if (rtstat < 0)
185 <                                error(WARNING,
186 <                                "unknown return status from rtrace process");
187 <                        else
188 <                                status = rtstat;
189 <                }
190 <        }
199 >        rtstat = done_rprocs(&rt0);
200 >        if (status == 0)
201 >                status = rtstat;
202          exit(status);
203   }
204  
# Line 216 | Line 227 | init(int np)                           /* start rtrace and set up buffers */
227                  }
228                  if (maxbytes < 0)
229                          error(SYSTEM, "cannot start rtrace process");
219                if (!i && np > 1)
220                        sleep(2);       /* wait for persist file */
230                  rtp->bsiz = maxbytes/(6*sizeof(float));
231                  rtp->buf = (float *)malloc(6*sizeof(float)*rtp->bsiz--);
232                  rtp->dest = (float **)calloc(rtp->bsiz, sizeof(float *));
# Line 226 | Line 235 | init(int np)                           /* start rtrace and set up buffers */
235                  rtp->nrays = 0;
236                  if (i == np)            /* last process? */
237                          break;
238 +                if (np > 1)
239 +                        sleep(2);       /* wait for persist file */
240                  rtp->next = (struct rtproc *)malloc(sizeof(struct rtproc));
241                  if (rtp->next == NULL)
242                          error(SYSTEM, "out of memory in init");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines