groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / src / preproc / pic / pic.h
CommitLineData
92d0a6a6 1// -*- C++ -*-
4d3e9548 2/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003, 2005, 2009
92d0a6a6
JR
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
4d3e9548
JL
10Software Foundation, either version 3 of the License, or
11(at your option) any later version.
92d0a6a6
JR
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
4d3e9548
JL
18You should have received a copy of the GNU General Public License
19along with this program. If not, see <http://www.gnu.org/licenses/>. */
92d0a6a6
JR
20
21#include "lib.h"
22
23#include <math.h>
24#include <stdlib.h>
25#include <errno.h>
26
92d0a6a6
JR
27#ifdef NEED_DECLARATION_RAND
28#undef rand
29extern "C" {
30 int rand();
31}
32#endif /* NEED_DECLARATION_RAND */
33
34#ifdef NEED_DECLARATION_SRAND
35#undef srand
36extern "C" {
37#ifdef RET_TYPE_SRAND_IS_VOID
38 void srand(unsigned int);
39#else
40 int srand(unsigned int);
41#endif
42}
43#endif /* NEED_DECLARATION_SRAND */
44
45#ifndef HAVE_FMOD
46extern "C" {
47 double fmod(double, double);
48}
49#endif
50
51#include "assert.h"
52#include "cset.h"
53#include "stringclass.h"
54#include "errarg.h"
55#include "error.h"
56#include "position.h"
57#include "text.h"
58#include "output.h"
59
60#ifndef M_SQRT2
61#define M_SQRT2 1.41421356237309504880
62#endif
63
64#ifndef M_PI
65#define M_PI 3.14159265358979323846
66#endif
67
68class input {
69 input *next;
70public:
71 input();
72 virtual ~input();
73 virtual int get() = 0;
74 virtual int peek() = 0;
75 virtual int get_location(const char **, int *);
76 friend class input_stack;
77 friend class copy_rest_thru_input;
78};
79
80class file_input : public input {
81 FILE *fp;
82 const char *filename;
83 int lineno;
84 string line;
85 const char *ptr;
86 int read_line();
87public:
88 file_input(FILE *, const char *);
89 ~file_input();
90 int get();
91 int peek();
92 int get_location(const char **, int *);
93};
94
95void lex_init(input *);
96int get_location(char **, int *);
97
98void do_copy(const char *file);
99void parse_init();
100void parse_cleanup();
101
102void lex_error(const char *message,
103 const errarg &arg1 = empty_errarg,
104 const errarg &arg2 = empty_errarg,
105 const errarg &arg3 = empty_errarg);
106
107void lex_warning(const char *message,
108 const errarg &arg1 = empty_errarg,
109 const errarg &arg2 = empty_errarg,
110 const errarg &arg3 = empty_errarg);
111
112void lex_cleanup();
113
114extern int flyback_flag;
115extern int command_char;
116// zero_length_line_flag is non-zero if zero-length lines are drawn
117// as dots by the output device
118extern int zero_length_line_flag;
119extern int driver_extension_flag;
120extern int compatible_flag;
121extern int safer_flag;
122extern char *graphname;