summaryrefslogtreecommitdiff
path: root/biblio/bibtex/bibtex-x/sysdep.h
blob: 7edc3230c5abbe2e4b2ab8ccefca3ba2516de693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
/*-
******************************************************************************
******************************************************************************
**
**  MODULE
**
**      file: sysdep.h
**
**  DESCRIPTION
**
**      A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, 
**      Unix and VMS.  This C language implementation is based on the 
**      original WEB source but it has been enhanced to support 8-bit input
**      characters and a very large processing capacity.
**
**      For documentation describing how to use and build this program, 
**      see the 00README.TXT file that accompanies this distribution.
**
**  MODULE CONTENTS
**
**      This module defines as many system dependent things as possible.
**      System / compiler dependent code should only appear in sysdep.h,
**      bibtex.c and utils.c.  System dependent code should be delimited by
**      preprocessor conditionals.  Look for:
**
**          #ifdef MSDOS
**          #ifdef OS2
**          #ifdef UNIX
**          #ifdef VMS
**
**  AUTHORS
**
**      Original WEB translation to C, conversion to "big" (32-bit) capacity,
**      addition of run-time selectable capacity and 8-bit support extensions
**      by:
**
**          Niel Kempson
**          Snowy Owl Systems Limited, Cheltenham, England
**          E-mail: kempson@snowyowl.co.uk
**      
**      8-bit support extensions also by:
**
**          Alejandro Aguilar-Sierra
**          Centro de Ciencias de la Atm\'osfera, 
**          Universidad Nacional Aut\'onoma de M\'exico, M\'exico
**          E-mail: asierra@servidor.unam.mx
**
**  COPYRIGHT
**
**      This implementation copyright (c) 1991-1995 by Niel Kempson
**           and copyright (c) 1995 by Alejandro Aguilar-Sierra.
**
**      This program is free software; you can redistribute it and/or
**      modify it under the terms of the GNU General Public License as
**      published by the Free Software Foundation; either version 1, or
**      (at your option) any later version.
**
**      This program is distributed in the hope that it will be useful,
**      but WITHOUT ANY WARRANTY; without even the implied warranty of
**      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**      General Public License for more details.
**
**      You should have received a copy of the GNU General Public License
**      along with this program; if not, write to the Free Software
**      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
**      In other words, you are welcome to use, share and improve this
**      program.  You are forbidden to forbid anyone else to use, share
**      and improve what you give them.  Help stamp out software-hoarding!
**
**  ACKNOWLEDGEMENT
**      
**      The original BibTeX was written by Oren Patashnik using Donald 
**      Knuth's WEB system.  This format produces a PASCAL program for 
**      execution and a TeX documented version of the source code. This 
**      program started as a (manual) translation of the WEB source into C.
**  
**  CHANGE LOG
**
**      $Log: sysdep.h,v $
**      Revision 3.71  1996/08/18  20:37:06  kempson
**      Official release 3.71 (see HISTORY file for details).
**
**      Revision 3.70  1996/04/08  10:08:40  kempson
**      Final documentation & cosmetic changes for official release 3.70.
**
**      Revision 3.6  1995/10/21  22:13:13  kempson
**      Added support for DJGPP under MSDOS.
**
**      Revision 3.5  1995/09/24  20:44:37  kempson
**      Many changes for final beta test version.
**
**      Revision 3.4  1995/04/09  22:15:46  kempson
**      Placed under RCS control
**
******************************************************************************
******************************************************************************
*/
#ifndef __SYSDEP_H__
# define __SYSDEP_H__               1


/*-
**============================================================================
** Include the relevant header files.
**============================================================================
*/
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <ctype.h>


/*-
**============================================================================
** For each environment (MSDOS, OS/2, UNIX & VMS), the following
** preprocessor macros must be defined:
**
** IMPLEMENTATION       the implementation string reported by BibTeX when
**                      the --version is specified.
**
** PATH_DELIM           the character used to separate components of a
**                      search path string.
**
**                          Note: usually ';' for DOS & OS/2, ':' for Unix
**                                and ',' for VMS.
**============================================================================
*/
#ifdef WIN32
# ifdef _MSC_VER
#  define IMPLEMENTATION            "Microsoft(R) C/C++ for Win32"
# elif defined(__MINGW32__)
#  define IMPLEMENTATION            "MinGW32 C/C++ for Win32"
# else
#  define IMPLEMENTATION            "Unknown C/C++ for Win32"
# endif				/* _MSC_VER */
#endif

#ifdef  MSDOS

# ifdef DJGPP
#  define IMPLEMENTATION            "DJGPP/GNU C 32 bit bound for DOS"
# else
#  define IMPLEMENTATION            "EMX/GNU C 32 bit bound for DOS"
# endif		                /* DJGPP */

# define PATH_DELIM                 ';'
#endif				/* MSDOS */

#ifdef  OS2
# define IMPLEMENTATION             "EMX/GNU C 32 bit for OS/2"
# define PATH_DELIM                 ';'
#endif				/* OS2 */

#ifdef  UNIX
# ifndef IMPLEMENTATION
#  define IMPLEMENTATION            "C for Unix"
# endif
# define PATH_DELIM                 ':'
#endif				/* UNIX */

