--- ray/src/rt/rv2.c 2003/02/22 02:07:29 2.38
+++ ray/src/rt/rv2.c 2003/07/21 22:30:19 2.42
@@ -1,5 +1,5 @@
#ifndef lint
-static const char RCSid[] = "$Id: rv2.c,v 2.38 2003/02/22 02:07:29 greg Exp $";
+static const char RCSid[] = "$Id: rv2.c,v 2.42 2003/07/21 22:30:19 schorsch Exp $";
#endif
/*
* rv2.c - command routines used in tracing a view.
@@ -7,71 +7,16 @@ static const char RCSid[] = "$Id: rv2.c,v 2.38 2003/02
* External symbols declared in rpaint.h
*/
-/* ====================================================================
- * The Radiance Software License, Version 1.0
- *
- * Copyright (c) 1990 - 2002 The Regents of the University of California,
- * through Lawrence Berkeley National Laboratory. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes Radiance software
- * (http://radsite.lbl.gov/)
- * developed by the Lawrence Berkeley National Laboratory
- * (http://www.lbl.gov/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
- * and "The Regents of the University of California" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact radiance@radsite.lbl.gov.
- *
- * 5. Products derived from this software may not be called "Radiance",
- * nor may "Radiance" appear in their name, without prior written
- * permission of Lawrence Berkeley National Laboratory.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of Lawrence Berkeley National Laboratory. For more
- * information on Lawrence Berkeley National Laboratory, please see
- * .
- */
+#include "copyright.h"
-#include "ray.h"
+#include
+#include
+#include "platform.h"
+#include "ray.h"
#include "otypes.h"
-
#include "rpaint.h"
-#include
-
extern int psample; /* pixel sample size */
extern double maxdiff; /* max. sample difference */
@@ -124,7 +69,7 @@ char *s;
while (isspace(*s))
s++;
if (*s == '-') { /* command line parameters */
- copystruct(&nv, &ourview);
+ nv = ourview;
if (sscanview(&nv, s))
newview(&nv);
else
@@ -226,7 +171,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);
@@ -243,9 +188,9 @@ char *s;
error(COMMAND, "no previous view");
return;
}
- copystruct(&nv, &ourview);
- copystruct(&ourview, &oldview);
- copystruct(&oldview, &nv);
+ nv = ourview;
+ ourview = oldview;
+ oldview = nv;
newimage();
}
@@ -320,7 +265,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;
@@ -519,10 +464,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) {
@@ -809,9 +754,7 @@ char *s;
error(COMMAND, errmsg);
return;
}
-#ifdef MSDOS
- setmode(fileno(fp), O_BINARY);
-#endif
+ SET_FILE_BINARY(fp);
(*dev->comout)("writing \"");
(*dev->comout)(fname);
(*dev->comout)("\"...\n");