pic.h revision 151498
1214571Sdim// -*- C++ -*- 2214571Sdim/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003, 2005 3214571Sdim Free Software Foundation, Inc. 4214571Sdim Written by James Clark (jjc@jclark.com) 5214571Sdim 6214571SdimThis file is part of groff. 7214571Sdim 8214571Sdimgroff is free software; you can redistribute it and/or modify it under 9214571Sdimthe terms of the GNU General Public License as published by the Free 10214571SdimSoftware Foundation; either version 2, or (at your option) any later 11214571Sdimversion. 12214571Sdim 13214571Sdimgroff is distributed in the hope that it will be useful, but WITHOUT ANY 14214571SdimWARRANTY; without even the implied warranty of MERCHANTABILITY or 15214571SdimFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16214571Sdimfor more details. 17214571Sdim 18214571SdimYou should have received a copy of the GNU General Public License along 19214571Sdimwith groff; see the file COPYING. If not, write to the Free Software 20214571SdimFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 21214571Sdim 22214571Sdim#include "lib.h" 23214571Sdim 24214571Sdim#include <math.h> 25214571Sdim#include <stdlib.h> 26214571Sdim#include <errno.h> 27214571Sdim 28214571Sdim#ifdef NEED_DECLARATION_RAND 29214571Sdim#undef rand 30214571Sdimextern "C" { 31214571Sdim int rand(); 32214571Sdim} 33214571Sdim#endif /* NEED_DECLARATION_RAND */ 34214571Sdim 35214571Sdim#ifdef NEED_DECLARATION_SRAND 36214571Sdim#undef srand 37214571Sdimextern "C" { 38214571Sdim#ifdef RET_TYPE_SRAND_IS_VOID 39214571Sdim void srand(unsigned int); 40214571Sdim#else 41214571Sdim int srand(unsigned int); 42214571Sdim#endif 43214571Sdim} 44214571Sdim#endif /* NEED_DECLARATION_SRAND */ 45214571Sdim 46214571Sdim#ifndef HAVE_FMOD 47214571Sdimextern "C" { 48214571Sdim double fmod(double, double); 49214571Sdim} 50214571Sdim#endif 51214571Sdim 52214571Sdim#include "assert.h" 53214571Sdim#include "cset.h" 54214571Sdim#include "stringclass.h" 55214571Sdim#include "errarg.h" 56214571Sdim#include "error.h" 57214571Sdim#include "position.h" 58214571Sdim#include "text.h" 59214571Sdim#include "output.h" 60214571Sdim 61214571Sdim#ifndef M_SQRT2 62214571Sdim#define M_SQRT2 1.41421356237309504880 63214571Sdim#endif 64214571Sdim 65214571Sdim#ifndef M_PI 66214571Sdim#define M_PI 3.14159265358979323846 67214571Sdim#endif 68214571Sdim 69214571Sdimclass input { 70214571Sdim input *next; 71214571Sdimpublic: 72214571Sdim input(); 73214571Sdim virtual ~input(); 74214571Sdim virtual int get() = 0; 75 virtual int peek() = 0; 76 virtual int get_location(const char **, int *); 77 friend class input_stack; 78 friend class copy_rest_thru_input; 79}; 80 81class file_input : public input { 82 FILE *fp; 83 const char *filename; 84 int lineno; 85 string line; 86 const char *ptr; 87 int read_line(); 88public: 89 file_input(FILE *, const char *); 90 ~file_input(); 91 int get(); 92 int peek(); 93 int get_location(const char **, int *); 94}; 95 96void lex_init(input *); 97int get_location(char **, int *); 98 99void do_copy(const char *file); 100void parse_init(); 101void parse_cleanup(); 102 103void lex_error(const char *message, 104 const errarg &arg1 = empty_errarg, 105 const errarg &arg2 = empty_errarg, 106 const errarg &arg3 = empty_errarg); 107 108void lex_warning(const char *message, 109 const errarg &arg1 = empty_errarg, 110 const errarg &arg2 = empty_errarg, 111 const errarg &arg3 = empty_errarg); 112 113void lex_cleanup(); 114 115extern int flyback_flag; 116extern int command_char; 117// zero_length_line_flag is non-zero if zero-length lines are drawn 118// as dots by the output device 119extern int zero_length_line_flag; 120extern int driver_extension_flag; 121extern int compatible_flag; 122extern int safer_flag; 123extern char *graphname; 124