--- ray/src/rt/devcomm.c 1989/11/01 17:33:03 1.7 +++ ray/src/rt/devcomm.c 1990/01/30 11:37:36 1.11 @@ -10,7 +10,7 @@ static char SCCSid[] = "$SunId$ LBL"; * 10/5/88 */ -#include +#include "standard.h" #include @@ -39,8 +39,7 @@ int comm_close(), comm_clear(), comm_paintr(), comm_er struct driver comm_driver, comm_default = { comm_close, comm_clear, comm_paintr, comm_getcur, - comm_comout, comm_comin, - MAXRES, MAXRES, 0 + comm_comout, comm_comin }; FILE *devin, *devout; @@ -81,12 +80,14 @@ char *dname, *id; goto syserr; if ((devin = fdopen(p2[0], "r")) == NULL) goto syserr; - bcopy(&comm_default, &comm_driver, sizeof(comm_driver)); + copystruct(&comm_driver, &comm_default); /* verify & get resolution */ putw(COM_SENDM, devout); fflush(devout); if (getw(devin) != COM_RECVM) return(NULL); + fread((char *)&comm_driver.pixaspect, + sizeof(comm_driver.pixaspect), 1, devin); comm_driver.xsiz = getw(devin); comm_driver.ysiz = getw(devin); /* input handling */ @@ -123,8 +124,8 @@ comm_clear(xres, yres) /* clear screen */ int xres, yres; { putc(COM_CLEAR, devout); - fwrite(&xres, sizeof(xres), 1, devout); - fwrite(&yres, sizeof(yres), 1, devout); + putw(xres, devout); + putw(yres, devout); fflush(devout); } @@ -138,11 +139,11 @@ int xmin, ymin, xmax, ymax; static long lastflush = 0; /* ray count at last flush */ putc(COM_PAINTR, devout); - fwrite(col, sizeof(COLOR), 1, devout); - fwrite(&xmin, sizeof(xmin), 1, devout); - fwrite(&ymin, sizeof(ymin), 1, devout); - fwrite(&xmax, sizeof(xmax), 1, devout); - fwrite(&ymax, sizeof(ymax), 1, devout); + fwrite((char *)col, sizeof(COLOR), 1, devout); + putw(xmin, devout); + putw(ymin, devout); + putw(xmax, devout); + putw(ymax, devout); if (nrays - lastflush >= WFLUSH) { fflush(devout); lastflush = nrays; @@ -161,8 +162,8 @@ int *xp, *yp; if (getc(devin) != COM_GETCUR) reply_error("getcur"); c = getc(devin); - fread(xp, sizeof(*xp), 1, devin); - fread(yp, sizeof(*yp), 1, devin); + *xp = getw(devin); + *yp = getw(devin); return(c); } @@ -178,10 +179,17 @@ char *str; static -comm_comin(buf) /* read string from command line */ +comm_comin(buf, prompt) /* read string from command line */ char *buf; +char *prompt; { putc(COM_COMIN, devout); + if (prompt == NULL) + putc(0, devout); + else { + putc(1, devout); + myputs(prompt, devout); + } fflush(devout); if (getc(devin) != COM_COMIN) reply_error("comin");