1 | /* |
---|
2 | * Internal header file. |
---|
3 | * Copyright (c) 1995-1998 Markku Rossi. |
---|
4 | * |
---|
5 | * Author: Markku Rossi <mtr@iki.fi> |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * This file is part of GNU enscript. |
---|
10 | * |
---|
11 | * This program is free software; you can redistribute it and/or modify |
---|
12 | * it under the terms of the GNU General Public License as published by |
---|
13 | * the Free Software Foundation; either version 2, or (at your option) |
---|
14 | * any later version. |
---|
15 | * |
---|
16 | * This program is distributed in the hope that it will be useful, |
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | * GNU General Public License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU General Public License |
---|
22 | * along with this program; see the file COPYING. If not, write to |
---|
23 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
24 | * Boston, MA 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef GSINT_H |
---|
28 | #define GSINT_H |
---|
29 | |
---|
30 | /* |
---|
31 | * Config stuffs. |
---|
32 | */ |
---|
33 | |
---|
34 | #ifdef HAVE_CONFIG_H |
---|
35 | #include <config.h> |
---|
36 | #endif |
---|
37 | |
---|
38 | #include <stdio.h> |
---|
39 | |
---|
40 | #include <sys/types.h> |
---|
41 | #include <sys/stat.h> |
---|
42 | |
---|
43 | #ifndef ___P |
---|
44 | #if PROTOTYPES |
---|
45 | #define ___P(protos) protos |
---|
46 | #else /* no PROTOTYPES */ |
---|
47 | #define ___P(protos) () |
---|
48 | #endif /* no PROTOTYPES */ |
---|
49 | #endif |
---|
50 | |
---|
51 | #if STDC_HEADERS |
---|
52 | |
---|
53 | #include <stdlib.h> |
---|
54 | #include <string.h> |
---|
55 | |
---|
56 | #else /* no STDC_HEADERS */ |
---|
57 | |
---|
58 | #if HAVE_STDLIB_H |
---|
59 | #include <stdlib.h> |
---|
60 | #endif |
---|
61 | |
---|
62 | #if HAVE_STRING_H |
---|
63 | #include <string.h> |
---|
64 | #endif |
---|
65 | |
---|
66 | #ifndef HAVE_STRCHR |
---|
67 | #define strchr index |
---|
68 | #define strrchr rindex |
---|
69 | #endif |
---|
70 | char *strchr (); |
---|
71 | char *strrchr (); |
---|
72 | |
---|
73 | #ifndef HAVE_STRERROR |
---|
74 | extern char *strerror ___P ((int)); |
---|
75 | #endif |
---|
76 | |
---|
77 | #ifndef HAVE_MEMMOVE |
---|
78 | extern void *memmove ___P ((void *, void *, size_t)); |
---|
79 | #endif |
---|
80 | |
---|
81 | #ifndef HAVE_MEMCPY |
---|
82 | extern void *memcpy ___P ((void *, void *, size_t)); |
---|
83 | #endif |
---|
84 | |
---|
85 | #endif /* no STDC_HEADERS */ |
---|
86 | |
---|
87 | #if HAVE_UNISTD_H |
---|
88 | #include <unistd.h> |
---|
89 | #endif |
---|
90 | |
---|
91 | #if HAVE_MATH_H |
---|
92 | #include <math.h> |
---|
93 | #else |
---|
94 | extern double atan2 ___P ((double, double)); |
---|
95 | #endif |
---|
96 | |
---|
97 | #include <errno.h> |
---|
98 | #include <time.h> |
---|
99 | #include <assert.h> |
---|
100 | #include <ctype.h> |
---|
101 | |
---|
102 | #if HAVE_PWD_H |
---|
103 | #include <pwd.h> |
---|
104 | #else |
---|
105 | #include "dummypwd.h" |
---|
106 | #endif |
---|
107 | |
---|
108 | #if ENABLE_NLS |
---|
109 | #include <libintl.h> |
---|
110 | #define _(String) gettext (String) |
---|
111 | #else |
---|
112 | #define _(String) String |
---|
113 | #endif |
---|
114 | |
---|
115 | #if HAVE_LC_MESSAGES |
---|
116 | #include <locale.h> |
---|
117 | #endif |
---|
118 | |
---|
119 | #ifndef HAVE_GETCWD |
---|
120 | #if HAVE_GETWD |
---|
121 | #define getcwd(buf, len) getwd(buf) |
---|
122 | #endif /* HAVE_GETWD */ |
---|
123 | #endif /* not HAVE_GETCWD */ |
---|
124 | |
---|
125 | #include "afm.h" |
---|
126 | #include "strhash.h" |
---|
127 | #include "xalloc.h" |
---|
128 | |
---|
129 | /* |
---|
130 | * Types and definitions. |
---|
131 | */ |
---|
132 | |
---|
133 | #define MATCH(a, b) (strcmp (a, b) == 0) |
---|
134 | |
---|
135 | #define ISNUMBERDIGIT(ch) \ |
---|
136 | (('0' <= (ch) && (ch) <= '9') || (ch) == '.' || (ch) == '-' || (ch) == '+') |
---|
137 | |
---|
138 | /* Return the width of the character <ch> */ |
---|
139 | #define CHAR_WIDTH(ch) (font_widths[(unsigned char) (ch)]) |
---|
140 | |
---|
141 | /* Current point y movement from line to line. */ |
---|
142 | #define LINESKIP (Fpt.h + baselineskip) |
---|
143 | |
---|
144 | |
---|
145 | /* Constants for output files. */ |
---|
146 | #define OUTPUT_FILE_NONE NULL |
---|
147 | #define OUTPUT_FILE_STDOUT ((char *) 1) |
---|
148 | |
---|
149 | /* Underlay styles. */ |
---|
150 | #define UL_STYLE_OUTLINE 0 |
---|
151 | #define UL_STYLE_FILLED 1 |
---|
152 | |
---|
153 | struct media_entry_st |
---|
154 | { |
---|
155 | struct media_entry_st *next; |
---|
156 | char *name; |
---|
157 | int w; |
---|
158 | int h; |
---|
159 | int llx; |
---|
160 | int lly; |
---|
161 | int urx; |
---|
162 | int ury; |
---|
163 | }; |
---|
164 | |
---|
165 | typedef struct media_entry_st MediaEntry; |
---|
166 | |
---|
167 | typedef enum |
---|
168 | { |
---|
169 | HDR_NONE, |
---|
170 | HDR_SIMPLE, |
---|
171 | HDR_FANCY |
---|
172 | } HeaderType; |
---|
173 | |
---|
174 | |
---|
175 | typedef enum |
---|
176 | { |
---|
177 | ENC_ISO_8859_1, |
---|
178 | ENC_ISO_8859_2, |
---|
179 | ENC_ISO_8859_3, |
---|
180 | ENC_ISO_8859_4, |
---|
181 | ENC_ISO_8859_5, |
---|
182 | ENC_ISO_8859_7, |
---|
183 | ENC_ASCII, |
---|
184 | ENC_ASCII_FISE, |
---|
185 | ENC_ASCII_DKNO, |
---|
186 | ENC_IBMPC, |
---|
187 | ENC_MAC, |
---|
188 | ENC_VMS, |
---|
189 | ENC_HP8, |
---|
190 | ENC_KOI8, |
---|
191 | ENC_PS |
---|
192 | } InputEncoding; |
---|
193 | |
---|
194 | typedef enum |
---|
195 | { |
---|
196 | LABEL_SHORT, |
---|
197 | LABEL_LONG |
---|
198 | } PageLabelFormat; |
---|
199 | |
---|
200 | typedef enum |
---|
201 | { |
---|
202 | MWLS_NONE = 0, |
---|
203 | MWLS_PLUS = 1, |
---|
204 | MWLS_BOX = 2, |
---|
205 | MWLS_ARROW = 3 |
---|
206 | } MarkWrappedLinesStyle; |
---|
207 | |
---|
208 | typedef enum |
---|
209 | { |
---|
210 | NPF_SPACE, |
---|
211 | NPF_QUESTIONMARK, |
---|
212 | NPF_CARET, |
---|
213 | NPF_OCTAL |
---|
214 | } NonPrintableFormat; |
---|
215 | |
---|
216 | typedef enum |
---|
217 | { |
---|
218 | FORMFEED_COLUMN, |
---|
219 | FORMFEED_PAGE, |
---|
220 | FORMFEED_HCOLUMN |
---|
221 | } FormFeedType; |
---|
222 | |
---|
223 | typedef enum |
---|
224 | { |
---|
225 | LE_TRUNCATE, |
---|
226 | LE_CHAR_WRAP, |
---|
227 | LE_WORD_WRAP |
---|
228 | } LineEndType; |
---|
229 | |
---|
230 | struct file_lookup_ctx_st |
---|
231 | { |
---|
232 | char name[256]; |
---|
233 | char suffix[256]; |
---|
234 | char fullname[512]; |
---|
235 | }; |
---|
236 | |
---|
237 | typedef struct file_lookup_ctx_st FileLookupCtx; |
---|
238 | |
---|
239 | typedef int (*PathWalkProc) ___P ((char *path, void *context)); |
---|
240 | |
---|
241 | struct input_stream_st |
---|
242 | { |
---|
243 | int is_pipe; /* Is <fp> opened to pipe? */ |
---|
244 | FILE *fp; |
---|
245 | unsigned char buf[4096]; |
---|
246 | unsigned int data_in_buf; |
---|
247 | unsigned int bufpos; |
---|
248 | unsigned int nreads; |
---|
249 | unsigned char *unget_ch; |
---|
250 | unsigned int unget_pos; |
---|
251 | unsigned int unget_alloc; |
---|
252 | }; |
---|
253 | |
---|
254 | typedef struct input_stream_st InputStream; |
---|
255 | |
---|
256 | struct page_range_st |
---|
257 | { |
---|
258 | struct page_range_st *next; |
---|
259 | int odd; |
---|
260 | int even; |
---|
261 | unsigned int start; |
---|
262 | unsigned int end; |
---|
263 | }; |
---|
264 | |
---|
265 | typedef struct page_range_st PageRange; |
---|
266 | |
---|
267 | struct font_point_st |
---|
268 | { |
---|
269 | double w; /* width */ |
---|
270 | double h; /* height */ |
---|
271 | }; |
---|
272 | |
---|
273 | typedef struct font_point_st FontPoint; |
---|
274 | |
---|
275 | struct color_st |
---|
276 | { |
---|
277 | float r; |
---|
278 | float g; |
---|
279 | float b; |
---|
280 | }; |
---|
281 | |
---|
282 | typedef struct color_st Color; |
---|
283 | |
---|
284 | struct cached_font_info_st |
---|
285 | { |
---|
286 | double font_widths[256]; |
---|
287 | char font_ctype[256]; |
---|
288 | AFMBoolean font_is_fixed; |
---|
289 | AFMNumber font_bbox_lly; |
---|
290 | }; |
---|
291 | |
---|
292 | typedef struct cached_font_info_st CachedFontInfo; |
---|
293 | |
---|
294 | |
---|
295 | /* |
---|
296 | * Global variables. |
---|
297 | */ |
---|
298 | |
---|
299 | extern char *program; |
---|
300 | extern FILE *ofp; |
---|
301 | extern char version_string[]; |
---|
302 | extern char ps_version_string[]; |
---|
303 | extern char date_string[]; |
---|
304 | extern struct tm run_tm; |
---|
305 | extern struct tm mod_tm; |
---|
306 | extern struct passwd *passwd; |
---|
307 | extern char libpath[]; |
---|
308 | extern char *afm_path; |
---|
309 | extern char afm_path_buffer[]; |
---|
310 | extern MediaEntry *media_names; |
---|
311 | extern MediaEntry *media; |
---|
312 | extern char no_job_header_switch[]; |
---|
313 | extern char output_first_line[]; |
---|
314 | extern char queue_param[]; |
---|
315 | extern char spooler_command[]; |
---|
316 | extern int nl; |
---|
317 | extern int bs; |
---|
318 | extern unsigned int current_pagenum; |
---|
319 | extern unsigned int input_filenum; |
---|
320 | extern unsigned int current_file_linenum; |
---|
321 | extern char fname[]; |
---|
322 | |
---|
323 | /* Statistics. */ |
---|
324 | extern int total_pages; |
---|
325 | extern int num_truncated_lines; |
---|
326 | extern int num_missing_chars; |
---|
327 | extern int missing_chars[]; |
---|
328 | extern int num_non_printable_chars; |
---|
329 | extern int non_printable_chars[]; |
---|
330 | |
---|
331 | /* Dimensions that are used during PostScript generation. */ |
---|
332 | extern int d_page_w; |
---|
333 | extern int d_page_h; |
---|
334 | extern int d_header_w; |
---|
335 | extern int d_header_h; |
---|
336 | extern int d_footer_h; |
---|
337 | extern int d_output_w; |
---|
338 | extern int d_output_h; |
---|
339 | extern int d_output_x_margin; |
---|
340 | extern int d_output_y_margin; |
---|
341 | extern unsigned int nup_xpad; |
---|
342 | extern unsigned int nup_ypad; |
---|
343 | |
---|
344 | /* Document needed resources. */ |
---|
345 | extern StringHashPtr res_fonts; |
---|
346 | |
---|
347 | /* Fonts to download. */ |
---|
348 | extern StringHashPtr download_fonts; |
---|
349 | |
---|
350 | /* Additional key-value pairs, passed to the generated PostScript code. */ |
---|
351 | extern StringHashPtr pagedevice; |
---|
352 | extern StringHashPtr statusdict; |
---|
353 | |
---|
354 | /* User defined strings. */ |
---|
355 | extern StringHashPtr user_strings; |
---|
356 | |
---|
357 | /* Cache for AFM files. */ |
---|
358 | extern StringHashPtr afm_cache; |
---|
359 | extern StringHashPtr afm_info_cache; |
---|
360 | |
---|
361 | /* AFM library handle. */ |
---|
362 | extern AFMHandle afm; |
---|
363 | |
---|
364 | /* Fonts. */ |
---|
365 | extern char *HFname; |
---|
366 | extern FontPoint HFpt; |
---|
367 | extern char *Fname; |
---|
368 | extern FontPoint Fpt; |
---|
369 | extern FontPoint default_Fpt; |
---|
370 | extern char *default_Fname; |
---|
371 | |
---|
372 | extern double font_widths[]; |
---|
373 | extern char font_ctype[]; |
---|
374 | extern int font_is_fixed; |
---|
375 | extern double font_bbox_lly; |
---|
376 | |
---|
377 | /* Options. */ |
---|
378 | |
---|
379 | extern char *printer; |
---|
380 | extern char printer_buf[]; |
---|
381 | extern int verbose; |
---|
382 | extern int num_copies; |
---|
383 | extern char *title; |
---|
384 | extern int num_columns; |
---|
385 | extern LineEndType line_end; |
---|
386 | extern int quiet; |
---|
387 | extern int landscape; |
---|
388 | extern HeaderType header; |
---|
389 | extern char *fancy_header_name; |
---|
390 | extern char fancy_header_default[]; |
---|
391 | extern double line_indent; |
---|
392 | extern char *page_header; |
---|
393 | extern char *output_file; |
---|
394 | extern unsigned int lines_per_page; |
---|
395 | extern InputEncoding encoding; |
---|
396 | extern char *media_name; |
---|
397 | extern char media_name_buffer[]; |
---|
398 | extern char *encoding_name; |
---|
399 | extern char encoding_name_buffer[]; |
---|
400 | extern int special_escapes; |
---|
401 | extern int escape_char; |
---|
402 | extern int default_escape_char; |
---|
403 | extern int tabsize; |
---|
404 | extern double baselineskip; |
---|
405 | extern FontPoint ul_ptsize; |
---|
406 | extern double ul_gray; |
---|
407 | extern char *ul_font; |
---|
408 | extern char *underlay; |
---|
409 | extern char ul_position_buf[]; |
---|
410 | extern char *ul_position; |
---|
411 | extern double ul_x; |
---|
412 | extern double ul_y; |
---|
413 | extern double ul_angle; |
---|
414 | extern unsigned int ul_style; |
---|
415 | extern char *ul_style_str; |
---|
416 | extern char ul_style_str_buf[]; |
---|
417 | extern int ul_position_p; |
---|
418 | extern int ul_angle_p; |
---|
419 | extern PageLabelFormat page_label; |
---|
420 | extern char *page_label_format; |
---|
421 | extern char page_label_format_buf[]; |
---|
422 | extern int pass_through; |
---|
423 | extern int line_numbers; |
---|
424 | extern unsigned int start_line_number; |
---|
425 | extern int interpret_formfeed; |
---|
426 | extern NonPrintableFormat non_printable_format; |
---|
427 | extern MarkWrappedLinesStyle mark_wrapped_lines_style; |
---|
428 | extern char mark_wrapped_lines_style_name[]; |
---|
429 | extern char *npf_name; |
---|
430 | extern char npf_name_buf[]; |
---|
431 | extern int clean_7bit; |
---|
432 | extern int append_ctrl_D; |
---|
433 | extern unsigned int highlight_bars; |
---|
434 | extern double highlight_bar_gray; |
---|
435 | extern int page_prefeed; |
---|
436 | extern PageRange *page_ranges; |
---|
437 | extern int borders; |
---|
438 | extern double line_highlight_gray; |
---|
439 | extern double bggray; |
---|
440 | extern int accept_composites; |
---|
441 | extern FormFeedType formfeed_type; |
---|
442 | extern char *input_filter_stdin; |
---|
443 | extern int toc; |
---|
444 | extern FILE *toc_fp; |
---|
445 | extern char *toc_fmt_string; |
---|
446 | extern unsigned int file_align; |
---|
447 | extern int slicing; |
---|
448 | extern unsigned int slice; |
---|
449 | extern char states_path[]; |
---|
450 | extern char states_color_model[]; |
---|
451 | extern char states_config_file[]; |
---|
452 | extern char states_highlight_level[]; |
---|
453 | extern unsigned int nup; |
---|
454 | extern unsigned int nup_rows; |
---|
455 | extern unsigned int nup_columns; |
---|
456 | extern int nup_landscape; |
---|
457 | extern unsigned int nup_width; |
---|
458 | extern unsigned int nup_height; |
---|
459 | extern double nup_scale; |
---|
460 | extern char *output_language; |
---|
461 | extern int output_language_pass_through; |
---|
462 | extern int generate_PageSize; |
---|
463 | extern double horizontal_column_height; |
---|
464 | extern unsigned int pslevel; |
---|
465 | extern int rotate_even_pages; |
---|
466 | |
---|
467 | |
---|
468 | /* |
---|
469 | * Prototypes for global functions. |
---|
470 | */ |
---|
471 | |
---|
472 | /* Print message if <verbose> is >= <verbose_level>. */ |
---|
473 | #define MESSAGE(verbose_level, body) \ |
---|
474 | do { \ |
---|
475 | if (!quiet && verbose >= (verbose_level)) \ |
---|
476 | fprintf body; \ |
---|
477 | } while (0) |
---|
478 | |
---|
479 | /* Report continuable error. */ |
---|
480 | #define ERROR(body) \ |
---|
481 | do { \ |
---|
482 | fprintf (stderr, "%s: ", program); \ |
---|
483 | fprintf body; \ |
---|
484 | fprintf (stderr, "\n"); \ |
---|
485 | fflush (stderr); \ |
---|
486 | } while (0) |
---|
487 | |
---|
488 | /* Report fatal error and exit with status 1. Function never returns. */ |
---|
489 | #define FATAL(body) \ |
---|
490 | do { \ |
---|
491 | fprintf (stderr, "%s: ", program); \ |
---|
492 | fprintf body; \ |
---|
493 | fprintf (stderr, "\n"); \ |
---|
494 | fflush (stderr); \ |
---|
495 | exit (1); \ |
---|
496 | } while (0) |
---|
497 | |
---|
498 | /* |
---|
499 | * Read config file <path, name>. Returns bool. If function fails, error |
---|
500 | * is found from errno. |
---|
501 | */ |
---|
502 | int read_config ___P ((char *path, char *name)); |
---|
503 | |
---|
504 | /* Print PostScript header to our output stream. */ |
---|
505 | void dump_ps_header ___P ((void)); |
---|
506 | |
---|
507 | /* Print PostScript trailer to our output stream. */ |
---|
508 | void dump_ps_trailer ___P ((void)); |
---|
509 | |
---|
510 | /* |
---|
511 | * Open InputStream to <fp> or <fname>. If <input_filter> is given |
---|
512 | * it is used to pre-filter the incoming data stream. Function returns |
---|
513 | * 1 if stream could be opened or 0 otherwise. |
---|
514 | */ |
---|
515 | int is_open ___P ((InputStream *is, FILE *fp, char *fname, |
---|
516 | char *input_filter)); |
---|
517 | |
---|
518 | /* Close InputStream <is>. */ |
---|
519 | void is_close ___P ((InputStream *is)); |
---|
520 | |
---|
521 | /* |
---|
522 | * Read next character from the InputStream <is>. Returns EOF if |
---|
523 | * EOF was reached. |
---|
524 | */ |
---|
525 | int is_getc ___P ((InputStream *is)); |
---|
526 | |
---|
527 | /* |
---|
528 | * Put character <ch> back to the InputStream <is>. Function returns EOF |
---|
529 | * if character couldn't be unget. |
---|
530 | */ |
---|
531 | int is_ungetc ___P ((int ch, InputStream *is)); |
---|
532 | |
---|
533 | /* |
---|
534 | * Process single input file <fp>. File's name is given in <fname> and |
---|
535 | * it is used to print headers. |
---|
536 | */ |
---|
537 | void process_file ___P ((char *fname, InputStream *fp)); |
---|
538 | |
---|
539 | /* Add a new media to the list of known media. */ |
---|
540 | void add_media ___P ((char *name, int w, int h, int llx, int lly, int urx, |
---|
541 | int ury)); |
---|
542 | |
---|
543 | /* Print a listing of missing characters. */ |
---|
544 | void do_list_missing_characters ___P ((int *array)); |
---|
545 | |
---|
546 | /* |
---|
547 | * Check if file <name, suffix> exists. Returns bool. If function fails |
---|
548 | * error can be found from errno. |
---|
549 | */ |
---|
550 | int file_existsp ___P ((char *name, char *suffix)); |
---|
551 | |
---|
552 | /* |
---|
553 | * Paste file <name, suffix> to output stream. Returns bool. If |
---|
554 | * function fails, error can be found from errno. |
---|
555 | */ |
---|
556 | int paste_file ___P ((char *name, char *suffix)); |
---|
557 | |
---|
558 | /* |
---|
559 | * Do tilde substitution for filename <from> and insert result to <to>. |
---|
560 | * Buffer <to> must be long enought to hold expanded name. |
---|
561 | */ |
---|
562 | void tilde_subst ___P ((char *from, char *to)); |
---|
563 | |
---|
564 | /* |
---|
565 | * Parse one float dimension from string <string>. If <units> is true, |
---|
566 | * then number can be followed by an optional unit specifier. If |
---|
567 | * <horizontal> is true, then dimension is horizontal, otherwise it |
---|
568 | * is vertical. |
---|
569 | */ |
---|
570 | double parse_float ___P ((char *string, int units, int horizontal)); |
---|
571 | |
---|
572 | /* |
---|
573 | * Parse font spec <spec> and return font's name and size in variables |
---|
574 | * <name_return> and <size_return>. Returns 1 if <spec> was a valid |
---|
575 | * font spec or 0 otherwise. Returned name <name_return> is allocated |
---|
576 | * with xcalloc() and must be freed by caller. |
---|
577 | */ |
---|
578 | int parse_font_spec ___P ((char *spec, char **name_return, |
---|
579 | FontPoint *size_return)); |
---|
580 | |
---|
581 | /* |
---|
582 | * Read body font's character widths and character codes from AFM files. |
---|
583 | */ |
---|
584 | void read_font_info ___P ((void)); |
---|
585 | |
---|
586 | /* |
---|
587 | * Try to download font <name>. |
---|
588 | */ |
---|
589 | void download_font ___P ((char *name)); |
---|
590 | |
---|
591 | /* |
---|
592 | * Escape all PostScript string's special characters from string <string>. |
---|
593 | * Returns a xmalloc()ated result. |
---|
594 | */ |
---|
595 | char *escape_string ___P ((char *string)); |
---|
596 | |
---|
597 | /* |
---|
598 | * Expand user escapes from string <string>. Returns a xmalloc()ated |
---|
599 | * result. |
---|
600 | */ |
---|
601 | char *format_user_string ___P ((char *context_name, char *string)); |
---|
602 | |
---|
603 | /* |
---|
604 | * Parses key-value pair <kv> and inserts/deletes key from <set>. |
---|
605 | */ |
---|
606 | void parse_key_value_pair ___P ((StringHashPtr set, char *kv)); |
---|
607 | |
---|
608 | /* |
---|
609 | * Count how many non-empty items there are in the key-value set <set>. |
---|
610 | */ |
---|
611 | int count_key_value_set ___P ((StringHashPtr set)); |
---|
612 | |
---|
613 | /* |
---|
614 | * Walk through path <path> and call <proc> once for each of its |
---|
615 | * components. Function returns 0 if all components were accessed. |
---|
616 | * Callback <proc> can interrupt walking by returning a non zero |
---|
617 | * return value. In that case value is returned as the return value |
---|
618 | * of the pathwalk(). |
---|
619 | */ |
---|
620 | int pathwalk ___P ((char *path, PathWalkProc proc, void *context)); |
---|
621 | |
---|
622 | /* Lookup file from path. <context> must point to FileLookupCtx. */ |
---|
623 | int file_lookup ___P ((char *path, void *context)); |
---|
624 | |
---|
625 | |
---|
626 | /* |
---|
627 | * Portable printer interface. |
---|
628 | */ |
---|
629 | |
---|
630 | /* |
---|
631 | * Open and initialize printer <cmd>, <options>, <queue_param> and |
---|
632 | * <printer_name>. Function returns a FILE pointer to which enscript |
---|
633 | * can generate its PostScript output or NULL if printer |
---|
634 | * initialization failed. Command can store its context information |
---|
635 | * to variable <context_return> wich is passed as an argument to the |
---|
636 | * printer_close() function. |
---|
637 | */ |
---|
638 | FILE *printer_open ___P ((char *cmd, char *options, char *queue_param, |
---|
639 | char *printer_name, void **context_return)); |
---|
640 | |
---|
641 | /* |
---|
642 | * Flush all pending output to printer <context> and close it. |
---|
643 | */ |
---|
644 | void printer_close ___P ((void *context)); |
---|
645 | |
---|
646 | #endif /* not GSINT_H */ |
---|