xref: /csrg-svn/contrib/groff-1.08/pic/pic.h (revision 69503)
169485Sbostic // -*- C++ -*-
269485Sbostic /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
369485Sbostic      Written by James Clark (jjc@jclark.com)
469485Sbostic 
569485Sbostic This file is part of groff.
669485Sbostic 
769485Sbostic groff is free software; you can redistribute it and/or modify it under
869485Sbostic the terms of the GNU General Public License as published by the Free
969485Sbostic Software Foundation; either version 2, or (at your option) any later
1069485Sbostic version.
1169485Sbostic 
1269485Sbostic groff is distributed in the hope that it will be useful, but WITHOUT ANY
1369485Sbostic WARRANTY; without even the implied warranty of MERCHANTABILITY or
1469485Sbostic FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1569485Sbostic for more details.
1669485Sbostic 
1769485Sbostic You should have received a copy of the GNU General Public License along
1869485Sbostic with groff; see the file COPYING.  If not, write to the Free Software
1969485Sbostic Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
2069485Sbostic 
2169485Sbostic #include <stdio.h>
22*69503Sbostic #include <unistd.h>
2369485Sbostic #include <string.h>
2469485Sbostic #include <math.h>
2569485Sbostic #include <stdlib.h>
2669485Sbostic #include <errno.h>
2769485Sbostic 
2869485Sbostic extern "C" {
2969485Sbostic   double hypot(double, double);
3069485Sbostic }
3169485Sbostic 
3269485Sbostic #include "assert.h"
3369485Sbostic #include "cset.h"
3469485Sbostic #include "lib.h"
3569485Sbostic #include "stringclass.h"
3669485Sbostic #include "errarg.h"
3769485Sbostic #include "error.h"
3869485Sbostic #include "position.h"
3969485Sbostic #include "text.h"
4069485Sbostic #include "output.h"
4169485Sbostic 
4269485Sbostic #ifndef M_SQRT2
4369485Sbostic #define M_SQRT2	1.41421356237309504880
4469485Sbostic #endif
4569485Sbostic 
4669485Sbostic #ifndef M_PI
4769485Sbostic #define M_PI 3.14159265358979323846
4869485Sbostic #endif
4969485Sbostic 
5069485Sbostic class input {
5169485Sbostic   input *next;
5269485Sbostic public:
5369485Sbostic   input();
5469485Sbostic   virtual ~input();
5569485Sbostic   virtual int get() = 0;
5669485Sbostic   virtual int peek() = 0;
5769485Sbostic   virtual int get_location(const char **, int *);
5869485Sbostic   friend class input_stack;
5969485Sbostic   friend class copy_rest_thru_input;
6069485Sbostic };
6169485Sbostic 
6269485Sbostic class file_input : public input {
6369485Sbostic   FILE *fp;
6469485Sbostic   const char *filename;
6569485Sbostic   int lineno;
6669485Sbostic   string line;
6769485Sbostic   const char *ptr;
6869485Sbostic   int read_line();
6969485Sbostic public:
7069485Sbostic   file_input(FILE *, const char *);
7169485Sbostic   ~file_input();
7269485Sbostic   int get();
7369485Sbostic   int peek();
7469485Sbostic   int get_location(const char **, int *);
7569485Sbostic };
7669485Sbostic 
7769485Sbostic void lex_init(input *);
7869485Sbostic int get_location(char **, int *);
7969485Sbostic 
8069485Sbostic void do_copy(const char *file);
8169485Sbostic void parse_init();
8269485Sbostic void parse_cleanup();
8369485Sbostic 
8469485Sbostic void lex_error(const char *message,
8569485Sbostic 	       const errarg &arg1 = empty_errarg,
8669485Sbostic 	       const errarg &arg2 = empty_errarg,
8769485Sbostic 	       const errarg &arg3 = empty_errarg);
8869485Sbostic 
8969485Sbostic void lex_warning(const char *message,
9069485Sbostic 		 const errarg &arg1 = empty_errarg,
9169485Sbostic 		 const errarg &arg2 = empty_errarg,
9269485Sbostic 		 const errarg &arg3 = empty_errarg);
9369485Sbostic 
9469485Sbostic void lex_cleanup();
9569485Sbostic 
9669485Sbostic extern int flyback_flag;
9769485Sbostic extern int command_char;
9869485Sbostic // zero_length_line_flag is non-zero if zero-length lines are drawn
9969485Sbostic // as dots by the output device
10069485Sbostic extern int zero_length_line_flag;
10169485Sbostic extern int driver_extension_flag;
10269485Sbostic extern int compatible_flag;
103