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

  1. /*
  2.  
  3.  Copyright (C) 1990-1996 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  4.  Kai Uwe Rommel, Onno van der Linden and Igor Mandrichenko.
  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. #if defined(__OS2__) && !defined(OS2)
  12. #  define OS2
  13. #endif
  14.  
  15. /* Automatic setting of the common Microsoft C idenfifier MSC.
  16.  * NOTE: Watcom also defines M_I*86 !
  17.  */
  18. #if defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__))
  19. #  ifndef MSC
  20. #    define MSC                 /* This should work for older MSC, too!  */
  21. #  endif
  22. #endif
  23.  
  24. #if defined(__WATCOMC__) && defined(__386__)
  25. #  define WATCOMC_386
  26. #endif
  27.  
  28. #if defined(__EMX__) || defined(WATCOMC_386) || defined(__BORLANDC__)
  29. #  if (defined(OS2) && !defined(__32BIT__))
  30. #    define __32BIT__
  31. #  endif
  32. #endif
  33.  
  34. #if defined(OS2) && !defined(__32BIT__)
  35. #  define MEMORY16
  36. #endif
  37.  
  38. #ifndef NO_ASM
  39. #  define ASMV
  40. /* #  define ASM_CRC */
  41. #endif
  42.  
  43. #ifdef MEMORY16
  44. #  ifdef __TURBOC__
  45. #    include <alloc.h>
  46. #    if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  47. #      if defined(DYNAMIC_CRC_TABLE) && defined(DYNALLOC_CRCTAB)
  48.         error: No dynamic CRC table allocation with Borland C far data models.
  49. #      endif /* DYNAMIC_CRC_TABLE */
  50. #    endif /* Turbo/Borland C far data memory models */
  51. #    define nearmalloc malloc
  52. #    define nearfree   free
  53. #    define DYN_ALLOC
  54. #  else /* !__TURBOC__ */
  55. #    include <malloc.h>
  56. #    define nearmalloc _nmalloc
  57. #    define nearfree   _nfree
  58. #    define farmalloc  _fmalloc
  59. #    define farfree    _ffree
  60. #  endif /* ?__TURBOC__ */
  61. #  define MY_ZCALLOC 1
  62. #  if defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)
  63. #    define USE_OWN_CRCTAB
  64. #  endif
  65. #endif /* ?MEMORY16 */
  66.  
  67.  
  68. /* The symbol MSDOS is consistently used in the generic source files
  69.  * to identify code to support for MSDOS (and MSDOS related) stuff.
  70.  * e.g: FAT or (FAT like) file systems,
  71.  *      '\\' as directory separator in paths,
  72.  *      "\r\n" as record (line) terminator in text files, ...
  73.  *
  74.  * MSDOS is defined anyway with MS C 16-bit. So the block above works.
  75.  * For the 32-bit compilers, MSDOS must not be defined in the block above.
  76.  */
  77. #if (defined(OS2) && !defined(MSDOS))
  78. #  define MSDOS
  79. /* inherit MS-DOS file system etc. stuff */
  80. #endif
  81.  
  82. #define USE_CASE_MAP
  83. #define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : procname(n))
  84.  
  85. /* time stamp resolution of file system is 2 seconds */
  86. #define ROUNDED_TIME(time)  (((time) + 1) & (~1))
  87.  
  88. #define FOPR "rb"
  89. #define FOPM "r+b"
  90. #define FOPW "wb"
  91.  
  92. #ifdef __32BIT__
  93. #  define CBSZ 0x40000
  94. #  define ZBSZ 0x40000
  95. #else
  96. #  define CBSZ 0xE000
  97. #  define ZBSZ 0x7F00 /* Some libraries do not allow a buffer size > 32K */
  98. #endif
  99.  
  100. #include <sys/types.h>
  101. #include <sys/stat.h>
  102. #include <io.h>
  103.  
  104. #ifdef ZCRYPT_INTERNAL
  105. #  ifndef __GO32__
  106. #    include <process.h>        /* getpid() declaration for srand seed */
  107. #  endif
  108. #endif
  109.  
  110. /* for some (all ?) versions of IBM C Set/2 and IBM C Set++ */
  111. #ifndef S_IFMT
  112. #  define S_IFMT 0xF000
  113. #endif /* !S_IFMT */
  114.  
  115. #ifdef MSC
  116. #  define NO_UNISTD_H
  117. #endif
  118.  
  119. #ifdef __WATCOMC__
  120. #  define NO_MKTEMP
  121. /* Get asm routines to link properly without using "__cdecl": */
  122. #  ifdef __386__
  123. #    ifdef ASMV
  124. #      pragma aux window "*";
  125. #      pragma aux prev "*";
  126. #      pragma aux prev_length "*";
  127. #      pragma aux strstart "*";
  128. #      pragma aux match_start "*";
  129. #      pragma aux max_chain_length "*";
  130. #      pragma aux good_match "*";
  131. #      pragma aux nice_match "*";
  132. #      pragma aux match_init "*";
  133. #      pragma aux longest_match "*";
  134. #    endif
  135. #    ifndef USE_ZLIB
  136. #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  137. #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  138.                                       modify [eax ecx edx]
  139. #    endif /* !USE_ZLIB */
  140. #  else /* !__386__ */
  141. #    if defined(ASMV) || defined(ASM_CRC)
  142. /*#      error 16 bit assembly modules currently DO NOT WORK with Watcom C. */
  143. #    endif
  144. #    ifdef ASMV
  145. #      pragma aux match_init    "_*" parm caller [] loadds modify [ax bx]
  146. #      pragma aux longest_match "_*" parm caller [] loadds value [ax] \
  147.                                       modify [ax bx cx dx es]
  148. #    endif
  149. #    ifndef USE_ZLIB
  150. #      pragma aux crc32         "_*" parm caller [] value [ax dx] \
  151.                                       modify [ax bx cx dx es]
  152. #      pragma aux get_crc_table "_*" parm caller [] value [ax] \
  153.                                       modify [ax bx cx dx]
  154. #    endif /* !USE_ZLIB */
  155. #  endif /* ?__386__ */
  156. #endif
  157.  
  158. #ifdef __IBMC__
  159. #  define NO_UNISTD_H
  160. #  define NO_MKTEMP
  161. #endif
  162.