Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6725 siemargl 1
/*
2
  Copyright (c) 1990-2008 Info-ZIP.  All rights reserved.
3
 
4
  See the accompanying file LICENSE, version 2000-Apr-09 or later
5
  (the contents of which are also included in unzip.h) for terms of use.
6
  If, for some reason, all these files are missing, the Info-ZIP license
7
  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8
*/
9
/*---------------------------------------------------------------------------
10
    MS-DOS specific configuration section:
11
  ---------------------------------------------------------------------------*/
12
 
13
#ifndef __doscfg_h
14
#define __doscfg_h
15
 
16
#include            /* for REGS macro (TC) or _dos_setftime (MSC) */
17
 
18
#ifdef __TURBOC__          /* includes Power C */
19
#  include    /* for structure ftime */
20
#  ifndef __BORLANDC__     /* there appears to be a bug (?) in Borland's */
21
#    include        /*  MEM.H related to __STDC__ and far poin-   */
22
#  endif                   /*  ters. (dpk)  [mem.h included for memcpy]  */
23
#endif
24
 
25
#ifdef WINDLL
26
#  if (defined(MSC) || defined(__WATCOMC__))
27
#    include 
28
#  else /* !(MSC || __WATCOMC__) ==> may be BORLANDC, or GNU environment */
29
#    include 
30
#  endif /* ?(MSC || __WATCOMC__) */
31
#endif
32
 
33
#ifdef __WATCOMC__
34
#  define DOS_STAT_BANDAID
35
 
36
#  ifdef __386__
37
#    ifndef WATCOMC_386
38
#      define WATCOMC_386
39
#    endif
40
#    define __32BIT__
41
#    undef far
42
#    define far
43
#    undef near
44
#    define near
45
 
46
/* Get asm routines to link properly without using "__cdecl": */
47
#    ifndef USE_ZLIB
48
#      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
49
#      pragma aux get_crc_table "_*" parm caller [] value [eax] \
50
                                      modify [eax ecx edx]
51
#    endif /* !USE_ZLIB */
52
#  else /* !__386__ */
53
#    ifndef USE_ZLIB
54
#      pragma aux crc32         "_*" parm caller [] value [ax dx] \
55
                                      modify [ax cx dx bx]
56
#      pragma aux get_crc_table "_*" parm caller [] value [ax] \
57
                                      modify [ax cx dx bx]
58
#    endif /* !USE_ZLIB */
59
#  endif /* ?__386__ */
60
#endif /* __WATCOMC__ */
61
 
62
#ifdef __EMX__
63
#  ifndef __32BIT__
64
#    define __32BIT__
65
#  endif
66
#  define far
67
#  ifndef HAVE_MKTIME
68
#    define HAVE_MKTIME
69
#  endif
70
#endif
71
 
72
#if defined(__GO32__) || defined(__DJGPP__)    /* MS-DOS compiler, not OS/2 */
73
#  ifndef __32BIT__
74
#    define __32BIT__
75
#  endif
76
#  ifndef __GO32__
77
#    define __GO32__
78
#  endif
79
#  ifndef HAVE_MKTIME
80
#    define HAVE_MKTIME
81
#  endif
82
#  include            /* for structure ftime and ftime() */
83
#  if (defined(__DJGPP__) && (__DJGPP__ > 1))
84
#    include             /* for prototypes for read/write etc. */
85
#    include                /* for FA_LABEL */
86
#    if ((__DJGPP__ == 2) && (__DJGPP_MINOR__ == 0))
87
#      include       /* for _USE_LFN, djgpp 2.0 only */
88
#    endif
89
#    define USE_LFN _USE_LFN       /* runtime test:  support long filenames? */
90
#  else
91
     int setmode(int, int);        /* not in older djgpp's include files */
92
#  endif
93
#endif
94
 
95
#ifndef __32BIT__
96
#  define __16BIT__
97
#endif
98
 
99
#if (defined(M_I86CM) || defined(M_I86LM)) || defined(WINDLL)
100
#  define MED_MEM
101
#endif
102
#if (defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__))
103
#  define MED_MEM
104
#endif
105
#ifdef __16BIT__
106
#  ifndef MED_MEM
107
#    define SMALL_MEM
108
#  endif
109
#endif
110
 
111
#define EXE_EXTENSION ".exe"  /* OS/2 has GetLoadPath() function instead */
112
 
113
#ifdef __16BIT__
114
#  if defined(MSC) || defined(__WATCOMC__)
115
#    include 
116
#    define nearmalloc _nmalloc
117
#    define nearfree _nfree
118
#  endif
119
#  if defined(__TURBOC__) && defined(DYNALLOC_CRCTAB)
120
#    if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
121
#      undef DYNALLOC_CRCTAB
122
#    endif
123
#  endif
124
#  ifndef nearmalloc
125
#    define nearmalloc malloc
126
#    define nearfree free
127
#  endif
128
#  if defined(DEBUG) && defined(MSC) && (!defined(_MSC_VER) || _MSC_VER < 600)
129
     /* for MSC 5.1, prevent macro expansion space overflow in DEBUG mode */
