2 /* Copyright (C) 1989-2014 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 3 of the License, or
10 (at your option) any later 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
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #if defined(__INTERIX) && !defined(_ALL_SOURCE)
32 const char *i_to_a(int);
33 const char *ui_to_a(unsigned int);
34 const char *if_to_a(int, int);
37 #define __GETOPT_PREFIX groff_
42 #define getlocale(category) setlocale(category, NULL)
43 #else /* !HAVE_SETLOCALE */
46 #define setlocale(category, locale) (void)(category, locale)
47 #define getlocale(category) ((void)(category), (char *)"C")
48 #endif /* !HAVE_SETLOCALE */
50 char *strsave(const char *s);
51 int is_prime(unsigned);
52 double groff_hypot(double, double);
62 /* HP-UX 10.20 and LynxOS 4.0.0 don't declare snprintf() */
63 #if !defined(HAVE_SNPRINTF) || defined(NEED_DECLARATION_SNPRINTF)
64 extern "C" { int snprintf(char *, size_t, const char *, /*args*/ ...); }
67 /* LynxOS 4.0.0 has snprintf() but no vsnprintf() */
68 #if !defined(HAVE_VSNPRINTF) || defined(NEED_DECLARATION_VSNPRINTF)
69 extern "C" { int vsnprintf(char *, size_t, const char *, va_list); }
72 /* LynxOS 4.0.0 doesn't declare vfprintf() */
73 #ifdef NEED_DECLARATION_VFPRINTF
74 extern "C" { int vfprintf(FILE *, const char *, va_list); }
78 /* since mkstemp() is defined as a real C++ function if taken from
79 groff's mkstemp.cpp we need a declaration */
80 int mkstemp(char *tmpl);
81 #endif /* HAVE_MKSTEMP */
83 int mksdir(char *tmpl);
85 FILE *xtmpfile(char **namep = 0,
86 const char *postfix_long = 0, const char *postfix_short = 0,
88 char *xtmptemplate(const char *postfix_long, const char *postfix_short);
90 #ifdef NEED_DECLARATION_POPEN
91 extern "C" { FILE *popen(const char *, const char *); }
92 #endif /* NEED_DECLARATION_POPEN */
94 #ifdef NEED_DECLARATION_PCLOSE
95 extern "C" { int pclose (FILE *); }
96 #endif /* NEED_DECLARATION_PCLOSE */
98 size_t file_name_max(const char *fname);
99 size_t path_name_max();
101 int interpret_lf_args(const char *p);
103 extern char invalid_char_table[];
105 inline int invalid_input_char(int c)
107 return c >= 0 && invalid_char_table[c];
110 #ifdef HAVE_STRCASECMP
111 #ifdef NEED_DECLARATION_STRCASECMP
112 // Ultrix4.3's string.h fails to declare this.
113 extern "C" { int strcasecmp(const char *, const char *); }
114 #endif /* NEED_DECLARATION_STRCASECMP */
115 #else /* !HAVE_STRCASECMP */
116 extern "C" { int strcasecmp(const char *, const char *); }
117 #endif /* HAVE_STRCASECMP */
119 #if !defined(_AIX) && !defined(sinix) && !defined(__sinix__)
120 #ifdef HAVE_STRNCASECMP
121 #ifdef NEED_DECLARATION_STRNCASECMP
122 // SunOS's string.h fails to declare this.
123 extern "C" { int strncasecmp(const char *, const char *, int); }
124 #endif /* NEED_DECLARATION_STRNCASECMP */
125 #else /* !HAVE_STRNCASECMP */
126 extern "C" { int strncasecmp(const char *, const char *, size_t); }
127 #endif /* HAVE_STRNCASECMP */
128 #endif /* !_AIX && !sinix && !__sinix__ */
130 #ifdef HAVE_CC_LIMITS_H
132 #else /* !HAVE_CC_LIMITS_H */
133 #define INT_MAX 2147483647
134 #endif /* !HAVE_CC_LIMITS_H */
136 /* It's not safe to rely on people getting INT_MIN right (ie signed). */
142 #ifdef CFRONT_ANSI_BUG
144 /* This works around a bug in cfront 2.0 used with ANSI C compilers. */
146 #define INT_MIN ((long)(-INT_MAX-1))
148 #else /* !CFRONT_ANSI_BUG */
150 #define INT_MIN (-INT_MAX-1)
152 #endif /* !CFRONT_ANSI_BUG */
154 /* Maximum number of digits in the decimal representation of an int
155 (not including the -). */
157 #define INT_DIGITS 10
163 const double PI = 3.14159265358979323846;
165 /* ad_delete deletes an array of objects with destructors;
166 a_delete deletes an array of objects without destructors */
168 #ifdef ARRAY_DELETE_NEEDS_SIZE
169 /* for 2.0 systems */
170 #define ad_delete(size) delete [size]
171 #define a_delete delete
172 #else /* !ARRAY_DELETE_NEEDS_SIZE */
173 /* for ARM systems */
174 #define ad_delete(size) delete []
175 #define a_delete delete []
176 #endif /* !ARRAY_DELETE_NEEDS_SIZE */