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