groff before CVS: release 1.10
[s-roff.git] / include / lib.h
blob1c46089ac76ae5b96b8d1ba30cb910056cc189e1
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 extern "C" {
22 #ifndef strerror
23 char *strerror(int);
24 #endif
25 #ifndef __BORLANDC__
26 const char *itoa(int);
27 const char *iftoa(int, int);
28 #endif /* __BORLANDC__ */
31 #ifdef STDLIB_H_DECLARES_GETOPT
32 #include <stdlib.h>
33 #else /* not STDLIB_H_DECLARES_GETOPT */
34 #ifdef UNISTD_H_DECLARES_GETOPT
35 #include <sys/types.h>
36 #include <unistd.h>
37 #else /* not UNISTD_H_DECLARES_GETOPT */
38 extern "C" {
39 int getopt(int, char *const *, const char *);
41 #endif /* not UNISTD_H_DECLARES_GETOPT */
43 extern "C" {
44 extern char *optarg;
45 extern int optind;
46 extern int opterr;
49 #endif /* not STDLIB_H_DECLARES_GETOPT */
51 char *strsave(const char *s);
52 int is_prime(unsigned);
54 #include <stdio.h>
56 FILE *xtmpfile();
58 #ifndef STDIO_H_DECLARES_POPEN
60 extern "C" { FILE *popen(const char *, const char *); }
62 #endif /* not STDIO_H_DECLARES_POPEN */
64 #ifndef STDIO_H_DECLARES_PCLOSE
66 extern "C" { int pclose (FILE *); }
68 #endif /* not STDIO_H_DECLARES_PCLOSE */
70 int interpret_lf_args(const char *p);
72 extern char illegal_char_table[];
74 inline int illegal_input_char(int c)
76 return c >= 0 && illegal_char_table[c];
79 #ifdef HAVE_CC_LIMITS_H
80 #include <limits.h>
81 #else /* not HAVE_CC_LIMITS_H */
82 #define INT_MAX 2147483647
83 #endif /* not HAVE_CC_LIMITS_H */
85 /* It's not safe to rely on people getting INT_MIN right (ie signed). */
87 #ifdef INT_MIN
88 #undef INT_MIN
89 #endif
91 #ifdef CFRONT_ANSI_BUG
93 /* This works around a bug in cfront 2.0 used with ANSI C compilers. */
95 #define INT_MIN ((long)(-INT_MAX-1))
97 #else /* not CFRONT_ANSI_BUG */
99 #define INT_MIN (-INT_MAX-1)
101 #endif /* not CFRONT_ANSI_BUG */
103 /* Maximum number of digits in the decimal representation of an int
104 (not including the -). */
106 #define INT_DIGITS 10
108 #ifdef PI
109 #undef PI
110 #endif
112 const double PI = 3.14159265358979323846;
114 /* ad_delete deletes an array of objects with destructors;
115 a_delete deletes an array of objects without destructors */
117 #ifdef ARRAY_DELETE_NEEDS_SIZE
118 /* for 2.0 systems */
119 #define ad_delete(size) delete [size]
120 #define a_delete delete
121 #else /* not ARRAY_DELETE_NEEDS_SIZE */
122 /* for ARM systems */
123 #define ad_delete(size) delete []
124 #define a_delete delete []
125 #endif /* not ARRAY_DELETE_NEEDS_SIZE */