Sync-to-go: update copyright for 2015
[s-roff.git] / src / dev-ps / ps.h
blob34239f2bc4694deb864e62ec8fc899c10c8bcf42
1 /*@
2 * Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
4 * Copyright (C) 1989 - 1992, 2002 - 2003
5 * Free Software Foundation, Inc.
6 * Written by James Clark (jjc@jclark.com)
8 * This 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
10 * Software Foundation; either version 2, or (at your option) any later
11 * version.
13 * This 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.
18 * You should have received a copy of the GNU General Public License along
19 * with groff; see the file COPYING. If not, write to the Free Software
20 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _PS_H
23 #define _PS_H
25 #include "config.h"
26 #include "ps-config.h"
28 #include "searchpath.h"
30 class ps_output
32 FILE *fp;
33 int col;
34 int max_line_length; // not including newline
35 int need_space;
36 int fixed_point;
38 public:
39 ps_output(FILE *, int max_line_length);
40 ps_output &put_string(const char *, int);
41 ps_output &put_number(int);
42 ps_output &put_fix_number(int);
43 ps_output &put_float(double);
44 ps_output &put_symbol(const char *);
45 ps_output &put_color(unsigned int);
46 ps_output &put_literal_symbol(const char *);
47 ps_output &set_fixed_point(int);
48 ps_output &simple_comment(const char *);
49 ps_output &begin_comment(const char *);
50 ps_output &comment_arg(const char *);
51 ps_output &end_comment();
52 ps_output &set_file(FILE *);
53 ps_output &include_file(FILE *);
54 ps_output &copy_file(FILE *);
55 ps_output &end_line();
56 ps_output &put_delimiter(char);
57 ps_output &special(const char *);
58 FILE *get_file();
61 inline FILE *ps_output::get_file()
63 return fp;
66 enum resource_type {
67 RESOURCE_FONT,
68 RESOURCE_PROCSET,
69 RESOURCE_FILE,
70 RESOURCE_ENCODING,
71 RESOURCE_FORM,
72 RESOURCE_PATTERN
75 struct resource;
77 extern string an_empty_string;
79 class resource_manager
81 unsigned extensions;
82 unsigned language_level;
83 resource *procset_resource;
84 resource *resource_list;
85 resource *lookup_resource(resource_type type, string &name,
86 string &version = an_empty_string,
87 unsigned revision = 0);
88 resource *lookup_font(const char *name);
89 void read_download_file();
90 void supply_resource(resource *r, int rank, FILE *ofp, int is_document = 0);
91 void process_file(int rank, file_case *fcp, FILE *ofp);
92 resource *read_file_arg(const char **);
93 resource *read_procset_arg(const char **);
94 resource *read_font_arg(const char **);
95 resource *read_resource_arg(const char **);
96 void print_resources_comment(unsigned flag, FILE *ofp);
97 void print_extensions_comment(FILE *ofp);
98 void print_language_level_comment(FILE *ofp);
99 int do_begin_resource(const char *ptr, int rank, file_case *fcp, FILE *ofp);
100 int do_include_resource(const char *ptr, int rank, file_case *fcp, FILE *ofp);
101 int do_begin_document(const char *ptr, int rank, file_case *fcp, FILE *ofp);
102 int do_include_document(const char *ptr, int rank, file_case *fcp, FILE *ofp);
103 int do_begin_procset(const char *ptr, int rank, file_case *fcp, FILE *ofp);
104 int do_include_procset(const char *ptr, int rank, file_case *fcp, FILE *ofp);
105 int do_begin_font(const char *ptr, int rank, file_case *fcp, FILE *ofp);
106 int do_include_font(const char *ptr, int rank, file_case *fcp, FILE *ofp);
107 int do_begin_file(const char *ptr, int rank, file_case *fcp, FILE *ofp);
108 int do_include_file(const char *ptr, int rank, file_case *fp, FILE *ofp);
109 int change_to_end_resource(const char *ptr, int rank, file_case *fp,
110 FILE *ofp);
111 int do_begin_preview(const char *ptr, int rank, file_case *fcp, FILE *ofp);
112 int do_begin_data(const char *ptr, int rank, file_case *fcp, FILE *ofp);
113 int do_begin_binary(const char *ptr, int rank, file_case *fcp, FILE *ofp);
115 public:
116 resource_manager();
117 ~resource_manager();
118 void import_file(const char *filename, ps_output &);
119 void need_font(const char *name);
120 void print_header_comments(ps_output &);
121 void document_setup(ps_output &);
122 void output_prolog(ps_output &);
125 extern unsigned broken_flags;
127 // broken_flags is ored from these
129 enum {
130 NO_SETUP_SECTION = 01,
131 STRIP_PERCENT_BANG = 02,
132 STRIP_STRUCTURE_COMMENTS = 04,
133 USE_PS_ADOBE_2_0 = 010,
134 NO_PAPERSIZE = 020
137 extern search_path include_search_path;
139 #endif // _PS_H
140 // s-it2-mode