ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/plot4.c
Revision: 1.4
Committed: Sat Nov 15 02:13:37 2003 UTC (20 years, 5 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 1.3: +18 -8 lines
Log Message:
Continued ANSIfication, and reduced other compile warnings.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.4 static const char RCSid[] = "$Id: plot4.c,v 1.3 2003/10/27 10:28:59 schorsch Exp $";
3 greg 1.1 #endif
4     /*
5     * plot4.c - program to put four metafile pages onto one.
6     *
7     * Greg Ward
8     * 7/10/86
9     */
10    
11 schorsch 1.3 #include "rtprocess.h"
12 greg 1.1 #include "meta.h"
13 schorsch 1.4 #include "plot.h"
14 greg 1.1
15    
16     #define OUTFILT "pexpand +OCIms" /* output filter */
17    
18     #define SEGNAME "plot4seg" /* segment name */
19    
20    
21     extern FILE *pout; /* the output stream */
22    
23     char *progname;
24    
25 schorsch 1.4 static void plot4(FILE *fp);
26     static void doseg(int n);
27 greg 1.1
28 schorsch 1.4
29     int
30     main(
31     int argc,
32     char *argv[]
33     )
34 greg 1.1 {
35     FILE *fp;
36     int i;
37    
38     progname = argv[0];
39    
40     pout = popen(OUTFILT, "w");
41    
42     if (argc > 1)
43     for (i = 1; i < argc; i++) {
44     fp = efopen(argv[i], "r");
45     plot4(fp);
46     fclose(fp);
47     }
48     else
49     plot4(stdin);
50    
51     pglob(PEOF, 0200, NULL);
52    
53     return(pclose(pout));
54     }
55    
56    
57 schorsch 1.4 void
58     plot4( /* put a file into its place on page */
59     FILE *fp
60     )
61 greg 1.1 {
62     static int nplts = 0;
63     PRIMITIVE curp;
64    
65     pglob(POPEN, 0, SEGNAME);
66    
67     while (readp(&curp, fp))
68     if (curp.com == PEOP) {
69     pglob(PCLOSE, 0200, NULL);
70     doseg(nplts++ % 4);
71     pglob(POPEN, 0, SEGNAME);
72     } else
73     writep(&curp, pout);
74    
75     pglob(PCLOSE, 0200, NULL);
76     }
77    
78    
79 schorsch 1.4 void
80     doseg( /* do segment number n */
81     int n
82     )
83 greg 1.1 {
84     switch (n) {
85     case 0: /* upper left */
86     pprim(PSEG, 0, 0, XYSIZE/2, XYSIZE/2-1, XYSIZE-1, SEGNAME);
87     break;
88     case 1: /* upper right */
89     pprim(PSEG, 0, XYSIZE/2, XYSIZE/2, XYSIZE-1, XYSIZE-1, SEGNAME);
90     break;
91     case 2: /* lower left */
92     pprim(PSEG, 0, 0, 0, XYSIZE/2-1, XYSIZE/2-1, SEGNAME);
93     break;
94     case 3: /* lower right, end page */
95     pprim(PSEG, 0, XYSIZE/2, 0, XYSIZE-1, XYSIZE/2-1, SEGNAME);
96     pglob(PEOP, 0200, NULL);
97     break;
98     }
99     }