Debian Codegraph @

texk/bibtex-x/sysdep.h

raw
1 /*-
2 ******************************************************************************
3 ******************************************************************************
4 **
5 ** MODULE
6 **
7 ** file: sysdep.h
8 **
9 ** DESCRIPTION
10 **
11 ** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x,
12 ** Unix and VMS. This C language implementation is based on the
13 ** original WEB source but it has been enhanced to support 8-bit input
14 ** characters and a very large processing capacity.
15 **
16 ** For documentation describing how to use and build this program,
17 ** see the 00README.TXT file that accompanies this distribution.
18 **
19 ** MODULE CONTENTS
20 **
21 ** This module defines as many system dependent things as possible.
22 ** System / compiler dependent code should only appear in sysdep.h,
23 ** bibtex.c and utils.c. System dependent code should be delimited by
24 ** preprocessor conditionals. Look for:
25 **
26 ** #ifdef MSDOS
27 ** #ifdef OS2
28 ** #ifdef UNIX
29 ** #ifdef VMS
30 **
31 ** AUTHORS
32 **
33 ** Original WEB translation to C, conversion to "big" (32-bit) capacity,
34 ** addition of run-time selectable capacity and 8-bit support extensions
35 ** by:
36 **
37 ** Niel Kempson
38 ** Snowy Owl Systems Limited, Cheltenham, England
39 ** E-mail: [email protected]
40 **
41 ** 8-bit support extensions also by:
42 **
43 ** Alejandro Aguilar-Sierra
44 ** Centro de Ciencias de la Atm\'osfera,
45 ** Universidad Nacional Aut\'onoma de M\'exico, M\'exico
46 ** E-mail: [email protected]
47 **
48 ** COPYRIGHT
49 **
50 ** This implementation copyright (c) 1991-1995 by Niel Kempson
51 ** and copyright (c) 1995 by Alejandro Aguilar-Sierra.
52 **
53 ** This program is free software; you can redistribute it and/or
54 ** modify it under the terms of the GNU General Public License as
55 ** published by the Free Software Foundation; either version 1, or
56 ** (at your option) any later version.
57 **
58 ** This program is distributed in the hope that it will be useful,
59 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
60 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
61 ** General Public License for more details.
62 **
63 ** You should have received a copy of the GNU General Public License
64 ** along with this program; if not, write to the Free Software
65 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
66 **
67 ** In other words, you are welcome to use, share and improve this
68 ** program. You are forbidden to forbid anyone else to use, share
69 ** and improve what you give them. Help stamp out software-hoarding!
70 **
71 ** ACKNOWLEDGEMENT
72 **
73 ** The original BibTeX was written by Oren Patashnik using Donald
74 ** Knuth's WEB system. This format produces a PASCAL program for
75 ** execution and a TeX documented version of the source code. This
76 ** program started as a (manual) translation of the WEB source into C.
77 **
78 ** CHANGE LOG
79 **
80 ** $Log: sysdep.h,v $
81 ** Revision 3.71 1996/08/18 20:37:06 kempson
82 ** Official release 3.71 (see HISTORY file for details).
83 **
84 ** Revision 3.70 1996/04/08 10:08:40 kempson
85 ** Final documentation & cosmetic changes for official release 3.70.
86 **
87 ** Revision 3.6 1995/10/21 22:13:13 kempson
88 ** Added support for DJGPP under MSDOS.
89 **
90 ** Revision 3.5 1995/09/24 20:44:37 kempson
91 ** Many changes for final beta test version.
92 **
93 ** Revision 3.4 1995/04/09 22:15:46 kempson
94 ** Placed under RCS control
95 **
96 ******************************************************************************
97 ******************************************************************************
98 */
99 #ifndef __SYSDEP_H__
100 # define __SYSDEP_H__ 1
101
102
103 /*-
104 **============================================================================
105 ** Include the relevant header files.
106 **============================================================================
107 */
108 #include <stdlib.h>
109 #include <stdio.h>
110 #include <setjmp.h>
111 #include <string.h>
112 #include <ctype.h>
113
114 #ifdef KPATHSEA
115 #include <kpathsea/config.h>
116 #include <kpathsea/progname.h>
117 #include <kpathsea/variable.h>
118 #endif
119
120 /*-
121 **============================================================================
122 ** For each environment (MSDOS, OS/2, UNIX & VMS), the following
123 ** preprocessor macros must be defined:
124 **
125 ** IMPLEMENTATION the implementation string reported by BibTeX when
126 ** the --version is specified.
127 **
128 ** PATH_DELIM the character used to separate components of a
129 ** search path string.
130 **
131 ** Note: usually ';' for DOS & OS/2, ':' for Unix
132 ** and ',' for VMS.
133 **============================================================================
134 */
135 #ifdef WIN32
136 # ifdef _MSC_VER
137 # define IMPLEMENTATION "Microsoft(R) C/C++ for Win32"
138 # elif defined(__MINGW32__)
139 # define IMPLEMENTATION "MinGW32 C/C++ for Win32"
140 # else
141 # define IMPLEMENTATION "Unknown C/C++ for Win32"
142 # endif /* _MSC_VER */
143 #endif
144
145 #ifdef MSDOS
146
147 # ifdef DJGPP
148 # define IMPLEMENTATION "DJGPP/GNU C 32 bit bound for DOS"
149 # else
150 # define IMPLEMENTATION "EMX/GNU C 32 bit bound for DOS"
151 # endif /* DJGPP */
152
153 # define PATH_DELIM ';'
154 #endif /* MSDOS */
155
156 #ifdef OS2
157 # define IMPLEMENTATION "EMX/GNU C 32 bit for OS/2"
158 # define PATH_DELIM ';'
159 #endif /* OS2 */
160
161 #ifdef UNIX
162 # ifndef IMPLEMENTATION
163 # define IMPLEMENTATION "C for Unix"
164 # endif
165 # define PATH_DELIM ':'
166 #endif /* UNIX */
167
168 #ifdef VMS
169 # define IMPLEMENTATION "GNU C for VMS"
170 # define PATH_DELIM ','
171 #endif /* VMS */
172
173
174 /*-
175 **============================================================================
176 ** Define the exit status values that should be returned to the operating
177 ** system.
178 **============================================================================
179 */
180 #ifdef VMS
181 # define NORMAL_EXIT_STATUS 0x10000001L
182 # define WARNING_EXIT_STATUS 0x10000000L
183 # define ERROR_EXIT_STATUS 0x10000002L
184 # define FATAL_EXIT_STATUS 0x10000004L
185 #else /* NOT VMS */
186 # define NORMAL_EXIT_STATUS 0
187 # define WARNING_EXIT_STATUS 1
188 # define ERROR_EXIT_STATUS 2
189 # define FATAL_EXIT_STATUS 3
190 #endif /* VMS */
191
192
193 /*-
194 **============================================================================
195 ** Some macros to satisfy ANSI C's strict (for C anyway) type checking.
196 **============================================================================
197 */
198 #if defined(WIN32) && defined(KPATHSEA)
199 #define FPRINTF (void) win32_fprintf
200 #define FPUTS (void) win32_fputs
201 #else
202 #define FPRINTF (void) fprintf
203 #define FPUTS (void) fputs
204 #endif
205 #define FPUTC (void) fputc
206 #define PRINTF (void) printf
207 #define PUTC (void) putc
208 #define SPRINTF (void) sprintf
209 #define CHR(x) (x)
210
211
212 /*-
213 **============================================================================
214 ** Some macros to make the C code look more like the WEB from which it was
215 ** translated.
216 **============================================================================
217 */
218 #define BEGIN {
219 #define END }
220 #ifndef TRUE
221 # define TRUE 1
222 #endif
223 #ifndef FALSE
224 # define FALSE 0
225 #endif
226 #define REPEAT do
227 #define UNTIL(X) while ( ! (X))
228 #define DIV /
229 #define MOD %
230
231
232 /*-
233 **============================================================================
234 ** WEB section number: 39
235 ** ~~~~~~~~~~~~~~~~~~~~
236 ** We implement path searching for the function |a_open_in|. If
237 ** |name_of_file| doesn't start with `\' then path names from the
238 ** appropriate path list are prepended until success or the end of the path
239 ** list is reached.
240 **============================================================================
241 */
242 #define NO_SEARCH_PATH 0
243 #define AUX_FILE_SEARCH_PATH 1
244 #define BIB_FILE_SEARCH_PATH 2
245 #define BST_FILE_SEARCH_PATH 3
246 #define CSF_FILE_SEARCH_PATH 4
247
248
249 /*-
250 **============================================================================
251 ** The Makefile specifies a number of preprocessor macros used to control
252 ** how BibTeX searches for input files. If any of them are undefined, an
253 ** error message will be issued by the C preprocessor. The macros
254 ** required are:
255 **
256 ** AUX_INPUT_ENVVAR - environment variable specifying the search path for
257 ** .aux files
258 ** AUX_INPUT_PATH - fallback search path for .aux files
259 ** BIB_INPUT_ENVVAR - environment variable specifying the search path for
260 ** .bib files
261 ** BIB_INPUT_PATH - fallback search path for .bib files
262 ** BST_INPUT_ENVVAR - environment variable specifying the search path for
263 ** .bst files
264 ** BST_INPUT_PATH - fallback search path for .bst files
265 ** CSF_INPUT_ENVVAR - environment variable specifying the search path for
266 ** .csf files
267 ** CSF_INPUT_PATH - fallback search path for .csf files
268 **
269 ** CSF_FILE_ENVVAR - environment variable specifying the default .csf file
270 ** CSF_FILE_NAME - fallback name of the default .csf file
271 **============================================================================
272 */
273 #ifndef KPATHSEA
274 #ifndef AUX_INPUT_ENVVAR
275 # error Macro 'AUX_INPUT_ENVVAR' has not been defined. Please check Makefile.
276 #endif
277
278 #ifndef AUX_INPUT_PATH
279 # error Macro 'AUX_INPUT_PATH' has not been defined. Please check Makefile.
280 #endif
281
282 #ifndef BIB_INPUT_ENVVAR
283 # error Macro 'BIB_INPUT_ENVVAR' has not been defined. Please check Makefile.
284 #endif
285
286 #ifndef BIB_INPUT_PATH
287 # error Macro 'BIB_INPUT_PATH' has not been defined. Please check Makefile.
288 #endif
289
290 #ifndef BST_INPUT_ENVVAR
291 # error Macro 'BST_INPUT_ENVVAR' has not been defined. Please check Makefile.
292 #endif
293
294 #ifndef BST_INPUT_PATH
295 # error Macro 'BST_INPUT_PATH' has not been defined. Please check Makefile.
296 #endif
297
298 #ifndef CSF_INPUT_ENVVAR
299 # error Macro 'CSF_INPUT_ENVVAR' has not been defined. Please check Makefile.
300 #endif
301
302 #ifndef CSF_INPUT_PATH
303 # error Macro 'CSF_INPUT_PATH' has not been defined. Please check Makefile.
304 #endif
305
306 #ifndef CSF_FILE_ENVVAR
307 # error Macro 'CSF_FILE_ENVVAR' has not been defined. Please check Makefile.
308 #endif
309
310 #ifndef CSF_FILE_NAME
311 # error Macro 'CSF_FILE_NAME' has not been defined. Please check Makefile.
312 #endif
313 #endif /* ! KPATHSEA */
314
315
316 #endif /* __SYSDEP_H__ */