PageRenderTime 52ms CodeModel.GetById 38ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/groff/src/devices/grops/ps.h

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