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

Comparing ray/src/hd/rholo4.c (file contents):
Revision 3.28 by greg, Sat Feb 22 02:07:25 2003 UTC vs.
Revision 3.32 by schorsch, Mon Jun 30 14:59:12 2003 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Holodeck display process communication
6   */
7  
8 + #include <sys/uio.h>
9 + #include <string.h>
10 +
11   #include "rholo.h"
12   #include "rhdisp.h"
13 < #include <sys/uio.h>
13 > #include "rtprocess.h"
14  
15   #ifndef HDSUF
16   #define HDSUF           ".hdi"
# Line 21 | Line 24 | static const char      RCSid[] = "$Id$";
24   #endif
25  
26   static int      inp_flags;
27 < static int      dpd[3];
27 > static SUBPROC  dpd;
28   static FILE     *dpout;
29  
30  
# Line 32 | Line 35 | char   *dname;
35          int     i, n, len;
36  
37          if (!strcmp(dname, SLAVENAME)) {
38 <                dpd[0] = 0;             /* read from stdin */
38 >                dpd.r = 0;              /* read from stdin */
39                  dpout = stdout;         /* write to stdout */
40 <                dpd[2] = -1;            /* we're the slave process */
40 >                dpd.running = 0; /* we're the slave procees */
41          } else {
42                                          /* get full display program name */
43   #ifdef DEVPATH
# Line 52 | Line 55 | char   *dname;
55                  cmd[0] = buf;
56                  cmd[1] = froot; cmd[2] = fd1; cmd[3] = fd0;
57                  cmd[4] = NULL;
58 <                i = open_process(dpd, cmd);
58 >                i = open_process(&dpd, cmd);
59                  if (i <= 0)
60                          error(USER, "cannot start display process");
61 <                if ((dpout = fdopen(dpd[1], "w")) == NULL)
61 >                if ((dpout = fdopen(dpd.w, "w")) == NULL)
62                          error(SYSTEM, "problem opening display pipe");
63                                          /* close dup'ed stdin and stdout */
64                  if (readinp)
65                          close(atoi(fd0));
66                  close(atoi(fd1));
67          }
68 <        dpd[1] = -1;            /* causes ignored error in close_process() */
68 >        dpd.w = -1;             /* causes ignored error in close_process() */
69          inp_flags = 0;
70                                  /* check if outside */
71          if (vdef(OBSTRUCTIONS) && vbool(OBSTRUCTIONS))
# Line 74 | Line 77 | char   *dname;
77          }
78                                  /* write out hologram grids & octrees */
79          for (i = 0; hdlist[i] != NULL; i++) {
80 <                bcopy((char *)hdlist[i], buf, sizeof(HDGRID));
80 >                memcpy(buf, (void *)hdlist[i], sizeof(HDGRID));
81                  len = sizeof(HDGRID);
82                  n = vdef(GEOMETRY);
83                  sfn = i<n ? nvalue(GEOMETRY,i) :
# Line 112 | Line 115 | int    block;
115                                          /* check read blocking */
116          if (block != (inp_flags == 0)) {
117                  inp_flags = block ? 0 : FNONBLK;
118 <                if (fcntl(dpd[0], F_SETFL, inp_flags) < 0)
118 >                if (fcntl(dpd.r, F_SETFL, inp_flags) < 0)
119                          goto fcntlerr;
120          }
121                                          /* read message header */
122 <        n = read(dpd[0], (char *)&msg, sizeof(MSGHEAD));
122 >        n = read(dpd.r, (char *)&msg, sizeof(MSGHEAD));
123          if (n != sizeof(MSGHEAD)) {
124                  if (n >= 0) {
125                          dpout = NULL;
# Line 132 | Line 135 | int    block;
135                  buf = (char *)malloc(msg.nbytes);
136                  if (buf == NULL)
137                          error(SYSTEM, "out of memory in disp_check");
138 <                if (inp_flags != 0 && fcntl(dpd[0], F_SETFL, inp_flags=0) < 0)
138 >                if (inp_flags != 0 && fcntl(dpd.r, F_SETFL, inp_flags=0) < 0)
139                          goto fcntlerr;
140 <                if (readbuf(dpd[0], buf, msg.nbytes) != msg.nbytes)
140 >                if (readbuf(dpd.r, buf, msg.nbytes) != msg.nbytes)
141                          goto readerr;
142          }
143          switch (msg.type) {             /* take appropriate action */
# Line 250 | Line 253 | disp_close()                   /* close our display process */
253          disp_result(DS_SHUTDOWN, 0, NULL);
254          fclose(dpout);
255          dpout = NULL;
256 <        return(dpd[2]<0 ? 0 : close_process(dpd));
256 >        return(dpd.running ? close_process(&dpd) : 0);
257 >
258   }
259  
260  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines