4 /* Copyright (C) 1989-2000, 2001, 2002, 2003, 2005
5 Free Software Foundation, Inc.
6 Written by James Clark (jjc@jclark.com)
8 This file is part of groff.
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING. If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
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_
43 #define setlocale(category, locale) do {} while(0)
46 char *strsave(const char *s
);
47 int is_prime(unsigned);
48 double groff_hypot(double, double);
58 /* HP-UX 10.20 and LynxOS 4.0.0 don't declare snprintf() */
59 #if !defined(HAVE_SNPRINTF) || defined(NEED_DECLARATION_SNPRINTF)
60 extern "C" { int snprintf(char *, size_t, const char *, /*args*/ ...); }
63 /* LynxOS 4.0.0 has snprintf() but no vsnprintf() */
64 #if !defined(HAVE_VSNPRINTF) || defined(NEED_DECLARATION_VSNPRINTF)
65 extern "C" { int vsnprintf(char *, size_t, const char *, va_list); }
68 /* LynxOS 4.0.0 doesn't declare vfprintf() */
69 #ifdef NEED_DECLARATION_VFPRINTF
70 extern "C" { int vfprintf(FILE *, const char *, va_list); }
74 /* since mkstemp() is defined as a real C++ function if taken from
75 groff's mkstemp.cpp we need a declaration */
76 int mkstemp(char *tmpl
);
77 #endif /* HAVE_MKSTEMP */
79 int mksdir(char *tmpl
);
81 FILE *xtmpfile(char **namep
= 0,
82 const char *postfix_long
= 0, const char *postfix_short
= 0,
84 char *xtmptemplate(const char *postfix_long
, const char *postfix_short
);
86 #ifdef NEED_DECLARATION_POPEN
87 extern "C" { FILE *popen(const char *, const char *); }
88 #endif /* NEED_DECLARATION_POPEN */
90 #ifdef NEED_DECLARATION_PCLOSE
91 extern "C" { int pclose (FILE *); }
92 #endif /* NEED_DECLARATION_PCLOSE */
94 size_t file_name_max(const char *fname
);
95 size_t path_name_max();
97 int interpret_lf_args(const char *p
);
99 extern char invalid_char_table
[];
101 inline int invalid_input_char(int c
)
103 return c
>= 0 && invalid_char_table
[c
];
106 #ifdef HAVE_STRCASECMP
107 #ifdef NEED_DECLARATION_STRCASECMP
108 // Ultrix4.3's string.h fails to declare this.
109 extern "C" { int strcasecmp(const char *, const char *); }
110 #endif /* NEED_DECLARATION_STRCASECMP */
111 #else /* not HAVE_STRCASECMP */
112 extern "C" { int strcasecmp(const char *, const char *); }
113 #endif /* HAVE_STRCASECMP */
115 #if !defined(_AIX) && !defined(sinix) && !defined(__sinix__)
116 #ifdef HAVE_STRNCASECMP
117 #ifdef NEED_DECLARATION_STRNCASECMP
118 // SunOS's string.h fails to declare this.
119 extern "C" { int strncasecmp(const char *, const char *, int); }
120 #endif /* NEED_DECLARATION_STRNCASECMP */
121 #else /* not HAVE_STRNCASECMP */
122 extern "C" { int strncasecmp(const char *, const char *, size_t); }
123 #endif /* HAVE_STRNCASECMP */
124 #endif /* !_AIX && !sinix && !__sinix__ */
126 #ifdef HAVE_CC_LIMITS_H
128 #else /* not HAVE_CC_LIMITS_H */
129 #define INT_MAX 2147483647
130 #endif /* not HAVE_CC_LIMITS_H */
132 /* It's not safe to rely on people getting INT_MIN right (ie signed). */
138 #ifdef CFRONT_ANSI_BUG
140 /* This works around a bug in cfront 2.0 used with ANSI C compilers. */
142 #define INT_MIN ((long)(-INT_MAX-1))
144 #else /* not CFRONT_ANSI_BUG */
146 #define INT_MIN (-INT_MAX-1)
148 #endif /* not CFRONT_ANSI_BUG */
150 /* Maximum number of digits in the decimal representation of an int
151 (not including the -). */
153 #define INT_DIGITS 10
159 const double PI
= 3.14159265358979323846;
161 /* ad_delete deletes an array of objects with destructors;
162 a_delete deletes an array of objects without destructors */
164 #ifdef ARRAY_DELETE_NEEDS_SIZE
165 /* for 2.0 systems */
166 #define ad_delete(size) delete [size]
167 #define a_delete delete
168 #else /* not ARRAY_DELETE_NEEDS_SIZE */
169 /* for ARM systems */
170 #define ad_delete(size) delete []
171 #define a_delete delete []
172 #endif /* not ARRAY_DELETE_NEEDS_SIZE */