]> git.cworth.org Git - gzip/blob - tailor.h
Imported Upstream version 1.3.2
[gzip] / tailor.h
1 /* tailor.h -- target dependent definitions
2  * Copyright (C) 1992-1993 Jean-loup Gailly.
3  * This is free software; you can redistribute it and/or modify it under the
4  * terms of the GNU General Public License, see the file COPYING.
5  */
6
7 /* The target dependent definitions should be defined here only.
8  * The target dependent functions should be defined in tailor.c.
9  */
10
11 /* $Id: tailor.h,v 0.18 1993/06/14 19:32:20 jloup Exp $ */
12
13 #if defined(__MSDOS__) && !defined(MSDOS)
14 #  define MSDOS
15 #endif
16
17 #if defined(__OS2__) && !defined(OS2)
18 #  define OS2
19 #endif
20
21 #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
22 #  undef MSDOS
23 #endif
24
25 #ifdef MSDOS
26 #  ifdef __GNUC__
27      /* DJGPP version 1.09+ on MS-DOS.
28       * The DJGPP 1.09 stat() function must be upgraded before gzip will
29       * fully work.
30       * No need for HAVE_DIRENT_H, since <unistd.h> defines POSIX_SOURCE which
31       * implies HAVE_DIRENT_H.
32       */
33 #    define near
34 #  else
35 #    define MAXSEG_64K
36 #    ifdef __TURBOC__
37 #      define off_t long
38 #      ifdef __BORLANDC__
39 #        define HAVE_DIRENT_H
40 #        define HAVE_UTIME
41 #      endif
42 #      define HAVE_UTIME_H
43 #    else /* MSC */
44 #      define HAVE_SYS_UTIME_H
45 #    endif
46 #  endif
47 #  define PATH_SEP2 '\\'
48 #  define PATH_SEP3 ':'
49 #  define MAX_PATH_LEN  128
50 #  define NO_MULTIPLE_DOTS
51 #  define MAX_EXT_CHARS 3
52 #  define Z_SUFFIX "z"
53 #  define PROTO
54 #  define STDC_HEADERS
55 #  define NO_SIZE_CHECK
56 #  define UNLINK_READONLY_BUG
57 #  define casemap(c) tolow(c) /* Force file names to lower case */
58 #  include <io.h>
59 #  define OS_CODE  0x00
60 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
61 #  if !defined(NO_ASM) && !defined(ASMV)
62 #    define ASMV
63 #  endif
64 #else
65 #  define near
66 #endif
67
68 #ifdef OS2
69 #  define PATH_SEP2 '\\'
70 #  define PATH_SEP3 ':'
71 #  define MAX_PATH_LEN  260
72 #  ifdef OS2FAT
73 #    define NO_MULTIPLE_DOTS
74 #    define MAX_EXT_CHARS 3
75 #    define Z_SUFFIX "z"
76 #    define casemap(c) tolow(c)
77 #  endif
78 #  define PROTO
79 #  define STDC_HEADERS
80 #  define UNLINK_READONLY_BUG
81 #  include <io.h>
82 #  define OS_CODE  0x06
83 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
84 #  ifdef _MSC_VER
85 #    define HAVE_SYS_UTIME_H
86 #    define MAXSEG_64K
87 #    undef near
88 #    define near _near
89 #  endif
90 #  ifdef __EMX__
91 #    define HAVE_SYS_UTIME_H
92 #    define HAVE_DIRENT_H
93 #    define EXPAND(argc,argv) \
94        {_response(&argc, &argv); _wildcard(&argc, &argv);}
95 #  endif
96 #  ifdef __BORLANDC__
97 #    define HAVE_DIRENT_H
98 #    define HAVE_UTIME_H
99 #  endif
100 #  ifdef __ZTC__
101 #    define NO_DIR
102 #    include <dos.h>
103 #    define EXPAND(argc,argv) \
104        {response_expand(&argc, &argv);}
105 #  endif
106 #endif
107
108 #ifdef WIN32 /* Windows NT */
109 #  define HAVE_SYS_UTIME_H
110 #  define PATH_SEP2 '\\'
111 #  define PATH_SEP3 ':'
112 #  define MAX_PATH_LEN  260
113 #  define PROTO
114 #  define STDC_HEADERS
115 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
116 #  define UNLINK_READONLY_BUG
117 #  include <io.h>
118 #  include <malloc.h>
119 #  ifdef NTFAT
120 #    define NO_MULTIPLE_DOTS
121 #    define MAX_EXT_CHARS 3
122 #    define Z_SUFFIX "z"
123 #    define casemap(c) tolow(c) /* Force file names to lower case */
124 #  endif
125 #  define OS_CODE  0x0b
126 #endif
127
128 #ifdef MSDOS
129 #  ifdef __TURBOC__
130 #    include <alloc.h>
131 #    define DYN_ALLOC
132      /* Turbo C 2.0 does not accept static allocations of large arrays */
133      void * fcalloc (unsigned items, unsigned size);
134      void fcfree (void *ptr);
135 #  else /* MSC */
136 #    include <malloc.h>
137 #    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
138 #    define fcfree(ptr) hfree(ptr)
139 #  endif
140 #else
141 #  ifdef MAXSEG_64K
142 #    define fcalloc(items,size) calloc((items),(size))
143 #  else
144 #    define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
145 #  endif
146 #  define fcfree(ptr) free(ptr)
147 #endif
148
149 #if defined(VAXC) || defined(VMS)
150 #  define PATH_SEP ']'
151 #  define PATH_SEP2 ':'
152 #  define SUFFIX_SEP ';'
153 #  define NO_MULTIPLE_DOTS
154 #  define Z_SUFFIX "-gz"
155 #  define RECORD_IO 1
156 #  define casemap(c) tolow(c)
157 #  define OS_CODE  0x02
158 #  define OPTIONS_VAR "GZIP_OPT"
159 #  define STDC_HEADERS
160 #  define EXPAND(argc,argv) vms_expand_args(&argc,&argv);
161 #  include <file.h>
162 #  define unlink delete
163 #  ifdef VAXC
164 #    include <unixio.h>
165 #  else
166 #    define HAVE_FCNTL_H
167 #  endif
168 #endif
169
170 #ifdef AMIGA
171 #  define PATH_SEP2 ':'
172 #  define STDC_HEADERS
173 #  define OS_CODE  0x01
174 #  define ASMV
175 #  ifdef __GNUC__
176 #    define HAVE_DIRENT_H
177 #    define HAVE_FCNTL_H
178 #    define HAVE_UNISTD_H
179 #    define HAVE_CHOWN
180 #    define HAVE_LSTAT
181 #  else /* SASC */
182 #    define NO_STDIN_FSTAT
183 #    define HAVE_SYS_DIR_H
184 #    include <fcntl.h> /* for read() and write() */
185 #    define direct dirent
186      extern void _expand_args(int *argc, char ***argv);
187 #    define EXPAND(argc,argv) _expand_args(&argc,&argv);
188 #    undef  O_BINARY /* disable useless --ascii option */
189 #  endif
190 #endif
191
192 #if defined(ATARI) || defined(atarist)
193 #  ifndef STDC_HEADERS
194 #    define STDC_HEADERS
195 #    define HAVE_UNISTD_H
196 #    define HAVE_DIRENT_H
197 #  endif
198 #  define ASMV
199 #  define OS_CODE  0x05
200 #  ifdef TOSFS
201 #    define PATH_SEP2 '\\'
202 #    define PATH_SEP3 ':'
203 #    define MAX_PATH_LEN  128
204 #    define NO_MULTIPLE_DOTS
205 #    define MAX_EXT_CHARS 3
206 #    define Z_SUFFIX "z"
207 #    define casemap(c) tolow(c) /* Force file names to lower case */
208 #  endif
209 #endif
210
211 #ifdef MACOS
212 #  define PATH_SEP ':'
213 #  define DYN_ALLOC
214 #  define PROTO
215 #  define NO_STDIN_FSTAT
216 #  define chmod(file, mode) (0)
217 #  define OPEN(name, flags, mode) open(name, flags)
218 #  define OS_CODE  0x07
219 #  ifdef MPW
220 #    define isatty(fd) ((fd) <= 2)
221 #  endif
222 #endif
223
224 #ifdef __50SERIES /* Prime/PRIMOS */
225 #  define PATH_SEP '>'
226 #  define STDC_HEADERS
227 #  define NO_STDIN_FSTAT 
228 #  define NO_SIZE_CHECK 
229 #  define RECORD_IO  1
230 #  define casemap(c)  tolow(c) /* Force file names to lower case */
231 #  define put_char(c) put_byte((c) & 0x7F)
232 #  define get_char(c) ascii2pascii(get_byte())
233 #  define OS_CODE  0x0F    /* temporary, subject to change */
234 #  ifdef SIGTERM
235 #    undef SIGTERM         /* We don't want a signal handler for SIGTERM */
236 #  endif
237 #endif
238
239 #if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */
240 #  define NOMEMCPY /* problem with overlapping copies */
241 #endif
242
243 #ifdef TOPS20
244 #  define OS_CODE  0x0a
245 #endif
246
247 #ifndef unix
248 #  define NO_ST_INO /* don't rely on inode numbers */
249 #endif
250
251
252         /* Common defaults */
253
254 #ifndef OS_CODE
255 #  define OS_CODE  0x03  /* assume Unix */
256 #endif
257
258 #ifndef PATH_SEP
259 #  define PATH_SEP '/'
260 #endif
261
262 #ifndef casemap
263 #  define casemap(c) (c)
264 #endif
265
266 #ifndef OPTIONS_VAR
267 #  define OPTIONS_VAR "GZIP"
268 #endif
269
270 #ifndef Z_SUFFIX
271 #  define Z_SUFFIX ".gz"
272 #endif
273
274 #ifdef MAX_EXT_CHARS
275 #  define MAX_SUFFIX  MAX_EXT_CHARS
276 #else
277 #  define MAX_SUFFIX  30
278 #endif
279
280 #ifndef MAKE_LEGAL_NAME
281 #  ifdef NO_MULTIPLE_DOTS
282 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
283 #  else
284 #    define MAKE_LEGAL_NAME(name)
285 #  endif
286 #endif
287
288 #ifndef MIN_PART
289 #  define MIN_PART 3
290    /* keep at least MIN_PART chars between dots in a file name. */
291 #endif
292
293 #ifndef EXPAND
294 #  define EXPAND(argc,argv)
295 #endif
296
297 #ifndef RECORD_IO
298 #  define RECORD_IO 0
299 #endif
300
301 #ifndef SET_BINARY_MODE
302 #  define SET_BINARY_MODE(fd)
303 #endif
304
305 #ifndef OPEN
306 #  define OPEN(name, flags, mode) open(name, flags, mode)
307 #endif
308
309 #ifndef get_char
310 #  define get_char() get_byte()
311 #endif
312
313 #ifndef put_char
314 #  define put_char(c) put_byte(c)
315 #endif