]>
git.saurik.com Git - bison.git/blob - src/system.h
1 /* system-dependent definitions for Bison.
2 Copyright (C) 2000 Free Software Foundation, Inc.
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)
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.
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. */
18 #ifndef BISON_SYSTEM_H
19 #define BISON_SYSTEM_H
34 # define getpid _getpid
45 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
47 /* An ANSI string.h and pre-ANSI memory.h might conflict. */
48 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
50 # endif /* not STDC_HEADERS and HAVE_MEMORY_H */
52 # define bcopy(src, dst, num) memcpy((dst), (src), (num))
54 #else /* not STDC_HEADERS and not HAVE_STRING_H */
56 /* memory.h and strings.h conflict on some systems. */
57 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
59 #if defined(STDC_HEADERS) || defined(HAVE_CTYPE_H)
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 */
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
99 #ifndef HAVE_SETLOCALE
100 # define setlocale(Category, Locale)
104 # include <libintl.h>
105 # define _(Text) gettext (Text)
107 # undef bindtextdomain
108 # define bindtextdomain(Domain, Directory)
110 # define textdomain(Domain)
111 # define _(Text) Text
113 #define N_(Text) Text
116 /*-------------------------------.
117 | Fix broken compilation flags. |
118 `-------------------------------*/
121 # define LOCALEDIR "/usr/local/share/locale"
124 #endif /* BISON_SYSTEM_H */
127 /*---------------------------------.
128 | Machine-dependencies for Bison. |
129 `---------------------------------*/
132 # define MAXSHORT 2147483647
133 # define MINSHORT -2147483648
135 # define MAXSHORT 32767
136 # define MINSHORT -32768
139 #if defined (MSDOS) && !defined (__GO32__)
140 # define BITS_PER_WORD 16
141 # define MAXTABLE 16383
143 # define BITS_PER_WORD 32
144 # define MAXTABLE 32767
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)