--- ray/src/rt/rv2.c 2003/06/05 19:29:34 2.40 +++ ray/src/rt/rv2.c 2004/03/30 16:13:01 2.43 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rv2.c,v 2.40 2003/06/05 19:29:34 schorsch Exp $"; +static const char RCSid[] = "$Id: rv2.c,v 2.43 2004/03/30 16:13:01 schorsch Exp $"; #endif /* * rv2.c - command routines used in tracing a view. @@ -7,12 +7,14 @@ static const char RCSid[] = "$Id: rv2.c,v 2.40 2003/06 * External symbols declared in rpaint.h */ -#include - #include "copyright.h" +#include +#include + #include "platform.h" #include "ray.h" +#include "ambient.h" #include "otypes.h" #include "rpaint.h" @@ -33,9 +35,10 @@ extern char *progname; extern char *octname; -void -getframe(s) /* get a new frame */ -char *s; +extern void +getframe( /* get a new frame */ + char *s +) { if (getrect(s, &pframe) < 0) return; @@ -43,9 +46,10 @@ char *s; } -void -getrepaint(s) /* get area and repaint */ -char *s; +extern void +getrepaint( /* get area and repaint */ + char *s +) { RECT box; @@ -55,9 +59,10 @@ char *s; } -void -getview(s) /* get/show view parameters */ -char *s; +extern void +getview( /* get/show view parameters */ + char *s +) { FILE *fp; char buf[128]; @@ -68,7 +73,7 @@ char *s; while (isspace(*s)) s++; if (*s == '-') { /* command line parameters */ - copystruct(&nv, &ourview); + nv = ourview; if (sscanview(&nv, s)) newview(&nv); else @@ -160,9 +165,10 @@ char *s; } -void -lastview(s) /* return to a previous view */ -char *s; +extern void +lastview( /* return to a previous view */ + char *s +) { char buf[128]; char *fname; @@ -170,7 +176,7 @@ char *s; VIEW nv; if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ - copystruct(&nv, &stdview); + nv = stdview; if ((fname = getpath(buf, "", R_OK)) == NULL || (success = viewfile(fname, &nv, NULL)) == -1) { sprintf(errmsg, "cannot open \"%s\"", buf); @@ -187,16 +193,17 @@ char *s; error(COMMAND, "no previous view"); return; } - copystruct(&nv, &ourview); - copystruct(&ourview, &oldview); - copystruct(&oldview, &nv); + nv = ourview; + ourview = oldview; + oldview = nv; newimage(); } -void -saveview(s) /* save view to rad file */ -char *s; +extern void +saveview( /* save view to rad file */ + char *s +) { char view[64]; char *fname; @@ -231,9 +238,10 @@ char *s; } -void -loadview(s) /* load view from rad file */ -char *s; +extern void +loadview( /* load view from rad file */ + char *s +) { char buf[512]; char *fname; @@ -264,7 +272,7 @@ char *s; buf[0] = '\0'; fgets(buf, sizeof(buf), fp); pclose(fp); - copystruct(&nv, &stdview); + nv = stdview; if (!sscanview(&nv, buf)) { error(COMMAND, "rad error -- no such view?"); return; @@ -273,9 +281,10 @@ char *s; } -void -getaim(s) /* aim camera */ -char *s; +extern void +getaim( /* aim camera */ + char *s +) { double zfact; VIEW nv; @@ -293,9 +302,10 @@ char *s; } -void -getmove(s) /* move camera */ -char *s; +extern void +getmove( /* move camera */ + char *s +) { FVECT vc; double mag; @@ -306,9 +316,10 @@ char *s; } -void -getrotate(s) /* rotate camera */ -char *s; +extern void +getrotate( /* rotate camera */ + char *s +) { VIEW nv; FVECT v1; @@ -336,9 +347,10 @@ char *s; } -void -getpivot(s) /* pivot viewpoint */ -register char *s; +extern void +getpivot( /* pivot viewpoint */ + register char *s +) { FVECT vc; double angle, elev, mag; @@ -354,9 +366,10 @@ register char *s; } -void -getexposure(s) /* get new exposure */ -char *s; +extern void +getexposure( /* get new exposure */ + char *s +) { char buf[128]; register char *cp; @@ -422,11 +435,13 @@ char *s; typedef union {int i; double d; COLOR C;} *MyUptr; -int -getparam(str, dsc, typ, p) /* get variable from user */ -char *str, *dsc; -int typ; -void *p; +extern int +getparam( /* get variable from user */ + char *str, + char *dsc, + int typ, + void *p +) { register MyUptr ptr = (MyUptr)p; int i0; @@ -463,10 +478,10 @@ void *p; (*dev->comout)(buf); (*dev->comin)(buf, NULL); if (buf[0] == '\0' || - index("yY+1tTnN-0fF", buf[0]) == NULL) + strchr("yY+1tTnN-0fF", buf[0]) == NULL) return(0); } - ptr->i = index("yY+1tT", buf[0]) != NULL; + ptr->i = strchr("yY+1tT", buf[0]) != NULL; return(1); case 'C': /* color */ if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) { @@ -483,12 +498,14 @@ void *p; setcolor(ptr->C, d0, d1, d2); return(1); } + return 0; /* nothing matched */ } -void -setparam(s) /* get/set program parameter */ -register char *s; +extern void +setparam( /* get/set program parameter */ + register char *s +) { char buf[128]; @@ -660,7 +677,7 @@ badparam: } -void +extern void traceray(s) /* trace a single ray */ char *s; { @@ -729,7 +746,7 @@ char *s; } -void +extern void writepict(s) /* write the picture to a file */ char *s; {