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.9 by greg, Mon Jan 8 15:07:31 1990 UTC vs.
Revision 1.12 by greg, Thu Feb 22 11:46:13 1990 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10   *      10/5/88
11   */
12  
13 < #include <stdio.h>
13 > #include "standard.h"
14  
15   #include <signal.h>
16  
# Line 26 | Line 26 | static char SCCSid[] = "$SunId$ LBL";
26   #define vfork           fork
27   #endif
28  
29 #ifndef WFLUSH
30 #define WFLUSH          30              /* flush after this many rays */
31 #endif
32
29   extern char     *getpath(), *getenv();
30  
31   int     onsigio();
32  
33   int     comm_close(), comm_clear(), comm_paintr(), comm_errout(),
34 <                comm_getcur(), comm_comout(), comm_comin();
34 >                comm_getcur(), comm_comout(), comm_comin(), comm_flush();
35  
36 < struct driver   comm_driver, comm_default = {
36 > struct driver   comm_driver = {
37          comm_close, comm_clear, comm_paintr, comm_getcur,
38 <        comm_comout, comm_comin
38 >        comm_comout, comm_comin, comm_flush
39   };
40  
41   FILE    *devin, *devout;
# Line 80 | Line 76 | char   *dname, *id;
76                  goto syserr;
77          if ((devin = fdopen(p2[0], "r")) == NULL)
78                  goto syserr;
83        bcopy(&comm_default, &comm_driver, sizeof(comm_driver));
79                                                  /* verify & get resolution */
80          putw(COM_SENDM, devout);
81          fflush(devout);
82          if (getw(devin) != COM_RECVM)
83                  return(NULL);
84 <        fread(&comm_driver.pixaspect, sizeof(comm_driver.pixaspect), 1, devin);
84 >        fread((char *)&comm_driver.pixaspect,
85 >                        sizeof(comm_driver.pixaspect), 1, devin);
86          comm_driver.xsiz = getw(devin);
87          comm_driver.ysiz = getw(devin);
88                                                  /* input handling */
# Line 134 | Line 130 | comm_paintr(col, xmin, ymin, xmax, ymax)       /* paint a re
130   COLOR   col;
131   int     xmin, ymin, xmax, ymax;
132   {
137        extern long     nrays;          /* number of rays traced */
138        static long     lastflush = 0;  /* ray count at last flush */
139
133          putc(COM_PAINTR, devout);
134 <        fwrite(col, sizeof(COLOR), 1, devout);
134 >        fwrite((char *)col, sizeof(COLOR), 1, devout);
135          putw(xmin, devout);
136          putw(ymin, devout);
137          putw(xmax, devout);
138          putw(ymax, devout);
146        if (nrays - lastflush >= WFLUSH) {
147                fflush(devout);
148                lastflush = nrays;
149        }
139   }
140  
141  
142 + static
143 + comm_flush()                            /* flush output to driver */
144 + {
145 +        putc(COM_FLUSH, devout);
146 +        fflush(devout);
147 + }
148 +
149 +
150   static int
151   comm_getcur(xp, yp)                     /* get and return cursor position */
152   int     *xp, *yp;
# Line 178 | Line 175 | char   *str;
175  
176  
177   static
178 < comm_comin(buf)                         /* read string from command line */
178 > comm_comin(buf, prompt)                 /* read string from command line */
179   char    *buf;
180 + char    *prompt;
181   {
182          putc(COM_COMIN, devout);
183 +        if (prompt == NULL)
184 +                putc(0, devout);
185 +        else {
186 +                putc(1, devout);
187 +                myputs(prompt, devout);
188 +        }
189          fflush(devout);
190          if (getc(devin) != COM_COMIN)
191                  reply_error("comin");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines