Line data Source code
1 : /* Copyright (C) 1989-2025 Free Software Foundation, Inc. 2 : Written by James Clark (jjc@jclark.com) 3 : 4 : This file is part of groff, the GNU roff typesetting system. 5 : 6 : groff is free software; you can redistribute it and/or modify it under 7 : the terms of the GNU General Public License as published by the Free 8 : Software Foundation, either version 3 of the License, or 9 : (at your option) any later version. 10 : 11 : groff is distributed in the hope that it will be useful, but WITHOUT ANY 12 : WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 : for more details. 15 : 16 : You should have received a copy of the GNU General Public License 17 : along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 : 19 : #ifndef GROFF_LIB_H 20 : #define GROFF_LIB_H 21 : 22 : #if defined(__INTERIX) && !defined(_ALL_SOURCE) 23 : #define _ALL_SOURCE 24 : #endif 25 : 26 : #ifdef __cplusplus 27 : extern "C" { 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); 32 : #ifdef __cplusplus 33 : } 34 : #endif 35 : 36 : #ifdef HAVE_SETLOCALE 37 : #include <locale.h> 38 : #define getlocale(category) setlocale(category, NULL) 39 : #else /* !HAVE_SETLOCALE */ 40 : #define LC_ALL 0 41 : #define LC_CTYPE 0 42 : #define setlocale(category, locale) (void)(category, locale) 43 : #define getlocale(category) ((void)(category), (char *)"C") 44 : #endif /* !HAVE_SETLOCALE */ 45 : 46 : #include <stdbool.h> 47 : 48 : char *strsave(const char *s); 49 : unsigned ceil_prime(unsigned); 50 : 51 : #include <stdio.h> 52 : #include <string.h> 53 : #ifdef HAVE_STRINGS_H 54 : #include <strings.h> 55 : #endif 56 : 57 : #include <stdarg.h> 58 : 59 : #ifdef __cplusplus 60 : extern "C" { 61 : #endif 62 : 63 : /* LynxOS 4.0.0 doesn't declare vfprintf() */ 64 : #ifdef NEED_DECLARATION_VFPRINTF 65 : int vfprintf(FILE *, const char *, va_list); 66 : #endif 67 : 68 : #ifndef HAVE_MKSTEMP 69 : /* since mkstemp() is defined as a real C++ function if taken from 70 : groff's mkstemp.cpp we need a declaration */ 71 : int mkstemp(char *tmpl); 72 : #endif /* HAVE_MKSTEMP */ 73 : 74 : int mksdir(char *tmpl); 75 : 76 : #ifdef __cplusplus 77 : FILE *xtmpfile(const char **namep = 0 /* nullptr */, 78 : const char *postfix_long = 0 /* nullptr */, 79 : const char *postfix_short = 0 /* nullptr */); 80 : char *xtmptemplate(const char *postfix_long, 81 : const char *postfix_short); 82 : #endif 83 : 84 : #ifdef NEED_DECLARATION_POPEN 85 : FILE *popen(const char *, const char *); 86 : #endif /* NEED_DECLARATION_POPEN */ 87 : 88 : #ifdef NEED_DECLARATION_PCLOSE 89 : int pclose (FILE *); 90 : #endif /* NEED_DECLARATION_PCLOSE */ 91 : 92 : size_t file_name_max(const char *fname); 93 : size_t path_name_max(void); 94 : 95 : extern char invalid_char_table[]; 96 : 97 399283170 : inline bool is_invalid_input_char(int c) 98 : { 99 399283170 : return (c >= 0 && invalid_char_table[c]); 100 : } 101 : 102 : #ifdef __cplusplus 103 : } 104 : #endif 105 : 106 : #ifdef HAVE_CC_LIMITS_H 107 : #include <limits.h> 108 : #else /* !HAVE_CC_LIMITS_H */ 109 : #define INT_MAX 2147483647 110 : #endif /* !HAVE_CC_LIMITS_H */ 111 : 112 : /* Maximum number of digits in decimal representations of `int` types 113 : not including a leading minus sign. */ 114 : #define INT_DIGITS 19 /* enough for 64 bit integer */ 115 : #define UINT_DIGITS 20 116 : 117 : #ifdef PI 118 : #undef PI 119 : #endif 120 : 121 : static const double PI = 3.14159265358979323846; 122 : 123 : #endif /* GROFF_LIB_H */ 124 : 125 : // Local Variables: 126 : // fill-column: 72 127 : // mode: C++ 128 : // End: 129 : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72: