home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / msdos / osdep.h < prev    next >
C/C++ Source or Header  |  1997-10-26  |  5KB  |  182 lines

  1. /*
  2.  
  3.  Copyright (C) 1990-1997 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 WINDLL
  61. #  define MSWIN
  62. #  define MEMORY16
  63. #  define ZIPERR(errcode, msg)  return(ziperr(errcode, msg), (errcode))
  64. #endif
  65.  
  66.  
  67. #if !defined(__EMX__) && !defined(__GO32__) && !defined(WATCOMC_386)
  68. #if !defined(WINDLL)
  69. #  define MSDOS16 /* 16 bit MSDOS only */
  70. #  define MEMORY16
  71. #endif
  72. #endif
  73.  
  74. #if !defined(NO_ASM) && !defined(ASMV)
  75. #  define ASMV
  76. #endif
  77.  
  78. #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
  79. #  define USE_EF_UT_TIME
  80. #endif
  81.  
  82. #ifdef MEMORY16
  83. #  ifndef NO_ASM
  84. #    define ASM_CRC 1
  85. #  endif /* ?NO_ASM */
  86. #  ifdef __TURBOC__
  87. #    include <alloc.h>
  88. #    if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  89. #      if defined(DYNAMIC_CRC_TABLE) && defined(DYNALLOC_CRCTAB)
  90.         error: No dynamic CRC table allocation with Borland C far data models.
  91. #      endif /* DYNAMIC_CRC_TABLE */
  92. #    endif /* Turbo/Borland C far data memory models */
  93. #    define nearmalloc malloc
  94. #    define nearfree   free
  95. #    define DYN_ALLOC
  96. #  else /* !__TURBOC__ */
  97. #    include <malloc.h>
  98. #    define nearmalloc _nmalloc
  99. #    define nearfree   _nfree
  100. #    define farmalloc  _fmalloc
  101. #    define farfree    _ffree
  102. #  endif /* ?__TURBOC__ */
  103. #  define MY_ZCALLOC 1
  104. #  if defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)
  105. #    define USE_OWN_CRCTAB
  106. #  endif
  107. #endif /* MEMORY16 */
  108.  
  109.  
  110. #define USE_CASE_MAP
  111.  
  112. #define ROUNDED_TIME(time)  (((time) + 1) & (~1))
  113. #define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : procname(n))
  114.  
  115. #define FOPR "rb"
  116. #define FOPM "r+b"
  117. #define FOPW "wb"
  118.  
  119. #include <sys/types.h>
  120. #include <sys/stat.h>
  121. #include <io.h>
  122.  
  123. #ifdef ZCRYPT_INTERNAL
  124. #  ifdef WINDLL
  125. #    define ZCR_SEED2     (unsigned)3141592654L /* use PI as seed pattern */
  126. #  else
  127. #    ifndef __GO32__
  128. #      include <process.h>      /* getpid() declaration for srand seed */
  129. #    endif
  130. #  endif
  131. #endif
  132.  
  133. /*
  134.  * djgpp 1.x did not declare these
  135.  */
  136. #if defined(__GO32__) && !defined(__DJGPP__)
  137. char *strlwr(char *);
  138. int setmode(int, int);
  139. #endif
  140.  
  141. #ifdef __WATCOMC__
  142. #  define NO_MKTEMP
  143. #  define HAS_OPENDIR
  144. #  define SSTAT stat_bandaid
  145.    int stat_bandaid(const char *path, struct stat *buf);
  146.  
  147. /* Get asm routines to link properly without using "__cdecl": */
  148. #  ifdef __386__
  149. #    ifdef ASMV
  150. #      pragma aux match_init    "_*" parm caller [] modify []
  151. #      pragma aux longest_match "_*" parm caller [] value [eax] \
  152.                                       modify [eax ecx edx]
  153. #    endif
  154. #    ifndef USE_ZLIB
  155. #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  156. #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  157.                                       modify [eax ecx edx]
  158. #    endif /* !USE_ZLIB */
  159. #  else /* !__386__ */
  160. #    ifdef ASMV
  161. #      pragma aux match_init    "_*" parm caller [] loadds modify [ax bx]
  162. #      pragma aux longest_match "_*" parm caller [] loadds value [ax] \
  163.                                       modify [ax bx cx dx es]
  164. #    endif /* ASMV */
  165. #    ifndef USE_ZLIB
  166. #      pragma aux crc32         "_*" parm caller [] value [ax dx] \
  167.                                       modify [ax bx cx dx es]
  168. #      pragma aux get_crc_table "_*" parm caller [] value [ax] \
  169.                                       modify [ax bx cx dx]
  170. #    endif /* !USE_ZLIB */
  171. #  endif /* ?__386__ */
  172. #endif /* __WATCOMC__ */
  173.  
  174. /*
  175.  * Wrapper function to get around the MSC7 00:00:00 31 Dec 1899 time base,
  176.  * see msdos.c for more info
  177.  */
  178.  
  179. #if defined(_MSC_VER) && _MSC_VER == 700
  180. #  define localtime(t) msc7_localtime(t)
  181. #endif
  182.