Subversion Repositories Kolibri OS

Rev

Rev 6617 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ; zutil.inc -- internal interface and configuration of the compression library
  2. ; Copyright (C) 1995-2013 Jean-loup Gailly.
  3. ; For conditions of distribution and use, see copyright notice in zlib.inc
  4.  
  5. ; WARNING: this file should *not* be used by applications. It is
  6. ; part of the implementation of the compression library and is
  7. ; subject to change. Applications should only use zlib.inc.
  8.  
  9.  
  10. macro ERR_MSG err
  11. {
  12.         mov ecx,Z_NEED_DICT
  13.         sub ecx,err
  14.         mov ecx,[4*ecx+z_errmsg]
  15. }
  16.  
  17. macro ERR_RETURN strm,err
  18. {
  19.         ERR_MSG err
  20.         mov [strm+z_stream.msg],ecx
  21.         mov eax,err
  22. }
  23. ; To be used only when the state is known to be valid
  24.  
  25. ;        /* common constants */
  26.  
  27. ;#ifndef DEF_WBITS
  28. ;#  define DEF_WBITS MAX_WBITS
  29. ;end if
  30. ; default windowBits for decompression. MAX_WBITS is for compression only
  31.  
  32. ;#if MAX_MEM_LEVEL >= 8
  33. DEF_MEM_LEVEL equ 8
  34. ;#else
  35. ;#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
  36. ;end if
  37. ; default memLevel
  38.  
  39. STORED_BLOCK equ 0
  40. STATIC_TREES equ 1
  41. DYN_TREES   equ 2
  42. ; The three kinds of block type
  43.  
  44. MIN_MATCH equ 3
  45. MAX_MATCH equ 258
  46. ; The minimum and maximum match lengths
  47.  
  48. PRESET_DICT equ 0x20 ;preset dictionary flag in zlib header
  49.  
  50. ;        /* common defaults */
  51.  
  52. OS_CODE equ 0x03 ;assume Unix
  53.  
  54. ;         /* functions */
  55.  
  56. ; Diagnostic functions
  57. ;if DEBUG eq 1
  58. ;#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
  59. ;#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
  60. macro Tracevv mes1, mes2
  61. {
  62.         ;zlib_debug 'Tracevv = %d', mes1
  63. }
  64. ;#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
  65. ;#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
  66. ;end if
  67.  
  68. macro ZALLOC strm, items, size
  69. {
  70.         stdcall dword[strm+z_stream.zalloc], [strm+z_stream.opaque], items, size
  71. }
  72. macro ZFREE strm, p2addr
  73. {
  74.         stdcall dword[strm+z_stream.zfree], dword[strm+z_stream.opaque], p2addr
  75. }
  76. macro TRY_FREE s, p
  77. {
  78. local .end0
  79.         cmp p,0
  80.         je .end0
  81.         ZFREE s, p
  82.         .end0:
  83. }
  84.  
  85. ; Reverse the bytes in a 32-bit value
  86. macro ZSWAP32 q
  87. {
  88.         bswap q
  89. }
  90.