ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/plot4.c
Revision: 1.2
Committed: Fri Aug 1 14:14:24 2003 UTC (20 years, 9 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 1.1: +1 -13 lines
Log Message:
Eliminated CPM, MAC, and UNIX conditional compiles.

File Contents

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