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.27 by schorsch, Fri Jan 2 12:47:01 2004 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  
64 < extern char  *malloc();
64 > static gethfunc tabputs;
65  
66  
67 < tabputs(s)                      /* print line preceded by a tab */
68 < char  *s;
67 > static int
68 > tabputs(                        /* print line preceded by a tab */
69 >        char    *s,
70 >        void    *p
71 > )
72   {
73          char  fmt[32];
74  
75          if (isheadid(s))
76 <                return;
77 <        if (formatval(fmt, s))
78 <                wrongformat = strcmp(fmt, COLRFMT);
79 <        else {
76 >                return(0);
77 >        if (formatval(fmt, s)) {
78 >                if (globmatch(ourfmt, fmt)) {
79 >                        wrongformat = 0;
80 >                        strcpy(ourfmt, fmt);
81 >                } else
82 >                        wrongformat = 1;
83 >        } else {
84                  putc('\t', stdout);
85                  fputs(s, stdout);
86          }
87 +        return(0);
88   }
89  
90  
# Line 91 | Line 98 | char  *argv[];
98          int  xsgn, ysgn;
99          char  *thislabel;
100          int  an;
101 < #ifdef MSDOS
102 <        extern int  _fmode;
103 <        _fmode = O_BINARY;
97 <        setmode(fileno(stdin), O_BINARY);
98 <        setmode(fileno(stdout), O_BINARY);
99 < #endif
101 >        SET_DEFAULT_BINARY();
102 >        SET_FILE_BINARY(stdin);
103 >        SET_FILE_BINARY(stdout);
104          progname = argv[0];
105  
106          for (an = 1; an < argc && argv[an][0] == '-'; an++)
# Line 145 | Line 149 | char  *argv[];
149                  }
150   dofiles:
151          newheader("RADIANCE", stdout);
152 +        fputnow(stdout);
153          for (nfile = 0; an < argc; nfile++) {
154                  if (nfile >= MAXFILE)
155                          goto toomany;
# Line 222 | Line 227 | getfile:
227                  printf("%s:\n", input[nfile].name);
228                  getheader(input[nfile].fp, tabputs, NULL);
229                  if (wrongformat) {
230 <                        fprintf(stderr, "%s: not a Radiance picture\n",
230 >                        fprintf(stderr, "%s: incompatible input format\n",
231                                          input[nfile].name);
232                          quit(1);
233                  }
# Line 289 | Line 294 | getfile:
294                  ymax = ysiz;
295                                          /* add new header info. */
296          printargs(argc, argv, stdout);
297 <        fputformat(COLRFMT, stdout);
297 >        if (strcmp(ourfmt, PICFMT))
298 >                fputformat(ourfmt, stdout);     /* print format if known */
299          putchar('\n');
300          fprtresolu(xsiz, ysiz, stdout);
301  
# Line 381 | Line 387 | register COLR  c1, c2;
387  
388          j = 4;                          /* check exponents first! */
389          while (j--)
390 <                if (i = c1[j] - c2[j])
390 >                if ( (i = c1[j] - c2[j]) )
391                          return(i);
392          return(0);
393   }
# Line 392 | Line 398 | lblopen(s, xp, yp)             /* open pipe to label generator */
398   char  *s;
399   int  *xp, *yp;
400   {
401 <        char  com[128];
401 >        char  com[PATH_MAX];
402          FILE  *fp;
403  
404          sprintf(com, "psign -s -.15 -a 2 -x %d -y %d '%.90s'", *xp, *yp, s);
# Line 409 | Line 415 | err:
415   }
416  
417  
418 + void
419   quit(code)              /* exit gracefully */
420   int  code;
421   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines