| 1 |
– |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Copy data into a holodeck file |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include "holo.h" |
| 9 |
|
#include "view.h" |
| 13 |
– |
#include "resolu.h" |
| 10 |
|
|
| 11 |
|
#ifndef BKBSIZE |
| 12 |
|
#define BKBSIZE 256 /* beam clump size (kilobytes) */ |
| 13 |
|
#endif |
| 14 |
|
|
| 15 |
< |
int checkdepth = 1; /* check depth (!-f option)? */ |
| 16 |
< |
int checkrepeats = 0; /* check for repeats (-c option)? */ |
| 15 |
> |
int checkdepth = 1; /* check depth (!-d option)? */ |
| 16 |
> |
int checkrepeats = 0; /* check for repeats (-u option)? */ |
| 17 |
|
int frompicz; /* input from pictures & depth-buffers? */ |
| 18 |
|
int noutsects; /* number of output sections */ |
| 19 |
|
char obstr, unobstr; /* flag pointer values */ |
| 107 |
|
char *fname; |
| 108 |
|
int append; |
| 109 |
|
{ |
| 114 |
– |
extern long ftell(); |
| 110 |
|
FILE *fp; |
| 111 |
|
int fd; |
| 112 |
|
int hflags = 0; |
| 119 |
|
error(SYSTEM, errmsg); |
| 120 |
|
} |
| 121 |
|
/* check header and magic number */ |
| 122 |
< |
if (getheader(fp, holheadline, &hflags) < 0 || |
| 122 |
> |
if (getheader(fp, holheadline, (char *)&hflags) < 0 || |
| 123 |
|
hflags&H_BADF || getw(fp) != HOLOMAGIC) { |
| 124 |
|
sprintf(errmsg, "file \"%s\" not in holodeck format", fname); |
| 125 |
|
error(USER, errmsg); |
| 128 |
|
nextloc = ftell(fp); /* get stdio position */ |
| 129 |
|
fclose(fp); /* done with stdio */ |
| 130 |
|
for (n = 0; nextloc > 0L; n++) { /* initialize each section */ |
| 131 |
< |
lseek(fd, nextloc, 0); |
| 131 |
> |
lseek(fd, (off_t)nextloc, 0); |
| 132 |
|
read(fd, (char *)&nextloc, sizeof(nextloc)); |
| 133 |
|
hdinit(fd, NULL)->priv = hflags&H_OBST ? &obstr : |
| 134 |
|
hflags&H_OBSF ? &unobstr : (char *)NULL; |
| 194 |
|
bpcmp(b1p, b2p) /* compare beam positions on disk */ |
| 195 |
|
int *b1p, *b2p; |
| 196 |
|
{ |
| 197 |
< |
register long pdif = beamdir[*b1p].fo - beamdir[*b2p].fo; |
| 197 |
> |
register off_t pdif = beamdir[*b1p].fo - beamdir[*b2p].fo; |
| 198 |
|
|
| 199 |
|
if (pdif > 0L) return(1); |
| 200 |
|
if (pdif < 0L) return(-1); |
| 231 |
|
} |
| 232 |
|
hdfreebeam(hp, bq[i]); /* free the beam */ |
| 233 |
|
} |
| 239 |
– |
hdfreebeam(NULL, 0); /* write & free clump */ |
| 234 |
|
return(0); |
| 235 |
|
} |
| 236 |
|
|
| 317 |
|
copystruct(&phd.vw, &stdview); |
| 318 |
|
phd.expos = 1.0; |
| 319 |
|
phd.badfmt = phd.gotview = phd.altprims = 0; |
| 320 |
< |
if (getheader(pfp, picheadline, &phd) < 0 || |
| 320 |
> |
if (getheader(pfp, picheadline, (char *)&phd) < 0 || |
| 321 |
|
phd.badfmt || !fgetsresolu(&prs, pfp)) { |
| 322 |
|
sprintf(errmsg, "bad format for picture file \"%s\"", pcf); |
| 323 |
|
error(USER, errmsg); |
| 385 |
|
/* write output and free beams */ |
| 386 |
|
hdflush(NULL); |
| 387 |
|
/* clean up */ |
| 388 |
< |
free((char *)cscn); |
| 389 |
< |
free((char *)zscn); |
| 388 |
> |
free((void *)cscn); |
| 389 |
> |
free((void *)zscn); |
| 390 |
|
fclose(pfp); |
| 391 |
|
close(zfd); |
| 392 |
|
} |
| 393 |
|
|
| 394 |
|
|
| 395 |
+ |
void |
| 396 |
|
eputs(s) /* put error message to stderr */ |
| 397 |
|
register char *s; |
| 398 |
|
{ |
| 412 |
|
} |
| 413 |
|
|
| 414 |
|
|
| 415 |
+ |
void |
| 416 |
|
quit(code) /* exit the program gracefully */ |
| 417 |
|
int code; |
| 418 |
|
{ |