130
#    define NO_DEBUG_IN_MACROS
131
#  endif
132
#  ifdef USE_DEFLATE64
133
#    if (defined(M_I86TM) || defined(M_I86SM) || defined(M_I86MM))
134
#      error Deflate64(tm) requires compact or large memory model
135
#    endif
136
#    if (defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__))
137
#      error Deflate64(tm) requires compact or large memory model
138
#    endif
139
     /* the 64k history buffer for Deflate64 must be allocated specially */
140
#    define MALLOC_WORK
141
#    define MY_ZCALLOC
142
#  endif
143
#endif
144
 
145
/* 32-bit MSDOS supports the 32-bit optimized CRC-32 C code */
146
#ifdef IZ_CRC_BE_OPTIMIZ
147
# undef IZ_CRC_BE_OPTIMIZ
148
#endif
149
#ifdef __32BIT__
150
# if !defined(IZ_CRC_LE_OPTIMIZ) && !defined(NO_CRC_OPTIMIZ)
151
#  define IZ_CRC_LE_OPTIMIZ
152
# endif
153
#else /* __16BIT__ does not support optimized C crc32 code */
154
# ifdef IZ_CRC_LE_OPTIMIZ
155
#  undef IZ_CRC_LE_OPTIMIZ
156
# endif
157
#endif
158
 
159
/* another stat()/fopen() bug with some 16-bit compilers on Novell drives;
160
 * very dangerous (silently overwrites executables in other directories)
161
 */
162
#define NOVELL_BUG_WORKAROUND
163
 
164
/* enables additional test and message code that directs UnZip to fail safely
165
 * in case the "workaround" enabled above does not work as intended
166
 */
167
#define NOVELL_BUG_FAILSAFE
168
 
169
/* Some implementations of stat() tend to fail on "." in root directories
170
 * or on remote (root) directories specified by an UNC network path. This
171
 * patch of stat() is useful for at least the WATCOM compilers. The
172
 * stat_bandaid() wrapper detects stat failures on root directories and
173
 * fills in suitable values.
174
 */
175
#ifdef DOS_STAT_BANDAID
176
#  ifdef SSTAT
177
#    undef SSTAT
178
#  endif
179
#  ifdef WILD_STAT_BUG
180
#    define SSTAT(path,pbuf) (iswild(path) || stat_bandaid(path,pbuf))
181
#  else
182
#    define SSTAT stat_bandaid
183
#  endif
184
   int stat_bandaid(const char *path, struct stat *buf);
185
#endif
186
 
187
/* the TIMESTAMP feature is now supported on MSDOS, enable it per default */
188
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
189
#  define TIMESTAMP
190
#endif
191
 
192
/* check that TZ environment variable is defined before using UTC times */
193
#if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ))
194
#  define IZ_CHECK_TZ
195
#endif
196
 
197
/* The optional "long filename" support available with some MSDOS compiler
198
 * environments running under VFAT systems (Win95) is controlled with the
199
 * help of the two preprocessor symbols USE_VFAT and USE_LFN:
200
 *  - USE_VFAT is a compile time switch that selects the long filename
201
 *             semantics in mapname()
202
 *  - USE_LFN  is a macro equating to a boolean expression indicating
203
 *             whether long filenames are supported. If available, this
204
 *             macro should make use of a runtime function checking the
205
 *             LFN support.
206
 *
207
 * The code in msdos.c distinguishes three cases:
208
 * 1.) USE_VFAT is not defined:
209
 *     No support of LFN is included; filenames are mapped to 8+3 plain FAT
210
 *     syntax unconditionally.
211
 *     This is achieved by ``#define MAYBE_PLAIN_FAT'' to include the plain
212
 *     FAT name mapping code and by ``#undef USE_LFN'' to disable bypassing
213
 *     of the FAT mapping at runtime.
214
 * 2.) USE_VFAT is defined:
215
 *     Support for LFN is enabled.
216
 *  a) USE_LFN is undefined:
217
 *     There is no (runtime) check available to distinguish between OS
218
 *     environments that support VFAT extensions and those that do not.
219
 *     In this case, filenames are mapped to the more liberal VFAT LFN
220
 *     syntax unconditionally. The internal switch MAYBE_PLAIN_FAT remains
221
 *     undefined to exclude to "map to plain FAT" code parts.
222
 *  b) USE_LFN is defined (hopefully to a boolean runtime LFN check function):
223
 *     "#define MAYBE_PLAIN_FAT" is applied to include the plain FAT mapping
224
 *     code; the programs checks at runtime whether the OS supports LFN and
225
 *     uses the appropiate mapping syntax.
226
 */
227
/* Some environments, like DJGPP v2, can support long filenames on VFAT
228
 * systems and DOS 8.3 filenames on FAT systems in the same executable.  If
229
 * such support is available, USE_LFN should be defined to an expression
230
 * that will return non-zero when long filenames API should be used, zero
231
 * otherwise.
232
 */
