Subversion Repositories Kolibri OS

Rev

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