]>
Commit | Line | Data |
---|---|---|
a0f6b076 AD |
1 | /* system-dependent definitions for Bison. |
2 | Copyright (C) 2000 Free Software Foundation, Inc. | |
3 | ||
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 2, or (at your option) | |
7 | any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program; if not, write to the Free Software Foundation, | |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
17 | ||
d968a24b JT |
18 | #ifndef BISON_SYSTEM_H |
19 | #define BISON_SYSTEM_H | |
20 | ||
21 | #ifdef HAVE_CONFIG_H | |
22 | # include <config.h> | |
23 | #endif | |
24 | ||
ceed8467 AD |
25 | #include <stdio.h> |
26 | ||
5fcfb6e7 | 27 | #ifdef MSDOS |
a0f6b076 | 28 | # include <io.h> |
5fcfb6e7 RS |
29 | #endif |
30 | ||
d36e30d8 | 31 | #ifdef _MSC_VER |
a0f6b076 AD |
32 | # include <stdlib.h> |
33 | # include <process.h> | |
34 | # define getpid _getpid | |
d36e30d8 RS |
35 | #endif |
36 | ||
499daa50 | 37 | #if HAVE_STDLIB_H |
a0f6b076 | 38 | # include <stdlib.h> |
5fcfb6e7 RS |
39 | #endif |
40 | ||
499daa50 | 41 | #if HAVE_UNISTD_H |
a0f6b076 | 42 | # include <unistd.h> |
7bb4d914 JT |
43 | #endif |
44 | ||
5fcfb6e7 | 45 | #if defined(STDC_HEADERS) || defined(HAVE_STRING_H) |
a0f6b076 | 46 | # include <string.h> |
5fcfb6e7 | 47 | /* An ANSI string.h and pre-ANSI memory.h might conflict. */ |
a0f6b076 AD |
48 | # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) |
49 | # include <memory.h> | |
50 | # endif /* not STDC_HEADERS and HAVE_MEMORY_H */ | |
51 | # ifndef bcopy | |
52 | # define bcopy(src, dst, num) memcpy((dst), (src), (num)) | |
53 | # endif | |
5fcfb6e7 | 54 | #else /* not STDC_HEADERS and not HAVE_STRING_H */ |
a0f6b076 | 55 | # include <strings.h> |
5fcfb6e7 RS |
56 | /* memory.h and strings.h conflict on some systems. */ |
57 | #endif /* not STDC_HEADERS and not HAVE_STRING_H */ | |
f2d78a99 | 58 | |
7bb4d914 | 59 | #if defined(STDC_HEADERS) || defined(HAVE_CTYPE_H) |
a0f6b076 AD |
60 | # include <ctype.h> |
61 | #endif | |
62 | ||
63 | #include <errno.h> | |
64 | #ifndef errno | |
65 | extern int errno; | |
7bb4d914 JT |
66 | #endif |
67 | ||
499daa50 AD |
68 | #if PROTOTYPES |
69 | # define PARAMS(p) p | |
70 | #else | |
71 | # define PARAMS(p) () | |
72 | #endif | |
a0f6b076 AD |
73 | |
74 | /*-----------------. | |
75 | | GCC extensions. | | |
76 | `-----------------*/ | |
77 | ||
78 | #ifndef __attribute__ | |
79 | /* This feature is available in gcc versions 2.5 and later. */ | |
80 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ | |
81 | # define __attribute__(Spec) /* empty */ | |
82 | # endif | |
83 | /* The __-protected variants of `format' and `printf' attributes | |
84 | are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ | |
85 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) | |
86 | # define __format__ format | |
87 | # define __printf__ printf | |
88 | # endif | |
89 | #endif | |
90 | ||
91 | ||
92 | /*------. | |
93 | | NLS. | | |
94 | `------*/ | |
95 | ||
7bb4d914 | 96 | #ifdef HAVE_LOCALE_H |
f2d78a99 RS |
97 | # include <locale.h> |
98 | #endif | |
7bb4d914 | 99 | #ifndef HAVE_SETLOCALE |
f2d78a99 RS |
100 | # define setlocale(Category, Locale) |
101 | #endif | |
102 | ||
7bb4d914 | 103 | #ifdef ENABLE_NLS |
f2d78a99 RS |
104 | # include <libintl.h> |
105 | # define _(Text) gettext (Text) | |
106 | #else | |
3e2bf5ad | 107 | # undef bindtextdomain |
f2d78a99 | 108 | # define bindtextdomain(Domain, Directory) |
3e2bf5ad | 109 | # undef textdomain |
f2d78a99 RS |
110 | # define textdomain(Domain) |
111 | # define _(Text) Text | |
112 | #endif | |
113 | #define N_(Text) Text | |
114 | ||
a0f6b076 AD |
115 | |
116 | /*-------------------------------. | |
117 | | Fix broken compilation flags. | | |
118 | `-------------------------------*/ | |
119 | ||
8a278a04 | 120 | #ifndef LOCALEDIR |
a0f6b076 | 121 | # define LOCALEDIR "/usr/local/share/locale" |
8a278a04 | 122 | #endif |
d968a24b JT |
123 | |
124 | #endif /* BISON_SYSTEM_H */ | |
ceed8467 AD |
125 | |
126 | ||
127 | /*---------------------------------. | |
128 | | Machine-dependencies for Bison. | | |
129 | `---------------------------------*/ | |
130 | ||
131 | #ifdef eta10 | |
132 | # define MAXSHORT 2147483647 | |
133 | # define MINSHORT -2147483648 | |
134 | #else | |
135 | # define MAXSHORT 32767 | |
136 | # define MINSHORT -32768 | |
137 | #endif | |
138 | ||
139 | #if defined (MSDOS) && !defined (__GO32__) | |
140 | # define BITS_PER_WORD 16 | |
141 | # define MAXTABLE 16383 | |
142 | #else | |
143 | # define BITS_PER_WORD 32 | |
144 | # define MAXTABLE 32767 | |
145 | #endif | |
146 | ||
147 | #define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD) | |
148 | #define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD))) | |
149 | #define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD))) | |
150 | #define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0) | |
015acc48 AD |
151 | |
152 | ||
153 | /*-----------. | |
154 | | Booleans. | | |
155 | `-----------*/ | |
156 | ||
157 | #ifndef TRUE | |
158 | # define TRUE (1) | |
159 | # define FALSE (0) | |
160 | #endif | |
161 | typedef int bool; |