| 1 |
/* w2c/config.h: All .c files include this first. |
| 2 |
|
| 3 |
Copyright 1995, 1996, 2006, 2007, 2009, 2010, 2012, 2014, |
| 4 |
2015 Karl Berry. |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 2, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License 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 WEB2C_CONFIG_H |
| 20 |
#define WEB2C_CONFIG_H |
| 21 |
|
| 22 |
/* The stuff from the path searching library. */ |
| 23 |
#include <kpathsea/config.h> |
| 24 |
#include <w2c/c-auto.h> |
| 25 |
#include <stdarg.h> |
| 26 |
|
| 27 |
/* How to open a binary file. */ |
| 28 |
#include <kpathsea/c-fopen.h> |
| 29 |
|
| 30 |
#ifdef __cplusplus |
| 31 |
extern "C" { |
| 32 |
#endif |
| 33 |
|
| 34 |
/* The smallest signed type: use `signed char' if ANSI C, `short' if |
| 35 |
char is unsigned, otherwise `char'. */ |
| 36 |
#ifndef SCHAR_TYPE |
| 37 |
#if __STDC__ |
| 38 |
#define SCHAR_TYPE signed char |
| 39 |
#else /* not __STDC */ |
| 40 |
#ifdef __CHAR_UNSIGNED__ |
| 41 |
#define SCHAR_TYPE short |
| 42 |
#else |
| 43 |
#define SCHAR_TYPE char |
| 44 |
#endif |
| 45 |
#endif /* not __STDC__ */ |
| 46 |
#endif /* not SCHAR_TYPE */ |
| 47 |
typedef SCHAR_TYPE schar; |
| 48 |
|
| 49 |
/* The type `integer' must be a signed integer capable of holding at |
| 50 |
least the range of numbers (-2^31)..(2^31-1). If your compiler goes |
| 51 |
to great lengths to make programs fail, you might have to change this |
| 52 |
definition. If this changes, you may have to modify |
| 53 |
web2c/fixwrites.c, since it generates code to do integer output using |
| 54 |
"%ld", and casts all integral values to be printed to `long'. |
| 55 |
|
| 56 |
If you define your own INTEGER_TYPE, you have to define your own |
| 57 |
INTEGER_MAX and INTEGER_MIN, too. */ |
| 58 |
#ifndef INTEGER_TYPE |
| 59 |
|
| 60 |
#if SIZEOF_LONG > 4 && !defined (NO_DUMP_SHARE) |
| 61 |
/* If we have 64-bit longs and want to share format files (with 32-bit |
| 62 |
machines), use `int'. */ |
| 63 |
#define INTEGER_IS_INT |
| 64 |
#endif |
| 65 |
|
| 66 |
#ifdef INTEGER_IS_INT |
| 67 |
#define INTEGER_TYPE int |
| 68 |
#define INTEGER_MAX INT_MAX |
| 69 |
#define INTEGER_MIN INT_MIN |
| 70 |
#else |
| 71 |
#define INTEGER_TYPE long |
| 72 |
#define INTEGER_MAX LONG_MAX |
| 73 |
#define INTEGER_MIN LONG_MIN |
| 74 |
#endif /* not INTEGER_IS_INT */ |
| 75 |
|
| 76 |
#endif /* not INTEGER_TYPE */ |
| 77 |
|
| 78 |
typedef INTEGER_TYPE integer; |
| 79 |
|
| 80 |
/* We need a type that's at least off_t wide */ |
| 81 |
typedef off_t longinteger; |
| 82 |
|
| 83 |
/* To print file offsets we cast them to `LONGINTEGER_TYPE' (or |
| 84 |
`unsigned LONGINTEGER_TYPE') and use the conversion specifier |
| 85 |
`"%" LONGINTEGER_PRI "d"' (or `"%" LONGINTEGER_PRI "u"'). */ |
| 86 |
#if defined(WIN32) |
| 87 |
#define LONGINTEGER_TYPE __int64 |
| 88 |
#define LONGINTEGER_PRI "I64" |
| 89 |
#elif SIZEOF_LONG < SIZEOF_OFF_T |
| 90 |
#define LONGINTEGER_TYPE long long |
| 91 |
#define LONGINTEGER_PRI "ll" |
| 92 |
#else |
| 93 |
#define LONGINTEGER_TYPE long |
| 94 |
#define LONGINTEGER_PRI "l" |
| 95 |
#endif |
| 96 |
|
| 97 |
/* We also need a genuine 64-bit integer type. */ |
| 98 |
#if defined(WIN32) |
| 99 |
typedef __int64 integer64; |
| 100 |
#else |
| 101 |
typedef int64_t integer64; |
| 102 |
#endif |
| 103 |
|
| 104 |
/* And we need uintptr_t. */ |
| 105 |
#ifndef HAVE_UINTPTR_T |
| 106 |
# if SIZEOF_VOID_P == SIZEOF_INT |
| 107 |
typedef unsigned int uintptr_t; |
| 108 |
# elif SIZEOF_VOID_P == SIZEOF_LONG |
| 109 |
typedef unsigned long uintptr_t; |
| 110 |
# endif |
| 111 |
#endif |
| 112 |
|
| 113 |
/* I don't want to write a configure test for remove when all Unix |
| 114 |
machines have unlink. But, for the sake of non-Unix machines that |
| 115 |
support ANSI C... */ |
| 116 |
#if !defined (unix) && !defined (__unix__) && defined (__STDC__) && !defined (unlink) |
| 117 |
#define unlink remove |
| 118 |
#endif |
| 119 |
|
| 120 |
/* Window support on the Amiga is just for the Amiga. */ |
| 121 |
#ifdef AMIGA |
| 122 |
#define AMIGAWIN |
| 123 |
#endif |
| 124 |
|
| 125 |
/* Window support for WIN32 machines. */ |
| 126 |
#ifdef WIN32 |
| 127 |
#define WIN32WIN |
| 128 |
#endif |
| 129 |
|
| 130 |
#if defined __GNUC__ && __GNUC__ >=3 |
| 131 |
#define WEB2C_NORETURN __attribute__((__noreturn__)) |
| 132 |
#else |
| 133 |
#define WEB2C_NORETURN |
| 134 |
#endif |
| 135 |
|
| 136 |
/* From uexit.c. This is here because the lib/ and web2c/ routines |
| 137 |
themselves can use it, but they don't need cpascal.h. */ |
| 138 |
WEB2C_NORETURN |
| 139 |
extern void uexit (int status); |
| 140 |
|
| 141 |
/* usage.c */ |
| 142 |
extern void usage (const_string progname); |
| 143 |
extern void usagehelp (const_string *message, const_string bug_email); |
| 144 |
|
| 145 |
#ifdef __cplusplus |
| 146 |
} |
| 147 |
#endif |
| 148 |
|
| 149 |
#endif /* not WEB2C_CONFIG_H */ |