--- ray/src/rt/devcomm.c 2008/05/01 15:50:28 2.14 +++ ray/src/rt/devcomm.c 2016/08/18 00:52:48 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: devcomm.c,v 2.14 2008/05/01 15:50:28 greg Exp $"; +static const char RCSid[] = "$Id: devcomm.c,v 2.19 2016/08/18 00:52:48 greg Exp $"; #endif /* * devcomm.c - communication routines for separate drivers. @@ -10,8 +10,11 @@ static const char RCSid[] = "$Id: devcomm.c,v 2.14 200 #include "copyright.h" #include -#include /* XXX platform specific */ +#if !defined(_WIN32) && !defined(_WIN64) +#include +#endif +#include "paths.h" #include "platform.h" #include "standard.h" #include "driver.h" @@ -54,13 +57,15 @@ final_connect(void) /* verify and initialize connec getstate(); /* set error vectors */ erract[COMMAND].pf = comm_comout; + /* doesn't work with raypcalls.c if (erract[WARNING].pf != NULL) erract[WARNING].pf = comm_comout; + */ return(&comm_driver); } -extern struct driver * +struct driver * slave_init( /* run rview in slave mode */ char *dname, char *id @@ -73,7 +78,7 @@ slave_init( /* run rview in slave mode */ } -extern struct driver * +struct driver * comm_init( /* set up and execute driver */ char *dname, char *id @@ -142,8 +147,10 @@ comm_close(void) /* done with driver */ fclose(devin); if (devchild < 0) return; +#if !defined(_WIN32) && !defined(_WIN64) while ((pid = wait(0)) != -1 && pid != devchild) ; +#endif } @@ -170,7 +177,7 @@ comm_paintr( /* paint a rectangle */ ) { putc(COM_PAINTR, devout); - fwrite((char *)col, sizeof(COLOR), 1, devout); + putbinary(col, sizeof(COLOR), 1, devout); putw(xmin, devout); putw(ymin, devout); putw(xmax, devout); @@ -243,11 +250,11 @@ comm_comin( /* read string from command line */ static void mygets( /* get string from file (with nul) */ - register char *s, - register FILE *fp + char *s, + FILE *fp ) { - register int c; + int c; while ((c = getc(fp)) != EOF) if ((*s++ = c) == '\0') @@ -258,8 +265,8 @@ mygets( /* get string from file (with nul) */ static void myputs( /* put string to file (with nul) */ - register char *s, - register FILE *fp + char *s, + FILE *fp ) { do @@ -282,7 +289,7 @@ reply_error( /* what should we do here? */ static void getstate(void) /* get driver state variables */ { - fread((char *)&comm_driver.pixaspect, + getbinary((char *)&comm_driver.pixaspect, sizeof(comm_driver.pixaspect), 1, devin); comm_driver.xsiz = getw(devin); comm_driver.ysiz = getw(devin);