osdep.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 1999-Oct-05 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, both of these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
  7. */
  8. #if defined(__OS2__) && !defined(OS2)
  9. # define OS2
  10. #endif
  11. /* Automatic setting of the common Microsoft C idenfifier MSC.
  12. * NOTE: Watcom also defines M_I*86 !
  13. */
  14. #if defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__))
  15. # ifndef MSC
  16. # define MSC /* This should work for older MSC, too! */
  17. # endif
  18. #endif
  19. #if defined(__WATCOMC__) && defined(__386__)
  20. # define WATCOMC_386
  21. #endif
  22. #if defined(__EMX__) || defined(WATCOMC_386) || defined(__BORLANDC__)
  23. # if (defined(OS2) && !defined(__32BIT__))
  24. # define __32BIT__
  25. # endif
  26. #endif
  27. #if defined(OS2) && !defined(__32BIT__)
  28. # define MEMORY16
  29. #endif
  30. #ifndef NO_ASM
  31. # define ASMV
  32. /* # define ASM_CRC */
  33. #endif
  34. /* enable creation of UTC time fields unless explicitely suppressed */
  35. #if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
  36. # define USE_EF_UT_TIME
  37. #endif
  38. /* check that TZ environment variable is defined before using UTC times */
  39. #if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ))
  40. # define IZ_CHECK_TZ
  41. #endif
  42. #ifndef ZP_NEED_MEMCOMPR
  43. # define ZP_NEED_MEMCOMPR
  44. #endif
  45. #ifdef MEMORY16
  46. # ifdef __TURBOC__
  47. # include <alloc.h>
  48. # if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  49. # if defined(DYNAMIC_CRC_TABLE) && defined(DYNALLOC_CRCTAB)
  50. error: No dynamic CRC table allocation with Borland C far data models.
  51. # endif /* DYNAMIC_CRC_TABLE */
  52. # endif /* Turbo/Borland C far data memory models */
  53. # define nearmalloc malloc
  54. # define nearfree free
  55. # define DYN_ALLOC
  56. # else /* !__TURBOC__ */
  57. # include <malloc.h>
  58. # define nearmalloc _nmalloc
  59. # define nearfree _nfree
  60. # define farmalloc _fmalloc
  61. # define farfree _ffree
  62. # endif /* ?__TURBOC__ */
  63. # define MY_ZCALLOC 1
  64. #endif /* MEMORY16 */
  65. /* The symbol MSDOS is consistently used in the generic source files
  66. * to identify code to support for MSDOS (and MSDOS related) stuff.
  67. * e.g: FAT or (FAT like) file systems,
  68. * '\\' as directory separator in paths,
  69. * "\r\n" as record (line) terminator in text files, ...
  70. *
  71. * MSDOS is defined anyway with MS C 16-bit. So the block above works.
  72. * For the 32-bit compilers, MSDOS must not be defined in the block above.
  73. */
  74. #if (defined(OS2) && !defined(MSDOS))
  75. # define MSDOS
  76. /* inherit MS-DOS file system etc. stuff */
  77. #endif
  78. #define USE_CASE_MAP
  79. #define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
  80. procname(n, 1))
  81. /* time stamp resolution of file system is 2 seconds */
  82. #define ROUNDED_TIME(time) ((time_t)(((unsigned long)(time) + 1) & (~1)))
  83. #define FOPR "rb"
  84. #define FOPM "r+b"
  85. #define FOPW "wb"
  86. #ifdef __32BIT__
  87. # define CBSZ 0x40000
  88. # define ZBSZ 0x40000
  89. #else
  90. # define CBSZ 0xE000
  91. # define ZBSZ 0x7F00 /* Some libraries do not allow a buffer size > 32K */
  92. #endif
  93. #include <sys/types.h>
  94. #include <sys/stat.h>
  95. #include <io.h>
  96. #ifdef ZCRYPT_INTERNAL
  97. # ifndef __GO32__
  98. # include <process.h> /* getpid() declaration for srand seed */
  99. # endif
  100. #endif
  101. /* for some (all ?) versions of IBM C Set/2 and IBM C Set++ */
  102. #ifndef S_IFMT
  103. # define S_IFMT 0xF000
  104. #endif /* !S_IFMT */
  105. #ifdef MSC
  106. # define NO_UNISTD_H
  107. #endif
  108. #ifdef __WATCOMC__
  109. # define NO_MKTEMP
  110. /* Get asm routines to link properly without using "__cdecl": */
  111. # ifdef __386__
  112. # ifdef ASMV
  113. # pragma aux window "*";
  114. # pragma aux prev "*";
  115. # pragma aux prev_length "*";
  116. # pragma aux strstart "*";
  117. # pragma aux match_start "*";
  118. # pragma aux max_chain_length "*";
  119. # pragma aux good_match "*";
  120. # pragma aux nice_match "*";
  121. # pragma aux match_init "*";
  122. # pragma aux longest_match "*";
  123. # endif
  124. # ifndef USE_ZLIB
  125. # pragma aux crc32 "_*" parm caller [] value [eax] modify [eax]
  126. # pragma aux get_crc_table "_*" parm caller [] value [eax] \
  127. modify [eax ecx edx]
  128. # endif /* !USE_ZLIB */
  129. # else /* !__386__ */
  130. # if defined(ASMV) || defined(ASM_CRC)
  131. /*# error 16 bit assembly modules currently DO NOT WORK with Watcom C. */
  132. # endif
  133. # ifdef ASMV
  134. # pragma aux match_init "_*" parm caller [] loadds modify [ax bx]
  135. # pragma aux longest_match "_*" parm caller [] loadds value [ax] \
  136. modify [ax bx cx dx es]
  137. # endif
  138. # ifndef USE_ZLIB
  139. # pragma aux crc32 "_*" parm caller [] value [ax dx] \
  140. modify [ax bx cx dx es]
  141. # pragma aux get_crc_table "_*" parm caller [] value [ax] \
  142. modify [ax bx cx dx]
  143. # endif /* !USE_ZLIB */
  144. # endif /* ?__386__ */
  145. #endif
  146. #ifdef __IBMC__
  147. # define NO_UNISTD_H
  148. # define NO_MKTEMP
  149. # define timezone _timezone /* (underscore names work with */
  150. # define tzset _tzset /* all versions of C Set) */
  151. #endif