10 |
|
#include <time.h> |
11 |
|
#include <signal.h> |
12 |
|
#include <sys/mman.h> |
13 |
+ |
#include <sys/wait.h> |
14 |
|
#include <unistd.h> |
15 |
|
|
16 |
|
#include "platform.h" |
17 |
|
#include "RpictSimulManager.h" |
18 |
+ |
#include "func.h" |
19 |
|
#include "ambient.h" |
20 |
|
#include "pmapray.h" |
21 |
|
#include "random.h" |
22 |
|
|
21 |
– |
extern char *progname; /* argv[0] */ |
23 |
|
const char *sigerr[NSIG]; /* signal error messages */ |
24 |
|
|
25 |
|
VIEW ourview = STDVIEW; /* global view parameters */ |
61 |
|
void |
62 |
|
quit(int code) /* quit program */ |
63 |
|
{ |
63 |
– |
if (nproc < 0) { |
64 |
– |
ray_pnprocs = -1; // hack to avoid cleanup in child |
65 |
– |
_exit(code); |
66 |
– |
} |
64 |
|
exit(code); // don't bother to free data structs |
65 |
|
} |
66 |
|
|
99 |
|
int outfmt = 'c'; |
100 |
|
int rval; |
101 |
|
int i; |
102 |
< |
/* global program name */ |
103 |
< |
progname = argv[0]; |
102 |
> |
/* set global program name */ |
103 |
> |
fixargv0(argv[0]); |
104 |
|
/* feature check only? */ |
105 |
|
strcat(RFeatureList, RXPIECE_FEATURES); |
106 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
107 |
|
return feature_status(argc-2, argv+2); |
108 |
+ |
/* initialize calcomp routines */ |
109 |
+ |
initfunc(); |
110 |
|
/* set defaults */ |
111 |
|
default_options(); |
112 |
|
/* option city */ |
638 |
|
pixaspect = .0; // need to leave this as is |
639 |
|
myRPmanager.NewHeader(pout); // get prev. header info |
640 |
|
const char * tval = myRPmanager.GetHeadStr("TILED="); |
641 |
< |
if (tval) sscanf(tval, "%d %d", &tileGrid[0], &tileGrid[1]); |
641 |
> |
if (!tval || sscanf(tval, "%d %d", &tileGrid[0], &tileGrid[1]) != 2) |
642 |
> |
error(USER, "existing picture must be tiled"); |
643 |
|
CHECK(myRPmanager.GetView()==NULL, |
644 |
|
USER, "missing view in picture file"); |
645 |
|
ourview = *myRPmanager.GetView(); |
748 |
|
ndone++; |
749 |
|
} |
750 |
|
if (!ndone) |
751 |
< |
error(WARNING, "no tiles need rendering, exit"); |
751 |
> |
error(WARNING, "no tiles to render, exiting"); |
752 |
|
/* |
753 |
|
munmap(pixMap, pmlen); // technically unnecessary... |
754 |
|
if (zdMap) munmap(zdMap, zmlen); |