| 28 |
|
TMbright inpsfb; /* encoded tm->inpsf */ |
| 29 |
|
} COLRDATA; |
| 30 |
|
|
| 31 |
– |
#ifdef NOPROTO |
| 32 |
– |
static MEM_PTR colrInit(); |
| 33 |
– |
static void colrNewSpace(); |
| 34 |
– |
#else |
| 31 |
|
static MEM_PTR colrInit(struct tmStruct *); |
| 32 |
|
static void colrNewSpace(struct tmStruct *); |
| 33 |
< |
#endif |
| 33 |
> |
static gethfunc headline; |
| 34 |
> |
|
| 35 |
|
static struct tmPackage colrPkg = { /* our package functions */ |
| 36 |
|
colrInit, colrNewSpace, free |
| 37 |
|
}; |
| 55 |
|
|
| 56 |
|
if (tmTop == NULL) |
| 57 |
|
returnErr(TM_E_TMINVAL); |
| 58 |
< |
if (ls == NULL | scan == NULL | len < 0) |
| 58 |
> |
if ((ls == NULL) | (scan == NULL) | (len < 0)) |
| 59 |
|
returnErr(TM_E_ILLEGAL); |
| 60 |
|
#if TM_PIC_CTRANS |
| 61 |
|
if (tmNeedMatrix(tmTop)) { /* need floating point */ |
| 114 |
|
} else if (tmTop->flags & TM_F_BW) { |
| 115 |
|
cmon[RED] = cmon[GRN] = cmon[BLU] = li; |
| 116 |
|
} |
| 117 |
< |
bi = ( (int4)GAMTSZ*cd->clfb[RED]*cmon[RED]/li ) >> 8; |
| 117 |
> |
bi = ( (int32)GAMTSZ*cd->clfb[RED]*cmon[RED]/li ) >> 8; |
| 118 |
|
cs[3*i ] = bi>=GAMTSZ ? 255 : cd->gamb[bi]; |
| 119 |
< |
bi = ( (int4)GAMTSZ*cd->clfb[GRN]*cmon[GRN]/li ) >> 8; |
| 119 |
> |
bi = ( (int32)GAMTSZ*cd->clfb[GRN]*cmon[GRN]/li ) >> 8; |
| 120 |
|
cs[3*i+1] = bi>=GAMTSZ ? 255 : cd->gamb[bi]; |
| 121 |
< |
bi = ( (int4)GAMTSZ*cd->clfb[BLU]*cmon[BLU]/li ) >> 8; |
| 121 |
> |
bi = ( (int32)GAMTSZ*cd->clfb[BLU]*cmon[BLU]/li ) >> 8; |
| 122 |
|
cs[3*i+2] = bi>=GAMTSZ ? 255 : cd->gamb[bi]; |
| 123 |
|
} |
| 124 |
|
returnOK; |
| 139 |
|
|
| 140 |
|
|
| 141 |
|
static int |
| 142 |
< |
headline(s, rh) /* grok a header line */ |
| 143 |
< |
register char *s; |
| 144 |
< |
register struct radhead *rh; |
| 142 |
> |
headline( /* grok a header line */ |
| 143 |
> |
register char *s, |
| 144 |
> |
void *vrh |
| 145 |
> |
) |
| 146 |
|
{ |
| 147 |
|
char fmt[32]; |
| 148 |
+ |
register struct radhead *rh = vrh; |
| 149 |
|
|
| 150 |
|
if (formatval(fmt, s)) { |
| 151 |
|
if (!strcmp(fmt, COLRFMT)) |
| 186 |
|
/* check arguments */ |
| 187 |
|
if (tmTop == NULL) |
| 188 |
|
returnErr(TM_E_TMINVAL); |
| 189 |
< |
if (lpp == NULL | xp == NULL | yp == NULL | |
| 190 |
< |
(fname == NULL & fp == TM_GETFILE)) |
| 189 |
> |
if ((lpp == NULL) | (xp == NULL) | (yp == NULL) | |
| 190 |
> |
((fname == NULL) & (fp == TM_GETFILE))) |
| 191 |
|
returnErr(TM_E_ILLEGAL); |
| 192 |
|
*xp = *yp = 0; /* error precaution */ |
| 193 |
|
if ((inpf = fp) == TM_GETFILE && (inpf = fopen(fname, "r")) == NULL) |
| 195 |
|
*lpp = NULL; |
| 196 |
|
if (cpp != TM_NOCHROMP) *cpp = NULL; |
| 197 |
|
info = rhdefault; /* get our header */ |
| 198 |
< |
getheader(inpf, headline, (char *)&info); |
| 199 |
< |
if (info.format == FMTBAD | info.expos <= 0. || |
| 198 |
> |
getheader(inpf, headline, &info); |
| 199 |
> |
if ((info.format == FMTBAD) | (info.expos <= 0.) || |
| 200 |
|
fgetresolu(xp, yp, inpf) < 0) { |
| 201 |
|
err = TM_E_BADFILE; goto done; |
| 202 |
|
} |
| 249 |
|
|
| 250 |
|
|
| 251 |
|
#ifdef PCOND |
| 252 |
< |
int /* run pcond to map picture */ |
| 252 |
> |
static int /* run pcond to map picture */ |
| 253 |
|
dopcond(psp, xp, yp, flags, monpri, gamval, Lddyn, Ldmax, fname) |
| 254 |
|
BYTE **psp; |
| 255 |
|
int *xp, *yp; |
| 304 |
|
rp = (BYTE *)malloc(sizeof(BYTE) * *xp * *yp); |
| 305 |
|
else |
| 306 |
|
rp = (BYTE *)malloc(3*sizeof(BYTE) * *xp * *yp); |
| 307 |
< |
if ((*psp = rp) == NULL | scan == NULL) { |
| 307 |
> |
if (((*psp = rp) == NULL) | (scan == NULL)) { |
| 308 |
|
pclose(infp); |
| 309 |
|
returnErr(TM_E_NOMEM); |
| 310 |
|
} |
| 350 |
|
TMbright *lp; |
| 351 |
|
int err; |
| 352 |
|
/* check arguments */ |
| 353 |
< |
if (psp == NULL | xp == NULL | yp == NULL | monpri == NULL | |
| 354 |
< |
(fname == NULL & fp == TM_GETFILE)) |
| 353 |
> |
if ((psp == NULL) | (xp == NULL) | (yp == NULL) | (monpri == NULL) | |
| 354 |
> |
((fname == NULL) & (fp == TM_GETFILE))) |
| 355 |
|
returnErr(TM_E_ILLEGAL); |
| 356 |
|
/* set defaults */ |
| 357 |
|
if (gamval < MINGAM) gamval = DEFGAM; |