| 7 |
|
|
| 8 |
|
#include "copyright.h" |
| 9 |
|
|
| 10 |
< |
#include "standard.h" |
| 10 |
> |
#include <time.h> |
| 11 |
|
|
| 12 |
+ |
#include "platform.h" |
| 13 |
+ |
#include "standard.h" |
| 14 |
|
#include "color.h" |
| 13 |
– |
|
| 15 |
|
#include "resolu.h" |
| 15 |
– |
|
| 16 |
|
#include "data.h" |
| 17 |
|
|
| 18 |
|
/* picture memory usage before warning */ |
| 19 |
|
#ifndef PSIZWARN |
| 20 |
< |
#ifdef BIGMEM |
| 21 |
< |
#define PSIZWARN 5000000 |
| 22 |
< |
#else |
| 20 |
> |
#ifdef SMLMEM |
| 21 |
|
#define PSIZWARN 1500000 |
| 22 |
+ |
#else |
| 23 |
+ |
#define PSIZWARN 5000000 |
| 24 |
|
#endif |
| 25 |
|
#endif |
| 26 |
|
|
| 33 |
|
|
| 34 |
|
static DATARRAY *dtab[TABSIZ]; /* data array list */ |
| 35 |
|
|
| 36 |
+ |
static gethfunc headaspect; |
| 37 |
|
|
| 38 |
+ |
|
| 39 |
|
DATARRAY * |
| 40 |
|
getdata(dname) /* get data array dname */ |
| 41 |
|
char *dname; |
| 80 |
|
/* get dimensions */ |
| 81 |
|
if (fgetval(fp, 'i', (char *)&asize) <= 0) |
| 82 |
|
goto scanerr; |
| 83 |
< |
if (asize <= 0 | asize > MAXDDIM) { |
| 83 |
> |
if ((asize <= 0) | (asize > MAXDDIM)) { |
| 84 |
|
sprintf(errmsg, "bad number of dimensions for \"%s\"", dname); |
| 85 |
|
error(USER, errmsg); |
| 86 |
|
} |
| 140 |
|
|
| 141 |
|
|
| 142 |
|
static int |
| 143 |
< |
headaspect(s, iap) /* check string for aspect ratio */ |
| 144 |
< |
char *s; |
| 145 |
< |
double *iap; |
| 143 |
> |
headaspect( /* check string for aspect ratio */ |
| 144 |
> |
char *s, |
| 145 |
> |
void *iap |
| 146 |
> |
) |
| 147 |
|
{ |
| 148 |
|
char fmt[32]; |
| 149 |
|
|
| 150 |
|
if (isaspect(s)) |
| 151 |
< |
*iap *= aspectval(s); |
| 151 |
> |
*(double*)iap *= aspectval(s); |
| 152 |
|
else if (formatval(fmt, s) && !globmatch(PICFMT, fmt)) |
| 153 |
< |
*iap = 0.0; |
| 153 |
> |
*(double*)iap = 0.0; |
| 154 |
|
return(0); |
| 155 |
|
} |
| 156 |
|
|
| 165 |
|
COLR *scanin; |
| 166 |
|
int sl, ns; |
| 167 |
|
RESOLU inpres; |
| 168 |
< |
FLOAT loc[2]; |
| 168 |
> |
RREAL loc[2]; |
| 169 |
|
int y; |
| 170 |
|
register int x, i; |
| 171 |
|
register DATARRAY *pp; |
| 187 |
|
sprintf(errmsg, "cannot open picture file \"%s\"", pfname); |
| 188 |
|
error(SYSTEM, errmsg); |
| 189 |
|
} |
| 190 |
< |
#ifdef MSDOS |
| 188 |
< |
setmode(fileno(fp), O_BINARY); |
| 189 |
< |
#endif |
| 190 |
> |
SET_FILE_BINARY(fp); |
| 191 |
|
/* get dimensions */ |
| 192 |
|
inpaspect = 1.0; |
| 193 |
< |
getheader(fp, headaspect, (char *)&inpaspect); |
| 193 |
> |
getheader(fp, headaspect, &inpaspect); |
| 194 |
|
if (inpaspect <= FTINY || !fgetsresolu(&inpres, fp)) |
| 195 |
|
goto readerr; |
| 196 |
|
pp[0].nd = 2; |
| 237 |
|
fclose(fp); |
| 238 |
|
i = hash(pname); |
| 239 |
|
pp[0].next = dtab[i]; /* link into picture list */ |
| 240 |
< |
copystruct(&pp[1], &pp[0]); |
| 241 |
< |
copystruct(&pp[2], &pp[0]); |
| 240 |
> |
pp[1] = pp[0]; |
| 241 |
> |
pp[2] = pp[0]; |
| 242 |
|
pp[0].type = RED; /* differentiate RGB records */ |
| 243 |
|
pp[1].type = GRN; |
| 244 |
|
pp[2].type = BLU; |
| 270 |
|
head.next = dtab[hval]; |
| 271 |
|
dpl = &head; |
| 272 |
|
while ((dp = dpl->next) != NULL) |
| 273 |
< |
if ((dta == NULL | dta == dp)) { |
| 273 |
> |
if ((dta == NULL) | (dta == dp)) { |
| 274 |
|
dpl->next = dp->next; |
| 275 |
|
if (dp->type == DATATY) |
| 276 |
|
free((void *)dp->arr.d); |