* src/libs/libgroff/glyphuni.cpp (glyph_to_unicode_list),
[s-roff.git] / src / include / lib.h
blobfd7d6fec0646fa64f020df87052340542cad3bb9
1 // -*- C++ -*-
2 /* Copyright (C) 1989-2000, 2001, 2002, 2003 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 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
25 extern "C" {
26 #ifndef HAVE_STRERROR
27 char *strerror(int);
28 #endif
29 const char *i_to_a(int);
30 const char *ui_to_a(unsigned int);
31 const char *if_to_a(int, int);
34 /* stdio.h on IRIX, OSF/1, emx, UWIN, and MinGW include getopt.h */
35 /* unistd.h on CYGWIN includes getopt.h */
37 #if !(defined(__sgi) \
38 || (defined(__osf__) && defined(__alpha)) \
39 || defined(_UWIN) \
40 || defined(__EMX__) \
41 || defined(__CYGWIN__) \
42 || defined(__MINGW32__))
43 #include <groff-getopt.h>
44 #else
45 #include <getopt.h>
46 #endif
48 #ifdef HAVE_SETLOCALE
49 #include <locale.h>
50 #else
51 #define setlocale(category, locale) do {} while(0)
52 #endif
54 char *strsave(const char *s);
55 int is_prime(unsigned);
57 #include <stdio.h>
58 #include <string.h>
59 #ifdef HAVE_STRINGS_H
60 #include <strings.h>
61 #endif
63 #include <stdarg.h>
65 /* HP-UX 10.20 and LynxOS 4.0.0 don't declare snprintf() */
66 #if !defined(HAVE_SNPRINTF) || defined(NEED_DECLARATION_SNPRINTF)
67 extern "C" { int snprintf(char *, size_t, const char *, /*args*/ ...); }
68 #endif
70 /* LynxOS 4.0.0 has snprintf() but no vsnprintf() */
71 #if !defined(HAVE_VSNPRINTF) || defined(NEED_DECLARATION_VSNPRINTF)
72 extern "C" { int vsnprintf(char *, size_t, const char *, va_list); }
73 #endif
75 /* LynxOS 4.0.0 doesn't declare vfprintf() */
76 #ifdef NEED_DECLARATION_VFPRINTF
77 extern "C" { int vfprintf(FILE *, const char *, va_list); }
78 #endif
80 #ifndef HAVE_MKSTEMP
81 /* since mkstemp() is defined as a real C++ function if taken from
82 groff's mkstemp.cpp we need a declaration */
83 int mkstemp(char *tmpl);
84 #endif /* HAVE_MKSTEMP */
86 int mksdir(char *tmpl);
88 FILE *xtmpfile(char **namep = 0,
89 const char *postfix_long = 0, const char *postfix_short = 0,
90 int do_unlink = 1);
91 char *xtmptemplate(const char *postfix_long, const char *postfix_short);
93 #ifdef NEED_DECLARATION_POPEN
94 extern "C" { FILE *popen(const char *, const char *); }
95 #endif /* NEED_DECLARATION_POPEN */
97 #ifdef NEED_DECLARATION_PCLOSE
98 extern "C" { int pclose (FILE *); }
99 #endif /* NEED_DECLARATION_PCLOSE */
101 size_t file_name_max(const char *fname);
103 int interpret_lf_args(const char *p);
105 extern char invalid_char_table[];
107 inline int invalid_input_char(int c)
109 return c >= 0 && invalid_char_table[c];
112 #ifdef HAVE_STRCASECMP
113 #ifdef NEED_DECLARATION_STRCASECMP
114 // Ultrix4.3's string.h fails to declare this.
115 extern "C" { int strcasecmp(const char *, const char *); }
116 #endif /* NEED_DECLARATION_STRCASECMP */
117 #else /* not HAVE_STRCASECMP */
118 extern "C" { int strcasecmp(const char *, const char *); }
119 #endif /* HAVE_STRCASECMP */
121 #if !defined(_AIX) && !defined(sinix) && !defined(__sinix__)
122 #ifdef HAVE_STRNCASECMP
123 #ifdef NEED_DECLARATION_STRNCASECMP
124 // SunOS's string.h fails to declare this.
125 extern "C" { int strncasecmp(const char *, const char *, int); }
126 #endif /* NEED_DECLARATION_STRNCASECMP */
127 #else /* not HAVE_STRNCASECMP */
128 extern "C" { int strncasecmp(const char *, const char *, size_t); }
129 #endif /* HAVE_STRNCASECMP */
130 #endif /* !_AIX && !sinix && !__sinix__ */
132 #ifdef HAVE_CC_LIMITS_H
133 #include <limits.h>
134 #else /* not HAVE_CC_LIMITS_H */
135 #define INT_MAX 2147483647
136 #endif /* not HAVE_CC_LIMITS_H */
138 /* It's not safe to rely on people getting INT_MIN right (ie signed). */
140 #ifdef INT_MIN
141 #undef INT_MIN
142 #endif
144 #ifdef CFRONT_ANSI_BUG
146 /* This works around a bug in cfront 2.0 used with ANSI C compilers. */
148 #define INT_MIN ((long)(-INT_MAX-1))
150 #else /* not CFRONT_ANSI_BUG */
152 #define INT_MIN (-INT_MAX-1)
154 #endif /* not CFRONT_ANSI_BUG */
156 /* Maximum number of digits in the decimal representation of an int
157 (not including the -). */
159 #define INT_DIGITS 10
161 #ifdef PI
162 #undef PI
163 #endif
165 const double PI = 3.14159265358979323846;
167 /* ad_delete deletes an array of objects with destructors;
168 a_delete deletes an array of objects without destructors */
170 #ifdef ARRAY_DELETE_NEEDS_SIZE
171 /* for 2.0 systems */
172 #define ad_delete(size) delete [size]
173 #define a_delete delete
174 #else /* not ARRAY_DELETE_NEEDS_SIZE */
175 /* for ARM systems */
176 #define ad_delete(size) delete []
177 #define a_delete delete []
178 #endif /* not ARRAY_DELETE_NEEDS_SIZE */