Subversion Repositories Kolibri OS

Rev

Rev 6639 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. format MS COFF
  2. public EXPORTS
  3.  
  4. section '.flat' code readable align 16
  5.  
  6. include '../../../../proc32.inc'
  7. include '../../../../macros.inc'
  8. include '../../../../KOSfuncs.inc'
  9.  
  10. FASTEST equ 1
  11. GEN_TREES_H equ 0
  12. DEBUG equ 0
  13. DYNAMIC_CRC_TABLE equ 1
  14.  
  15. ; define NO_GZIP when compiling if you want to disable gzip header and
  16. ; trailer creation by deflate().  NO_GZIP would be used to avoid linking in
  17. ; the crc code when it is not needed.  For shared libraries, gzip encoding
  18. ; should be left enabled.
  19. GZIP equ 1
  20.  
  21. macro zlib_debug fmt,p1
  22. {
  23. local .end_t
  24. local .m_fmt
  25. jmp .end_t
  26.         .m_fmt db fmt,13,10,0
  27. align 4
  28. .end_t:
  29. if p1 eq
  30.         stdcall dbg_print,0,.m_fmt
  31. else
  32.         stdcall str_format_dbg, buf_param,.m_fmt,p1
  33. end if
  34. }
  35.  
  36. include 'zlib.inc'
  37. include 'deflate.inc'
  38. include 'zutil.asm'
  39. include 'crc32.asm'
  40. include 'adler32.asm'
  41. include 'trees.asm'
  42. include 'deflate.asm'
  43.  
  44. align 4
  45. buf_param rb 80
  46.  
  47. align 4
  48. proc dbg_print, fun:dword, mes:dword
  49. pushad
  50.         mov eax,SF_BOARD
  51.         mov ebx,SSF_DEBUG_WRITE
  52.  
  53.         mov esi,[fun]
  54.         cmp esi,0
  55.         je .end0
  56.         @@:
  57.                 mov cl,byte[esi]
  58.                 int 0x40
  59.                 inc esi
  60.                 cmp byte[esi],0
  61.                 jne @b
  62.         mov cl,':'
  63.         int 0x40
  64.         mov cl,' '
  65.         int 0x40
  66.         .end0:
  67.         mov esi,[mes]
  68.         cmp esi,0
  69.         je .end_f
  70.         @@:
  71.                 mov cl,byte[esi]
  72.                 cmp cl,0
  73.                 je .end_f
  74.                 int 0x40
  75.                 inc esi
  76.                 jmp @b
  77.         .end_f:
  78. popad
  79.         ret
  80. endp
  81.  
  82. align 4
  83. proc str_format_dbg, buf:dword, fmt:dword, p1:dword
  84. pushad
  85.         mov esi,[fmt]
  86.         mov edi,[buf]
  87.         mov ecx,80-1
  88.         .cycle0:
  89.                 lodsb
  90.                 cmp al,'%'
  91.                 jne .no_param
  92.                         lodsb
  93.                         dec ecx
  94.                         cmp al,0
  95.                         je .cycle0end
  96.                         cmp al,'d'
  97.                         je @f
  98.                         cmp al,'u'
  99.                         je @f
  100.                         cmp al,'l'
  101.                         je .end1
  102.                                 jmp .end0
  103.                         .end1: ;%lu %lx
  104.                                 lodsb
  105.                                 dec ecx
  106.                                 cmp al,'u'
  107.                                 jne .end0
  108.                         @@:
  109.                                 mov eax,[p1]
  110.                                 stdcall convert_int_to_str,ecx
  111.                                 xor al,al
  112.                                 repne scasb
  113.                                 dec edi
  114.                         .end0:
  115.                         loop .cycle0
  116.                 .no_param:
  117.                 stosb
  118.                 cmp al,0
  119.                 je .cycle0end
  120.                 loop .cycle0
  121.         .cycle0end:
  122.         xor al,al
  123.         stosb
  124.         stdcall dbg_print,0,[buf]
  125. popad
  126.         ret
  127. endp
  128.  
  129. ;input:
  130. ; eax - число
  131. ; edi - буфер для строки
  132. ; len - длинна буфера
  133. ;output:
  134. align 4
  135. proc convert_int_to_str, len:dword
  136. pushad
  137.         mov esi,[len]
  138.         add esi,edi
  139.         dec esi
  140.         call .str
  141. popad
  142.         ret
  143. endp
  144.  
  145. align 4
  146. .str:
  147.         mov ecx,0x0a
  148.         cmp eax,ecx
  149.         jb @f
  150.                 xor edx,edx
  151.                 div ecx
  152.                 push edx
  153.                 call .str
  154.                 pop eax
  155.         @@:
  156.         cmp edi,esi
  157.         jge @f
  158.                 or al,0x30
  159.                 stosb
  160.                 mov byte[edi],0
  161.         @@:
  162.         ret
  163.  
  164. ; export table
  165. align 4
  166. EXPORTS:
  167.         dd      adeflateInit,   deflateInit
  168.         dd      adeflateInit2,  deflateInit2
  169.         dd      adeflateReset,  deflateReset
  170.         dd      adeflate,       deflate
  171.         dd      adeflateEnd,    deflateEnd
  172.         dd      0
  173.  
  174. ; exported names
  175. adeflateInit    db      'deflateInit',0
  176. adeflateInit2   db      'deflateInit2',0
  177. adeflateReset   db      'deflateReset',0
  178. adeflate        db      'deflate',0
  179. adeflateEnd     db      'deflateEnd',0