--- ray/src/rt/data.c 2003/02/25 02:47:22 2.16 +++ ray/src/rt/data.c 2004/01/02 11:43:42 2.26 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: data.c,v 2.16 2003/02/25 02:47:22 greg Exp $"; +static const char RCSid[] = "$Id: data.c,v 2.26 2004/01/02 11:43:42 schorsch Exp $"; #endif /* * data.c - routines dealing with interpolated data. @@ -7,20 +7,20 @@ static const char RCSid[] = "$Id: data.c,v 2.16 2003/0 #include "copyright.h" -#include "standard.h" +#include +#include "platform.h" +#include "standard.h" #include "color.h" - #include "resolu.h" - #include "data.h" /* picture memory usage before warning */ #ifndef PSIZWARN -#ifdef BIGMEM -#define PSIZWARN 5000000 -#else +#ifdef SMLMEM #define PSIZWARN 1500000 +#else +#define PSIZWARN 5000000 #endif #endif @@ -33,7 +33,9 @@ static const char RCSid[] = "$Id: data.c,v 2.16 2003/0 static DATARRAY *dtab[TABSIZ]; /* data array list */ +static gethfunc headaspect; + DATARRAY * getdata(dname) /* get data array dname */ char *dname; @@ -67,7 +69,7 @@ char *dname; * 0 0 ni p0i p1i .. pni */ - if ((dfname = getpath(dname, getlibpath(), R_OK)) == NULL) { + if ((dfname = getpath(dname, getrlibpath(), R_OK)) == NULL) { sprintf(errmsg, "cannot find data file \"%s\"", dname); error(USER, errmsg); } @@ -78,7 +80,7 @@ char *dname; /* get dimensions */ if (fgetval(fp, 'i', (char *)&asize) <= 0) goto scanerr; - if (asize <= 0 | asize > MAXDDIM) { + if ((asize <= 0) | (asize > MAXDDIM)) { sprintf(errmsg, "bad number of dimensions for \"%s\"", dname); error(USER, errmsg); } @@ -138,16 +140,17 @@ scanerr: static int -headaspect(s, iap) /* check string for aspect ratio */ -char *s; -double *iap; +headaspect( /* check string for aspect ratio */ + char *s, + void *iap +) { char fmt[32]; if (isaspect(s)) - *iap *= aspectval(s); + *(double*)iap *= aspectval(s); else if (formatval(fmt, s) && !globmatch(PICFMT, fmt)) - *iap = 0.0; + *(double*)iap = 0.0; return(0); } @@ -162,7 +165,7 @@ char *pname; COLR *scanin; int sl, ns; RESOLU inpres; - FLOAT loc[2]; + RREAL loc[2]; int y; register int x, i; register DATARRAY *pp; @@ -171,7 +174,7 @@ char *pname; if (!strcmp(pname, pp->name)) return(pp); /* found! */ - if ((pfname = getpath(pname, getlibpath(), R_OK)) == NULL) { + if ((pfname = getpath(pname, getrlibpath(), R_OK)) == NULL) { sprintf(errmsg, "cannot find picture file \"%s\"", pname); error(USER, errmsg); } @@ -184,12 +187,10 @@ char *pname; sprintf(errmsg, "cannot open picture file \"%s\"", pfname); error(SYSTEM, errmsg); } -#ifdef MSDOS - setmode(fileno(fp), O_BINARY); -#endif + SET_FILE_BINARY(fp); /* get dimensions */ inpaspect = 1.0; - getheader(fp, headaspect, (char *)&inpaspect); + getheader(fp, headaspect, &inpaspect); if (inpaspect <= FTINY || !fgetsresolu(&inpres, fp)) goto readerr; pp[0].nd = 2; @@ -236,8 +237,8 @@ char *pname; fclose(fp); i = hash(pname); pp[0].next = dtab[i]; /* link into picture list */ - copystruct(&pp[1], &pp[0]); - copystruct(&pp[2], &pp[0]); + pp[1] = pp[0]; + pp[2] = pp[0]; pp[0].type = RED; /* differentiate RGB records */ pp[1].type = GRN; pp[2].type = BLU; @@ -269,7 +270,7 @@ DATARRAY *dta; head.next = dtab[hval]; dpl = &head; while ((dp = dpl->next) != NULL) - if ((dta == NULL | dta == dp)) { + if ((dta == NULL) | (dta == dp)) { dpl->next = dp->next; if (dp->type == DATATY) free((void *)dp->arr.d);