* src/include/lib.h: Added xtmptemplate and made xtmpfile
[s-roff.git] / src / include / lib.h
blobb92457e8220b1f9e01dc59fd1c58f667d88ac101
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(char **namep=0, char *postfix=0, int do_unlink=1);
57 char *xtmptemplate(char *extension=0);
59 #ifndef STDIO_H_DECLARES_POPEN
61 extern "C" { FILE *popen(const char *, const char *); }
63 #endif /* not STDIO_H_DECLARES_POPEN */
65 #ifndef STDIO_H_DECLARES_PCLOSE
67 extern "C" { int pclose (FILE *); }
69 #endif /* not STDIO_H_DECLARES_PCLOSE */
71 int interpret_lf_args(const char *p);
73 extern char illegal_char_table[];
75 inline int illegal_input_char(int c)
77 return c >= 0 && illegal_char_table[c];
80 #ifndef HAVE_STRCASECMP
81 # define strcasecmp(a,b) strcmp((a),(b))
82 #endif
84 #ifdef HAVE_CC_LIMITS_H
85 #include <limits.h>
86 #else /* not HAVE_CC_LIMITS_H */
87 #define INT_MAX 2147483647
88 #endif /* not HAVE_CC_LIMITS_H */
90 /* It's not safe to rely on people getting INT_MIN right (ie signed). */
92 #ifdef INT_MIN
93 #undef INT_MIN
94 #endif
96 #ifdef CFRONT_ANSI_BUG
98 /* This works around a bug in cfront 2.0 used with ANSI C compilers. */
100 #define INT_MIN ((long)(-INT_MAX-1))
102 #else /* not CFRONT_ANSI_BUG */
104 #define INT_MIN (-INT_MAX-1)
106 #endif /* not CFRONT_ANSI_BUG */
108 /* Maximum number of digits in the decimal representation of an int
109 (not including the -). */
111 #define INT_DIGITS 10
113 #ifdef PI
114 #undef PI
115 #endif
117 const double PI = 3.14159265358979323846;
119 /* ad_delete deletes an array of objects with destructors;
120 a_delete deletes an array of objects without destructors */
122 #ifdef ARRAY_DELETE_NEEDS_SIZE
123 /* for 2.0 systems */
124 #define ad_delete(size) delete [size]
125 #define a_delete delete
126 #else /* not ARRAY_DELETE_NEEDS_SIZE */
127 /* for ARM systems */
128 #define ad_delete(size) delete []
129 #define a_delete delete []
130 #endif /* not ARRAY_DELETE_NEEDS_SIZE */