home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip21.zip / msdos / osdep.h < prev    next >
C/C++ Source or Header  |  1996-04-27  |  5KB  |  169 lines

  1. /*
  2.  
  3.  Copyright (C) 1990-1996 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  4.  Onno van der Linden, Christian Spieler and Kai Uwe Rommel.
  5.  Permission is granted to any individual or institution to use, copy, or
  6.  redistribute this software so long as all of the original files are included,
  7.  that it is not sold for profit, and that this copyright notice is retained.
  8.  
  9. */
  10.  
  11. /* The symbol DOS is used throughout the Zip source to identify code portions
  12.  * specific to the MSDOS port.
  13.  * Just to make sure, we check that it is set.
  14.  * (Currently, this should should not be neccessary, since currently it has
  15.  * to be set on the compiler command line to get this file read in.)
  16.  */
  17. #ifndef DOS
  18. #  define DOS
  19. #endif
  20.  
  21. /* The symbol MSDOS is consistently used in the generic source files
  22.  * to identify code to support for MSDOS (and MSDOS related) stuff.
  23.  * e.g: FAT or (FAT like) file systems,
  24.  *      '\\' as directory separator in paths,
  25.  *      "\r\n" as record (line) terminator in text files, ...
  26.  *
  27.  * IMPORTANT Note:
  28.  *  This symbol is not unique for the MSDOS port !!!!!!
  29.  *  It is also defined by ports to some other OS which are (to some extend)
  30.  *  considered DOS compatible.
  31.  *  Examples are: OS/2 (OS2), Windows NT and Windows 95 (WIN32).
  32.  *
  33.  */
  34. #ifndef MSDOS
  35. #  define MSDOS
  36. #endif
  37.  
  38. /* Power C is similar to Turbo C */
  39. #ifdef __POWERC
  40. #  define __TURBOC__
  41. #endif /* __POWERC */
  42.  
  43. /* Automatic setting of the common Microsoft C idenfifier MSC.
  44.  * NOTE: Watcom also defines M_I*86 !
  45.  */
  46. #if defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__))
  47. #  ifndef MSC
  48. #    define MSC                 /* This should work for older MSC, too!  */
  49. #  endif
  50. #endif
  51.  
  52. #if !defined(__GO32__) && !defined(__EMX__)
  53. #  define NO_UNISTD_H
  54. #endif
  55.  
  56. #if defined(__WATCOMC__) && defined(__386__)
  57. #  define WATCOMC_386
  58. #endif
  59.  
  60. #ifdef WIZZIPDLL
  61. #  define NO_ASM
  62. #  define NO_SECURE_TESTS
  63. #  define MSWIN
  64. #  define REENTRANT
  65. #endif
  66.  
  67. #ifdef MSWIN
  68. #  define MEMORY16
  69. #endif
  70.  
  71.  
  72. #if !defined(__EMX__) && !defined(__GO32__) && !defined(WATCOMC_386)
  73. #if !defined(MSWIN)
  74. #  define MSDOS16 /* 16 bit MSDOS only */
  75. #  define MEMORY16
  76. #endif
  77. #endif
  78.  
  79. #if !defined(NO_ASM) && !defined(ASMV)
  80. #  define ASMV
  81. #endif
  82.  
  83. #if !defined(NO_EF_UX_TIME) && !defined(USE_EF_UX_TIME)
  84. #  define USE_EF_UX_TIME
  85. #endif
  86.  
  87. #ifdef MEMORY16
  88. #  ifndef NO_ASM
  89. #    define ASM_CRC 1
  90. #  endif /* ?NO_ASM */
  91. #  ifdef __TURBOC__
  92. #    include <alloc.h>
  93. #    if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  94. #      if defined(DYNAMIC_CRC_TABLE) && defined(DYNALLOC_CRCTAB)
  95.         error: No dynamic CRC table allocation with Borland C far data models.
  96. #      endif /* DYNAMIC_CRC_TABLE */
  97. #    endif /* Turbo/Borland C far data memory models */
  98. #    define nearmalloc malloc
  99. #    define nearfree   free
  100. #    define DYN_ALLOC
  101. #  else /* !__TURBOC__ */
  102. #    include <malloc.h>
  103. #    define nearmalloc _nmalloc
  104. #    define nearfree   _nfree
  105. #    define farmalloc  _fmalloc
  106. #    define farfree    _ffree
  107. #  endif /* ?__TURBOC__ */
  108. #  define MY_ZCALLOC 1
  109. #  if defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)
  110. #    define USE_OWN_CRCTAB
  111. #  endif
  112. #endif /* MEMORY16 */
  113.  
  114.  
  115. #define MSVMS
  116.  
  117. #define FOPR "rb"
  118. #define FOPM "r+b"
  119. #define FOPW "wb"
  120.  
  121. #include <sys/types.h>
  122. #include <sys/stat.h>
  123. #include <io.h>
  124.  
  125. /*
  126.  * djgpp 1.x did not declare these
  127.  */
  128. #if defined(__GO32__) && !defined(__DJGPP__)
  129. char *strlwr(char *);
  130. int setmode(int, int);
  131. #endif
  132.  
  133. #ifdef __WATCOMC__
  134. #  define NO_MKTEMP
  135. #  define HAS_OPENDIR
  136.  
  137. /* Get asm routines to link properly without using "__cdecl": */
  138. #  ifdef __386__
  139. #    ifdef ASMV
  140. #      pragma aux match_init    "_*" parm caller [] modify []
  141. #      pragma aux longest_match "_*" parm caller [] value [eax] \
  142.                                       modify [eax ecx edx]
  143. #    endif
  144. #    ifndef USE_ZLIB
  145. #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  146. #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  147.                                       modify [eax ecx edx]
  148. #    endif /* !USE_ZLIB */
  149. #  else /* !__386__ */
  150. #    ifdef ASMV
  151. #      pragma aux match_init    "_*" parm caller [] loadds modify [ax bx]
  152. #      pragma aux longest_match "_*" parm caller [] loadds value [ax] \
  153.                                       modify [ax bx cx dx es]
  154. #    endif /* ASMV */
  155. #    ifndef USE_ZLIB
  156. #      pragma aux crc32         "_*" parm caller [] value [ax dx] \
  157.                                       modify [ax bx cx dx es]
  158. #      pragma aux get_crc_table "_*" parm caller [] value [ax] \
  159.                                       modify [ax bx cx dx]
  160. #    endif /* !USE_ZLIB */
  161. #  endif /* ?__386__ */
  162. #endif /* __WATCOMC__ */
  163.  
  164. #ifdef WIZZIPDLL
  165. #define NO_ASM
  166. #define NO_SECURE_TESTS
  167. #define MSWIN
  168. #endif
  169.