home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip21.zip / os2 / osdep.h < prev    next >
C/C++ Source or Header  |  1996-04-05  |  4KB  |  153 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 MSVMS if MSDOS or VMS defined */
  83. #define MSVMS
  84.  
  85. #define FOPR "rb"
  86. #define FOPM "r+b"
  87. #define FOPW "wb"
  88.  
  89. #ifdef __32BIT__
  90. #  define CBSZ 0x40000
  91. #  define ZBSZ 0x40000
  92. #else
  93. #  define CBSZ 0xE000
  94. #  define ZBSZ 0x7F00 /* Some libraries do not allow a buffer size > 32K */
  95. #endif
  96.  
  97. #include <sys/types.h>
  98. #include <sys/stat.h>
  99. #include <io.h>
  100.  
  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.  
  106. #ifdef MSC
  107. #  define NO_UNISTD_H
  108. #endif
  109.  
  110. #ifdef __WATCOMC__
  111. #  define NO_MKTEMP
  112. /* Get asm routines to link properly without using "__cdecl": */
  113. #  ifdef __386__
  114. #    ifdef ASMV
  115. #      pragma aux window "*";
  116. #      pragma aux prev "*";
  117. #      pragma aux prev_length "*";
  118. #      pragma aux strstart "*";
  119. #      pragma aux match_start "*";
  120. #      pragma aux max_chain_length "*";
  121. #      pragma aux good_match "*";
  122. #      pragma aux nice_match "*";
  123. #      pragma aux match_init "*";
  124. #      pragma aux longest_match "*";
  125. #    endif
  126. #    ifndef USE_ZLIB
  127. #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  128. #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  129.                                       modify [eax ecx edx]
  130. #    endif /* !USE_ZLIB */
  131. #  else /* !__386__ */
  132. #    if defined(ASMV) || defined(ASM_CRC)
  133. /*#      error 16 bit assembly modules currently DO NOT WORK with Watcom C. */
  134. #    endif
  135. #    ifdef ASMV
  136. #      pragma aux match_init    "_*" parm caller [] loadds modify [ax bx]
  137. #      pragma aux longest_match "_*" parm caller [] loadds value [ax] \
  138.                                       modify [ax bx cx dx es]
  139. #    endif
  140. #    ifndef USE_ZLIB
  141. #      pragma aux crc32         "_*" parm caller [] value [ax dx] \
  142.                                       modify [ax bx cx dx es]
  143. #      pragma aux get_crc_table "_*" parm caller [] value [ax] \
  144.                                       modify [ax bx cx dx]
  145. #    endif /* !USE_ZLIB */
  146. #  endif /* ?__386__ */
  147. #endif
  148.  
  149. #ifdef __IBMC__
  150. #  define NO_UNISTD_H
  151. #  define NO_MKTEMP
  152. #endif
  153.