Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

tailor.h

00001 /*
00002   Copyright (c) 1990-1999 Info-ZIP.  All rights reserved.
00003 
00004   See the accompanying file LICENSE, version 1999-Oct-05 or later
00005   (the contents of which are also included in zip.h) for terms of use.
00006   If, for some reason, both of these files are missing, the Info-ZIP license
00007   also may be found at:  ftp://ftp.cdrom.com/pub/infozip/license.html
00008 */
00009 #ifdef AMIGA
00010 #include "amiga/osdep.h"
00011 #endif
00012 
00013 #ifdef AOSVS
00014 #include "aosvs/osdep.h"
00015 #endif
00016 
00017 #ifdef ATARI
00018 #include "atari/osdep.h"
00019 #endif
00020 
00021 #ifdef __BEOS__
00022 #include "beos/osdep.h"
00023 #endif
00024 
00025 #ifdef DOS
00026 #include "msdos/osdep.h"
00027 #endif
00028 
00029 #ifdef __human68k__
00030 #include "human68k/osdep.h"
00031 #endif
00032 
00033 #if ((defined(__MWERKS__) && defined(macintosh)) || defined(MACOS))
00034 #include "macos/osdep.h"
00035 #endif
00036 
00037 #ifdef OS2
00038 #include "os2/osdep.h"
00039 #endif
00040 
00041 #ifdef __riscos
00042 #include "acorn/osdep.h"
00043 #endif
00044 
00045 #ifdef QDOS
00046 #include "qdos/osdep.h"
00047 #endif
00048 
00049 #ifdef __TANDEM
00050 #include "tandem.h"
00051 #include "tanzip.h"
00052 #endif
00053 
00054 #ifdef UNIX
00055 #include "unix/osdep.h"
00056 #endif
00057 
00058 #if defined(__COMPILER_KCC__) || defined(TOPS20)
00059 #include "tops20/osdep.h"
00060 #endif
00061 
00062 #if defined(VMS) || defined(__VMS)
00063 #include "vms/osdep.h"
00064 #endif
00065 
00066 #if defined(__VM__) || defined(VM_CMS) || defined(MVS)
00067 #include "cmsmvs.h"
00068 #endif
00069 
00070 #ifdef WIN32
00071 #include "win32/osdep.h"
00072 #endif
00073 
00074 #ifdef THEOS
00075 #include "theos/osdep.h"
00076 #endif
00077 
00078 #if (defined(USE_ZLIB) && defined(ASM_CRC))
00079 #  undef ASM_CRC
00080 #endif
00081 
00082 #if (defined(USE_ZLIB) && defined(ASMV))
00083 #  undef ASMV
00084 #endif
00085 
00086 /* When "void" is an alias for "int", prototypes cannot be used. */
00087 #if (defined(NO_VOID) && !defined(NO_PROTO))
00088 #  define NO_PROTO
00089 #endif
00090 
00091 /* Used to remove arguments in function prototypes for non-ANSI C */
00092 #ifndef NO_PROTO
00093 #  define OF(a) a
00094 #else /* NO_PROTO */
00095 #  define OF(a) ()
00096 #endif /* ?NO_PROTO */
00097 
00098 /* If the compiler can't handle const define ZCONST in osdep.h */
00099 /* Define const itself in case the system include files are bonkers */
00100 #ifndef ZCONST
00101 #  ifdef NO_CONST
00102 #    define ZCONST
00103 #    define const
00104 #  else
00105 #    define ZCONST const
00106 #  endif
00107 #endif
00108 
00109 /*
00110  * case mapping functions. case_map is used to ignore case in comparisons,
00111  * to_up is used to force upper case even on Unix (for dosify option).
00112  */
00113 #ifdef USE_CASE_MAP
00114 #  define case_map(c) upper[(c) & 0xff]
00115 #  define to_up(c)    upper[(c) & 0xff]
00116 #else
00117 #  define case_map(c) (c)
00118 #  define to_up(c)    ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
00119 #endif /* USE_CASE_MAP */
00120 
00121 /* Define void, zvoid, and extent (size_t) */
00122 #include <stdio.h>
00123 
00124 #ifndef NO_STDDEF_H
00125 #  include <stddef.h>
00126 #endif /* !NO_STDDEF_H */
00127 
00128 #ifndef NO_STDLIB_H
00129 #  include <stdlib.h>
00130 #endif /* !NO_STDLIB_H */
00131 
00132 #ifndef NO_UNISTD_H
00133 #  include <unistd.h> /* usually defines _POSIX_VERSION */
00134 #endif /* !NO_UNISTD_H */
00135 
00136 #ifndef NO_FCNTL_H
00137 #  include <fcntl.h>
00138 #endif /* !NO_FNCTL_H */
00139 
00140 #ifndef NO_STRING_H
00141 #  include <string.h>
00142 #else
00143 #  include <strings.h>
00144 #endif /* NO_STRING_H */
00145 
00146 #ifdef NO_VOID
00147 #  define void int
00148    typedef char zvoid;
00149 #else /* !NO_VOID */
00150 # ifdef NO_TYPEDEF_VOID
00151 #  define zvoid void
00152 # else
00153    typedef void zvoid;
00154 # endif
00155 #endif /* ?NO_VOID */
00156 
00157 #ifdef NO_STRRCHR
00158 #  define strrchr rindex
00159 #endif
00160 
00161 #ifdef NO_STRCHR
00162 #  define strchr index
00163 #endif
00164 
00165 /*
00166  * A couple of forward declarations that are needed on systems that do
00167  * not supply C runtime library prototypes.
00168  */
00169 #ifdef NO_PROTO
00170 char *strcpy();
00171 char *strcat();
00172 char *strrchr();
00173 /* XXX use !defined(ZMEM) && !defined(__hpux__) ? */
00174 #if !defined(ZMEM) && defined(NO_STRING_H)
00175 char *memset();
00176 char *memcpy();
00177 #endif /* !ZMEM && NO_STRING_H */
00178 
00179 /* XXX use !defined(__hpux__) ? */
00180 #ifdef NO_STDLIB_H
00181 char *calloc();
00182 char *malloc();
00183 char *getenv();
00184 long atol();
00185 #endif /* NO_STDLIB_H */
00186 
00187 #endif /* NO_PROTO */
00188 
00189 #ifndef NO_MKTEMP
00190 char *mktemp();
00191 #endif /* !NO_MKTEMP */
00192 
00193 /*
00194  * SEEK_* macros, should be defined in stdio.h
00195  */
00196 /* Define fseek() commands */
00197 #ifndef SEEK_SET
00198 #  define SEEK_SET 0
00199 #endif /* !SEEK_SET */
00200 
00201 #ifndef SEEK_CUR
00202 #  define SEEK_CUR 1
00203 #endif /* !SEEK_CUR */
00204 
00205 #ifndef FALSE
00206 #  define FALSE 0
00207 #endif
00208 
00209 #ifndef TRUE
00210 #  define TRUE 1
00211 #endif
00212 
00213 #ifdef NO_SIZE_T
00214    typedef unsigned int extent;
00215 #else
00216    typedef size_t extent;
00217 #endif
00218 
00219 #ifdef NO_TIME_T
00220    typedef long time_t;
00221 #endif
00222 
00223 /* DBCS support for Info-ZIP's zip  (mainly for japanese (-: )
00224  * by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp)
00225  * This code is public domain!   Date: 1998/12/20
00226  */
00227 #ifdef _MBCS
00228 #   include <locale.h>
00229 
00230     /* Multi Byte Character Set */
00231     extern char *___tmp_ptr;
00232     unsigned char *zmbschr OF((ZCONST unsigned char *, unsigned int));
00233     unsigned char *zmbsrchr OF((ZCONST unsigned char *, unsigned int));
00234 #   define CLEN(ptr) mblen(ptr, MB_CUR_MAX)
00235 #   define PREINCSTR(ptr) (ptr += CLEN(ptr))
00236 #   define POSTINCSTR(ptr) (___tmp_ptr=(char *)ptr,ptr += CLEN(ptr),___tmp_ptr)
00237     int lastchar OF((ZCONST char *ptr));
00238 #   define MBSCHR(str,c) (char *)zmbschr((ZCONST unsigned char *)(str), c)
00239 #   define MBSRCHR(str,c) (char *)zmbsrchr((ZCONST unsigned char *)(str), (c))
00240 #   define SETLOCALE(category, locale) setlocale(category, locale)
00241 #else /* !_MBCS */
00242 #   define CLEN(ptr) 1
00243 #   define PREINCSTR(ptr) (++(ptr))
00244 #   define POSTINCSTR(ptr) ((ptr)++)
00245 #   define lastchar(ptr) ((*(ptr)=='\0') ? '\0' : ptr[strlen(ptr)-1])
00246 #   define MBSCHR(str, c) strchr(str, c)
00247 #   define MBSRCHR(str, c) strrchr(str, c)
00248 #   define SETLOCALE(category, locale)
00249 #endif /* ?_MBCS */
00250 #define INCSTR(ptr) PREINCSTR(ptr)
00251 
00252 
00253 /* System independent replacement for "struct utimbuf", which is missing
00254  * in many older OS environments.
00255  */
00256 typedef struct ztimbuf {
00257     time_t actime;              /* new access time */
00258     time_t modtime;             /* new modification time */
00259 } ztimbuf;
00260 
00261 /* This macro round a time_t value to the OS specific resolution */
00262 #ifndef ROUNDED_TIME
00263 #  define ROUNDED_TIME(time)   (time)
00264 #endif
00265 
00266 /* Some systems define S_IFLNK but do not support symbolic links */
00267 #if defined (S_IFLNK) && defined(NO_SYMLINK)
00268 #  undef S_IFLNK
00269 #endif
00270 
00271 #ifndef FOPR    /* fallback default definitions for FOPR, FOPM, FOPW: */
00272 #  define FOPR "r"
00273 #  define FOPM "r+"
00274 #  define FOPW "w"
00275 #endif /* fallback definition */
00276 
00277 #ifndef FOPW_TMP    /* fallback default for opening writable temp files */
00278 #  define FOPW_TMP FOPW
00279 #endif
00280 
00281 /* Open the old zip file in exclusive mode if possible (to avoid adding
00282  * zip file to itself).
00283  */
00284 #ifdef OS2
00285 #  define FOPR_EX FOPM
00286 #else
00287 #  define FOPR_EX FOPR
00288 #endif
00289 
00290 
00291 /* MSDOS file or directory attributes */
00292 #define MSDOS_HIDDEN_ATTR 0x02
00293 #define MSDOS_DIR_ATTR 0x10
00294 
00295 
00296 /* Define this symbol if your target allows access to unaligned data.
00297  * This is not mandatory, just a speed optimization. The compressed
00298  * output is strictly identical.
00299  */
00300 #if (defined(MSDOS) && !defined(WIN32)) || defined(i386)
00301 #    define UNALIGNED_OK
00302 #endif
00303 #if defined(mc68020) || defined(vax)
00304 #    define UNALIGNED_OK
00305 #endif
00306 
00307 #if (defined(SMALL_MEM) && !defined(CBSZ))
00308 #   define CBSZ 2048 /* buffer size for copying files */
00309 #   define ZBSZ 2048 /* buffer size for temporary zip file */
00310 #endif
00311 
00312 #if (defined(MEDIUM_MEM) && !defined(CBSZ))
00313 #  define CBSZ 8192
00314 #  define ZBSZ 8192
00315 #endif
00316 
00317 #ifndef CBSZ
00318 #  define CBSZ 16384
00319 #  define ZBSZ 16384
00320 #endif
00321 
00322 #ifndef SBSZ
00323 #  define SBSZ CBSZ     /* copy buf size for STORED entries, see zipup() */
00324 #endif
00325 
00326 #ifndef MEMORY16
00327 #  ifdef __WATCOMC__
00328 #    undef huge
00329 #    undef far
00330 #    undef near
00331 #  endif
00332 #  ifdef THEOS
00333 #    undef far
00334 #    undef near
00335 #  endif
00336 #  if (!defined(__IBMC__) || !defined(OS2))
00337 #    ifndef huge
00338 #      define huge
00339 #    endif
00340 #    ifndef far
00341 #      define far
00342 #    endif
00343 #    ifndef near
00344 #      define near
00345 #    endif
00346 #  endif
00347 #  define nearmalloc malloc
00348 #  define nearfree free
00349 #  define farmalloc malloc
00350 #  define farfree free
00351 #endif /* !MEMORY16 */
00352 
00353 #ifndef Far
00354 #  define Far far
00355 #endif
00356 
00357 #if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC)
00358 #   define DYN_ALLOC
00359 #endif
00360 
00361 #ifndef SSTAT
00362 #  define SSTAT      stat
00363 #endif
00364 #ifdef S_IFLNK
00365 #  define LSTAT      lstat
00366 #  define LSSTAT(n, s)  (linkput ? lstat((n), (s)) : SSTAT((n), (s)))
00367 #else
00368 #  define LSTAT      SSTAT
00369 #  define LSSTAT     SSTAT
00370 #endif
00371 
00372 /* The following default definition of the second input for the crypthead()
00373  * random seed computation can be used on most systems (all those that
00374  * supply a UNIX compatible getpid() function).
00375  */
00376 #ifdef ZCRYPT_INTERNAL
00377 #  ifndef ZCR_SEED2
00378 #    define ZCR_SEED2     (unsigned) getpid()   /* use PID as seed pattern */
00379 #  endif
00380 #endif /* ZCRYPT_INTERNAL */
00381 
00382 /* The following OS codes are defined in pkzip appnote.txt */
00383 #ifdef AMIGA
00384 #  define OS_CODE  0x100
00385 #endif
00386 #ifdef VMS
00387 #  define OS_CODE  0x200
00388 #endif
00389 /* unix    3 */
00390 #ifdef VM_CMS
00391 #  define OS_CODE  0x400
00392 #endif
00393 #ifdef ATARI
00394 #  define OS_CODE  0x500
00395 #endif
00396 #ifdef OS2
00397 #  define OS_CODE  0x600
00398 #endif
00399 #ifdef MACOS
00400 #  define OS_CODE  0x700
00401 #endif
00402 /* z system 8 */
00403 /* cp/m     9 */
00404 #ifdef TOPS20
00405 #  define OS_CODE  0xa00
00406 #endif
00407 #ifdef WIN32
00408 #  define OS_CODE  0xb00
00409 #endif
00410 #ifdef QDOS
00411 #  define OS_CODE  0xc00
00412 #endif
00413 #ifdef RISCOS
00414 #  define OS_CODE  0xd00
00415 #endif
00416 #ifdef VFAT
00417 #  define OS_CODE  0xe00
00418 #endif
00419 #ifdef MVS
00420 #  define OS_CODE  0xf00
00421 #endif
00422 #ifdef __BEOS__
00423 #  define OS_CODE  0x1000
00424 #endif
00425 #ifdef TANDEM
00426 #  define OS_CODE  0x1100
00427 #endif
00428 #ifdef THEOS
00429 #  define OS_CODE  0x1200
00430 #endif
00431 
00432 #define NUM_HOSTS 19
00433 /* Number of operating systems. Should be updated when new ports are made */
00434 
00435 #if defined(DOS) && !defined(OS_CODE)
00436 #  define OS_CODE  0x000
00437 #endif
00438 
00439 #ifndef OS_CODE
00440 #  define OS_CODE  0x300  /* assume Unix */
00441 #endif
00442 
00443 /* can't use "return 0" from main() on VMS */
00444 #ifndef EXIT
00445 #  define EXIT  exit
00446 #endif
00447 #ifndef RETURN
00448 #  define RETURN return
00449 #endif
00450 
00451 #ifndef ZIPERR
00452 #  define ZIPERR ziperr
00453 #endif
00454 
00455 #if (defined(USE_ZLIB) && defined(MY_ZCALLOC))
00456    /* special zcalloc function is not needed when linked against zlib */
00457 #  undef MY_ZCALLOC
00458 #endif
00459 
00460 #if (!defined(USE_ZLIB) && !defined(MY_ZCALLOC))
00461    /* Any system without a special calloc function */
00462 #  define zcalloc(items,size) \
00463           (zvoid far *)calloc((unsigned)(items), (unsigned)(size))
00464 #  define zcfree    free
00465 #endif /* !USE_ZLIB && !MY_ZCALLOC */
00466 
00467 /* end of tailor.h */

Generated on Wed Oct 26 14:46:52 2005 for Lgi by  doxygen 1.4.1