pic.h revision 75584
112795Swpaul// -*- C++ -*-
212795Swpaul/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
312795Swpaul     Written by James Clark (jjc@jclark.com)
412795Swpaul
512795SwpaulThis file is part of groff.
612795Swpaul
712795Swpaulgroff is free software; you can redistribute it and/or modify it under
8100441Scharnierthe terms of the GNU General Public License as published by the Free
912795SwpaulSoftware Foundation; either version 2, or (at your option) any later
1012795Swpaulversion.
1112795Swpaul
12100441Scharniergroff is distributed in the hope that it will be useful, but WITHOUT ANY
1312795SwpaulWARRANTY; without even the implied warranty of MERCHANTABILITY or
1412795SwpaulFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1512795Swpaulfor more details.
16100441Scharnier
1712795SwpaulYou should have received a copy of the GNU General Public License along
1812795Swpaulwith groff; see the file COPYING.  If not, write to the Free Software
1912795SwpaulFoundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20100441Scharnier
2112795Swpaul#include <stdio.h>
2212795Swpaul#include <string.h>
2312795Swpaul#include <math.h>
24100441Scharnier#include <stdlib.h>
2512795Swpaul#include <errno.h>
2612795Swpaul
2712795Swpaul#ifdef NEED_DECLARATION_HYPOT
2812795Swpaulextern "C" {
2912795Swpaul  double hypot(double, double);
30100441Scharnier}
3112795Swpaul#endif /* NEED_DECLARATION_HYPOT */
32100441Scharnier
3312795Swpaul#include "assert.h"
3412795Swpaul#include "cset.h"
3512795Swpaul#include "lib.h"
3627935Scharnier#include "stringclass.h"
3712795Swpaul#include "errarg.h"
38100441Scharnier#include "error.h"
39100441Scharnier#include "position.h"
40100441Scharnier#include "text.h"
4112795Swpaul#include "output.h"
4212795Swpaul
4312795Swpaul#ifndef M_SQRT2
4412795Swpaul#define M_SQRT2	1.41421356237309504880
4527935Scharnier#endif
4612795Swpaul
4712795Swpaul#ifndef M_PI
4812795Swpaul#define M_PI 3.14159265358979323846
4912795Swpaul#endif
5012795Swpaul
5112795Swpaulclass input {
5212795Swpaul  input *next;
5312795Swpaulpublic:
5412795Swpaul  input();
5512795Swpaul  virtual ~input();
5612795Swpaul  virtual int get() = 0;
5712795Swpaul  virtual int peek() = 0;
5812795Swpaul  virtual int get_location(const char **, int *);
5912795Swpaul  friend class input_stack;
6012795Swpaul  friend class copy_rest_thru_input;
6112795Swpaul};
6212795Swpaul
6312795Swpaulclass file_input : public input {
6412795Swpaul  FILE *fp;
6512795Swpaul  const char *filename;
6612795Swpaul  int lineno;
6792921Simp  string line;
6892921Simp  const char *ptr;
6992921Simp  int read_line();
7012795Swpaulpublic:
7112795Swpaul  file_input(FILE *, const char *);
7212795Swpaul  ~file_input();
7312795Swpaul  int get();
7412795Swpaul  int peek();
7512795Swpaul  int get_location(const char **, int *);
7612795Swpaul};
7712795Swpaul
7812795Swpaulvoid lex_init(input *);
7912795Swpaulint get_location(char **, int *);
8012795Swpaul
8112795Swpaulvoid do_copy(const char *file);
8212795Swpaulvoid parse_init();
8312795Swpaulvoid parse_cleanup();
8412795Swpaul
8512795Swpaulvoid lex_error(const char *message,
8617142Sjkh	       const errarg &arg1 = empty_errarg,
8712795Swpaul	       const errarg &arg2 = empty_errarg,
8812795Swpaul	       const errarg &arg3 = empty_errarg);
8912795Swpaul
9012795Swpaulvoid lex_warning(const char *message,
9112795Swpaul		 const errarg &arg1 = empty_errarg,
9212795Swpaul		 const errarg &arg2 = empty_errarg,
9312795Swpaul		 const errarg &arg3 = empty_errarg);
9412795Swpaul
9512795Swpaulvoid lex_cleanup();
9612795Swpaul
9712795Swpaulextern int flyback_flag;
9812795Swpaulextern int command_char;
9912795Swpaul// zero_length_line_flag is non-zero if zero-length lines are drawn
10012795Swpaul// as dots by the output device
10112795Swpaulextern int zero_length_line_flag;
10212795Swpaulextern int driver_extension_flag;
10312795Swpaulextern int compatible_flag;
10412795Swpaulextern int safer_flag;
10512795Swpaul