Subversion Repositories Kolibri OS

Rev

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

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