--- ray/src/rt/devmain.c 1990/01/08 13:38:18 1.4 +++ ray/src/rt/devmain.c 1990/02/22 11:46:24 1.8 @@ -22,8 +22,6 @@ static char SCCSid[] = "$SunId$ LBL"; int (*wrnvec)(), (*errvec)(), (*cmdvec)(); /* error vectors, unused */ -long nrays = 0; /* fake it */ - struct driver *dev = NULL; /* output device */ FILE *devin, *devout; /* communications channels */ @@ -32,11 +30,12 @@ int notified = 0; /* notified parent of input? */ char *progname; /* driver name */ -int r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(), r_mycomin(); +int r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(), r_flush(); int (*dev_func[NREQUESTS])() = { /* request handlers */ r_clear, r_paintr, - r_getcur, r_comout, r_comin + r_getcur, r_comout, + r_comin, r_flush }; @@ -62,9 +61,9 @@ char *argv[]; if ((dev = dinit(argv[0], argv[3])) == NULL) quit(1); putw(COM_RECVM, devout); /* verify initialization */ + fwrite((char *)&dev->pixaspect, sizeof(dev->pixaspect), 1, devout); putw(dev->xsiz, devout); putw(dev->ysiz, devout); - fwrite(dev->pixaspect, sizeof(dev->pixaspect), 1, devout); fflush(devout); /* loop on requests */ while ((com = getc(devin)) != EOF) { @@ -102,8 +101,7 @@ r_paintr() /* paint a rectangle */ COLOR col; int xmin, ymin, xmax, ymax; - nrays += 5; /* pretend */ - fread(col, sizeof(COLOR), 1, devin); + fread((char *)col, sizeof(COLOR), 1, devin); xmin = getw(devin); ymin = getw(devin); xmax = getw(devin); ymax = getw(devin); (*dev->paintr)(col, xmin, ymin, xmax, ymax); @@ -115,6 +113,13 @@ r_paintr() /* paint a rectangle */ } +r_flush() /* flush output */ +{ + if (dev->flush != NULL) + (*dev->flush)(); +} + + r_getcur() /* get and return cursor position */ { int c; @@ -145,9 +150,15 @@ r_comout() /* print string to command line */ r_comin() /* read string from command line */ { - char buf[256]; + char buf[256], *prompt; + /* get prompt */ + if (getc(devin)) { + mygets(buf, devin); + prompt = buf; + } else + prompt = NULL; /* get string */ - (*dev->comin)(buf); + (*dev->comin)(buf, prompt); /* reply */ putc(COM_COMIN, devout); myputs(buf, devout);