ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcompos.c
(Generate patch)

Comparing ray/src/px/pcompos.c (file contents):
Revision 2.2 by greg, Thu Dec 19 14:51:50 1991 UTC vs.
Revision 2.11 by greg, Wed Aug 12 12:39:52 1992 UTC

# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #include  "resolu.h"
18  
19 < #define  MAXFILE        32
19 > #define  MAXFILE        64
20  
21                                          /* output picture size */
22   int  xsiz = 0;
# Line 72 | Line 72 | char  *argv[];
72   {
73          int  ncolumns = 0;
74          int  autolabel = 0;
75 <        int  curcol = 0, curx = 0, cury = 0;
75 >        int  curcol = 0, x0 = 0, curx = 0, cury = 0, spacing = 0;
76          char  *thislabel;
77          int  an;
78  
# Line 81 | Line 81 | char  *argv[];
81          for (an = 1; an < argc && argv[an][0] == '-'; an++)
82                  switch (argv[an][1]) {
83                  case 'x':
84 <                        xmax = xsiz = atoi(argv[++an]);
84 >                        xsiz = atoi(argv[++an]);
85                          break;
86                  case 'y':
87 <                        ymax = ysiz = atoi(argv[++an]);
87 >                        ysiz = atoi(argv[++an]);
88                          break;
89                  case 'b':
90                          setcolr(bgcolr, atof(argv[an+1]),
# Line 95 | Line 95 | char  *argv[];
95                  case 'a':
96                          ncolumns = atoi(argv[++an]);
97                          break;
98 +                case 's':
99 +                        spacing = atoi(argv[++an]);
100 +                        break;
101 +                case 'o':
102 +                        curx = x0 = atoi(argv[++an]);
103 +                        cury = atoi(argv[++an]);
104 +                        break;
105                  case 'l':
106                          switch (argv[an][2]) {
107                          case 'a':
# Line 119 | Line 126 | dofiles:
126          for (nfile = 0; an < argc; nfile++) {
127                  if (nfile >= MAXFILE)
128                          goto toomany;
129 <                if (autolabel)
123 <                        thislabel = argv[an];
124 <                else
125 <                        thislabel = NULL;
129 >                thislabel = NULL;
130                  input[nfile].hasmin = input[nfile].hasmax = 0;
131                  while (an < argc && (argv[an][0] == '-' || argv[an][0] == '+'))
132                          switch (argv[an][1]) {
# Line 146 | Line 150 | dofiles:
150                          case 'l':
151                                  if (strcmp(argv[an], "-l"))
152                                          goto userr;
153 <                                thislabel = argv[++an];
153 >                                thislabel = argv[an+1];
154 >                                an += 2;
155                                  break;
156                          case '\0':
157                                  if (argv[an][0] == '-')
# Line 158 | Line 163 | dofiles:
163   getfile:
164                  if (argc-an < (ncolumns ? 1 : 3))
165                          goto userr;
166 +                if (autolabel && thislabel == NULL)
167 +                        thislabel = argv[an];
168                  if (!strcmp(argv[an], "-")) {
169                          input[nfile].name = "<stdin>";
170                          input[nfile].fp = stdin;
171                  } else {
172 <                        input[nfile].name = argv[an];
173 <                        if ((input[nfile].fp = argv[an][0] == '!' ?
174 <                                        popen(argv[an]+1, "r") :
175 <                                        fopen(argv[an], "r")) == NULL) {
172 >                        if (argv[an][0] == '!') {
173 >                                input[nfile].name = "<Command>";
174 >                                input[nfile].fp = popen(argv[an]+1, "r");
175 >                        } else {
176 >                                input[nfile].name = argv[an];
177 >                                input[nfile].fp = fopen(argv[an], "r");
178 >                        }
179 >                        if (input[nfile].fp == NULL) {
180                                  perror(argv[an]);
181                                  quit(1);
182                          }
# Line 188 | Line 199 | getfile:
199                  }
200                  if (ncolumns > 0) {
201                          if (curcol >= ncolumns) {
202 <                                cury = ymax;
203 <                                curx = 0;
202 >                                cury = ymax + spacing;
203 >                                curx = x0;
204                                  curcol = 0;
205                          }
206                          input[nfile].xloc = curx;
207                          input[nfile].yloc = cury;
208 <                        curx += input[nfile].xres;
208 >                        curx += input[nfile].xres + spacing;
209                          curcol++;
210                  } else {
211                          input[nfile].xloc = atoi(argv[an++]);
# Line 213 | Line 224 | getfile:
224                                  goto toomany;
225                          input[nfile].name = "<Label>";
226                          input[nfile].hasmin = input[nfile].hasmax = 0;
227 +                        input[nfile].xres = input[nfile-1].xres;
228 +                        input[nfile].yres = labelht;
229                          if ((input[nfile].fp = lblopen(thislabel,
230                                          &input[nfile].xres,
231                                          &input[nfile].yres)) == NULL)
# Line 224 | Line 237 | getfile:
237          }
238          if (xsiz <= 0)
239                  xsiz = xmax;
240 +        else if (xsiz > xmax)
241 +                xmax = xsiz;
242          if (ysiz <= 0)
243                  ysiz = ymax;
244 +        else if (ysiz > ymax)
245 +                ymax = ysiz;
246                                          /* add new header info. */
247          printargs(argc, argv, stdout);
248          fputformat(COLRFMT, stdout);
# Line 236 | Line 253 | getfile:
253          
254          quit(0);
255   userr:
256 <        fprintf(stderr, "Usage: %s [-x xr][-y yr][-b r g b][-a n][-la][-lh h] ",
256 >        fprintf(stderr,
257 >        "Usage: %s [-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ",
258                          progname);
259          fprintf(stderr, "[-t min1][+t max1][-l lab] pic1 x1 y1 ..\n");
260          quit(1);
# Line 333 | Line 351 | int  *xp, *yp;
351          char  com[128];
352          FILE  *fp;
353  
354 <        sprintf(com, "psign -h %d '%.30s' | pfilt -1 -x /2 -y /2",
337 <                        2*labelht, s);
354 >        sprintf(com, "psign -s -.15 -a 2 -x %d -y %d '%.90s'", *xp, *yp, s);
355          if ((fp = popen(com, "r")) == NULL)
356                  return(NULL);
357          if (checkheader(fp, COLRFMT, NULL) < 0)
# Line 351 | Line 368 | err:
368   quit(code)              /* exit gracefully */
369   int  code;
370   {
371 +        int  status;
372 +
373 +        if (code == 0)                  /* reap any children */
374 +                while (wait(&status) != -1)
375 +                        if (code == 0)
376 +                                code = status>>8 & 0xff;
377          exit(code);
378   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines