--- ray/src/gen/mkillum.c 1997/10/20 16:37:14 2.10 +++ ray/src/gen/mkillum.c 2003/06/27 22:27:45 2.15 @@ -1,19 +1,16 @@ -/* Copyright (c) 1995 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: mkillum.c,v 2.15 2003/06/27 22:27:45 greg Exp $"; #endif - /* * Make illum sources for optimizing rendering process */ -#include "mkillum.h" - #include - #include +#include "mkillum.h" +#include "platform.h" + /* default parameters */ #define SAMPDENS 48 /* points per projected steradian */ #define NSAMPS 32 /* samples per point */ @@ -60,16 +57,11 @@ int doneheader = 0; /* printed header yet? */ int warnings = 1; /* print warnings? */ -extern char *fgetline(), *fgetword(), *sskip(), - *atos(), *iskip(), *fskip(), *strcpy(); -extern FILE *popen(); - main(argc, argv) /* compute illum distributions using rtrace */ int argc; char *argv[]; { - extern char *getenv(), *getpath(); char *rtpath; FILE *fp; register int i; @@ -138,12 +130,13 @@ char *argv[]; } +void quit(status) /* exit with status */ int status; { int rtstat; - rtstat = close_process(rt.pd); + rtstat = close_process(&(rt.pd)); if (status == 0) if (rtstat < 0) error(WARNING, @@ -163,10 +156,12 @@ init() /* start rtrace and set up buffers */ ofun[OBJ_SPHERE].funp = o_sphere; ofun[OBJ_RING].funp = o_ring; /* set up signal handling */ +#ifdef SIGPIPE /* not present on Windows */ signal(SIGPIPE, quit); +#endif /* start rtrace process */ errno = 0; - maxbytes = open_process(rt.pd, rtargv); + maxbytes = open_process(&(rt.pd), rtargv); if (maxbytes == 0) { eputs(rtargv[0]); eputs(": command not found\n"); @@ -185,6 +180,7 @@ init() /* start rtrace and set up buffers */ } +void eputs(s) /* put string to stderr */ register char *s; { @@ -200,6 +196,7 @@ register char *s; } +void wputs(s) /* print warning if enabled */ char *s; { @@ -259,6 +256,8 @@ char *nm; case ' ': case '\t': case '\n': + case '\r': + case '\f': cp++; continue; case 'm': /* material name */ @@ -326,7 +325,7 @@ char *nm; case 'd': /* point sample density */ if (*++cp != '=') break; - if (!isintd(++cp, " \t\n")) + if (!isintd(++cp, " \t\n\r")) break; thisillum.sampdens = atoi(cp); cp = sskip(cp); @@ -334,7 +333,7 @@ char *nm; case 's': /* point super-samples */ if (*++cp != '=') break; - if (!isintd(++cp, " \t\n")) + if (!isintd(++cp, " \t\n\r")) break; thisillum.nsamps = atoi(cp); cp = sskip(cp); @@ -352,7 +351,7 @@ char *nm; case 'b': /* brightness */ if (*++cp != '=') break; - if (!isfltd(++cp, " \t\n")) + if (!isfltd(++cp, " \t\n\r")) break; thisillum.minbrt = atof(cp); if (thisillum.minbrt < 0.) @@ -447,10 +446,10 @@ char *nm; if (fgetword(str, MAXSTR, fp) == NULL) goto readerr; /* is it an alias? */ - if (!strcmp(str, ALIASID)) { + if (!strcmp(str, ALIASKEY)) { if (fgetword(str, MAXSTR, fp) == NULL) goto readerr; - printf("\n%s %s %s", thisillum.altmat, ALIASID, str); + printf("\n%s %s %s", thisillum.altmat, ALIASKEY, str); if (fgetword(str, MAXSTR, fp) == NULL) goto readerr; printf("\t%s\n", str);