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.18 by greg, Sun Feb 27 10:17:04 1994 UTC vs.
Revision 2.26 by schorsch, Mon Nov 10 12:28:56 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1993 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  pcompos.c - program to composite pictures.
6   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   */
9  
10   #include  <stdio.h>
14
11   #include  <math.h>
12 + #include  <time.h>
13 + #include  <string.h>
14  
15 < #ifdef MSDOS
18 < #include  <fcntl.h>
19 < #endif
15 > #include "copyright.h"
16  
17 + #include  "platform.h"
18 + #include  "rtprocess.h"
19   #include  "color.h"
22
20   #include  "resolu.h"
21  
22   #define  MAXFILE        64
# Line 58 | Line 55 | struct {
55  
56   int  nfile;                     /* number of files */
57  
58 + char  ourfmt[LPICFMT+1] = PICFMT;
59   int  wrongformat = 0;
60  
61 < FILE  *popen(), *lblopen();
61 > FILE  *lblopen();
62 > void  quit();
63  
65 extern char  *malloc();
64  
67
65   tabputs(s)                      /* print line preceded by a tab */
66   char  *s;
67   {
68          char  fmt[32];
69  
70          if (isheadid(s))
71 <                return;
72 <        if (formatval(fmt, s))
73 <                wrongformat = strcmp(fmt, COLRFMT);
74 <        else {
71 >                return(0);
72 >        if (formatval(fmt, s)) {
73 >                if (globmatch(ourfmt, fmt)) {
74 >                        wrongformat = 0;
75 >                        strcpy(ourfmt, fmt);
76 >                } else
77 >                        wrongformat = 1;
78 >        } else {
79                  putc('\t', stdout);
80                  fputs(s, stdout);
81          }
82 +        return(0);
83   }
84  
85  
# Line 91 | Line 93 | char  *argv[];
93          int  xsgn, ysgn;
94          char  *thislabel;
95          int  an;
96 < #ifdef MSDOS
97 <        extern int  _fmode;
98 <        _fmode = O_BINARY;
97 <        setmode(fileno(stdin), O_BINARY);
98 <        setmode(fileno(stdout), O_BINARY);
99 < #endif
96 >        SET_DEFAULT_BINARY();
97 >        SET_FILE_BINARY(stdin);
98 >        SET_FILE_BINARY(stdout);
99          progname = argv[0];
100  
101          for (an = 1; an < argc && argv[an][0] == '-'; an++)
# Line 145 | Line 144 | char  *argv[];
144                  }
145   dofiles:
146          newheader("RADIANCE", stdout);
147 +        fputnow(stdout);
148          for (nfile = 0; an < argc; nfile++) {
149                  if (nfile >= MAXFILE)
150                          goto toomany;
# Line 222 | Line 222 | getfile:
222                  printf("%s:\n", input[nfile].name);
223                  getheader(input[nfile].fp, tabputs, NULL);
224                  if (wrongformat) {
225 <                        fprintf(stderr, "%s: not a Radiance picture\n",
225 >                        fprintf(stderr, "%s: incompatible input format\n",
226                                          input[nfile].name);
227                          quit(1);
228                  }
# Line 289 | Line 289 | getfile:
289                  ymax = ysiz;
290                                          /* add new header info. */
291          printargs(argc, argv, stdout);
292 <        fputformat(COLRFMT, stdout);
292 >        if (strcmp(ourfmt, PICFMT))
293 >                fputformat(ourfmt, stdout);     /* print format if known */
294          putchar('\n');
295          fprtresolu(xsiz, ysiz, stdout);
296  
# Line 381 | Line 382 | register COLR  c1, c2;
382  
383          j = 4;                          /* check exponents first! */
384          while (j--)
385 <                if (i = c1[j] - c2[j])
385 >                if ( (i = c1[j] - c2[j]) )
386                          return(i);
387          return(0);
388   }
# Line 392 | Line 393 | lblopen(s, xp, yp)             /* open pipe to label generator */
393   char  *s;
394   int  *xp, *yp;
395   {
396 <        char  com[128];
396 >        char  com[PATH_MAX];
397          FILE  *fp;
398  
399          sprintf(com, "psign -s -.15 -a 2 -x %d -y %d '%.90s'", *xp, *yp, s);
# Line 409 | Line 410 | err:
410   }
411  
412  
413 + void
414   quit(code)              /* exit gracefully */
415   int  code;
416   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines