--- ray/src/common/caldefn.c 1989/02/02 10:34:26 1.1 +++ ray/src/common/caldefn.c 1990/07/19 11:06:37 1.4 @@ -16,6 +16,8 @@ static char SCCSid[] = "$SunId$ LBL"; * 1/15/88 Added clock for caching of variable values. * * 11/16/88 Added VARDEF structure for hard linking. + * + * 5/31/90 Added conditional compile (REDEFW) for redefinition warning. */ #include @@ -32,7 +34,7 @@ static char SCCSid[] = "$SunId$ LBL"; extern char *ecalloc(), *savestr(); -extern double dvalue(); +static double dvalue(); long eclock = -1; /* value storage timer */ @@ -66,7 +68,7 @@ char *fname; eputs(": cannot open\n"); quit(1); } - initfile(fname, fp); + initfile(fp, fname, 0); while (nextc != EOF) loaddefn(); if (fname != NULL) @@ -74,11 +76,12 @@ char *fname; } -scompile(file, str) /* get definitions from a string */ -char *file; +scompile(str, fn, ln) /* get definitions from a string */ char *str; +char *fn; +int ln; { - initstr(file, str); + initstr(str, fn, ln); while (nextc != EOF) loaddefn(); } @@ -370,7 +373,15 @@ loaddefn() /* load next definition */ #endif { /* ordinary definition */ ep = getdefn(); +#ifdef REDEFW + if (dlookup(dname(ep)) != NULL) { + dclear(dname(ep)); + wputs(dname(ep)); + wputs(": redefined\n"); + } +#else dclear(dname(ep)); +#endif dpush(ep); } if (nextc != EOF) {