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.24 by schorsch, Sun Jul 27 22:12:03 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  "color.h"
22
19   #include  "resolu.h"
20  
21   #define  MAXFILE        64
# Line 58 | Line 54 | struct {
54  
55   int  nfile;                     /* number of files */
56  
57 + char  ourfmt[LPICFMT+1] = PICFMT;
58   int  wrongformat = 0;
59  
60 < FILE  *popen(), *lblopen();
60 > FILE  *lblopen();
61 > void  quit();
62  
65 extern char  *malloc();
63  
67
64   tabputs(s)                      /* print line preceded by a tab */
65   char  *s;
66   {
67          char  fmt[32];
68  
69          if (isheadid(s))
70 <                return;
71 <        if (formatval(fmt, s))
72 <                wrongformat = strcmp(fmt, COLRFMT);
73 <        else {
70 >                return(0);
71 >        if (formatval(fmt, s)) {
72 >                if (globmatch(ourfmt, fmt)) {
73 >                        wrongformat = 0;
74 >                        strcpy(ourfmt, fmt);
75 >                } else
76 >                        wrongformat = 1;
77 >        } else {
78                  putc('\t', stdout);
79                  fputs(s, stdout);
80          }
81 +        return(0);
82   }
83  
84  
# Line 91 | Line 92 | char  *argv[];
92          int  xsgn, ysgn;
93          char  *thislabel;
94          int  an;
95 < #ifdef MSDOS
96 <        extern int  _fmode;
97 <        _fmode = O_BINARY;
97 <        setmode(fileno(stdin), O_BINARY);
98 <        setmode(fileno(stdout), O_BINARY);
99 < #endif
95 >        SET_DEFAULT_BINARY();
96 >        SET_FILE_BINARY(stdin);
97 >        SET_FILE_BINARY(stdout);
98          progname = argv[0];
99  
100          for (an = 1; an < argc && argv[an][0] == '-'; an++)
# Line 145 | Line 143 | char  *argv[];
143                  }
144   dofiles:
145          newheader("RADIANCE", stdout);
146 +        fputnow(stdout);
147          for (nfile = 0; an < argc; nfile++) {
148                  if (nfile >= MAXFILE)
149                          goto toomany;
# Line 222 | Line 221 | getfile:
221                  printf("%s:\n", input[nfile].name);
222                  getheader(input[nfile].fp, tabputs, NULL);
223                  if (wrongformat) {
224 <                        fprintf(stderr, "%s: not a Radiance picture\n",
224 >                        fprintf(stderr, "%s: incompatible input format\n",
225                                          input[nfile].name);
226                          quit(1);
227                  }
# Line 289 | Line 288 | getfile:
288                  ymax = ysiz;
289                                          /* add new header info. */
290          printargs(argc, argv, stdout);
291 <        fputformat(COLRFMT, stdout);
291 >        if (strcmp(ourfmt, PICFMT))
292 >                fputformat(ourfmt, stdout);     /* print format if known */
293          putchar('\n');
294          fprtresolu(xsiz, ysiz, stdout);
295  
# Line 381 | Line 381 | register COLR  c1, c2;
381  
382          j = 4;                          /* check exponents first! */
383          while (j--)
384 <                if (i = c1[j] - c2[j])
384 >                if ( (i = c1[j] - c2[j]) )
385                          return(i);
386          return(0);
387   }
# Line 409 | Line 409 | err:
409   }
410  
411  
412 + void
413   quit(code)              /* exit gracefully */
414   int  code;
415   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines