pic.h revision 104862
1// -*- C++ -*- 2/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 21 22#include "lib.h" 23 24#include <math.h> 25#include <stdlib.h> 26#include <errno.h> 27 28#ifdef NEED_DECLARATION_HYPOT 29extern "C" { 30 double hypot(double, double); 31} 32#endif /* NEED_DECLARATION_HYPOT */ 33 34#include "assert.h" 35#include "cset.h" 36#include "stringclass.h" 37#include "errarg.h" 38#include "error.h" 39#include "position.h" 40#include "text.h" 41#include "output.h" 42 43#ifndef M_SQRT2 44#define M_SQRT2 1.41421356237309504880 45#endif 46 47#ifndef M_PI 48#define M_PI 3.14159265358979323846 49#endif 50 51class input { 52 input *next; 53public: 54 input(); 55 virtual ~input(); 56 virtual int get() = 0; 57 virtual int peek() = 0; 58 virtual int get_location(const char **, int *); 59 friend class input_stack; 60 friend class copy_rest_thru_input; 61}; 62 63class file_input : public input { 64 FILE *fp; 65 const char *filename; 66 int lineno; 67 string line; 68 const char *ptr; 69 int read_line(); 70public: 71 file_input(FILE *, const char *); 72 ~file_input(); 73 int get(); 74 int peek(); 75 int get_location(const char **, int *); 76}; 77 78void lex_init(input *); 79int get_location(char **, int *); 80 81void do_copy(const char *file); 82void parse_init(); 83void parse_cleanup(); 84 85void lex_error(const char *message, 86 const errarg &arg1 = empty_errarg, 87 const errarg &arg2 = empty_errarg, 88 const errarg &arg3 = empty_errarg); 89 90void lex_warning(const char *message, 91 const errarg &arg1 = empty_errarg, 92 const errarg &arg2 = empty_errarg, 93 const errarg &arg3 = empty_errarg); 94 95void lex_cleanup(); 96 97extern int flyback_flag; 98extern int command_char; 99// zero_length_line_flag is non-zero if zero-length lines are drawn 100// as dots by the output device 101extern int zero_length_line_flag; 102extern int driver_extension_flag; 103extern int compatible_flag; 104extern int safer_flag; 105