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

Comparing ray/src/rt/devcomm.c (file contents):
Revision 1.12 by greg, Thu Feb 22 11:46:13 1990 UTC vs.
Revision 1.15 by greg, Tue Mar 6 17:44:37 1990 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include "standard.h"
14  
15 #include <signal.h>
16
15   #include "color.h"
16  
17   #include "driver.h"
# Line 22 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   #define DEVPATH         getenv("PATH")  /* device search path */
21   #endif
22  
23 + #ifndef DELAY
24 + #define DELAY           20              /* seconds to wait for response */
25 + #endif
26 +
27   #ifndef BSD
28   #define vfork           fork
29   #endif
# Line 76 | Line 78 | char   *dname, *id;
78                  goto syserr;
79          if ((devin = fdopen(p2[0], "r")) == NULL)
80                  goto syserr;
81 <                                                /* verify & get resolution */
81 >                                                /* verify initialization */
82          putw(COM_SENDM, devout);
83          fflush(devout);
84          if (getw(devin) != COM_RECVM)
85                  return(NULL);
86 <        fread((char *)&comm_driver.pixaspect,
87 <                        sizeof(comm_driver.pixaspect), 1, devin);
86 <        comm_driver.xsiz = getw(devin);
87 <        comm_driver.ysiz = getw(devin);
88 <                                                /* input handling */
89 <        signal(SIGIO, onsigio);
86 >                                                /* get driver parameters */
87 >        comm_flush();
88                                                  /* set error vectors */
89          cmdvec = comm_comout;
90          if (wrnvec != NULL)
# Line 106 | Line 104 | comm_close()                   /* done with driver */
104          cmdvec = NULL;                          /* reset error vectors */
105          if (wrnvec != NULL)
106                  wrnvec = stderr_v;
109        signal(SIGIO, SIG_DFL);
107          fclose(devout);
108          fclose(devin);
109          while ((pid = wait(0)) != -1 && pid != devchild)
# Line 144 | Line 141 | comm_flush()                           /* flush output to driver */
141   {
142          putc(COM_FLUSH, devout);
143          fflush(devout);
144 +        if (getc(devin) != COM_FLUSH)
145 +                reply_error("flush");
146 +        fread((char *)&comm_driver.pixaspect,
147 +                        sizeof(comm_driver.pixaspect), 1, devin);
148 +        comm_driver.xsiz = getw(devin);
149 +        comm_driver.ysiz = getw(devin);
150 +        comm_driver.inpready = getw(devin);
151   }
152  
153  
# Line 170 | Line 174 | char   *str;
174   {
175          putc(COM_COMOUT, devout);
176          myputs(str, devout);
173        fflush(devout);
177   }
178  
179  
# Line 190 | Line 193 | char   *prompt;
193          if (getc(devin) != COM_COMIN)
194                  reply_error("comin");
195          mygets(buf, devin);
196 <        if (comm_driver.inpready > 0)
194 <                comm_driver.inpready--;
196 >        comm_driver.inpready = getw(devin);
197   }
198  
199  
# Line 236 | Line 238 | char   *routine;
238          stderr_v(routine);
239          stderr_v(": driver reply error\n");
240          quit(1);
239 }
240
241
242 static
243 onsigio()                               /* input ready */
244 {
245        comm_driver.inpready++;
241   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines