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.13 by gregl, Fri Dec 12 11:13:17 1997 UTC vs.
Revision 3.20 by gwlarson, Tue Oct 6 18:09:49 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Silicon Graphics, Inc. */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ SGI";
# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ SGI";
13   #include <sys/uio.h>
14  
15   #ifndef HDSUF
16 < #define HDSUF   ".hdisp"
16 > #define HDSUF   ".hdi"
17   #endif
18  
19   static int      inp_flags;
# Line 53 | Line 53 | char   *dname;
53          if (readinp)
54                  close(atoi(fd0));
55          close(atoi(fd1));
56 +                                /* check if outside */
57 +        if (vdef(OBSTRUCTIONS) && vbool(OBSTRUCTIONS))
58 +                disp_result(DS_OUTSECT, 0, NULL);
59 +                                /* send eye separation if specified */
60 +        if (vdef(EYESEP)) {
61 +                char    fbuf[32];
62 +                sprintf(fbuf, "%.9e", vflt(EYESEP));
63 +                disp_result(DS_EYESEP, strlen(fbuf)+1, fbuf);
64 +        }
65                                  /* write out hologram grids */
66          for (i = 0; hdlist[i] != NULL; i++)
67                  disp_result(DS_ADDHOLO, sizeof(HDGRID), (char *)hdlist[i]);
# Line 96 | Line 105 | int    block;
105                  return(2);              /* acceptable failure */
106          }
107          if (msg.nbytes) {               /* get the message body */
108 +                if (msg.nbytes < 0)
109 +                        error(INTERNAL, "anti-message from display process");
110                  buf = (char *)malloc(msg.nbytes);
111                  if (buf == NULL)
112                          error(SYSTEM, "out of memory in disp_check");
113 <                if (fcntl(dpd[0], F_SETFL, inp_flags=0) < 0)
113 >                if (inp_flags != 0 && fcntl(dpd[0], F_SETFL, inp_flags=0) < 0)
114                          goto fcntlerr;
115                  if (readbuf(dpd[0], buf, msg.nbytes) != msg.nbytes)
116                          goto readerr;
# Line 113 | Line 124 | int    block;
124          case DR_NEWSET:         /* new calculation set */
125                  if (msg.nbytes % sizeof(PACKHEAD))
126                          error(INTERNAL, "bad DR_NEWSET from display process");
127 <                disp_result(DS_STARTIMM, 0, NULL);
127 >                if (msg.nbytes)
128 >                        disp_result(DS_STARTIMM, 0, NULL);
129                  bundle_set(BS_NEW, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD));
130 <                disp_result(DS_ENDIMM, 0, NULL);
131 <                disp_flush();
130 >                if (msg.nbytes) {
131 >                        disp_result(DS_ENDIMM, 0, NULL);
132 >                        disp_flush();
133 >                }
134                  break;
135          case DR_ADDSET:         /* add to calculation set */
136 +                if (!msg.nbytes)
137 +                        break;
138                  if (msg.nbytes % sizeof(PACKHEAD))
139                          error(INTERNAL, "bad DR_ADDSET from display process");
140                  disp_result(DS_STARTIMM, 0, NULL);
141                  bundle_set(BS_ADD, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD));
142                  disp_result(DS_ENDIMM, 0, NULL);
143 <                disp_check(0);          /* hack -- delete usu. follows add */
143 >                disp_flush();
144                  break;
145          case DR_ADJSET:         /* adjust calculation set members */
146 +                if (!msg.nbytes)
147 +                        break;
148                  if (msg.nbytes % sizeof(PACKHEAD))
149                          error(INTERNAL, "bad DR_ADJSET from display process");
150                  disp_result(DS_STARTIMM, 0, NULL);
# Line 135 | Line 153 | int    block;
153                  disp_flush();
154                  break;
155          case DR_DELSET:         /* delete from calculation set */
156 +                if (!msg.nbytes)
157 +                        break;
158                  if (msg.nbytes % sizeof(PACKHEAD))
159                          error(INTERNAL, "bad DR_DELSET from display process");
160                  bundle_set(BS_DEL, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD));
# Line 148 | Line 168 | int    block;
168          case DR_KILL:           /* kill computation process(es) */
169                  if (msg.nbytes)
170                          error(INTERNAL, "bad DR_KILL from display process");
171 <                if (nprocs > 0) {
172 <                        done_packets(flush_queue());
173 <                        if (end_rtrace())
154 <                                error(WARNING, "bad status returned by rtrace");
155 <                } else
171 >                if (nprocs > 0)
172 >                        done_rtrace();
173 >                else
174                          error(WARNING, "no rtrace process to kill");
175                  break;
176          case DR_RESTART:        /* restart computation process(es) */
177                  if (msg.nbytes)
178                          error(INTERNAL, "bad DR_RESTART from display process");
179 <                if (ncprocs > nprocs) {
180 <                        checkrad();
181 <                        if (start_rtrace() < 1)
164 <                                error(WARNING, "cannot restart rtrace");
165 <                } else if (nprocs > 0)
179 >                if (ncprocs > nprocs)
180 >                        new_rtrace();
181 >                else if (nprocs > 0)
182                          error(WARNING, "rtrace already runnning");
183                  else
184                          error(WARNING, "holodeck not open for writing");
# Line 215 | Line 231 | int    type, nbytes;
231   char    *p;
232   {
233          MSGHEAD msg;
234 <
234 >                                        /* consistency checks */
235 > #ifdef DEBUG
236 >        if (nbytes < 0 || nbytes > 0 & p == NULL)
237 >                error(CONSISTENCY, "bad buffer handed to disp_result");
238 > #endif
239          if (dpout == NULL)
240                  return;
241          msg.type = type;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines