Rev 7575 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1476 | IgorA | 1 | |
2 | Text rb MAX_COLOR_WORD_LEN ; ñëîâî äëÿ ïîäñâåòêè |
||
2102 | IgorA | 3 | f1 dd 0 ; ñïðàâêà ïî ñëîâó |
4 | flags db ? ; f1+4 ôëàãè èñïîëüçóåìûå ïðè âûäåëåíèè |
||
5 | endc db ? ; f1+5 ñèìâîë êîíöà âûäåëåíèÿ (èñïîëüçóåòñÿ ïðè flags&4) |
||
6 | escc db ? ; f1+6 ýêðàíèðóþùèé ñèìâîë (èñïîëüçóåòñÿ ïðè flags&4) |
||
7 | color db ? ; f1+7 íîìåð öâåòà |
||
8 | ends |
||
1476 | IgorA | 9 | |
10 | |||
11 | ColWords dd 0 |
||
12 | color_cursor dd ? |
||
13 | color_wnd_capt dd ? |
||
14 | color_wnd_work dd ? |
||
15 | color_wnd_bord dd ? |
||
16 | color_select dd ? |
||
17 | color_cur_text dd ? |
||
18 | color_wnd_text dd ? |
||
19 | |||
20 | |||
21 | open_file_size dd 0 |
||
7575 | IgorA | 22 | unpac_mem dd 0 |
23 | tex_colors dd 0 |
||
1476 | IgorA | 24 | tex_help_f1 dd 0 |
25 | |||
26 | |||
27 | |||
28 | |||
29 | err_opn db 0 ;îøèáêà îòêðûòèÿ ôàéëà |
||
30 | err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà |
||
31 | |||
32 | |||
33 | |||
34 | |||
35 | |||
36 | |||
37 | InitColText: |
||
38 | pushad |
||
39 | |||
40 | |||
7575 | IgorA | 41 | copy_path ebx,fn_syntax_dir,file_name_rez,0 |
1476 | IgorA | 42 | copy_path file_name_rez,sys_path,file_name,0 |
43 | |||
44 | |||
7575 | IgorA | 45 | ;fn_syntax_dir = 'info/' |
46 | ;file_name_rez = 'info/*.syn' |
||
47 | |||
48 | |||
49 | mov [run_file_70.Position], 0 |
||
4990 | IgorA | 50 | mov [run_file_70.Flags], 0 |
51 | mov dword[run_file_70.Count], 0 |
||
7575 | IgorA | 52 | mov dword[run_file_70.Buffer], open_b |
53 | mov byte[run_file_70+20], 0 |
||
4990 | IgorA | 54 | mov dword[run_file_70.FileName], file_name |
7575 | IgorA | 55 | mcall SF_FILE,run_file_70 |
56 | |||
1476 | IgorA | 57 | |
7575 | IgorA | 58 | stdcall mem.ReAlloc,[options_file],ecx |
59 | mov [options_file],eax |
||
60 | mov [open_file_size],ecx |
||
61 | |||
62 | |||
63 | mov [run_file_70.Position], 0 |
||
64 | mov [run_file_70.Flags], 0 |
||
65 | mov [run_file_70.Count], ecx |
||
66 | m2m dword[run_file_70.Buffer], dword[options_file] |
||
67 | mov byte[run_file_70+20], 0 |
||
68 | mov dword[run_file_70.FileName], file_name |
||
69 | mcall SF_FILE,run_file_70 ;çàãðóæàåì ôàéë èçîáðàæåíèß |
||
70 | test eax,eax |
||
71 | jnz .no_colors |
||
72 | cmp ebx,0xffffffff |
||
73 | je .no_colors |
||
74 | |||
1476 | IgorA | 75 | |
7575 | IgorA | 76 | |
77 | |||
1476 | IgorA | 78 | mov dword[count_colors_text],1 |
79 | mov dword[ColWords],0 |
||
80 | mov dword[tex_help_f1],0 |
||
81 | |||
82 | |||
7575 | IgorA | 83 | cmp dword[edi],'KPCK' |
84 | jne .end_unpack |
||
85 | ;notify_window_run ... |
||
86 | mov ecx,[edi+4] |
||
87 | cmp [open_file_size],ecx |
||
88 | jge @f |
||
89 | ;åñëè äëß ðàñïàêîâàíîãî ôàéëà íå õâàòàåò âûäåëåííîé ïàìßòè |
||
90 | stdcall mem.ReAlloc,edi,ecx |
||
91 | mov [options_file],eax |
||
92 | mov [open_file_size],ecx |
||
93 | @@: |
||
94 | ;âûäåëåíèå ïàìßòè äëß ðàñïàêîâêè ôàéëà |
||
95 | stdcall mem.ReAlloc,[unpac_mem],ecx |
||
96 | mov [unpac_mem],eax |
||
97 | |||
1476 | IgorA | 98 | |
7575 | IgorA | 99 | mov edi,[options_file] |
100 | mov esi,[unpac_mem] |
||
101 | mov ecx,[edi+4] |
||
102 | cld |
||
103 | rep movsb |
||
104 | .end_unpack: |
||
105 | mov esi,[options_file] |
||
1476 | IgorA | 106 | mov edi,count_colors_text |
107 | mov ecx,9 |
||
7575 | IgorA | 108 | rep movsd |
109 | |||
1476 | IgorA | 110 | |
111 | add eax,32 |
||
112 | mov [tex_colors],eax |
||
7575 | IgorA | 113 | |
1476 | IgorA | 114 | |
7575 | IgorA | 115 | add eax,8 |
1476 | IgorA | 116 | shl eax,2 |
117 | add eax,[options_file] |
||
118 | mov [Col],eax |
||
7575 | IgorA | 119 | |
1476 | IgorA | 120 | |
121 | mov ecx,[ColWords] |
||
7575 | IgorA | 122 | imul ecx,sizeof.TexColViv |
1476 | IgorA | 123 | add ecx,[Col] |
7575 | IgorA | 124 | mov [tex_help_f1],ecx |
125 | |||
1476 | IgorA | 126 | |
127 | stdcall [ted_clear], tedit0,1 |
||
128 | |||
129 | |||
130 | |||
131 | |||
132 | stdcall print_color,[color_cursor] |
||
133 | stdcall print_capt,col_2 |
||
134 | stdcall print_color,[color_wnd_capt] |
||
135 | stdcall print_capt,col_3 |
||
136 | stdcall print_color,[color_wnd_work] |
||
137 | stdcall print_capt,col_4 |
||
138 | stdcall print_color,[color_wnd_bord] |
||
139 | stdcall print_capt,col_5 |
||
140 | stdcall print_color,[color_select] |
||
141 | stdcall print_capt,col_6 |
||
142 | stdcall print_color,[color_cur_text] |
||
143 | |||
144 | |||
145 | mov ecx,[count_colors_text] ;êîëè÷åñòâî öâåòîâ òåêñòà |
||
146 | mov eax,[tex_colors] |
||
147 | @@: |
||
148 | stdcall print_capt,capt_type_dd |
||
149 | stdcall print_color,[eax] |
||
150 | add eax,4 |
||
151 | loop @b |
||
152 | |||
153 | |||
154 | mov ecx,[ColWords] |
||
7575 | IgorA | 155 | mov eax,[Col] |
1476 | IgorA | 156 | xor ebx,ebx |
157 | @@: ;öèêë ïî ïîäñâå÷èâàåìûì ñëîâàì |
||
7575 | IgorA | 158 | inc ebx |
1476 | IgorA | 159 | stdcall print_word,eax,ebx |
160 | add eax,sizeof.TexColViv |
||
161 | loop @b |
||
162 | |||
163 | |||
164 | mov ecx,[ColWords] |
||
7575 | IgorA | 165 | mov eax,[Col] |
1476 | IgorA | 166 | xor ebx,ebx |
167 | @@: ;öèêë ïî ñïðàâêàì ê ïîäñâ. ñëîâàì |
||
7575 | IgorA | 168 | inc ebx |
1476 | IgorA | 169 | stdcall print_word_f1,eax,ebx |
170 | add eax,sizeof.TexColViv |
||
171 | loop @b |
||
172 | |||
173 | |||
7575 | IgorA | 174 | stdcall [PathShow_prepare], PathShow_data_1 |
175 | call draw_window |
||
2086 | IgorA | 176 | |
1476 | IgorA | 177 | |
178 | popad |
||
179 | ret |
||
180 | |||
181 | |||
182 | proc print_color, color:dword |
||
183 | pushad |
||
184 | mov eax,dword[color] |
||
185 | |||
186 | |||
187 | shr ebx,16 |
||
188 | xchg al,bl |
||
189 | and eax,0xffff |
||
190 | and ebx,0xff |
||
191 | shl ebx,16 |
||
192 | or eax,ebx |
||
193 | |||
194 | |||
195 | ror eax,8 |
||
196 | ror al,4 |
||
197 | ror eax,8 |
||
198 | ror al,4 |
||
199 | rol eax,16 |
||
200 | mov edi,text_buffer |
||
201 | mov word[edi],'0x' |
||
202 | add edi,2 |
||
203 | mov ecx,6 |
||
204 | @@: |
||
205 | mov ebx,eax |
||
206 | and ebx,0xf |
||
207 | cmp bx,9 |
||
208 | jle .cifra |
||
209 | add bx,39 |
||
210 | .cifra: |
||
211 | add bx,48 |
||
212 | mov byte[edi],bl |
||
213 | inc edi |
||
214 | shr eax,4 |
||
215 | loop @b |
||
216 | mov byte[edi],13 |
||
217 | mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
||
218 | stdcall [ted_text_add], tedit0,text_buffer,9,ebx |
||
219 | popad |
||
220 | ret |
||
221 | endp |
||
222 | |||
223 | |||
224 | proc print_capt, capt:dword |
||
225 | pushad |
||
226 | mov esi,[capt] |
||
7575 | IgorA | 227 | stdcall str_len,esi |
1476 | IgorA | 228 | stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
229 | popad |
||
230 | ret |
||
231 | endp |
||
232 | |||
233 | |||
234 | proc print_word, text:dword, index:dword |
||
235 | pushad |
||
236 | mov edi,text_buffer |
||
7575 | IgorA | 237 | mov byte[edi],0 |
238 | stdcall str_cat,edi,capt_beg_word |
||
239 | stdcall str_len,edi |
||
240 | add edi,eax |
||
241 | |||
1476 | IgorA | 242 | |
7575 | IgorA | 243 | stdcall code_string,ecx,edi ;êîäèðóåì ñòðîêó ñ êëþ÷åâûì ñëîâîì |
244 | stdcall str_cat,edi,capt_end_word |
||
245 | |||
1476 | IgorA | 246 | |
7575 | IgorA | 247 | je @f |
1476 | IgorA | 248 | stdcall str_cat_value,edi,[index] |
7575 | IgorA | 249 | @@: |
1476 | IgorA | 250 | |
251 | |||
7575 | IgorA | 252 | add edi,eax |
253 | mov word[edi],',' |
||
254 | inc edi |
||
255 | movzx eax,byte[ecx+TexColViv.flags] |
||
256 | stdcall str_cat_value,edi,eax |
||
1476 | IgorA | 257 | stdcall str_len,edi |
258 | add edi,eax |
||
259 | mov word[edi],',' |
||
7575 | IgorA | 260 | inc edi |
1476 | IgorA | 261 | |
262 | |||
7575 | IgorA | 263 | or eax,eax ;ïðîâåðßåì åñòü ëè çàâåðøàþùèé è ýêðàíèíóþùèé ñèìâîë |
264 | jz @f |
||
265 | stdcall str_cat_value,edi,eax |
||
1476 | IgorA | 266 | stdcall str_len,edi |
267 | add edi,eax |
||
268 | @@: |
||
269 | mov word[edi],',' |
||
7575 | IgorA | 270 | inc edi |
1476 | IgorA | 271 | |
272 | |||
7575 | IgorA | 273 | stdcall str_cat_value,edi,eax |
1476 | IgorA | 274 | stdcall str_len,edi |
275 | add edi,eax |
||
276 | mov word[edi],13 |
||
7575 | IgorA | 277 | |
1476 | IgorA | 278 | |
279 | stdcall str_len,esi |
||
280 | stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
||
7575 | IgorA | 281 | |
1476 | IgorA | 282 | |
283 | ret |
||
284 | endp |
||
285 | |||
286 | |||
287 | proc print_word_f1, text:dword, index:dword |
||
288 | pushad |
||
289 | mov edi,[text] |
||
7575 | IgorA | 290 | mov esi,[edi+TexColViv.f1] |
291 | cmp esi,0 |
||
1476 | IgorA | 292 | je @f |
293 | mov ebx,text_buffer |
||
294 | mov byte[ebx],0 |
||
295 | stdcall str_cat,ebx,capt_point |
||
296 | stdcall str_cat_value,ebx,[index] |
||
297 | stdcall str_cat,ebx,capt_beg_db |
||
298 | stdcall str_len,ebx |
||
299 | add ebx,eax |
||
300 | |||
301 | |||
7575 | IgorA | 302 | stdcall code_string,esi,ebx ;êîäèðóåì ñòðîêó |
1476 | IgorA | 303 | stdcall str_cat,ebx,capt_end_word_f1 |
304 | |||
305 | |||
306 | stdcall str_len,ebx |
||
307 | stdcall [ted_text_add], tedit0,ebx,eax,ted_opt_ed_move_cursor |
||
308 | @@: |
||
309 | popad |
||
310 | ret |
||
311 | endp |
||
312 | |||
313 | |||
7575 | IgorA | 314 | ; êîäèðîâêà ñòðîêè, çàìåíà íåïå÷àòàåìûõ ñèìâîëîâ íà ÷èñëîâûå êîäû |
315 | align 4 |
||
1476 | IgorA | 316 | proc code_string, text:dword, out_text:dword |
317 | pushad |
||
318 | mov esi,[text] |
||
7575 | IgorA | 319 | stdcall str_len,esi |
1476 | IgorA | 320 | mov ecx,eax |
321 | mov edi,[out_text] |
||
7575 | IgorA | 322 | or ecx,ecx |
7861 | IgorA | 323 | jz .end_copy ;åñëè ñòðîêà ñî ñïðàâêîé ïóñòàß |
324 | |||
1476 | IgorA | 325 | |
326 | mov al,byte[esi] |
||
327 | inc esi |
||
328 | cmp al,9 |
||
329 | je @f |
||
330 | cmp al,13 |
||
331 | je @f |
||
332 | cmp al,39 |
||
333 | je @f |
||
334 | mov byte[edi],al |
||
335 | inc edi |
||
336 | loop .copy |
||
337 | jmp .end_copy |
||
338 | @@: |
||
339 | mov byte[edi],39 |
||
340 | mov byte[edi+1],',' |
||
341 | add edi,2 |
||
342 | and eax,0xff |
||
343 | mov dword[edi],0 |
||
344 | stdcall convert_int_to_str,4 |
||
7575 | IgorA | 345 | stdcall str_len,edi |
1476 | IgorA | 346 | add edi,eax |
347 | mov byte[edi],',' |
||
348 | mov byte[edi+1],39 |
||
349 | add edi,2 |
||
350 | loop .copy |
||
351 | .end_copy: |
||
352 | mov byte[edi],0 |
||
353 | popad |
||
354 | ret |
||
355 | endp |
||
356 | |||
357 | |||
358 | proc mem_clear, mem:dword, len:dword |
||
359 | push eax ecx edi |
||
360 | cld |
||
361 | xor al,al |
||
362 | mov edi, dword[mem] |
||
363 | mov ecx, dword[len] |
||
364 | repne stosb |
||
365 | pop edi ecx eax |
||
366 | ret |
||
367 | endp |
||
368 | |||
369 | |||
370 | proc str_cat, str1:dword, str2:dword |
||
371 | push eax ecx edi esi |
||
372 | mov esi,dword[str2] |
||
373 | stdcall str_len,esi |
||
374 | mov ecx,eax |
||
375 | inc ecx |
||
376 | mov edi,dword[str1] |
||
377 | stdcall str_len,edi |
||
378 | add edi,eax |
||
379 | cld |
||
380 | repne movsb |
||
381 | pop esi edi ecx eax |
||
382 | ret |
||
383 | endp |
||
384 | |||
385 | |||
386 | proc str_cat_value, str1:dword, value:dword |
||
387 | pushad |
||
388 | mov edi,[str1] |
||
389 | stdcall str_len,edi |
||
390 | add edi,eax |
||
391 | mov eax,[value] |
||
392 | stdcall convert_int_to_str,12 |
||
7575 | IgorA | 393 | popad |
1476 | IgorA | 394 | ret |
395 | endp |
||
396 | |||
397 | |||
398 | ; eax = strlen |
||
399 | align 4 |
||
400 | proc str_len, str1:dword |
||
401 | mov eax,[str1] |
||
402 | @@: |
||
403 | cmp byte[eax],0 |
||
404 | je @f |
||
405 | inc eax |
||
406 | jmp @b |
||
407 | @@: |
||
408 | sub eax,[str1] |
||
409 | ret |
||
410 | endp |
||
411 | |||
412 | |||
413 | ; eax - ÷èñëî |
||
7575 | IgorA | 414 | ; edi - áóôåð äëß ñòðîêè |
415 | ; len - äëèííà áóôåðà |
||
416 | ;output: |
||
417 | align 4 |
||
1476 | IgorA | 418 | proc convert_int_to_str uses eax ecx edx edi esi, len:dword |
7575 | IgorA | 419 | mov esi,[len] |
420 | add esi,edi |
||
421 | dec esi |
||
422 | call .str |
||
1476 | IgorA | 423 | ret |
424 | endp |
||
7575 | IgorA | 425 | |
1476 | IgorA | 426 | |
427 | .str: |
||
428 | mov ecx,10 |
||
7575 | IgorA | 429 | cmp eax,ecx |
430 | jb @f |
||
1476 | IgorA | 431 | xor edx,edx |
7575 | IgorA | 432 | div ecx |
433 | push edx |
||
434 | ;dec edi ;ñìåùåíèå íåîáõîäèìîå äëß çàïèñè ñ êîíöà ñòðîêè |
||
435 | call .str |
||
436 | pop eax |
||
1476 | IgorA | 437 | @@: |
7575 | IgorA | 438 | cmp edi,esi |
439 | jge @f |
||
440 | or al,0x30 |
||
441 | stosb |
||
442 | mov byte[edi],0 ;â êîíåö ñòðîêè ñòàâèì 0, ÷òî-áû íå âûëàçèë ìóñîð |
||
443 | @@: |
||
444 | ret |
||
1476 | IgorA | 445 |