233
#ifndef USE_VFAT
234
#  ifdef USE_LFN
235
#    undef USE_LFN
236
#  endif
237
#  ifndef MAYBE_PLAIN_FAT
238
#    define MAYBE_PLAIN_FAT
239
#  endif
240
#else
241
#  ifdef USE_LFN
242
#    define MAYBE_PLAIN_FAT
243
#  endif
244
#endif
245
 
246
#ifdef ACORN_FTYPE_NFS
247
#  undef ACORN_FTYPE_NFS        /* no commas allowed in short filenames */
248
#endif
249
 
250
/* handlers for OEM <--> ANSI string conversions */
251
#ifdef WINDLL
252
#  if 1
253
     /* C RTL's file system support assumes OEM-coded strings */
254
#    ifdef CRTL_CP_IS_ISO
255
#      undef CRTL_CP_IS_ISO
256
#    endif
257
#    ifndef CRTL_CP_IS_OEM
258
#      define CRTL_CP_IS_OEM
259
#    endif
260
#  else
261
     /* C RTL's file system support assumes ISO-coded strings */
262
#    ifndef CRTL_CP_IS_ISO
263
#      define CRTL_CP_IS_ISO
264
#    endif
265
#    ifdef CRTL_CP_IS_OEM
266
#      undef CRTL_CP_IS_OEM
267
#    endif
268
#  endif /* ?(code page of 16bit Windows compilers) */
269
   /* include Win API declarations only in sources where conversion is
270
    * actually used (skip __EXTRACT_C, extract.c includes windll.h instead)
271
    */
272
#  if defined(__ENVARGS_C) || defined(__UNZIP_C) || defined(ZCRYPT_INTERNAL)
273
#    include 
274
#  endif
275
   /* use conversion functions of Windows API */
276
#  ifdef CRTL_CP_IS_ISO
277
#   define ISO_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
278
#   define OEM_TO_INTERN(src, dst)  OemToAnsi(src, dst)
279
#   define INTERN_TO_ISO(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
280
#   define INTERN_TO_OEM(src, dst)  AnsiToOem(src, dst)
281
#  endif
282
#  ifdef CRTL_CP_IS_OEM
283
#   define ISO_TO_INTERN(src, dst)  AnsiToOem(src, dst)
284
#   define OEM_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
285
#   define INTERN_TO_ISO(src, dst)  OemToAnsi(src, dst)
286
#   define INTERN_TO_OEM(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
287
#  endif
288
#  define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1)
289
#  define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1)
290
   /* UzpPassword supplies ANSI-coded string regardless of C RTL's native CP */
291
#  define STR_TO_CP2(dst, src)  (AnsiToOem(src, dst), dst)
292
   /* dummy defines to disable these functions, they are not needed */
293
#  define STR_TO_ISO
294
#  define STR_TO_OEM
295
#else
296
   /* use home-brewed conversion functions; internal charset is OEM */
297
#  ifdef CRTL_CP_IS_ISO
298
#    undef CRTL_CP_IS_ISO
299
#  endif
300
#  ifndef CRTL_CP_IS_OEM
301
#    define CRTL_CP_IS_OEM
302
#  endif
303
#endif
304
#ifndef NEED_ISO_OEM_INIT
305
#  define NEED_ISO_OEM_INIT
306
#endif
307
 
308
/* SCREENLINES macros for 16-bit and djgpp compilers */
309
#ifdef __16BIT__
310
#  define SCREENLINES (int)(*((unsigned char far*)0x00400084L) + 1)
311
#  define SCREENWIDTH (int)(*(unsigned short far*)0x0040004AL)
312
#endif
313
 
314
#if defined(__GO32__) || defined(__DJGPP__)    /* djgpp v1.x and v2.x */
315
#  include 
316
#  define SCREENLINES ScreenRows()
317
#  define SCREENWIDTH ScreenCols()
318
#endif
319
 
320
#ifdef __EMX__
321
#  define SCREENWIDTH 80
322
#  define SCREENSIZE(scrrows, scrcols)  screensize(scrrows, scrcols)
323
   int screensize(int *tt_rows, int *tt_cols);
324
#endif
325
 
326
#ifdef WATCOMC_386
327
#  define SCREENWIDTH 80
328
#  define SCREENSIZE(scrrows, scrcols)  screensize(scrrows, scrcols)
329
   int screensize(int *tt_rows, int *tt_cols);
330
#endif
331
 
332
#ifndef SCREENSIZE
333
#  define SCREENSIZE(scrrows, scrcols) { \
334
        if ((scrrows) != NULL) *(scrrows) = SCREENLINES; \
335
        if ((scrcols) != NULL) *(scrcols) = SCREENWIDTH; }
336
#endif
337
 
338
/* on the DOS console screen, line-wraps are always enabled */
339
#define SCREENLWRAP 1
340
#define TABSIZE 8
341
 
342
#endif /* !__doscfg_h */