--- ray/src/util/xglaresrc.c 2003/02/22 02:07:30 2.6 +++ ray/src/util/xglaresrc.c 2018/01/24 04:39:52 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: xglaresrc.c,v 2.6 2003/02/22 02:07:30 greg Exp $"; +static const char RCSid[] = "$Id: xglaresrc.c,v 2.10 2018/01/24 04:39:52 greg Exp $"; #endif /* * Circle sources in a displayed image. @@ -8,12 +8,14 @@ static const char RCSid[] = "$Id: xglaresrc.c,v 2.6 20 */ #include "standard.h" -#include "view.h" -#include "vfork.h" + +#include #include #include #include +#include "view.h" + #define XIM "ximage" #define NSEG 30 /* number of segments per circle */ @@ -35,10 +37,17 @@ Display *theDisplay = NULL; /* connection to server * GC vecGC, strGC; Window gwind; +static void init(char *pname, char *wname); +static void circle_sources(FILE *fp); +static void circle(FVECT dir, double dom); +static void value(FVECT dir, double v); -main(argc, argv) -int argc; -char *argv[]; + +int +main( + int argc, + char *argv[] +) { char *windowname = NULL; FILE *fp; @@ -77,8 +86,11 @@ char *argv[]; } -init(pname, wname) /* get view and find window */ -char *pname, *wname; +static void +init( /* get view and find window */ + char *pname, + char *wname +) { extern Window xfindwind(); XWindowAttributes wa; @@ -117,7 +129,7 @@ char *pname, *wname; exit(2); } /* start ximage */ - if (vfork() == 0) { + if (fork() == 0) { execlp(XIM, XIM, "-c", "256", pname, 0); perror(XIM); fprintf(stderr, "%s: cannot start %s\n", @@ -177,8 +189,10 @@ char *pname, *wname; } -circle_sources(fp) /* circle sources listed in fp */ -FILE *fp; +static void +circle_sources( /* circle sources listed in fp */ + FILE *fp +) { char linbuf[256]; int reading = 0; @@ -205,9 +219,11 @@ FILE *fp; } -circle(dir, dom) /* indicate a solid angle on image */ -FVECT dir; -double dom; +static void +circle( /* indicate a solid angle on image */ + FVECT dir, + double dom +) { FVECT start, cur; XPoint pt[NSEG+1]; @@ -224,8 +240,7 @@ double dom; cur[0] += ourview.vp[0]; cur[1] += ourview.vp[1]; cur[2] += ourview.vp[2]; - viewloc(pp, &ourview, cur); - if (pp[2] <= 0.0) + if (viewloc(pp, &ourview, cur) <= 0) goto fail; loc2pix(ip, &pres, pp[0], pp[1]); pt[i].x = ip[0]; @@ -239,9 +254,11 @@ fail: } -value(dir, v) /* print value on image */ -FVECT dir; -double v; +static void +value( /* print value on image */ + FVECT dir, + double v +) { FVECT pos; FVECT pp; @@ -251,8 +268,7 @@ double v; pos[0] = ourview.vp[0] + dir[0]; pos[1] = ourview.vp[1] + dir[1]; pos[2] = ourview.vp[2] + dir[2]; - viewloc(pp, &ourview, pos); - if (pp[2] <= 0.0) + if (viewloc(pp, &ourview, pos) <= 0) return; loc2pix(ip, &pres, pp[0], pp[1]); sprintf(buf, "%.0f", v);