예제 #1
0
static void
init(void)					/* perform final setup */
{
	register int	i;
						/* define constants */
	varset("PI", ':', PI);
	varset(vnfiles, ':', (double)nfiles);
	varset(vxmax, ':', (double)xmax);
	varset(vymax, ':', (double)ymax);
						/* set functions */
	for (i = 0; i < 3; i++) {
		funset(vcolexp[i], 1, ':', l_expos);
		funset(vcolin[i], 1, '=', l_colin);
	}
	funset(vbrtexp, 1, ':', l_expos);
	funset(vbrtin, 1, '=', l_colin);
	funset(vpixaspect, 1, ':', l_pixaspect);
	for (i = 0; i < 7; i++)
		funset(vray[i], 1, '=', l_ray);
	funset(vpsize, 1, '=', l_psize);
						/* set brightness function */
	if (!strcmp(ourfmt, CIEFMT)) {
		varset(vwhteff, ':', 1.0);
		ourbright = xyz_bright;
	} else
		varset(vwhteff, ':', WHTEFFICACY);
}
예제 #2
0
void
biggerlib()			/* expand the library */
{
				/* the Bessel functions */
    funset("j0", 1, ':', l_j0);
    funset("j1", 1, ':', l_j1);
    funset("jn", 2, ':', l_jn);
    funset("y0", 1, ':', l_y0);
    funset("y1", 1, ':', l_y1);
    funset("yn", 2, ':', l_yn);
    funset("erf", 1, ':', l_erf);
    funset("erfc", 1, ':', l_erfc);
}
예제 #3
0
파일: rcalc.c 프로젝트: Pizookies/Radiance
int
main(
int  argc,
char  *argv[]
)
{
	int  i;

	esupport |= E_VARIABLE|E_FUNCTION|E_INCHAN|E_OUTCHAN|E_RCONST;
	esupport &= ~(E_REDEFW);

#ifdef  BIGGERLIB
	biggerlib();
#endif
	varset("PI", ':', 3.14159265358979323846);
	funset("in", 1, '=', &l_in);

	for (i = 1; i < argc && argv[i][0] == '-'; i++)
		switch (argv[i][1]) {
		case 'b':
			blnkeq = !blnkeq;
			break;
		case 'l':
			igneol = !igneol;
			break;
		case 'p':
			passive = !passive;
			break;
		case 't':
			sepchar = argv[i][2];
			break;
		case 's':
			svpreset(argv[++i]);
			break;
		case 'f':
			fcompile(argv[++i]);
			break;
		case 'e':
			scompile(argv[++i], NULL, 0);
			break;
		case 'n':
			noinput = 1;
			break;
		case 'i':
			switch (argv[i][2]) {
			case '\0':
				itype = 'a';
				nbicols = 0;
				readfmt(argv[++i], 0);
				break;
			case 'a':
				itype = 'a';
				nbicols = 0;
				break;
			case 'd':
			case 'D':
				itype = argv[i][2];
				if (isdigit(argv[i][3]))
					nbicols = atoi(argv[i]+3);
				else
					nbicols = 1;
				if (nbicols*sizeof(double) > INBSIZ) {
					eputs(argv[0]);
					eputs(": too many input columns\n");
					quit(1);
				}
				break;
			case 'f':
			case 'F':
				itype = argv[i][2];
				if (isdigit(argv[i][3]))
					nbicols = atoi(argv[i]+3);
				else
					nbicols = 1;
				if (nbicols*sizeof(float) > INBSIZ) {
					eputs(argv[0]);
					eputs(": too many input columns\n");
					quit(1);
				}
				break;
			default:
				goto userr;
			}
			break;
		case 'o':
			switch (argv[i][2]) {
			case '\0':
				otype = 'a';
				readfmt(argv[++i], 1);
				break;
			case 'a':
				otype = 'a';
				break;
			case 'd':
			case 'D':
			case 'f':
			case 'F':
				otype = argv[i][2];
				break;
			default:
				goto userr;
			}
			break;
		case 'w':
			nowarn = !nowarn;
			break;
		case 'u':
			unbuff = !unbuff;
			break;
		default:;
		userr:
			eputs("Usage: ");
			eputs(argv[0]);
eputs(" [-b][-l][-n][-p][-w][-u][-tS][-s svar=sval][-e expr][-f source][-i infmt][-o outfmt] [file]\n");
			quit(1);
		}
	if (otype != 'a')
		SET_FILE_BINARY(stdout);
	if (noinput) {          /* produce a single output record */
		if (i < argc) {
			eputs(argv[0]);
			eputs(": file argument(s) incompatible with -n\n");
			quit(1);
		}
		eclock++;
		putout();
		quit(0);
	}
	if (itype != 'a')
		SET_FILE_BINARY(stdin);

	if (blnkeq)             /* for efficiency */
		nbsynch();

	if (i == argc)          /* from stdin */
		execute(NULL);
	else                    /* from one or more files */
		for ( ; i < argc; i++)
			execute(argv[i]);
	
	quit(0);
	return 0; /* pro forma return */
}