1 /*
2 * Source file:
3 * headers.c
4 *
5 * Prints page headers. All functions are just front-ends to PS_startpage().
6 */
7
8 #include "config.h"
9
10 #include <stdio.h>
11
12 #include "trueprint.h"
13 #include "postscript.h"
14 #include "options.h"
15 #include "headers.h"
16
17 static char *top_left_string;
18 static char *top_centre_string;
19 static char *top_right_string;
20 static char *bottom_left_string;
21 static char *bottom_centre_string;
22 static char *bottom_right_string;
23 static char *message_string;
24
25 /*
26 * Function:
27 * setup_headers
28 */
29 void
setup_headers(void)30 setup_headers(void)
31 {
32 top_left_string = NULL;
33 string_option("X", "left-header", "%L", &top_left_string, NULL, NULL,
34 OPT_PAGE_FURNITURE,
35 "specify string for left side of header");
36
37 bottom_left_string = NULL;
38 string_option("x", "left-footer", "%L", &bottom_left_string, NULL, NULL,
39 OPT_PAGE_FURNITURE,
40 "specify string for left side of footer");
41
42 top_centre_string = NULL;
43 string_option("Y", "center-header", "%N", &top_centre_string, NULL, NULL,
44 OPT_PAGE_FURNITURE,
45 "specify string for center of header");
46
47 bottom_centre_string = NULL;
48 string_option("y", "center-footer", "%n %p", &bottom_centre_string, NULL, NULL,
49 OPT_PAGE_FURNITURE,
50 "specify string for center of footer");
51
52 top_right_string = NULL;
53 string_option("Z", "right-header", "Page %P of %F", &top_right_string, NULL, NULL,
54 OPT_PAGE_FURNITURE,
55 "specify string for right side of header");
56
57 bottom_right_string = NULL;
58 string_option("z", "right-footer", "Page %P of %F", &bottom_right_string, NULL, NULL,
59 OPT_PAGE_FURNITURE,
60 "specify string for right side of footer");
61
62 message_string = NULL;
63 string_option("m", "message", NULL, &message_string, NULL, NULL,
64 OPT_PAGE_FURNITURE,
65 "message to be printed over page");
66 }
67
68 /*
69 * Function:
70 * print_text_header
71 */
72 void
print_text_header(long page_number,long total_pages)73 print_text_header(long page_number, long total_pages)
74 {
75 PS_startpage(top_left_string, top_centre_string, top_right_string,
76 bottom_left_string, bottom_centre_string, bottom_right_string,
77 message_string, page_number, total_pages, FALSE);
78 }
79
80 /*
81 * Function:
82 * print_file_header
83 */
84 void
print_file_header(long page_no)85 print_file_header(long page_no)
86 {
87 char page_no_string[10];
88
89 sprintf(page_no_string, "Page %ld", page_no);
90
91 PS_startpage("%L", "File Index", page_no_string,
92 "%L", "File Index", page_no_string,
93 message_string, page_no, 0, TRUE);
94 }
95
96 /*
97 * Function:
98 * print_index_header
99 */
100 void
print_index_header(long page_no)101 print_index_header(long page_no)
102 {
103 char page_no_string[10];
104
105 sprintf(page_no_string, "Page %ld", page_no);
106
107 PS_startpage("%L", "Function Index", page_no_string,
108 "%L", "Function Index", page_no_string,
109 message_string, page_no, 0, TRUE);
110 }
111
112
113
114
115
116
117
118