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

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.1 by gregl, Wed Nov 19 18:01:03 1997 UTC vs.
Revision 3.6 by gregl, Tue Nov 25 10:27:47 1997 UTC

# Line 17 | Line 17 | HOLO   *hdlist[HDMAX+1];       /* global holodeck list */
17  
18   int     imm_mode = 0;           /* bundles are being delivered immediately */
19  
20 VIEW    dvw;                    /* our current display view */
21
20   char    *progname;              /* global argv[0] */
21  
22 < #define SERV_READY      01
23 < #define DEV_READY       02
22 > #define RDY_SRV 01
23 > #define RDY_DEV 02
24  
25  
26   main(argc, argv)
27   int     argc;
28   char    *argv[];
29   {
30 <        int     rdy, inp, res = 0;
30 >        int     rdy, inp, res = 0, pause = 0;
31  
32          progname = argv[0];
33          if (argc != 2)
# Line 39 | Line 37 | char   *argv[];
37                                          /* enter main loop */
38          do {
39                  rdy = disp_wait();
40 <                if (rdy & DEV_READY) {
41 <                        inp = dev_input();      /* take residual action here */
40 >                if (rdy & RDY_DEV) {            /* get user input */
41 >                        inp = dev_input();
42 >                        if (inp & DEV_NEWVIEW)
43 >                                new_view(&odev.v);
44                          if (inp & DEV_SHUTDOWN)
45                                  serv_request(DR_SHUTDOWN, 0, NULL);
46 <                        else if (inp & DEV_NEWVIEW)
47 <                                new_view(&odev.v);
46 >                        if (inp & DEV_REDRAW) {
47 >                                imm_mode = 1;   /* preempt updates */
48 >                                beam_sync();
49 >                        }
50 >                        if (inp & DEV_WAIT)
51 >                                pause = 1;
52 >                        if (inp & DEV_RESUME) {
53 >                                serv_request(DR_NOOP, 0, NULL);
54 >                                pause = 0;
55 >                        }
56                  }
57 <                if (rdy & SERV_READY)
58 <                        res = serv_result();    /* processes result, also */
57 >                if (rdy & RDY_SRV) {            /* get server result */
58 >                        res = serv_result();
59 >                        if (pause && res != DS_SHUTDOWN) {
60 >                                serv_request(DR_ATTEN, 0, NULL);
61 >                                while ((res = serv_result()) != DS_ACKNOW &&
62 >                                                res != DS_SHUTDOWN)
63 >                                        ;
64 >                        }
65 >                }
66          } while (res != DS_SHUTDOWN);
67                                          /* all done */
68          quit(0);
# Line 63 | Line 78 | disp_wait()                    /* wait for more input */
78          register int    i;
79                                  /* see if we can avoid select call */
80          if (imm_mode || stdin->_cnt > 0)
81 <                return(SERV_READY);
81 >                return(RDY_SRV);
82          if (dev_flush())
83 <                return(DEV_READY);
83 >                return(RDY_DEV);
84                                  /* make the call */
85          FD_ZERO(&readset); FD_ZERO(&errset);
86          FD_SET(0, &readset);
# Line 81 | Line 96 | disp_wait()                    /* wait for more input */
96          }
97          flgs = 0;               /* flag what's ready */
98          if (FD_ISSET(0, &readset) || FD_ISSET(0, &errset))
99 <                flgs |= SERV_READY;
99 >                flgs |= RDY_SRV;
100          if (FD_ISSET(odev.ifd, &readset) || FD_ISSET(odev.ifd, &errset))
101 <                flgs |= DEV_READY;
101 >                flgs |= RDY_DEV;
102          return(flgs);
103   }
104  
# Line 146 | Line 161 | VIEW   *v;
161          if ((err = setview(v)) != NULL)
162                  error(INTERNAL, err);
163          dev_view(v);                    /* update display driver */
164 <        beam_view(&dvw, v);             /* update beam list */
165 <        copystruct(&dvw, v);            /* record new view */
164 >        dev_flush();                    /* update screen */
165 >        beam_view(v);                   /* update beam list */
166   }
167  
168  
# Line 229 | Line 244 | char   *p;
244                  fwrite(p, 1, nbytes, stdout);
245          if (fflush(stdout) < 0)
246                  error(SYSTEM, "write error in serv_request");
247 + }
248 +
249 +
250 + eputs(s)                        /* put error message to stderr */
251 + register char  *s;
252 + {
253 +        static int  midline = 0;
254 +
255 +        if (!*s)
256 +                return;
257 +        if (!midline++) {       /* prepend line with program name */
258 +                fputs(progname, stderr);
259 +                fputs(": ", stderr);
260 +        }
261 +        fputs(s, stderr);
262 +        if (s[strlen(s)-1] == '\n') {
263 +                fflush(stderr);
264 +                midline = 0;
265 +        }
266   }
267  
268  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines