7 |
|
|
8 |
|
#include "copyright.h" |
9 |
|
|
10 |
< |
#include "standard.h" |
10 |
> |
#include <time.h> |
11 |
> |
|
12 |
|
#include "platform.h" |
13 |
+ |
#include "paths.h" |
14 |
+ |
#include "standard.h" |
15 |
|
#include "color.h" |
16 |
|
#include "resolu.h" |
17 |
+ |
#include "view.h" |
18 |
|
#include "data.h" |
19 |
|
|
20 |
|
/* picture memory usage before warning */ |
35 |
|
|
36 |
|
static DATARRAY *dtab[TABSIZ]; /* data array list */ |
37 |
|
|
38 |
+ |
static gethfunc headaspect; |
39 |
|
|
40 |
< |
DATARRAY * |
41 |
< |
getdata(dname) /* get data array dname */ |
42 |
< |
char *dname; |
40 |
> |
|
41 |
> |
extern DATARRAY * |
42 |
> |
getdata( /* get data array dname */ |
43 |
> |
char *dname |
44 |
> |
) |
45 |
|
{ |
46 |
|
char *dfname; |
47 |
|
FILE *fp; |
83 |
|
/* get dimensions */ |
84 |
|
if (fgetval(fp, 'i', (char *)&asize) <= 0) |
85 |
|
goto scanerr; |
86 |
< |
if (asize <= 0 | asize > MAXDDIM) { |
86 |
> |
if ((asize <= 0) | (asize > MAXDDIM)) { |
87 |
|
sprintf(errmsg, "bad number of dimensions for \"%s\"", dname); |
88 |
|
error(USER, errmsg); |
89 |
|
} |
139 |
|
sprintf(errmsg, "%s in data file \"%s\"", |
140 |
|
feof(fp) ? "unexpected EOF" : "bad format", dfname); |
141 |
|
error(USER, errmsg); |
142 |
+ |
return NULL; /* pro forma return */ |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
static int |
147 |
< |
headaspect(s, iap) /* check string for aspect ratio */ |
148 |
< |
char *s; |
149 |
< |
double *iap; |
147 |
> |
headaspect( /* check string for aspect ratio */ |
148 |
> |
char *s, |
149 |
> |
void *iap |
150 |
> |
) |
151 |
|
{ |
152 |
|
char fmt[32]; |
153 |
|
|
154 |
|
if (isaspect(s)) |
155 |
< |
*iap *= aspectval(s); |
155 |
> |
*(double*)iap *= aspectval(s); |
156 |
|
else if (formatval(fmt, s) && !globmatch(PICFMT, fmt)) |
157 |
< |
*iap = 0.0; |
157 |
> |
*(double*)iap = 0.0; |
158 |
|
return(0); |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
< |
DATARRAY * |
163 |
< |
getpict(pname) /* get picture pname */ |
164 |
< |
char *pname; |
162 |
> |
extern DATARRAY * |
163 |
> |
getpict( /* get picture pname */ |
164 |
> |
char *pname |
165 |
> |
) |
166 |
|
{ |
167 |
|
double inpaspect; |
168 |
|
char *pfname; |
195 |
|
SET_FILE_BINARY(fp); |
196 |
|
/* get dimensions */ |
197 |
|
inpaspect = 1.0; |
198 |
< |
getheader(fp, headaspect, (char *)&inpaspect); |
198 |
> |
getheader(fp, headaspect, &inpaspect); |
199 |
|
if (inpaspect <= FTINY || !fgetsresolu(&inpres, fp)) |
200 |
|
goto readerr; |
201 |
|
pp[0].nd = 2; |
242 |
|
fclose(fp); |
243 |
|
i = hash(pname); |
244 |
|
pp[0].next = dtab[i]; /* link into picture list */ |
245 |
< |
copystruct(&pp[1], &pp[0]); |
246 |
< |
copystruct(&pp[2], &pp[0]); |
245 |
> |
pp[1] = pp[0]; |
246 |
> |
pp[2] = pp[0]; |
247 |
|
pp[0].type = RED; /* differentiate RGB records */ |
248 |
|
pp[1].type = GRN; |
249 |
|
pp[2].type = BLU; |
254 |
|
readerr: |
255 |
|
sprintf(errmsg, "bad picture file \"%s\"", pfname); |
256 |
|
error(USER, errmsg); |
257 |
+ |
return NULL; /* pro forma return */ |
258 |
|
} |
259 |
|
|
260 |
|
|
261 |
< |
void |
262 |
< |
freedata(dta) /* release data array reference */ |
263 |
< |
DATARRAY *dta; |
261 |
> |
extern void |
262 |
> |
freedata( /* release data array reference */ |
263 |
> |
DATARRAY *dta |
264 |
> |
) |
265 |
|
{ |
266 |
|
DATARRAY head; |
267 |
|
int hval, nents; |
277 |
|
head.next = dtab[hval]; |
278 |
|
dpl = &head; |
279 |
|
while ((dp = dpl->next) != NULL) |
280 |
< |
if ((dta == NULL | dta == dp)) { |
280 |
> |
if ((dta == NULL) | (dta == dp)) { |
281 |
|
dpl->next = dp->next; |
282 |
|
if (dp->type == DATATY) |
283 |
|
free((void *)dp->arr.d); |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
< |
double |
299 |
< |
datavalue(dp, pt) /* interpolate data value at a point */ |
300 |
< |
register DATARRAY *dp; |
301 |
< |
double *pt; |
298 |
> |
extern double |
299 |
> |
datavalue( /* interpolate data value at a point */ |
300 |
> |
register DATARRAY *dp, |
301 |
> |
double *pt |
302 |
> |
) |
303 |
|
{ |
304 |
|
DATARRAY sd; |
305 |
|
int asize; |