pic.h revision 104862
175584Sru// -*- C++ -*- 2104862Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 3104862Sru Free Software Foundation, Inc. 475584Sru Written by James Clark (jjc@jclark.com) 575584Sru 675584SruThis file is part of groff. 775584Sru 875584Srugroff is free software; you can redistribute it and/or modify it under 975584Sruthe terms of the GNU General Public License as published by the Free 1075584SruSoftware Foundation; either version 2, or (at your option) any later 1175584Sruversion. 1275584Sru 1375584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 1475584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 1575584SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1675584Srufor more details. 1775584Sru 1875584SruYou should have received a copy of the GNU General Public License along 1975584Sruwith groff; see the file COPYING. If not, write to the Free Software 2075584SruFoundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 2175584Sru 22104862Sru#include "lib.h" 23104862Sru 2475584Sru#include <math.h> 2575584Sru#include <stdlib.h> 2675584Sru#include <errno.h> 2775584Sru 2875584Sru#ifdef NEED_DECLARATION_HYPOT 2975584Sruextern "C" { 3075584Sru double hypot(double, double); 3175584Sru} 3275584Sru#endif /* NEED_DECLARATION_HYPOT */ 3375584Sru 3475584Sru#include "assert.h" 3575584Sru#include "cset.h" 3675584Sru#include "stringclass.h" 3775584Sru#include "errarg.h" 3875584Sru#include "error.h" 3975584Sru#include "position.h" 4075584Sru#include "text.h" 4175584Sru#include "output.h" 4275584Sru 4375584Sru#ifndef M_SQRT2 4475584Sru#define M_SQRT2 1.41421356237309504880 4575584Sru#endif 4675584Sru 4775584Sru#ifndef M_PI 4875584Sru#define M_PI 3.14159265358979323846 4975584Sru#endif 5075584Sru 5175584Sruclass input { 5275584Sru input *next; 5375584Srupublic: 5475584Sru input(); 5575584Sru virtual ~input(); 5675584Sru virtual int get() = 0; 5775584Sru virtual int peek() = 0; 5875584Sru virtual int get_location(const char **, int *); 5975584Sru friend class input_stack; 6075584Sru friend class copy_rest_thru_input; 6175584Sru}; 6275584Sru 6375584Sruclass file_input : public input { 6475584Sru FILE *fp; 6575584Sru const char *filename; 6675584Sru int lineno; 6775584Sru string line; 6875584Sru const char *ptr; 6975584Sru int read_line(); 7075584Srupublic: 7175584Sru file_input(FILE *, const char *); 7275584Sru ~file_input(); 7375584Sru int get(); 7475584Sru int peek(); 7575584Sru int get_location(const char **, int *); 7675584Sru}; 7775584Sru 7875584Sruvoid lex_init(input *); 7975584Sruint get_location(char **, int *); 8075584Sru 8175584Sruvoid do_copy(const char *file); 8275584Sruvoid parse_init(); 8375584Sruvoid parse_cleanup(); 8475584Sru 8575584Sruvoid lex_error(const char *message, 8675584Sru const errarg &arg1 = empty_errarg, 8775584Sru const errarg &arg2 = empty_errarg, 8875584Sru const errarg &arg3 = empty_errarg); 8975584Sru 9075584Sruvoid lex_warning(const char *message, 9175584Sru const errarg &arg1 = empty_errarg, 9275584Sru const errarg &arg2 = empty_errarg, 9375584Sru const errarg &arg3 = empty_errarg); 9475584Sru 9575584Sruvoid lex_cleanup(); 9675584Sru 9775584Sruextern int flyback_flag; 9875584Sruextern int command_char; 9975584Sru// zero_length_line_flag is non-zero if zero-length lines are drawn 10075584Sru// as dots by the output device 10175584Sruextern int zero_length_line_flag; 10275584Sruextern int driver_extension_flag; 10375584Sruextern int compatible_flag; 10475584Sruextern int safer_flag; 105