#ifdef  VMS
# define IMPLEMENTATION             "GNU C for VMS"
# define PATH_DELIM                 ','
#endif				/* VMS */


/*-
**============================================================================
** Define the exit status values that should be returned to the operating
** system.
**============================================================================
*/
#ifdef VMS
# define NORMAL_EXIT_STATUS         0x10000001L
# define WARNING_EXIT_STATUS        0x10000000L
# define ERROR_EXIT_STATUS          0x10000002L
# define FATAL_EXIT_STATUS          0x10000004L
#else                           /* NOT VMS */
# define NORMAL_EXIT_STATUS         0
# define WARNING_EXIT_STATUS        1
# define ERROR_EXIT_STATUS          2
# define FATAL_EXIT_STATUS          3
#endif                          /* VMS */


/*-
**============================================================================
** Some macros to satisfy ANSI C's strict (for C anyway) type checking.
**============================================================================
*/
#if defined(WIN32) && defined(KPATHSEA)
#define FPRINTF                     (void) win32_fprintf
#define FPUTS                       (void) win32_fputs
#else
#define FPRINTF                     (void) fprintf
#define FPUTS                       (void) fputs
#endif
#define FPUTC                       (void) fputc
#define PRINTF                      (void) printf
#define PUTC                        (void) putc
#define SPRINTF                     (void) sprintf
#define CHR(x)                      (x)


/*-
**============================================================================
** Some macros to make the C code look more like the WEB from which it was
** translated.
**============================================================================
*/
#define BEGIN                       {
#define END                         }
#ifndef TRUE
# define TRUE                       1
#endif
#ifndef FALSE
# define FALSE                      0
#endif
#define REPEAT                      do
#define UNTIL(X)                    while ( ! (X))
#define DIV                         /
#define MOD                         %


/*-
**============================================================================
** WEB section number:   39
** ~~~~~~~~~~~~~~~~~~~~
** We implement path searching for the function |a_open_in|. If
** |name_of_file| doesn't start with `\' then path names from the
** appropriate path list are prepended until success or the end of the path
** list is reached.
**============================================================================
*/
#define NO_SEARCH_PATH              0
#define AUX_FILE_SEARCH_PATH        1
#define BIB_FILE_SEARCH_PATH        2
#define BST_FILE_SEARCH_PATH        3
#define CSF_FILE_SEARCH_PATH        4


/*-
**============================================================================
** The Makefile specifies a number of preprocessor macros used to control
** how BibTeX searches for input files.  If any of them are undefined, an
** error message will be issued by the C preprocessor.  The macros
** required are:
**
**  AUX_INPUT_ENVVAR  - environment variable specifying the search path for
**                      .aux files 
**  AUX_INPUT_PATH    - fallback search path for .aux files
**  BIB_INPUT_ENVVAR  - environment variable specifying the search path for
**                      .bib files 
**  BIB_INPUT_PATH    - fallback search path for .bib files
**  BST_INPUT_ENVVAR  - environment variable specifying the search path for
**                      .bst files 
**  BST_INPUT_PATH    - fallback search path for .bst files
**  CSF_INPUT_ENVVAR  - environment variable specifying the search path for
**                      .csf files 
**  CSF_INPUT_PATH    - fallback search path for .csf files
**
**  CSF_FILE_ENVVAR   - environment variable specifying the default .csf file
**  CSF_FILE_NAME     - fallback name of the default .csf file
**============================================================================
*/
#ifndef KPATHSEA
#ifndef AUX_INPUT_ENVVAR
# error Macro 'AUX_INPUT_ENVVAR' has not been defined.  Please check Makefile.
#endif

#ifndef AUX_INPUT_PATH
# error Macro 'AUX_INPUT_PATH' has not been defined.  Please check Makefile.
#endif

#ifndef BIB_INPUT_ENVVAR
# error Macro 'BIB_INPUT_ENVVAR' has not been defined.  Please check Makefile.
#endif

#ifndef BIB_INPUT_PATH
# error Macro 'BIB_INPUT_PATH' has not been defined.  Please check Makefile.
#endif

#ifndef BST_INPUT_ENVVAR
# error Macro 'BST_INPUT_ENVVAR' has not been defined.  Please check Makefile.
#endif

#ifndef BST_INPUT_PATH
# error Macro 'BST_INPUT_PATH' has not been defined.  Please check Makefile.
#endif

#ifndef CSF_INPUT_ENVVAR
# error Macro 'CSF_INPUT_ENVVAR' has not been defined.  Please check Makefile.
#endif

#ifndef CSF_INPUT_PATH
# error Macro 'CSF_INPUT_PATH' has not been defined.  Please check Makefile.
#endif

#ifndef CSF_FILE_ENVVAR
# error Macro 'CSF_FILE_ENVVAR' has not been defined.  Please check Makefile.
#endif

#ifndef CSF_FILE_NAME
# error Macro 'CSF_FILE_NAME' has not been defined.  Please check Makefile.
#endif
#endif /* ! KPATHSEA */


#endif                          /* __SYSDEP_H__ */