3 # Make the basic PostScript file for the Exim spec from the gcode file, then
4 # join it together with the contents and the index, to make a single
5 # PostScript file, suitable for double-sided printing.
9 printf(OUT "%%%%Page: %s %d\nxpage\n\n", $title, $pagenumber++);
13 @roman = ("i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x",
14 "xi", "xii", "xiii", "xiv", "xv", "xvi", "xvii", "xviii", "xix");
18 system("sgtops z-gcode -to z-ps") && die "sgtops run failed\n";
20 open(SPEC, "z-ps") || die "Can't open z-ps\n";
21 open(CONTS, "zc-ps") || die "Can't open zc-ps\n";
22 open(INDEX, "zi-ps") || die "Can't open zi-ps\n";
23 open(OUT, ">spec.ps") || die "Can't open spec.ps\n";
25 # Copy spec headings etc.
29 last if (/^%%Page:/) ;
33 # Copy the first two pages - the title page, and its blank verso
35 for ($i = 1; $i < 3; $i++)
37 printf(OUT "%%%%Page: title%s %d\n", ($i == 1)? "" : "-verso", $pagenumber++);
40 last if (/^%%Page:/) ;
45 # Skip the contents heading
49 last if (/^%%Page:/) ;
52 # Output the contents pages - fudge the roman numerals as we know there
53 # won't be a vast number of them.
58 printf(OUT "%%%%Page: %s %d\n", $roman[$subpagenumber++], $pagenumber++);
61 next if (/^%%Pages:/);
62 next if (/^%%Trailer/);
63 last if (/^%%Page:/) ;
69 # If contents was an odd number of pages, insert a blank page
71 &blank_page("contents-pad") if ($pagenumber & 1) == 0;
73 # Copy the rest of the main file
79 printf(OUT "%%%%Page: %d %d\n", $subpagenumber++, $pagenumber++);
82 next if (/^%%Pages:/);
83 next if (/^%%Trailer/);
84 last if (/^%%Page:/) ;
90 # If contents was an odd number of pages, insert a blank page
92 &blank_page("body-pad") if ($pagenumber & 1) == 0;
94 # Skip the index heading
98 last if (/^%%Page:/) ;
101 # Copy the index pages
107 printf(OUT "%%%%Page: I%d %d\n", $subpagenumber++, $pagenumber++);
110 next if (/^%%Pages:/);
111 next if (/^%%Trailer/);
112 last if (/^%%Page:/) ;
119 printf(OUT "%%%%Trailer\n");
120 printf(OUT "%%%%Pages: %d\n", $pagenumber-1);