| Commit | Line | Data |
|---|---|---|
| 92d0a6a6 | 1 | // -*- C++ -*- |
| 4d3e9548 | 2 | /* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2003, 2009 |
| 92d0a6a6 JR |
3 | Free Software Foundation, Inc. |
| 4 | Written by James Clark (jjc@jclark.com) | |
| 5 | ||
| 6 | This file is part of groff. | |
| 7 | ||
| 8 | groff is free software; you can redistribute it and/or modify it under | |
| 9 | the terms of the GNU General Public License as published by the Free | |
| 4d3e9548 JL |
10 | Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. | |
| 92d0a6a6 JR |
12 | |
| 13 | groff is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 16 | for more details. | |
| 17 | ||
| 4d3e9548 JL |
18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
| 92d0a6a6 JR |
20 | |
| 21 | class ps_output { | |
| 22 | public: | |
| 23 | ps_output(FILE *, int max_line_length); | |
| 24 | ps_output &put_string(const char *, int); | |
| 25 | ps_output &put_number(int); | |
| 26 | ps_output &put_fix_number(int); | |
| 27 | ps_output &put_float(double); | |
| 28 | ps_output &put_symbol(const char *); | |
| 29 | ps_output &put_color(unsigned int); | |
| 30 | ps_output &put_literal_symbol(const char *); | |
| 31 | ps_output &set_fixed_point(int); | |
| 32 | ps_output &simple_comment(const char *); | |
| 33 | ps_output &begin_comment(const char *); | |
| 34 | ps_output &comment_arg(const char *); | |
| 35 | ps_output &end_comment(); | |
| 36 | ps_output &set_file(FILE *); | |
| 37 | ps_output &include_file(FILE *); | |
| 38 | ps_output ©_file(FILE *); | |
| 39 | ps_output &end_line(); | |
| 40 | ps_output &put_delimiter(char); | |
| 41 | ps_output &special(const char *); | |
| 42 | FILE *get_file(); | |
| 43 | private: | |
| 44 | FILE *fp; | |
| 45 | int col; | |
| 46 | int max_line_length; // not including newline | |
| 47 | int need_space; | |
| 48 | int fixed_point; | |
| 49 | }; | |
| 50 | ||
| 51 | inline FILE *ps_output::get_file() | |
| 52 | { | |
| 53 | return fp; | |
| 54 | } | |
| 55 | ||
| 56 | enum resource_type { | |
| 57 | RESOURCE_FONT, | |
| 58 | RESOURCE_PROCSET, | |
| 59 | RESOURCE_FILE, | |
| 60 | RESOURCE_ENCODING, | |
| 61 | RESOURCE_FORM, | |
| 62 | RESOURCE_PATTERN | |
| 63 | }; | |
| 64 | ||
| 65 | struct resource; | |
| 66 | ||
| 67 | extern string an_empty_string; | |
| 68 | ||
| 69 | class resource_manager { | |
| 70 | public: | |
| 71 | resource_manager(); | |
| 72 | ~resource_manager(); | |
| 73 | void import_file(const char *filename, ps_output &); | |
| 74 | void need_font(const char *name); | |
| 75 | void print_header_comments(ps_output &); | |
| 76 | void document_setup(ps_output &); | |
| 77 | void output_prolog(ps_output &); | |
| 78 | private: | |
| 79 | unsigned extensions; | |
| 80 | unsigned language_level; | |
| 81 | resource *procset_resource; | |
| 82 | resource *resource_list; | |
| 83 | resource *lookup_resource(resource_type type, string &name, | |
| 84 | string &version = an_empty_string, | |
| 85 | unsigned revision = 0); | |
| 86 | resource *lookup_font(const char *name); | |
| 87 | void read_download_file(); | |
| 88 | void supply_resource(resource *r, int rank, FILE *outfp, | |
| 89 | int is_document = 0); | |
| 90 | void process_file(int rank, FILE *fp, const char *filename, FILE *outfp); | |
| 91 | resource *read_file_arg(const char **); | |
| 92 | resource *read_procset_arg(const char **); | |
| 93 | resource *read_font_arg(const char **); | |
| 94 | resource *read_resource_arg(const char **); | |
| 95 | void print_resources_comment(unsigned flag, FILE *outfp); | |
| 96 | void print_extensions_comment(FILE *outfp); | |
| 97 | void print_language_level_comment(FILE *outfp); | |
| 98 | int do_begin_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 99 | int do_include_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 100 | int do_begin_document(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 101 | int do_include_document(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 102 | int do_begin_procset(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 103 | int do_include_procset(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 104 | int do_begin_font(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 105 | int do_include_font(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 106 | int do_begin_file(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 107 | int do_include_file(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 108 | int change_to_end_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 109 | int do_begin_preview(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 110 | int do_begin_data(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 111 | int do_begin_binary(const char *ptr, int rank, FILE *fp, FILE *outfp); | |
| 112 | }; | |
| 113 | ||
| 114 | extern unsigned broken_flags; | |
| 115 | ||
| 116 | // broken_flags is ored from these | |
| 117 | ||
| 118 | enum { | |
| 119 | NO_SETUP_SECTION = 01, | |
| 120 | STRIP_PERCENT_BANG = 02, | |
| 121 | STRIP_STRUCTURE_COMMENTS = 04, | |
| 122 | USE_PS_ADOBE_2_0 = 010, | |
| 123 | NO_PAPERSIZE = 020 | |
| 124 | }; | |
| 125 | ||
| 126 | #include "searchpath.h" | |
| 127 | ||
| 128 | extern search_path include_search_path; |