--- ray/src/util/rad.c 2004/10/04 04:42:33 2.79 +++ ray/src/util/rad.c 2008/08/21 07:05:59 2.86 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rad.c,v 2.79 2004/10/04 04:42:33 greg Exp $"; +static const char RCSid[] = "$Id: rad.c,v 2.86 2008/08/21 07:05:59 greg Exp $"; #endif /* * Executive program for oconv, rpict and pfilt @@ -1012,9 +1012,19 @@ specview( /* get proper view spec from vs */ } else if (*vs == 'z') { zpos = -1; vs++; } - viewtype = 'v'; - if((*vs == 'v') | (*vs == 'l') | (*vs == 'a') | (*vs == 'h') | (*vs == 'c')) + switch (*vs) { + case VT_PER: + case VT_PAR: + case VT_ANG: + case VT_HEM: + case VT_PLS: + case VT_CYL: viewtype = *vs++; + break; + default: + viewtype = VT_PER; + break; + } cp = viewopts; if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) { /* got one! */ *cp++ = '-'; *cp++ = 'v'; *cp++ = 't'; *cp++ = viewtype; @@ -1056,19 +1066,20 @@ specview( /* get proper view spec from vs */ } cp = addarg(cp, vup[upax+3]); switch (viewtype) { - case 'v': + case VT_PER: cp = addarg(cp, "-vh 45 -vv 45"); break; - case 'l': + case VT_PAR: d = sqrt(dim[0]*dim[0]+dim[1]*dim[1]+dim[2]*dim[2]); sprintf(cp, " -vh %.2g -vv %.2g", d, d); cp += strlen(cp); break; - case 'a': - case 'h': + case VT_ANG: + case VT_HEM: + case VT_PLS: cp = addarg(cp, "-vh 180 -vv 180"); break; - case 'c': + case VT_CYL: cp = addarg(cp, "-vh 180 -vv 90"); break; } @@ -1145,6 +1156,11 @@ myprintview( /* print out selected view */ VIEW vwr; char buf[128]; register char *cp; +#ifdef _WIN32 +/* XXX Should we allow something like this for all platforms? */ +/* XXX Or is it still required at all? */ +again: +#endif if (vopts == NULL) return(-1); #ifdef _WIN32 @@ -1181,6 +1197,8 @@ rvu( /* run rvu with first view */ if (sayview) myprintview(vw, stdout); sprintf(combuf, "rvu %s%s%s -R %s ", vw, po, opts, rifname); + if (nprocs > 1) + sprintf(combuf+strlen(combuf), "-n %d ", nprocs); if (rvdevice != NULL) sprintf(combuf+strlen(combuf), "-o %s ", rvdevice); if (vdef(EXPOSURE)) @@ -1315,14 +1333,12 @@ rpict( /* run rpict and pfilt for each view */ zopt, oct1name, rawfile); if (pfile != NULL && inchild()) { /* rpict persistent mode */ - if (!silent) { + if (!silent) printf("\t%s\n", combuf); - fflush(stdout); - } + fflush(stdout); sprintf(combuf, "rpict%s %s %s%s%s %s > %s", rep, rppopt, res, po, opts, oct1name, rawfile); - fflush(stdout); fp = popen(combuf, "w"); if (fp == NULL) goto rperror; @@ -1360,7 +1376,7 @@ rpict( /* run rpict and pfilt for each view */ } wait_process(1); /* wait for children to finish */ if (pfile != NULL) { /* clean up rpict persistent mode */ - int pid; + RT_PID pid; fp = fopen(pfile, "r"); if (fp != NULL) { if (fscanf(fp, "%*s %d", &pid) != 1 || @@ -1403,7 +1419,7 @@ runcom( /* run command */ printf("\t%s\n", cs); if (!nprocs) return(0); - fflush(stdout); /* flush output and pass to shell */ + fflush(NULL); /* flush output and pass to shell */ return(system(cs)); } @@ -1439,7 +1455,7 @@ mvfile( /* move a file */ static int next_process(void) /* fork the next process (max. nprocs) */ { - int child_pid; + RT_PID child_pid; if (nprocs <= 1) return(0); /* it's us or no one */ @@ -1450,7 +1466,7 @@ next_process(void) /* fork the next process (max. np } if (children_running >= nprocs) wait_process(0); /* wait for someone to finish */ - fflush(stdout); + fflush(NULL); /* flush output */ child_pid = fork(); /* split process */ if (child_pid == 0) { /* we're the child */ children_running = -1; @@ -1469,8 +1485,8 @@ wait_process( /* wait for process(es) to finish */ int all ) { - int ourstatus = 0; - int pid, status; + int ourstatus = 0, status; + RT_PID pid; if (all) all = children_running; @@ -1507,7 +1523,8 @@ int all; } int kill(pid, sig) /* win|unix_process.c should also wait and kill */ -int pid, sig; +RT_PID pid; +int sig; { return 0; }