1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
33 |
|
int argc; |
34 |
|
char *argv[]; |
35 |
|
{ |
36 |
< |
int i, rv; |
36 |
> |
int i; |
37 |
> |
/* print out parser version */ |
38 |
> |
printf("## Translated from MGF Version %d.%d\n", MG_VMAJOR, MG_VMINOR); |
39 |
|
/* initialize dispatch table */ |
40 |
|
mg_ehand[MG_E_COMMENT] = r_comment; /* we pass comments */ |
41 |
|
mg_ehand[MG_E_COLOR] = c_hcolor; /* they get color */ |
94 |
|
} |
95 |
|
putchar('\n'); |
96 |
|
if (i == argc) { /* convert stdin */ |
97 |
< |
if ((rv = mg_load(NULL)) != MG_OK) |
97 |
> |
if (mg_load(NULL) != MG_OK) |
98 |
|
exit(1); |
99 |
+ |
if (mg_nunknown) |
100 |
+ |
printf("## %s: %u unknown entities\n", |
101 |
+ |
argv[0], mg_nunknown); |
102 |
|
} else /* convert each file */ |
103 |
|
for ( ; i < argc; i++) { |
104 |
|
printf("## %s %s ##############################\n", |
105 |
|
argv[0], argv[i]); |
106 |
< |
if ((rv = mg_load(argv[i])) != MG_OK) |
106 |
> |
if (mg_load(argv[i]) != MG_OK) |
107 |
|
exit(1); |
108 |
+ |
if (mg_nunknown) { |
109 |
+ |
printf("## %s %s: %u unknown entities\n", |
110 |
+ |
argv[0], argv[i], mg_nunknown); |
111 |
+ |
mg_nunknown = 0; |
112 |
+ |
} |
113 |
|
} |
114 |
|
exit(0); |
115 |
|
userr: |
348 |
|
if (ac < 2) |
349 |
|
return(MG_EARGC); |
350 |
|
/* construct output file name */ |
351 |
< |
if ((op = strrchr(av[1], '/')) == NULL) |
351 |
> |
if ((op = strrchr(av[1], '/')) != NULL) |
352 |
> |
op++; |
353 |
> |
else |
354 |
|
op = av[1]; |
355 |
|
(void)strcpy(fname, op); |
356 |
|
if ((op = strrchr(fname, '.')) == NULL) |
357 |
|
op = fname + strlen(fname); |
358 |
|
(void)strcpy(op, ".rad"); |
359 |
|
/* see if we need to run ies2rad */ |
360 |
< |
if (access(op, 0) == -1) { |
360 |
> |
if (access(fname, 0) == -1) { |
361 |
|
(void)strcpy(combuf, "ies2rad");/* build ies2rad command */ |
362 |
|
op = combuf + 7; /* get -m option (first) */ |
363 |
|
if (ac-xa0 >= 2 && !strcmp(av[xa0], "-m")) { |
541 |
|
return(mname); |
542 |
|
} |
543 |
|
/* check for plastic */ |
544 |
< |
if (c_cmaterial->rs < .1 && (c_cmaterial->rs < .01 || |
533 |
< |
c_isgrey(&c_cmaterial->rs_c))) { |
544 |
> |
if (c_cmaterial->rs < .1) { |
545 |
|
cvtcolor(radrgb, &c_cmaterial->rd_c, |
546 |
|
c_cmaterial->rd/(1.-c_cmaterial->rs)); |
547 |
|
fprintf(matfp, "\nvoid plastic %s\n0\n0\n", mname); |