merge libraries 'archiver.obj' and 'zlib.obj'

git-svn-id: svn://kolibrios.org@6673 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-11-04 19:29:50 +00:00
parent f9e3adeff5
commit 22c6f65977
7 changed files with 1190 additions and 1214 deletions

View File

@ -1,4 +1,7 @@
archiver.obj ýêñïîðòèðóåò äâå ôóíêöèè äëÿ ðàñïàêîâêè deflate-äàííûõ. archiver.obj ýêñïîðòèðóåò äâå ôóíêöèè äëÿ ðàñïàêîâêè deflate-äàííûõ.
А также функции: deflateInit, deflateInit2, deflateReset, deflate,
deflateEnd для упаковки deflate-данных, сделанные на основе свободно
распространяемой библиотеки zlib.
Ïåðâàÿ: deflate_unpack Ïåðâàÿ: deflate_unpack
Îáúÿâëåíèå â ñòèëå Ñè: void* __stdcall deflate_unpack(const void* data, unsigned* pLength); Îáúÿâëåíèå â ñòèëå Ñè: void* __stdcall deflate_unpack(const void* data, unsigned* pLength);
@ -64,3 +67,17 @@ deflate_callback:
mov [ecx], length mov [ecx], length
mov eax, buffer mov eax, buffer
ret 8 ret 8
Алгоритм для упаковки данных:
1) Вызов функции deflateInit или deflateInit2.
2) Разбиение входного потока данных на порции по 64 Кб.
Для каждого блока в 64 Кб в цикле должен делаться вызов функции deflate.
За один вызов функции deflate сжатых данных образуется не более 16 Кб.
Т. е. если сжимаемых данных менее 16 Кб, то их можно упаковать за один вызов deflate.
Если сжимаемых данных менее 64 Кб, то их можно упаковать организовав один цикл с вызовом deflate.
Если сжимаемых данных более 64 Кб, то их можно упаковать организовав двойной цикл с вызовом deflate.
3) Вызов функции deflateEnd для очистки памяти.
Замечания:
Большие уровни сжатия пока что не поддерживаются.
Функция deflate не коректно работает с параметром Z_NO_FLUSH.
(Пока проблема не устранена рекомендуется всегда ставить Z_FINISH)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
@fasm.exe -m 32768 zlib.asm zlib.obj
@kpack zlib.obj
@fasm.exe -m 32768 example1.asm example1.kex @fasm.exe -m 32768 example1.asm example1.kex
@kpack example1.kex @kpack example1.kex
pause pause

View File

@ -23,8 +23,8 @@ if DYNAMIC_CRC_TABLE eq 1
align 4 align 4
crc_table_empty dd 1 crc_table_empty dd 1
align 4 ;align 4
crc_table rd TBLS*256 ;crc_table rd TBLS*256
; Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: ; Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
; x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. ; x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.

View File

