--- ray/src/px/pcomb.c 1989/07/11 17:13:44 1.3 +++ ray/src/px/pcomb.c 1989/09/12 13:04:22 1.5 @@ -129,7 +129,8 @@ getfiles: fputs(input[nfiles].name, stdout); fputs(":\n", stdout); getheader(input[nfiles].fp, tputs); - if (fscanf(input[nfiles].fp, "-Y %d +X %d\n", &ypos, &xpos) != 2) { + if (fgetresolu(&xpos, &ypos, input[nfiles].fp) != + (YMAJOR|YDECR)) { eputs(input[nfiles].name); eputs(": bad picture size\n"); quit(1); @@ -147,7 +148,7 @@ getfiles: } printargs(argc, argv, stdout); putchar('\n'); - printf("-Y %d +X %d\n", yres, xres); + fputresolu(YMAJOR|YDECR, xres, yres, stdout); combine(); quit(0); usage: @@ -160,12 +161,16 @@ eputs(" [-w][-x xr][-y yr][-e expr][-f file] [ [-s f][ combine() /* combine pictures */ { - int coldef[3]; + EPNODE *coldef[3]; COLOR *scanout; register int i, j; /* check defined variables */ - for (j = 0; j < 3; j++) - coldef[j] = vardefined(vcolout[j]); + for (j = 0; j < 3; j++) { + if (vardefined(vcolout[j])) + coldef[j] = eparse(vcolout[j]); + else + coldef[j] = NULL; + } /* allocate scanline */ scanout = (COLOR *)emalloc(xres*sizeof(COLOR)); /* combine files */ @@ -180,12 +185,10 @@ combine() /* combine pictures */ for (xpos = 0; xpos < xres; xpos++) { varset(vxpos, (double)xpos); eclock++; - for (j = 0; j < 3; j++) - if (coldef[j]) { + for (j = 0; j < 3; j++) { + if (coldef[j] != NULL) { colval(scanout[xpos],j) = - varvalue(vcolout[j]); - if (colval(scanout[xpos],j) < 0.0) - colval(scanout[xpos],j) = 0.0; + evalue(coldef[j]); } else { colval(scanout[xpos],j) = 0.0; for (i = 0; i < nfiles; i++) @@ -193,6 +196,9 @@ combine() /* combine pictures */ colval(input[i].coef,j) * colval(input[i].scan[xpos],j); } + if (colval(scanout[xpos],j) < 0.0) + colval(scanout[xpos],j) = 0.0; + } } if (fwritescan(scanout, xres, stdout) < 0) { eputs("write error\n");