Rev 1698 | Rev 1706 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1698 | IgorA | 1 | ; |
2 | ; в этом файле собраны функции создающие програмный код |
||
3 | ; |
||
4 | u_object object ;временный объект для задания смещений |
||
5 | |||
6 | macro insert_coma |
||
7 | { |
||
8 | stdcall [ted_text_add], tedit0,txt_coma,1,ted_opt_ed_move_cursor |
||
9 | } |
||
10 | macro insert_nl |
||
11 | { |
||
12 | stdcall [ted_text_add], tedit0,txt_nl,1,ted_opt_ed_move_cursor |
||
13 | } |
||
14 | macro insert_com |
||
15 | { |
||
16 | stdcall [ted_text_add], tedit0,txt_com,1,ted_opt_ed_move_cursor |
||
17 | } |
||
18 | macro insert_sp |
||
19 | { |
||
20 | stdcall [ted_text_add], tedit0,txt_sp,1,ted_opt_ed_move_cursor |
||
21 | } |
||
22 | |||
23 | ;функция вставляет текстовую строку в текстовый редактор |
||
24 | align 4 |
||
25 | proc insert_text, txt:dword |
||
26 | push eax |
||
27 | stdcall str_len,dword[txt] |
||
28 | cmp eax,1 |
||
29 | jl @f |
||
30 | stdcall [ted_text_add], tedit0,dword[txt],eax,ted_opt_ed_move_cursor |
||
31 | @@: |
||
32 | pop eax |
||
33 | ret |
||
34 | endp |
||
35 | |||
36 | ;вставляет указанное свойство из объекта в текстовый редактор |
||
37 | align 4 |
||
38 | proc insert_text_prop, p_obj:dword,index:dword |
||
39 | push eax edx |
||
40 | mov eax,[p_obj] |
||
41 | mov edx,[index] |
||
42 | stdcall get_obj_text_col,eax,edx |
||
43 | stdcall str_len,edx |
||
44 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
45 | pop edx eax |
||
46 | ret |
||
47 | endp |
||
48 | |||
49 | macro insert_tab |
||
50 | { |
||
51 | stdcall [ted_text_add], tedit0,txt_tab,1,ted_opt_ed_move_cursor |
||
52 | } |
||
53 | macro insert_br |
||
54 | { |
||
55 | stdcall [ted_text_add], tedit0,txt_br,3,ted_opt_ed_move_cursor |
||
56 | } |
||
57 | macro insert_a_met |
||
58 | { |
||
59 | stdcall [ted_text_add], tedit0,txt_a_met,3,ted_opt_ed_move_cursor |
||
60 | } |
||
61 | macro insert_0 |
||
62 | { |
||
63 | stdcall [ted_text_add], tedit0,txt_0,1,ted_opt_ed_move_cursor |
||
64 | } |
||
65 | macro insert_plus |
||
66 | { |
||
67 | stdcall [ted_text_add], tedit0,txt_plus,1,ted_opt_ed_move_cursor |
||
68 | } |
||
69 | macro insert_xor |
||
70 | { |
||
71 | stdcall [ted_text_add], tedit0,txt_xor,4,ted_opt_ed_move_cursor |
||
72 | } |
||
73 | macro insert_cmp |
||
74 | { |
||
75 | stdcall [ted_text_add], tedit0,txt_cmp,4,ted_opt_ed_move_cursor |
||
76 | } |
||
77 | macro insert_reg reg_name |
||
78 | { |
||
79 | stdcall [ted_text_add], tedit0,reg_name,3,ted_opt_ed_move_cursor |
||
80 | } |
||
81 | macro insert_reg8 reg_name |
||
82 | { |
||
83 | stdcall [ted_text_add], tedit0,reg_name,2,ted_opt_ed_move_cursor |
||
84 | } |
||
85 | macro insert_i65p |
||
86 | { |
||
87 | stdcall [ted_text_add], tedit0,txt_i65p,7,ted_opt_ed_move_cursor |
||
88 | } |
||
89 | |||
90 | |||
91 | ; |
||
92 | macro insert_but_beg |
||
93 | { |
||
94 | stdcall [ted_text_add], tedit0,txt_but_1,txt_but_2-txt_but_1,ted_opt_ed_move_cursor |
||
95 | } |
||
96 | macro insert_but_end |
||
97 | { |
||
98 | stdcall [ted_text_add], tedit0,txt_but_2,txt_but_3-txt_but_2,ted_opt_ed_move_cursor |
||
99 | } |
||
100 | ; |
||
101 | macro insert_key_beg |
||
102 | { |
||
103 | stdcall [ted_text_add], tedit0,txt_key_1,txt_key_2-txt_key_1,ted_opt_ed_move_cursor |
||
104 | } |
||
105 | macro insert_key_end |
||
106 | { |
||
107 | stdcall [ted_text_add], tedit0,txt_key_2,txt_key_3-txt_key_2,ted_opt_ed_move_cursor |
||
108 | } |
||
109 | |||
110 | macro insert_d_poi |
||
111 | { |
||
112 | stdcall [ted_text_add], tedit0,txt_d_poi,1,ted_opt_ed_move_cursor |
||
113 | } |
||
114 | macro insert_ret |
||
115 | { |
||
116 | stdcall [ted_text_add], tedit0,txt_ret,4,ted_opt_ed_move_cursor |
||
117 | } |
||
118 | |||
119 | |||
120 | align 4 |
||
121 | but_code_gen: |
||
122 | call code_gen |
||
123 | cmp byte[show_mode],1 ;условие видимости текстового окна |
||
124 | jne @f |
||
125 | stdcall [ted_draw], tedit0 |
||
126 | @@: |
||
127 | ret |
||
128 | |||
129 | ;функция создающая код всего файла |
||
130 | align 4 |
||
131 | code_gen: |
||
132 | stdcall [ted_clear], tedit0,1 |
||
133 | pushad |
||
134 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
135 | pop esi |
||
136 | xor bl,bl |
||
137 | call code_gen_obj |
||
138 | stdcall [ted_text_add], tedit0,\ |
||
139 | txt_nl,1,ted_opt_ed_move_cursor+ted_opt_ed_change_time ;добавляем символ новой строки с опцией ted_opt_ed_change_time для возможности сохранения файла |
||
140 | stdcall [ted_init_scroll_bars], tedit0, 4 ;меняем размеры скроллингов |
||
141 | popad |
||
142 | ret |
||
143 | |||
144 | ;input: |
||
145 | ; bl - уровень объекта |
||
146 | ; esi - указатель на узел |
||
147 | align 4 |
||
148 | code_gen_obj: |
||
149 | push ebx |
||
150 | .beg_iterat: |
||
151 | cmp esi,0 |
||
152 | je .find_no |
||
153 | |||
154 | cmp byte[esi+2],bl ;lev |
||
155 | jl .find_no |
||
156 | |||
157 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
158 | pop eax ;получаем данные узла |
||
159 | cmp eax,0 |
||
160 | je .find_no |
||
161 | |||
162 | cmp byte[eax],C_ST |
||
163 | jne @f |
||
164 | stdcall get_code_struct,eax ;обработка объекта |
||
165 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
166 | pop ecx ;переходим к следущему узлу |
||
167 | cmp ecx,0 |
||
168 | je .find_no |
||
169 | cmp byte[ecx+2],bl ;lev |
||
170 | jle .end_st |
||
171 | mov esi,ecx |
||
172 | push bx |
||
173 | mov bl,byte[esi+2] |
||
174 | call code_gen_obj ;рекурсивный вызов дочерних объектов |
||
175 | pop bx |
||
176 | .end_st: |
||
177 | stdcall [ted_text_add], tedit0,txt_ends,6,ted_opt_ed_move_cursor |
||
178 | jmp .beg_iterat |
||
179 | @@: |
||
180 | cmp byte[eax],C_TT |
||
181 | jne @f |
||
182 | stdcall get_code_text,eax ;обработка объекта |
||
183 | @@: |
||
184 | cmp byte[eax],C_IN |
||
185 | jne @f |
||
186 | stdcall get_code_incl,eax ;обработка объекта |
||
187 | @@: |
||
188 | cmp byte[eax],C_CO |
||
189 | jne @f |
||
190 | stdcall get_code_comment,eax ;обработка объекта |
||
191 | @@: |
||
192 | cmp byte[eax],C_VR |
||
193 | jne @f |
||
194 | stdcall get_code_variable,eax,ebx ;обработка объекта |
||
195 | @@: |
||
196 | cmp byte[eax],C_WI |
||
197 | jne @f |
||
198 | stdcall get_code_window,eax ;обработка объекта |
||
199 | @@: |
||
200 | cmp byte[eax],C_AC |
||
201 | jne @f |
||
202 | stdcall get_code_auto,eax ;обработка объекта |
||
203 | @@: |
||
204 | cmp byte[eax],C_KE ;клавиатура |
||
205 | jne @f |
||
206 | stdcall get_code_key,eax ;обработка объекта |
||
207 | @@: |
||
208 | |||
209 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
210 | pop esi ;переходим к следущему узлу |
||
211 | |||
212 | jmp .beg_iterat |
||
213 | .find_no: |
||
214 | pop ebx |
||
215 | ret |
||
216 | |||
217 | |||
218 | align 4 |
||
219 | proc get_code_text, p_obj:dword |
||
220 | pushad |
||
221 | insert_nl |
||
222 | mov ebx,dword[p_obj] |
||
223 | stdcall get_obj_text_col,ebx,0 |
||
224 | stdcall str_len,edx |
||
225 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
226 | insert_nl |
||
227 | popad |
||
228 | ret |
||
229 | endp |
||
230 | |||
231 | align 4 |
||
232 | proc get_code_auto, p_obj:dword |
||
233 | pushad |
||
234 | insert_nl |
||
235 | mov ebx,dword[p_obj] |
||
236 | mov ecx,dword[ebx+u_object.modif-u_object] |
||
237 | bt ecx,BIT_MOD_ACM |
||
238 | jae @f |
||
239 | ;автоматические события от мыши |
||
240 | call get_code_auto_m |
||
241 | @@: |
||
242 | bt ecx,BIT_MOD_ABU |
||
243 | jae @f |
||
244 | ;создание функции button |
||
245 | insert_but_beg |
||
246 | call get_code_auto_but ;коды вызова кнопок |
||
247 | insert_but_end |
||
248 | call get_code_a_but_fun ;коды функций, вызываемых при нажатии кнопок |
||
249 | @@: |
||
250 | bt ecx,BIT_MOD_ACD |
||
251 | jae @f |
||
252 | call get_code_auto_data_el |
||
253 | call get_code_auto_data_dop |
||
1705 | IgorA | 254 | call get_code_auto_data_libs |
1698 | IgorA | 255 | @@: |
256 | insert_nl |
||
257 | popad |
||
258 | ret |
||
259 | endp |
||
260 | |||
261 | |||
262 | align 4 |
||
263 | proc get_code_auto_m |
||
264 | pushad |
||
265 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
266 | pop esi |
||
267 | .beg_iterat: |
||
268 | cmp esi,0 |
||
269 | je .find_no |
||
270 | |||
271 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
272 | pop ebx ;получаем данные узла |
||
273 | cmp ebx,0 |
||
274 | je .find_no |
||
275 | |||
276 | cmp byte[ebx],C_ED |
||
277 | jne @f |
||
278 | stdcall insert_text, txt_std_mouse_ed |
||
279 | ;insert_sp |
||
280 | stdcall get_obj_text_col,ebx,0 |
||
281 | stdcall str_len,edx |
||
282 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
283 | insert_nl |
||
284 | @@: |
||
285 | cmp byte[ebx],C_CB |
||
286 | jne @f |
||
287 | stdcall insert_text, txt_std_mouse_cb |
||
288 | ;insert_sp |
||
289 | stdcall get_obj_text_col,ebx,0 |
||
290 | stdcall str_len,edx |
||
291 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
292 | insert_nl |
||
293 | @@: |
||
294 | |||
295 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
296 | pop esi ;переходим к следущему узлу |
||
297 | |||
298 | jmp .beg_iterat |
||
299 | .find_no: |
||
300 | popad |
||
301 | ret |
||
302 | endp |
||
303 | |||
304 | ;создание данных (структур объектов) |
||
305 | align 4 |
||
306 | proc get_code_auto_data_el |
||
307 | pushad |
||
308 | insert_nl ;отступ для форматирования |
||
309 | |||
310 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
311 | pop esi |
||
312 | .beg_iterat: |
||
313 | cmp esi,0 |
||
314 | je .find_no |
||
315 | |||
316 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
317 | pop ebx ;получаем данные узла |
||
318 | cmp ebx,0 |
||
319 | je .find_no |
||
320 | |||
321 | cmp byte[ebx],C_ED |
||
322 | jne @f |
||
323 | ;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt |
||
1705 | IgorA | 324 | stdcall insert_text_prop, ebx,0 |
1698 | IgorA | 325 | stdcall insert_text, txt_ebox |
326 | |||
327 | mov ecx,1 |
||
328 | .prop: |
||
329 | insert_sp |
||
1705 | IgorA | 330 | stdcall insert_text_prop, ebx,ecx |
1698 | IgorA | 331 | insert_coma |
332 | inc ecx |
||
333 | cmp ecx,10 |
||
334 | jl .prop |
||
335 | |||
336 | insert_br |
||
337 | ;insert_tab |
||
338 | stdcall insert_text, txt_txt |
||
339 | |||
340 | mov edx,fp_icon |
||
341 | stdcall get_obj_id, ebx,edx |
||
342 | stdcall str_len,edx ;eax = len(fp_icon) |
||
343 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
344 | |||
345 | ;insert_coma |
||
346 | ;insert_sp |
||
347 | stdcall insert_text, txt_mouse_dd |
||
348 | insert_nl |
||
349 | @@: |
||
350 | ;cmp byte[ebx],C_CB |
||
351 | ;jne @f |
||
352 | ;@@: |
||
353 | |||
354 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
355 | pop esi ;переходим к следущему узлу |
||
356 | |||
357 | jmp .beg_iterat |
||
358 | .find_no: |
||
359 | popad |
||
360 | ret |
||
361 | endp |
||
362 | |||
1705 | IgorA | 363 | ;данные для библиотек |
364 | align 4 |
||
365 | proc get_code_auto_data_libs |
||
366 | pushad |
||
367 | insert_nl ;отступ для форматирования |
||
368 | |||
369 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
370 | pop esi |
||
371 | .beg_iterat: |
||
372 | cmp esi,0 |
||
373 | je .find_no |
||
374 | |||
375 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
376 | pop ebx ;получаем данные узла |
||
377 | cmp ebx,0 |
||
378 | je .find_no |
||
379 | |||
380 | cmp byte[ebx],C_LIB |
||
381 | jne @f |
||
382 | ;0,1,2,3,4,5 - l_nam,s_dir,i_met,... |
||
383 | stdcall insert_text, txt_align_4 |
||
384 | stdcall insert_text_prop, ebx,2 |
||
385 | stdcall insert_text, txt_d_poi |
||
386 | insert_nl |
||
387 | |||
388 | call get_code_lib_table |
||
389 | @@: |
||
390 | |||
391 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
392 | pop esi ;переходим к следущему узлу |
||
393 | |||
394 | jmp .beg_iterat |
||
395 | .find_no: |
||
396 | popad |
||
397 | ret |
||
398 | endp |
||
399 | |||
400 | ;input: |
||
401 | ; esi |
||
402 | align 4 |
||
403 | get_code_lib_table: |
||
404 | pushad |
||
405 | mov bl,byte[esi+2] |
||
406 | mov edi,esi |
||
407 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
408 | pop edx ;получение данных родительского объекта |
||
409 | cmp edx,0 |
||
410 | je @f |
||
411 | @@: |
||
412 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
413 | pop esi ;переходим к следущему узлу |
||
414 | cmp esi,0 |
||
415 | je @f |
||
416 | cmp byte[esi+2],bl ;lev |
||
417 | jle @f |
||
418 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
419 | pop ecx ;получаем данные узла |
||
420 | cmp ecx,0 |
||
421 | je @f |
||
422 | cmp byte[ecx],C_IFN |
||
423 | jne @b |
||
424 | ;вставка указателя на функцию |
||
425 | insert_tab |
||
426 | stdcall insert_text_prop, ecx,0 |
||
427 | stdcall insert_text, txt_dd |
||
428 | stdcall insert_text_prop, edx,3 ;приставка к функции |
||
429 | stdcall insert_text_prop, ecx,0 |
||
430 | insert_nl |
||
431 | jmp @b |
||
432 | @@: |
||
433 | stdcall insert_text, txt_dd_0_0 |
||
434 | mov esi,edi |
||
435 | @@: |
||
436 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
437 | pop esi ;переходим к следущему узлу |
||
438 | cmp esi,0 |
||
439 | je @f |
||
440 | cmp byte[esi+2],bl ;lev |
||
441 | jle @f |
||
442 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
443 | pop ecx ;получаем данные узла |
||
444 | cmp ecx,0 |
||
445 | je @f |
||
446 | cmp byte[ecx],C_IFN |
||
447 | jne @b |
||
448 | ;вставка имени импортированной функции |
||
449 | insert_tab |
||
450 | stdcall insert_text_prop, edx,3 ;приставка к функции |
||
451 | stdcall insert_text_prop, ecx,0 |
||
452 | stdcall insert_text, txt_db |
||
453 | stdcall insert_text, txt_str_beg |
||
454 | stdcall insert_text_prop, ecx,1 |
||
455 | stdcall insert_text, txt_str_end |
||
456 | insert_nl |
||
457 | jmp @b |
||
458 | @@: |
||
459 | popad |
||
460 | ret |
||
461 | |||
1698 | IgorA | 462 | ; |
463 | align 4 |
||
464 | proc get_code_auto_data_dop |
||
465 | pushad |
||
466 | insert_nl ;отступ для форматирования |
||
467 | |||
468 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
469 | pop esi |
||
470 | .beg_iterat: |
||
471 | cmp esi,0 |
||
472 | je .find_no |
||
473 | |||
474 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
475 | pop ebx ;получаем данные узла |
||
476 | cmp ebx,0 |
||
477 | je .find_no |
||
478 | |||
479 | cmp byte[ebx],C_ED |
||
480 | jne @f |
||
481 | ;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt |
||
482 | stdcall insert_text, txt_txt |
||
483 | |||
484 | mov edx,fp_icon |
||
485 | stdcall get_obj_id, ebx,edx |
||
486 | stdcall str_len,edx ;eax = len(fp_icon) |
||
487 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
488 | stdcall insert_text, txt_times |
||
489 | |||
490 | stdcall get_obj_text_col,ebx,9 |
||
491 | stdcall str_len,edx |
||
492 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
493 | |||
494 | insert_plus |
||
495 | stdcall insert_text, txt_2 |
||
496 | stdcall insert_text, txt_db |
||
497 | insert_0 |
||
498 | insert_nl |
||
499 | @@: |
||
500 | ;cmp byte[ebx],C_CB |
||
501 | ;jne @f |
||
502 | ;@@: |
||
503 | |||
504 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
505 | pop esi ;переходим к следущему узлу |
||
506 | |||
507 | jmp .beg_iterat |
||
508 | .find_no: |
||
509 | popad |
||
510 | ret |
||
511 | endp |
||
512 | |||
513 | ;связываем кнопки с функциями |
||
514 | align 4 |
||
515 | proc get_code_auto_but |
||
516 | pushad |
||
517 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
518 | pop esi |
||
519 | .beg_iterat: |
||
520 | cmp esi,0 |
||
521 | je .find_no |
||
522 | |||
523 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
524 | pop ebx ;получаем данные узла |
||
525 | cmp ebx,0 |
||
526 | je .find_no |
||
527 | |||
528 | cmp byte[ebx],C_BU |
||
529 | jne @f |
||
530 | insert_tab |
||
531 | insert_cmp |
||
532 | insert_reg8 txt_ah |
||
533 | insert_coma |
||
534 | stdcall get_obj_text_col,ebx,0 |
||
535 | stdcall str_len,edx |
||
536 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
537 | insert_nl |
||
538 | insert_tab |
||
539 | stdcall insert_text, txt_jne_f |
||
540 | insert_nl |
||
541 | insert_tab |
||
542 | insert_tab |
||
543 | stdcall insert_text, txt_call |
||
544 | stdcall get_obj_text_col,ebx,6 |
||
545 | stdcall str_len,edx |
||
546 | cmp eax,1 |
||
547 | jl .c_fun |
||
548 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
549 | .c_fun: |
||
550 | insert_nl |
||
551 | insert_tab |
||
552 | insert_a_met ;@@: |
||
553 | insert_nl |
||
554 | @@: |
||
555 | |||
556 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
557 | pop esi ;переходим к следущему узлу |
||
558 | |||
559 | jmp .beg_iterat |
||
560 | .find_no: |
||
561 | popad |
||
562 | ret |
||
563 | endp |
||
564 | |||
565 | ;берем коды для функций нажатий на кнопки |
||
566 | align 4 |
||
567 | proc get_code_a_but_fun |
||
568 | pushad |
||
569 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
570 | pop esi |
||
571 | .beg_iterat: |
||
572 | cmp esi,0 |
||
573 | je .find_no |
||
574 | |||
575 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
576 | pop ebx ;получаем данные узла |
||
577 | cmp ebx,0 |
||
578 | je .find_no |
||
579 | |||
580 | cmp byte[ebx],C_BU |
||
581 | jne @f |
||
582 | stdcall get_obj_text_col,ebx,6 |
||
583 | stdcall str_len,edx |
||
584 | cmp eax,1 |
||
585 | jl .c_fun |
||
586 | insert_nl |
||
587 | stdcall insert_text, txt_align_4 |
||
588 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
589 | insert_d_poi |
||
590 | insert_nl |
||
591 | insert_tab |
||
592 | insert_ret |
||
593 | .c_fun: |
||
594 | @@: |
||
595 | |||
596 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
597 | pop esi ;переходим к следущему узлу |
||
598 | |||
599 | jmp .beg_iterat |
||
600 | .find_no: |
||
601 | popad |
||
602 | ret |
||
603 | endp |
||
604 | |||
605 | align 4 |
||
606 | proc get_code_key, p_obj:dword |
||
607 | pushad |
||
608 | insert_nl |
||
609 | mov ebx,dword[p_obj] |
||
610 | |||
611 | insert_key_beg |
||
612 | call get_code_funct_key ;коды вызова кнопок |
||
613 | insert_key_end |
||
614 | |||
615 | insert_nl |
||
616 | popad |
||
617 | ret |
||
618 | endp |
||
619 | |||
620 | align 4 |
||
621 | proc get_code_funct_key |
||
622 | pushad |
||
623 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
624 | pop esi |
||
625 | .beg_iterat: |
||
626 | cmp esi,0 |
||
627 | je .find_no |
||
628 | |||
629 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
630 | pop ebx ;получаем данные узла |
||
631 | cmp ebx,0 |
||
632 | je .find_no |
||
633 | |||
634 | cmp byte[ebx],C_ED |
||
635 | jne @f |
||
636 | stdcall insert_text, txt_std_key_ed |
||
637 | stdcall insert_text_prop,ebx,0 |
||
638 | insert_nl |
||
639 | @@: |
||
640 | |||
641 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
642 | pop esi ;переходим к следущему узлу |
||
643 | |||
644 | jmp .beg_iterat |
||
645 | .find_no: |
||
646 | popad |
||
647 | ret |
||
648 | endp |
||
649 | |||
650 | ;объекты подключения файлов 'include ...' |
||
651 | align 4 |
||
652 | proc get_code_incl, p_obj:dword |
||
653 | pushad |
||
654 | stdcall insert_text, txt_incl |
||
655 | mov ebx,dword[p_obj] |
||
656 | stdcall insert_text_prop,ebx,0 |
||
657 | |||
658 | stdcall get_obj_text_col,ebx,1 |
||
659 | stdcall str_len,edx |
||
660 | cmp eax,1 |
||
661 | jl @f |
||
662 | insert_sp |
||
663 | insert_com |
||
664 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
665 | @@: |
||
666 | |||
667 | insert_nl |
||
668 | popad |
||
669 | ret |
||
670 | endp |
||
671 | |||
672 | align 4 |
||
673 | proc get_code_comment, p_obj:dword |
||
674 | insert_com |
||
675 | stdcall insert_text_prop, dword[p_obj],0 |
||
676 | insert_nl |
||
677 | ret |
||
678 | endp |
||
679 | |||
680 | ;создаем код задания окна |
||
681 | align 4 |
||
682 | proc get_code_window, p_obj:dword |
||
683 | pushad |
||
684 | mov ebx,dword[p_obj] |
||
685 | ;2,3,4,5,6 - x,y,w,h,col_bkg |
||
686 | |||
687 | stdcall insert_text, txt_draw_wb |
||
688 | |||
689 | insert_tab |
||
690 | insert_xor |
||
691 | insert_reg txt_eax |
||
692 | insert_coma |
||
693 | insert_reg txt_eax |
||
694 | insert_nl |
||
695 | |||
696 | ;mov ebx,... |
||
697 | insert_tab |
||
698 | stdcall insert_text, txt_mov |
||
699 | insert_reg txt_ebx |
||
700 | insert_coma |
||
701 | stdcall insert_text_prop, ebx,2 |
||
702 | insert_i65p |
||
703 | stdcall insert_text_prop, ebx,4 |
||
704 | insert_nl |
||
705 | |||
706 | ;mov ecx,... |
||
707 | insert_tab |
||
708 | stdcall insert_text, txt_mov |
||
709 | insert_reg txt_ecx |
||
710 | insert_coma |
||
711 | stdcall insert_text_prop, ebx,3 |
||
712 | insert_i65p |
||
713 | stdcall insert_text_prop, ebx,5 |
||
714 | insert_nl |
||
715 | |||
716 | ;mov edx,... |
||
717 | insert_tab |
||
718 | stdcall insert_text, txt_mov |
||
719 | insert_reg txt_edx |
||
720 | insert_coma |
||
721 | stdcall insert_text_prop, ebx,6 |
||
722 | insert_nl |
||
723 | |||
724 | ;or edx,0x33000000 |
||
1705 | IgorA | 725 | insert_tab |
1698 | IgorA | 726 | stdcall insert_text, txt_or |
727 | insert_reg txt_edx |
||
728 | insert_coma |
||
729 | stdcall insert_text, txt_0x33000000 |
||
730 | insert_nl |
||
731 | |||
732 | ;mov edi,... |
||
733 | insert_tab |
||
734 | stdcall insert_text, txt_mov |
||
735 | insert_reg txt_edi |
||
736 | insert_coma |
||
737 | stdcall insert_text_prop, ebx,0 |
||
738 | insert_nl |
||
739 | |||
740 | insert_tab |
||
741 | stdcall insert_text, txt_i_40 |
||
1705 | IgorA | 742 | insert_nl |
1698 | IgorA | 743 | |
744 | call get_code_draw_obj |
||
745 | |||
1705 | IgorA | 746 | stdcall insert_text, txt_draw_we ;код завершающий функцию рисования |
1698 | IgorA | 747 | popad |
748 | ret |
||
749 | endp |
||
750 | |||
751 | |||
752 | ;формируем вызов функций для рисования объектов |
||
753 | align 4 |
||
754 | proc get_code_draw_obj |
||
755 | pushad |
||
756 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
757 | pop esi |
||
758 | .beg_iterat: |
||
759 | cmp esi,0 |
||
760 | je .find_no |
||
761 | |||
762 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
763 | pop ebx ;получаем данные узла |
||
764 | cmp ebx,0 |
||
765 | je .find_no |
||
766 | |||
767 | cmp byte[ebx],C_ED |
||
768 | jne @f |
||
769 | stdcall insert_text, txt_editb_draw |
||
770 | stdcall insert_text_prop, ebx,0 |
||
771 | insert_nl |
||
772 | @@: |
||
773 | cmp byte[ebx],C_CB |
||
774 | jne @f |
||
775 | stdcall insert_text, txt_cbox_draw |
||
776 | stdcall insert_text_prop, ebx,0 |
||
777 | insert_nl |
||
778 | @@: |
||
779 | cmp byte[ebx],C_BU |
||
780 | jne @f |
||
781 | insert_tab |
||
782 | stdcall insert_text, txt_mov |
||
783 | insert_reg txt_eax |
||
784 | insert_coma |
||
785 | stdcall insert_text, txt_8 |
||
786 | insert_nl |
||
787 | |||
788 | insert_tab |
||
789 | stdcall insert_text, txt_mov |
||
790 | insert_reg txt_ebx |
||
791 | insert_coma |
||
792 | stdcall insert_text_prop, ebx,1 |
||
793 | insert_i65p |
||
794 | stdcall insert_text_prop, ebx,3 |
||
795 | insert_nl |
||
796 | |||
797 | insert_tab |
||
798 | stdcall insert_text, txt_mov |
||
799 | insert_reg txt_ecx |
||
800 | insert_coma |
||
801 | stdcall insert_text_prop, ebx,2 |
||
802 | insert_i65p |
||
803 | stdcall insert_text_prop, ebx,4 |
||
804 | insert_nl |
||
805 | |||
806 | insert_tab |
||
807 | stdcall insert_text, txt_mov |
||
808 | insert_reg txt_edx |
||
809 | insert_coma |
||
810 | stdcall insert_text_prop, ebx,0 |
||
811 | insert_nl |
||
812 | |||
813 | insert_tab |
||
814 | stdcall insert_text, txt_or |
||
815 | insert_reg txt_edx |
||
816 | insert_coma |
||
817 | stdcall insert_text, txt_but_create |
||
818 | insert_nl |
||
819 | |||
820 | insert_tab |
||
821 | stdcall insert_text, txt_mov |
||
822 | insert_reg txt_esi |
||
823 | insert_coma |
||
824 | stdcall insert_text_prop, ebx,5 ;button color |
||
825 | insert_nl |
||
826 | |||
827 | insert_tab |
||
828 | stdcall insert_text, txt_i_40 |
||
829 | insert_nl |
||
830 | @@: |
||
831 | cmp byte[ebx],C_RE |
||
832 | jne @f |
||
833 | insert_tab |
||
834 | stdcall insert_text, txt_mov |
||
835 | insert_reg txt_eax |
||
836 | insert_coma |
||
837 | stdcall insert_text, txt_1 |
||
838 | stdcall insert_text, txt_3 |
||
839 | insert_nl |
||
840 | |||
841 | insert_tab |
||
842 | stdcall insert_text, txt_mov |
||
843 | insert_reg txt_ebx |
||
844 | insert_coma |
||
845 | stdcall insert_text_prop, ebx,1 |
||
846 | insert_i65p |
||
847 | stdcall insert_text_prop, ebx,3 |
||
848 | insert_nl |
||
849 | |||
850 | insert_tab |
||
851 | stdcall insert_text, txt_mov |
||
852 | insert_reg txt_ecx |
||
853 | insert_coma |
||
854 | stdcall insert_text_prop, ebx,2 |
||
855 | insert_i65p |
||
856 | stdcall insert_text_prop, ebx,4 |
||
857 | insert_nl |
||
858 | |||
859 | insert_tab |
||
860 | stdcall insert_text, txt_mov |
||
861 | insert_reg txt_edx |
||
862 | insert_coma |
||
863 | stdcall insert_text_prop, ebx,0 ;rect color |
||
864 | insert_nl |
||
865 | |||
866 | insert_tab |
||
867 | stdcall insert_text, txt_i_40 |
||
868 | insert_nl |
||
869 | @@: |
||
870 | |||
871 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
872 | pop esi ;переходим к следущему узлу |
||
873 | |||
874 | jmp .beg_iterat |
||
875 | .find_no: |
||
876 | popad |
||
877 | ret |
||
878 | endp |
||
879 | |||
880 | |||
881 | |||
882 | align 4 |
||
883 | proc get_code_struct, p_obj:dword |
||
884 | pushad |
||
885 | mov ebx,dword[p_obj] |
||
886 | ;0 - name |
||
887 | |||
888 | stdcall [ted_text_add], tedit0,txt_struct,7,ted_opt_ed_move_cursor |
||
1705 | IgorA | 889 | stdcall insert_text_prop, ebx,0 |
1698 | IgorA | 890 | insert_nl |
891 | |||
892 | popad |
||
893 | ret |
||
894 | endp |
||
895 | |||
896 | ;создать код объявления переменной |
||
897 | align 4 |
||
898 | proc get_code_variable, p_obj:dword,o_lev:dword |
||
899 | pushad |
||
900 | mov ebx,dword[p_obj] |
||
901 | ;0,1,2 - name,value,comment |
||
902 | |||
903 | mov ecx,dword[o_lev] |
||
904 | cmp cl,0 |
||
905 | je .no_tab ;избегаем зацикливания (0-1 = 2^32-1) |
||
906 | and cx,0xff |
||
907 | cld |
||
908 | @@: |
||
909 | insert_tab ;формирование отступа перед переменной |
||
910 | loop @b |
||
911 | .no_tab: |
||
912 | |||
1705 | IgorA | 913 | stdcall insert_text_prop, ebx,0 ;имя переменной |
1698 | IgorA | 914 | insert_sp |
915 | |||
916 | mov ecx,dword[ebx+u_object.typid-u_object] ;ecx - относительный индекс родительского объекта (в памяти) |
||
917 | xor eax,eax |
||
918 | mov ax,[tree2.info_size] |
||
919 | imul ecx,eax ;умножаем индекс на размер структуры |
||
920 | add ecx,[tree2.data_info] ;ecx - указатель данные родительского узла |
||
921 | |||
922 | ;проверку на правильность ecx ??? |
||
923 | |||
1705 | IgorA | 924 | stdcall insert_text_prop, ecx,0 ;тип переменной |
1698 | IgorA | 925 | insert_sp |
1705 | IgorA | 926 | stdcall insert_text_prop, ebx,1 ;значение |
1698 | IgorA | 927 | |
1705 | IgorA | 928 | stdcall get_obj_text_col,ebx,2 ;комментарий |
1698 | IgorA | 929 | stdcall str_len,edx |
930 | cmp eax,1 |
||
931 | jl @f |
||
932 | insert_sp |
||
933 | insert_com |
||
934 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
935 | @@: |
||
936 | insert_nl |
||
937 | |||
938 | popad |
||
939 | ret |
||
940 | endp |
||
941 | |||
942 | |||
943 | |||
944 | ;--- текстовые константы --- |
||
1705 | IgorA | 945 | txt_str_beg db 39,0 |
946 | txt_str_end db 39,',0',0 |
||
1698 | IgorA | 947 | txt_coma db ',',0 |
948 | txt_i_40 db 'int 0x40',13,0 |
||
949 | txt_0 db '0',0 |
||
950 | txt_1 db '1',0 |
||
951 | txt_2 db '2',0 |
||
952 | txt_3 db '3',0 |
||
953 | txt_4 db '4',0 |
||
954 | txt_8 db '8',0 |
||
955 | txt_plus db '+',0 |
||
956 | txt_nl db 13,0 |
||
957 | txt_com db ';',0 |
||
958 | txt_sp db ' ',0 |
||
959 | txt_tab db 9,0 |
||
960 | txt_br db '\',13,9,0 |
||
1705 | IgorA | 961 | txt_txt db 'txt_',0 |
962 | txt_db db ' db ',0 |
||
963 | txt_dd db ' dd ',0 |
||
964 | txt_dd_0_0 db 9,'dd 0,0',13,0 |
||
965 | txt_mouse_dd db ', mouse_dd, ',0 |
||
966 | txt_times db ':',13,9,'times ',0 |
||
1698 | IgorA | 967 | txt_draw_wb: |
968 | db 13,'align 4',13,'draw_window:',13,'pushad',13,9,'mcall 12,1',13,0 |
||
969 | txt_draw_we: |
||
970 | db 9,'mcall 12,2',13,'popad',13,9,'ret',13,0 |
||
971 | txt_but_create db '0x40000000',0 ;tmp |
||
972 | txt_0x33000000 db '0x33000000',0 ;tmp |
||
973 | txt_struct db 'struct ',0 |
||
974 | txt_ends db 'ends',13,13,0 |
||
975 | txt_mov db 'mov ',0 |
||
976 | txt_xor db 'xor ',0 |
||
977 | txt_or db 'or ',0 |
||
978 | txt_cmp db 'cmp ',0 |
||
979 | txt_call db 'call ',0 |
||
980 | txt_jne_f db 'jne @f',0 |
||
981 | txt_a_met db '@@:',0 |
||
982 | txt_ah db 'ah',0 |
||
983 | txt_eax db 'eax',0 |
||
984 | txt_ebx db 'ebx',0 |
||
985 | txt_ecx db 'ecx',0 |
||
986 | txt_edx db 'edx',0 |
||
987 | txt_edi db 'edi',0 |
||
988 | txt_esi db 'esi',0 |
||
989 | txt_align_4 db 'align 4',13,0 |
||
990 | txt_d_poi db ':',0 |
||
991 | txt_ret db 'ret',13,0 |
||
992 | txt_i65p db '*65536+',0 |
||
993 | txt_std_mouse_ed: |
||
994 | db 9,'stdcall [edit_box_mouse], ',0 |
||
995 | txt_std_mouse_cb: |
||
996 | db 9,'stdcall [check_box_mouse], ',0 |
||
997 | txt_std_key_ed: |
||
998 | db 9,'stdcall [edit_box_key], ',0 |
||
999 | txt_incl: |
||
1000 | db 'include ',0 |
||
1001 | txt_ebox: |
||
1705 | IgorA | 1002 | db ' edit_box',0 |
1698 | IgorA | 1003 | txt_editb_draw: |
1004 | db 9,'stdcall [edit_box_draw], ',0 |
||
1005 | txt_cbox_draw: |
||
1006 | db 9,'stdcall [check_box_draw], ',0 |
||
1007 | |||
1008 | txt_but_1: |
||
1009 | db 'align 4',13,'button:',13,9,'mcall 17',13 |
||
1010 | txt_but_2: |
||
1011 | db 9,'cmp ah,1',13,9,'jne still',13,'.exit:',13,9,'mcall -1',13 |
||
1012 | txt_but_3: |
||
1013 | |||
1014 | txt_key_1: |
||
1015 | db 'align 4',13,'key:',13,9,'mcall 2',13 |
||
1016 | txt_key_2: |
||
1017 | db 9,'jmp still',13 |
||
1018 | txt_key_3: |
||
1019 | |||
1020 | align 4 |
||
1021 | proc get_obj_id, p_obj:dword, txt_buf:dword |
||
1022 | push eax ecx edx |
||
1023 | mov eax,dword[p_obj] |
||
1024 | sub eax,[tree2.data_info] |
||
1025 | xor edx,edx |
||
1026 | xor ecx,ecx |
||
1027 | mov cx,word[tree2.info_size] |
||
1028 | div ecx |
||
1029 | |||
1030 | mov edx,dword[txt_buf] |
||
1031 | mov byte[edx],0 |
||
1032 | stdcall str_cat_value,edx,eax |
||
1033 | pop edx ecx eax |
||
1034 | ret |
||
1035 | endp |
||
1036 | |||
1037 | ;--- текстовые функции --- |
||
1038 | |||
1039 | align 4 |
||
1040 | proc mem_clear, mem:dword, len:dword |
||
1041 | push eax ecx edi |
||
1042 | cld |
||
1043 | xor al,al |
||
1044 | mov edi, dword[mem] |
||
1045 | mov ecx, dword[len] |
||
1046 | repne stosb |
||
1047 | pop edi ecx eax |
||
1048 | ret |
||
1049 | endp |
||
1050 | |||
1051 | align 4 |
||
1052 | proc str_cat, str1:dword, str2:dword |
||
1053 | push eax ecx edi esi |
||
1054 | mov esi,dword[str2] |
||
1055 | stdcall str_len,esi |
||
1056 | mov ecx,eax |
||
1057 | inc ecx |
||
1058 | mov edi,dword[str1] |
||
1059 | stdcall str_len,edi |
||
1060 | add edi,eax |
||
1061 | cld |
||
1062 | repne movsb |
||
1063 | pop esi edi ecx eax |
||
1064 | ret |
||
1065 | endp |
||
1066 | |||
1067 | align 4 |
||
1068 | proc str_cat_value, str1:dword, value:dword |
||
1069 | pushad |
||
1070 | mov edi,[str1] |
||
1071 | stdcall str_len,edi |
||
1072 | add edi,eax |
||
1073 | mov eax,[value] |
||
1074 | call tl_convert_to_str |
||
1075 | popad |
||
1076 | ret |
||
1077 | endp |
||
1078 | |||
1079 | ;output: |
||
1080 | ; eax = strlen |
||
1081 | align 4 |
||
1082 | proc str_len, str1:dword |
||
1083 | mov eax,[str1] |
||
1084 | @@: |
||
1085 | cmp byte[eax],0 |
||
1086 | je @f |
||
1087 | inc eax |
||
1088 | jmp @b |
||
1089 | @@: |
||
1090 | sub eax,[str1] |
||
1091 | ret |
||
1092 | endp |
||
1093 | |||
1094 | ;input: |
||
1095 | ; eax = value |
||
1096 | ; edi = string buffer |
||
1097 | align 4 |
||
1098 | tl_convert_to_str: |
||
1099 | pushad |
||
1100 | stdcall mem_clear,edi,12 |
||
1101 | call .str |
||
1102 | popad |
||
1103 | ret |
||
1104 | |||
1105 | align 4 |
||
1106 | .str: |
||
1107 | mov ecx,0x0a ;задается система счисления изменяются регистры ebx,eax,ecx,edx входные параметры eax - число |
||
1108 | ;преревод числа в ASCII строку входные данные ecx=система счисленя edi адрес куда записывать, будем строку, причем конец переменной |
||
1109 | cmp eax,ecx ;сравнить если в eax меньше чем в ecx то перейти на @@-1 т.е. на pop eax |
||
1110 | jb @f |
||
1111 | xor edx,edx ;очистить edx |
||
1112 | div ecx ;разделить - остаток в edx |
||
1113 | push edx ;положить в стек |
||
1114 | ;dec edi ;смещение необходимое для записи с конца строки |
||
1115 | call .str ;перейти на саму себя т.е. вызвать саму себя и так до того момента пока в eax не станет меньше чем в ecx |
||
1116 | pop eax |
||
1117 | @@: ;cmp al,10 ;проверить не меньше ли значение в al чем 10 (для системы счисленя 10 данная команда - лишная)) |
||
1118 | or al,0x30 ;данная команда короче чем две выше |
||
1119 | stosb ;записать элемент из регистра al в ячеку памяти es:edi |
||
1120 | ret |