@ -245,22 +245,14 @@ title db 'Zlib test, press on [Up], [Down], [Left], [Right]',0
align 4 align 4
import_archiver: import_archiver:
deflate_unpack dd sz_deflate_unpack deflate_unpack dd sz_deflate_unpack
dd 0,0
sz_deflate_unpack db 'deflate_unpack',0
align 4
import_zlib:
; dd sz_lib_init
deflateInit dd sz_deflateInit deflateInit dd sz_deflateInit
deflateInit2 dd sz_deflateInit2 deflateInit2 dd sz_deflateInit2
deflateReset dd sz_deflateReset deflateReset dd sz_deflateReset
deflate dd sz_deflate deflate dd sz_deflate
deflateEnd dd sz_deflateEnd deflateEnd dd sz_deflateEnd
calc_crc32 dd sz_calc_crc32 calc_crc32 dd sz_calc_crc32
dd 0,0 dd 0,0
sz_deflate_unpack db 'deflate_unpack',0
; sz_lib_init db 'lib_init',0
sz_deflateInit db 'deflateInit',0 sz_deflateInit db 'deflateInit',0
sz_deflateInit2 db 'deflateInit2',0 sz_deflateInit2 db 'deflateInit2',0
sz_deflateReset db 'deflateReset',0 sz_deflateReset db 'deflateReset',0
@ -272,21 +264,14 @@ import_zlib:
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
lib_name_0 db 'archiver.obj',0 lib_name_0 db 'archiver.obj',0
system_dir_1 db '/sys/lib/'
lib_name_1 db 'zlib.obj',0
err_message_found_lib0 db 'Sorry I cannot load library archiver.obj',0 err_message_found_lib0 db 'Sorry I cannot load library archiver.obj',0
err_message_found_lib1 db 'Sorry I cannot load library zlib.obj',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db 'System error',0
err_message_import0 db 'Error on load import library archiver.obj',0 err_message_import0 db 'Error on load import library archiver.obj',0
err_message_import1 db 'Error on load import library zlib.obj',0
l_libs_start: l_libs_start:
lib0 l_libs lib_name_0, cur_dir_path, library_path, system_dir_0,\ lib0 l_libs lib_name_0, cur_dir_path, library_path, system_dir_0,\
err_message_found_lib0, head_f_l, import_archiver,err_message_import0, head_f_i err_message_found_lib0, head_f_l, import_archiver,err_message_import0, head_f_i
lib1 l_libs lib_name_1, cur_dir_path, library_path, system_dir_1,\
err_message_found_lib1, head_f_l, import_zlib, err_message_import1, head_f_i
load_lib_end: load_lib_end:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -1,7 +1,3 @@
format MS COFF
public EXPORTS
section '.flat' code readable align 16
include '../../../../proc32.inc' include '../../../../proc32.inc'
include '../../../../macros.inc' include '../../../../macros.inc'
@ -44,7 +40,7 @@ end if
include 'zlib.inc' include 'zlib.inc'
include 'deflate.inc' include 'deflate.inc'
include 'zutil.asm' include 'zutil.asm'
include '../kfar_arc/crc.inc' ;include '../kfar_arc/crc.inc'
include 'crc32.asm' include 'crc32.asm'
include 'adler32.asm' include 'adler32.asm'
include 'trees.asm' include 'trees.asm'
@ -170,25 +166,3 @@ align 4
@@: @@:
ret ret
; export table
align 4
EXPORTS:
dd adeflateInit, deflateInit
dd adeflateInit2, deflateInit2
dd adeflateReset, deflateReset
dd adeflate, deflate
dd adeflateEnd, deflateEnd
dd adeflateCopy, deflateCopy
dd azError, zError
dd acalc_crc32, calc_crc32
dd 0
; exported names
adeflateInit db 'deflateInit',0
adeflateInit2 db 'deflateInit2',0
adeflateReset db 'deflateReset',0
adeflate db 'deflate',0
adeflateEnd db 'deflateEnd',0
adeflateCopy db 'deflateCopy',0
azError db 'zError',0
acalc_crc32 db 'calc_crc32',0

View File

@ -226,30 +226,15 @@ if Z_SOLO eq 0
; unsigned char *next; ; unsigned char *next;
; z_off64_t pos; ; z_off64_t pos;
;}; ;};
;int gzgetc_ OF((gzFile file)); /* backward compatibility */
;if Z_PREFIX_SET if Z_PREFIX_SET eq 1
;# undef z_gzgetc ;# undef z_gzgetc
;# define z_gzgetc(g) \ ;# define z_gzgetc(g) \
; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) ; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
;#else else
;# define gzgetc(g) \ ;# define gzgetc(g) \
; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) ; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
end if end if
; provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or end if
; change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
; both are true, the application gets the *64 functions, and the regular
; functions are changed to 64 bits) -- in case these are set on systems
; without large file support, _LFS64_LARGEFILE must also be true
; undocumented functions
;const char * zError OF((int));
;int inflateSyncPoint OF((z_streamp));
;const z_crc_t FAR * get_crc_table OF((void));
;int inflateUndermine OF((z_streamp, int));
;int inflateResetKeep OF((z_streamp));
;#if defined(_WIN32) && !defined(Z_SOLO)
;gzFile gzopen_w OF((const wchar_t *path,
; const char *mode));
;end if