--- ray/src/cv/mgf2rad.c 1995/04/14 19:03:20 2.16 +++ ray/src/cv/mgf2rad.c 1996/02/27 20:11:27 2.21 @@ -1,4 +1,4 @@ -/* Copyright (c) 1994 Regents of the University of California */ +/* Copyright (c) 1996 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -33,7 +33,9 @@ main(argc, argv) /* convert files to stdout */ int argc; char *argv[]; { - int i, rv; + int i; + /* print out parser version */ + printf("## Translated from MGF Version %d.%d\n", MG_VMAJOR, MG_VMINOR); /* initialize dispatch table */ mg_ehand[MG_E_COMMENT] = r_comment; /* we pass comments */ mg_ehand[MG_E_COLOR] = c_hcolor; /* they get color */ @@ -92,14 +94,22 @@ char *argv[]; } putchar('\n'); if (i == argc) { /* convert stdin */ - if ((rv = mg_load(NULL)) != MG_OK) + if (mg_load(NULL) != MG_OK) exit(1); + if (mg_nunknown) + printf("## %s: %u unknown entities\n", + argv[0], mg_nunknown); } else /* convert each file */ for ( ; i < argc; i++) { printf("## %s %s ##############################\n", argv[0], argv[i]); - if ((rv = mg_load(argv[i])) != MG_OK) + if (mg_load(argv[i]) != MG_OK) exit(1); + if (mg_nunknown) { + printf("## %s %s: %u unknown entities\n", + argv[0], argv[i], mg_nunknown); + mg_nunknown = 0; + } } exit(0); userr: @@ -345,7 +355,7 @@ char **av; op = fname + strlen(fname); (void)strcpy(op, ".rad"); /* see if we need to run ies2rad */ - if (access(op, 0) == -1) { + if (access(fname, 0) == -1) { (void)strcpy(combuf, "ies2rad");/* build ies2rad command */ op = combuf + 7; /* get -m option (first) */ if (ac-xa0 >= 2 && !strcmp(av[xa0], "-m")) { @@ -529,8 +539,7 @@ material() /* get (and print) current material */ return(mname); } /* check for plastic */ - if (c_cmaterial->rs < .1 && (c_cmaterial->rs < .01 || - c_isgrey(&c_cmaterial->rs_c))) { + if (c_cmaterial->rs < .1) { cvtcolor(radrgb, &c_cmaterial->rd_c, c_cmaterial->rd/(1.-c_cmaterial->rs)); fprintf(matfp, "\nvoid plastic %s\n0\n0\n", mname);