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

Comparing ray/src/rt/devmain.c (file contents):
Revision 1.2 by greg, Wed Oct 25 16:49:45 1989 UTC vs.
Revision 1.10 by greg, Tue Mar 6 17:44:44 1990 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14  
15   #include <stdio.h>
16  
17 #include <signal.h>
18
17   #include "color.h"
18  
19   #include "driver.h"
20  
21   int     (*wrnvec)(), (*errvec)(), (*cmdvec)();  /* error vectors, unused */
22  
25 long    nrays = 0;                              /* fake it */
26
23   struct driver   *dev = NULL;                    /* output device */
24  
25   FILE    *devin, *devout;                        /* communications channels */
26  
31 int     notified = 0;                           /* notified parent of input? */
32
27   char    *progname;                              /* driver name */
28  
29 < int     r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin();
29 > int     r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(), r_flush();
30  
31   int     (*dev_func[NREQUESTS])() = {            /* request handlers */
32                  r_clear, r_paintr,
33 <                r_getcur, r_comout, r_comin
33 >                r_getcur, r_comout,
34 >                r_comin, r_flush
35          };
36  
37  
# Line 62 | Line 57 | char   *argv[];
57          if ((dev = dinit(argv[0], argv[3])) == NULL)
58                  quit(1);
59          putw(COM_RECVM, devout);                /* verify initialization */
65        putw(dev->xsiz, devout);
66        putw(dev->ysiz, devout);
60          fflush(devout);
61                                                  /* loop on requests */
62          while ((com = getc(devin)) != EOF) {
# Line 101 | Line 94 | r_paintr()                             /* paint a rectangle */
94          COLOR   col;
95          int     xmin, ymin, xmax, ymax;
96  
97 <        nrays += 5;                     /* pretend */
105 <        fread(col, sizeof(COLOR), 1, devin);
97 >        fread((char *)col, sizeof(COLOR), 1, devin);
98          xmin = getw(devin); ymin = getw(devin);
99          xmax = getw(devin); ymax = getw(devin);
100          (*dev->paintr)(col, xmin, ymin, xmax, ymax);
109                                        /* check for input */
110        if (dev->inpready > notified) {
111                kill(getppid(), SIGIO);
112                notified = dev->inpready;
113        }
101   }
102  
103  
104 + r_flush()                               /* flush output */
105 + {
106 +        if (dev->flush != NULL)
107 +                (*dev->flush)();
108 +        putc(COM_FLUSH, devout);
109 +        fwrite((char *)&dev->pixaspect, sizeof(dev->pixaspect), 1, devout);
110 +        putw(dev->xsiz, devout);
111 +        putw(dev->ysiz, devout);
112 +        putw(dev->inpready, devout);
113 +        fflush(devout);
114 + }
115 +
116 +
117   r_getcur()                              /* get and return cursor position */
118   {
119          int     c;
# Line 144 | Line 144 | r_comout()                             /* print string to command line */
144  
145   r_comin()                               /* read string from command line */
146   {
147 <        char    buf[256];
147 >        char    buf[256], *prompt;
148 >                                        /* get prompt */
149 >        if (getc(devin)) {
150 >                mygets(buf, devin);
151 >                prompt = buf;
152 >        } else
153 >                prompt = NULL;
154                                          /* get string */
155 <        (*dev->comin)(buf);
155 >        (*dev->comin)(buf, prompt);
156                                          /* reply */
157          putc(COM_COMIN, devout);
158          myputs(buf, devout);
159 +        putw(dev->inpready, devout);
160          fflush(devout);
154                                        /* reset notify */
155        notified = 0;
161   }
162  
163  
# Line 176 | Line 181 | register FILE  *fp;
181          do
182                  putc(*s, fp);
183          while (*s++);
179 }
180
181
182 repaint(xmin, ymin, xmax, ymax)         /* repaint section of display */
183 int     xmin, ymin, xmax, ymax;
184 {
185        /* no can do! */
184   }
185  
186  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines