--- ray/src/common/calfunc.c 1992/05/18 14:15:49 2.3 +++ ray/src/common/calfunc.c 1992/10/02 15:58:31 2.5 @@ -20,6 +20,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include +#include + #include "calcomp.h" /* bits in argument flag (better be right!) */ @@ -337,6 +339,9 @@ char *fname; #ifndef VARIABLE +static VARDEF *varlist = NULL; /* our list of dummy variables */ + + VARDEF * varinsert(vname) /* dummy variable insert */ char *vname; @@ -347,8 +352,9 @@ char *vname; vp->name = savestr(vname); vp->nlinks = 1; vp->def = NULL; - vp->lib = NULL; - vp->next = NULL; + vp->lib = liblookup(vname); + vp->next = varlist; + varlist = vp; return(vp); } @@ -356,9 +362,28 @@ char *vname; varfree(vp) /* free dummy variable */ register VARDEF *vp; { + register VARDEF *vp2; + + if (vp == varlist) + varlist = vp->next; + else { + for (vp2 = varlist; vp2->next != vp; vp2 = vp2->next) + ; + vp2->next = vp->next; + } freestr(vp->name); efree((char *)vp); } + + +libupdate(nm) /* update library */ +char *nm; +{ + register VARDEF *vp; + + for (vp = varlist; vp != NULL; vp = vp->next) + vp->lib = liblookup(vp->name); +} #endif @@ -446,7 +471,6 @@ l_select() /* return argument #(A1+1) */ static double l_rand() /* random function between 0 and 1 */ { - extern double floor(); double x; x = argument(1); @@ -460,8 +484,6 @@ l_rand() /* random function between 0 and 1 */ static double l_floor() /* return largest integer not greater than arg1 */ { - extern double floor(); - return(floor(argument(1))); } @@ -469,8 +491,6 @@ l_floor() /* return largest integer not greater than static double l_ceil() /* return smallest integer not less than arg1 */ { - extern double ceil(); - return(ceil(argument(1))); } @@ -479,8 +499,6 @@ l_ceil() /* return smallest integer not less than arg static double l_sqrt() { - extern double sqrt(); - return(sqrt(argument(1))); } @@ -488,8 +506,6 @@ l_sqrt() static double l_sin() { - extern double sin(); - return(sin(argument(1))); } @@ -497,8 +513,6 @@ l_sin() static double l_cos() { - extern double cos(); - return(cos(argument(1))); } @@ -506,8 +520,6 @@ l_cos() static double l_tan() { - extern double tan(); - return(tan(argument(1))); } @@ -515,8 +527,6 @@ l_tan() static double l_asin() { - extern double asin(); - return(asin(argument(1))); } @@ -524,8 +534,6 @@ l_asin() static double l_acos() { - extern double acos(); - return(acos(argument(1))); } @@ -533,8 +541,6 @@ l_acos() static double l_atan() { - extern double atan(); - return(atan(argument(1))); } @@ -542,8 +548,6 @@ l_atan() static double l_atan2() { - extern double atan2(); - return(atan2(argument(1), argument(2))); } @@ -551,8 +555,6 @@ l_atan2() static double l_exp() { - extern double exp(); - return(exp(argument(1))); } @@ -560,8 +562,6 @@ l_exp() static double l_log() { - extern double log(); - return(log(argument(1))); } @@ -569,8 +569,6 @@ l_log() static double l_log10() { - extern double log10(); - return(log10(argument(1))); } #endif