kolibrios-fun/programs/develop/kol_f_edit/ced_code_g.inc
IgorA be5947897e Add new programm 'kol_f_edit'
Details view in 'readme.htm'

git-svn-id: svn://kolibrios.org@1698 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-11-11 21:47:18 +00:00

1032 lines
21 KiB
PHP

;
; â ýòîì ôàéëå ñîáðàíû ôóíêöèè ñîçäàþùèå ïðîãðàìíûé êîä
;
u_object object ;âðåìåííûé îáúåêò äëÿ çàäàíèÿ ñìåùåíèé
macro insert_coma
{
stdcall [ted_text_add], tedit0,txt_coma,1,ted_opt_ed_move_cursor
}
macro insert_nl
{
stdcall [ted_text_add], tedit0,txt_nl,1,ted_opt_ed_move_cursor
}
macro insert_com
{
stdcall [ted_text_add], tedit0,txt_com,1,ted_opt_ed_move_cursor
}
macro insert_sp
{
stdcall [ted_text_add], tedit0,txt_sp,1,ted_opt_ed_move_cursor
}
;ôóíêöèÿ âñòàâëÿåò òåêñòîâóþ ñòðîêó â òåêñòîâûé ðåäàêòîð
align 4
proc insert_text, txt:dword
push eax
stdcall str_len,dword[txt]
cmp eax,1
jl @f
stdcall [ted_text_add], tedit0,dword[txt],eax,ted_opt_ed_move_cursor
@@:
pop eax
ret
endp
;âñòàâëÿåò óêàçàííîå ñâîéñòâî èç îáúåêòà â òåêñòîâûé ðåäàêòîð
align 4
proc insert_text_prop, p_obj:dword,index:dword
push eax edx
mov eax,[p_obj]
mov edx,[index]
stdcall get_obj_text_col,eax,edx
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
pop edx eax
ret
endp
macro insert_tab
{
stdcall [ted_text_add], tedit0,txt_tab,1,ted_opt_ed_move_cursor
}
macro insert_br
{
stdcall [ted_text_add], tedit0,txt_br,3,ted_opt_ed_move_cursor
}
macro insert_a_met
{
stdcall [ted_text_add], tedit0,txt_a_met,3,ted_opt_ed_move_cursor
}
macro insert_0
{
stdcall [ted_text_add], tedit0,txt_0,1,ted_opt_ed_move_cursor
}
macro insert_plus
{
stdcall [ted_text_add], tedit0,txt_plus,1,ted_opt_ed_move_cursor
}
macro insert_xor
{
stdcall [ted_text_add], tedit0,txt_xor,4,ted_opt_ed_move_cursor
}
macro insert_cmp
{
stdcall [ted_text_add], tedit0,txt_cmp,4,ted_opt_ed_move_cursor
}
macro insert_reg reg_name
{
stdcall [ted_text_add], tedit0,reg_name,3,ted_opt_ed_move_cursor
}
macro insert_reg8 reg_name
{
stdcall [ted_text_add], tedit0,reg_name,2,ted_opt_ed_move_cursor
}
macro insert_i65p
{
stdcall [ted_text_add], tedit0,txt_i65p,7,ted_opt_ed_move_cursor
}
;
macro insert_but_beg
{
stdcall [ted_text_add], tedit0,txt_but_1,txt_but_2-txt_but_1,ted_opt_ed_move_cursor
}
macro insert_but_end
{
stdcall [ted_text_add], tedit0,txt_but_2,txt_but_3-txt_but_2,ted_opt_ed_move_cursor
}
;
macro insert_key_beg
{
stdcall [ted_text_add], tedit0,txt_key_1,txt_key_2-txt_key_1,ted_opt_ed_move_cursor
}
macro insert_key_end
{
stdcall [ted_text_add], tedit0,txt_key_2,txt_key_3-txt_key_2,ted_opt_ed_move_cursor
}
macro insert_d_poi
{
stdcall [ted_text_add], tedit0,txt_d_poi,1,ted_opt_ed_move_cursor
}
macro insert_ret
{
stdcall [ted_text_add], tedit0,txt_ret,4,ted_opt_ed_move_cursor
}
align 4
but_code_gen:
call code_gen
cmp byte[show_mode],1 ;óñëîâèå âèäèìîñòè òåêñòîâîãî îêíà
jne @f
stdcall [ted_draw], tedit0
@@:
ret
;ôóíêöèÿ ñîçäàþùàÿ êîä âñåãî ôàéëà
align 4
code_gen:
stdcall [ted_clear], tedit0,1
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
xor bl,bl
call code_gen_obj
stdcall [ted_text_add], tedit0,\
txt_nl,1,ted_opt_ed_move_cursor+ted_opt_ed_change_time ;äîáàâëÿåì ñèìâîë íîâîé ñòðîêè ñ îïöèåé ted_opt_ed_change_time äëÿ âîçìîæíîñòè ñîõðàíåíèÿ ôàéëà
stdcall [ted_init_scroll_bars], tedit0, 4 ;ìåíÿåì ðàçìåðû ñêðîëëèíãîâ
popad
ret
;input:
; bl - óðîâåíü îáúåêòà
; esi - óêàçàòåëü íà óçåë
align 4
code_gen_obj:
push ebx
.beg_iterat:
cmp esi,0
je .find_no
cmp byte[esi+2],bl ;lev
jl .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop eax ;ïîëó÷àåì äàííûå óçëà
cmp eax,0
je .find_no
cmp byte[eax],C_ST
jne @f
stdcall get_code_struct,eax ;îáðàáîòêà îáúåêòà
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop ecx ;ïåðåõîäèì ê ñëåäóùåìó óçëó
cmp ecx,0
je .find_no
cmp byte[ecx+2],bl ;lev
jle .end_st
mov esi,ecx
push bx
mov bl,byte[esi+2]
call code_gen_obj ;ðåêóðñèâíûé âûçîâ äî÷åðíèõ îáúåêòîâ
pop bx
.end_st:
stdcall [ted_text_add], tedit0,txt_ends,6,ted_opt_ed_move_cursor
jmp .beg_iterat
@@:
cmp byte[eax],C_TT
jne @f
stdcall get_code_text,eax ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_IN
jne @f
stdcall get_code_incl,eax ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_CO
jne @f
stdcall get_code_comment,eax ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_VR
jne @f
stdcall get_code_variable,eax,ebx ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_WI
jne @f
stdcall get_code_window,eax ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_AC
jne @f
stdcall get_code_auto,eax ;îáðàáîòêà îáúåêòà
@@:
cmp byte[eax],C_KE ;êëàâèàòóðà
jne @f
stdcall get_code_key,eax ;îáðàáîòêà îáúåêòà
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
pop ebx
ret
align 4
proc get_code_text, p_obj:dword
pushad
insert_nl
mov ebx,dword[p_obj]
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_nl
popad
ret
endp
align 4
proc get_code_auto, p_obj:dword
pushad
insert_nl
mov ebx,dword[p_obj]
mov ecx,dword[ebx+u_object.modif-u_object]
bt ecx,BIT_MOD_ACM
jae @f
;àâòîìàòè÷åñêèå ñîáûòèÿ îò ìûøè
call get_code_auto_m
@@:
bt ecx,BIT_MOD_ABU
jae @f
;ñîçäàíèå ôóíêöèè button
insert_but_beg
call get_code_auto_but ;êîäû âûçîâà êíîïîê
insert_but_end
call get_code_a_but_fun ;êîäû ôóíêöèé, âûçûâàåìûõ ïðè íàæàòèè êíîïîê
@@:
bt ecx,BIT_MOD_ACD
jae @f
call get_code_auto_data_el
call get_code_auto_data_dop
@@:
insert_nl
popad
ret
endp
align 4
proc get_code_auto_m
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_ED
jne @f
stdcall insert_text, txt_std_mouse_ed
;insert_sp
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_nl
@@:
cmp byte[ebx],C_CB
jne @f
stdcall insert_text, txt_std_mouse_cb
;insert_sp
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_nl
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
;ñîçäàíèå äàííûõ (ñòðóêòóð îáúåêòîâ)
align 4
proc get_code_auto_data_el
pushad
insert_nl ;îòñòóï äëÿ ôîðìàòèðîâàíèÿ
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_ED
jne @f
;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
stdcall insert_text, txt_ebox
mov ecx,1
.prop:
insert_sp
stdcall get_obj_text_col,ebx,ecx
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_coma
inc ecx
cmp ecx,10
jl .prop
insert_br
;insert_tab
stdcall insert_text, txt_txt
mov edx,fp_icon
stdcall get_obj_id, ebx,edx
stdcall str_len,edx ;eax = len(fp_icon)
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
;insert_coma
;insert_sp
stdcall insert_text, txt_mouse_dd
insert_nl
@@:
;cmp byte[ebx],C_CB
;jne @f
;@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
;
align 4
proc get_code_auto_data_dop
pushad
insert_nl ;îòñòóï äëÿ ôîðìàòèðîâàíèÿ
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_ED
jne @f
;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt
stdcall insert_text, txt_txt
mov edx,fp_icon
stdcall get_obj_id, ebx,edx
stdcall str_len,edx ;eax = len(fp_icon)
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
stdcall insert_text, txt_times
stdcall get_obj_text_col,ebx,9
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_plus
stdcall insert_text, txt_2
stdcall insert_text, txt_db
insert_0
insert_nl
@@:
;cmp byte[ebx],C_CB
;jne @f
;@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
;ñâÿçûâàåì êíîïêè ñ ôóíêöèÿìè
align 4
proc get_code_auto_but
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_BU
jne @f
insert_tab
insert_cmp
insert_reg8 txt_ah
insert_coma
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_nl
insert_tab
stdcall insert_text, txt_jne_f
insert_nl
insert_tab
insert_tab
stdcall insert_text, txt_call
stdcall get_obj_text_col,ebx,6
stdcall str_len,edx
cmp eax,1
jl .c_fun
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
.c_fun:
insert_nl
insert_tab
insert_a_met ;@@:
insert_nl
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
;áåðåì êîäû äëÿ ôóíêöèé íàæàòèé íà êíîïêè
align 4
proc get_code_a_but_fun
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_BU
jne @f
stdcall get_obj_text_col,ebx,6
stdcall str_len,edx
cmp eax,1
jl .c_fun
insert_nl
stdcall insert_text, txt_align_4
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_d_poi
insert_nl
insert_tab
insert_ret
.c_fun:
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
align 4
proc get_code_key, p_obj:dword
pushad
insert_nl
mov ebx,dword[p_obj]
insert_key_beg
call get_code_funct_key ;êîäû âûçîâà êíîïîê
insert_key_end
insert_nl
popad
ret
endp
align 4
proc get_code_funct_key
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_ED
jne @f
stdcall insert_text, txt_std_key_ed
stdcall insert_text_prop,ebx,0
insert_nl
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
;îáúåêòû ïîäêëþ÷åíèÿ ôàéëîâ 'include ...'
align 4
proc get_code_incl, p_obj:dword
pushad
stdcall insert_text, txt_incl
mov ebx,dword[p_obj]
stdcall insert_text_prop,ebx,0
stdcall get_obj_text_col,ebx,1
stdcall str_len,edx
cmp eax,1
jl @f
insert_sp
insert_com
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
@@:
insert_nl
popad
ret
endp
align 4
proc get_code_comment, p_obj:dword
insert_com
stdcall insert_text_prop, dword[p_obj],0
insert_nl
ret
endp
;ñîçäàåì êîä çàäàíèÿ îêíà
align 4
proc get_code_window, p_obj:dword
pushad
mov ebx,dword[p_obj]
;2,3,4,5,6 - x,y,w,h,col_bkg
stdcall insert_text, txt_draw_wb
insert_tab
insert_xor
insert_reg txt_eax
insert_coma
insert_reg txt_eax
insert_nl
;mov ebx,...
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ebx
insert_coma
stdcall insert_text_prop, ebx,2
insert_i65p
stdcall insert_text_prop, ebx,4
insert_nl
;mov ecx,...
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ecx
insert_coma
stdcall insert_text_prop, ebx,3
insert_i65p
stdcall insert_text_prop, ebx,5
insert_nl
;mov edx,...
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_edx
insert_coma
stdcall insert_text_prop, ebx,6
insert_nl
;or edx,0x33000000
stdcall insert_text, txt_or
insert_reg txt_edx
insert_coma
stdcall insert_text, txt_0x33000000
insert_nl
;mov edi,...
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_edi
insert_coma
stdcall insert_text_prop, ebx,0
insert_nl
insert_tab
stdcall insert_text, txt_i_40
call get_code_draw_obj
stdcall insert_text, txt_draw_we
popad
ret
endp
;ôîðìèðóåì âûçîâ ôóíêöèé äëÿ ðèñîâàíèÿ îáúåêòîâ
align 4
proc get_code_draw_obj
pushad
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
.beg_iterat:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop ebx ;ïîëó÷àåì äàííûå óçëà
cmp ebx,0
je .find_no
cmp byte[ebx],C_ED
jne @f
stdcall insert_text, txt_editb_draw
stdcall insert_text_prop, ebx,0
insert_nl
@@:
cmp byte[ebx],C_CB
jne @f
stdcall insert_text, txt_cbox_draw
stdcall insert_text_prop, ebx,0
insert_nl
@@:
cmp byte[ebx],C_BU
jne @f
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_eax
insert_coma
stdcall insert_text, txt_8
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ebx
insert_coma
stdcall insert_text_prop, ebx,1
insert_i65p
stdcall insert_text_prop, ebx,3
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ecx
insert_coma
stdcall insert_text_prop, ebx,2
insert_i65p
stdcall insert_text_prop, ebx,4
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_edx
insert_coma
stdcall insert_text_prop, ebx,0
insert_nl
insert_tab
stdcall insert_text, txt_or
insert_reg txt_edx
insert_coma
stdcall insert_text, txt_but_create
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_esi
insert_coma
stdcall insert_text_prop, ebx,5 ;button color
insert_nl
insert_tab
stdcall insert_text, txt_i_40
insert_nl
@@:
cmp byte[ebx],C_RE
jne @f
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_eax
insert_coma
stdcall insert_text, txt_1
stdcall insert_text, txt_3
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ebx
insert_coma
stdcall insert_text_prop, ebx,1
insert_i65p
stdcall insert_text_prop, ebx,3
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_ecx
insert_coma
stdcall insert_text_prop, ebx,2
insert_i65p
stdcall insert_text_prop, ebx,4
insert_nl
insert_tab
stdcall insert_text, txt_mov
insert_reg txt_edx
insert_coma
stdcall insert_text_prop, ebx,0 ;rect color
insert_nl
insert_tab
stdcall insert_text, txt_i_40
insert_nl
@@:
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;ïåðåõîäèì ê ñëåäóùåìó óçëó
jmp .beg_iterat
.find_no:
popad
ret
endp
align 4
proc get_code_struct, p_obj:dword
pushad
mov ebx,dword[p_obj]
;0 - name
stdcall [ted_text_add], tedit0,txt_struct,7,ted_opt_ed_move_cursor
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_nl
popad
ret
endp
;ñîçäàòü êîä îáúÿâëåíèÿ ïåðåìåííîé
align 4
proc get_code_variable, p_obj:dword,o_lev:dword
pushad
mov ebx,dword[p_obj]
;0,1,2 - name,value,comment
mov ecx,dword[o_lev]
cmp cl,0
je .no_tab ;èçáåãàåì çàöèêëèâàíèÿ (0-1 = 2^32-1)
and cx,0xff
cld
@@:
insert_tab ;ôîðìèðîâàíèå îòñòóïà ïåðåä ïåðåìåííîé
loop @b
.no_tab:
stdcall get_obj_text_col,ebx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_sp
mov ecx,dword[ebx+u_object.typid-u_object] ;ecx - îòíîñèòåëüíûé èíäåêñ ðîäèòåëüñêîãî îáúåêòà (â ïàìÿòè)
xor eax,eax
mov ax,[tree2.info_size]
imul ecx,eax ;óìíîæàåì èíäåêñ íà ðàçìåð ñòðóêòóðû
add ecx,[tree2.data_info] ;ecx - óêàçàòåëü äàííûå ðîäèòåëüñêîãî óçëà
;ïðîâåðêó íà ïðàâèëüíîñòü ecx ???
stdcall get_obj_text_col,ecx,0
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
insert_sp
stdcall get_obj_text_col,ebx,1
stdcall str_len,edx
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
stdcall get_obj_text_col,ebx,2
stdcall str_len,edx
cmp eax,1
jl @f
insert_sp
insert_com
stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
@@:
insert_nl
popad
ret
endp
;--- òåêñòîâûå êîíñòàíòû ---
txt_coma db ',',0
txt_i_40 db 'int 0x40',13,0
txt_0 db '0',0
txt_1 db '1',0
txt_2 db '2',0
txt_3 db '3',0
txt_4 db '4',0
txt_8 db '8',0
txt_plus db '+',0
txt_nl db 13,0
txt_com db ';',0
txt_sp db ' ',0
txt_tab db 9,0
txt_br db '\',13,9,0
txt_txt:
db 'txt_',0
txt_db:
db ' db ',0
txt_mouse_dd:
db ', mouse_dd, ',0
txt_times:
db ':',13,9,'times ',0
txt_draw_wb:
db 13,'align 4',13,'draw_window:',13,'pushad',13,9,'mcall 12,1',13,0
txt_draw_we:
db 9,'mcall 12,2',13,'popad',13,9,'ret',13,0
txt_but_create db '0x40000000',0 ;tmp
txt_0x33000000 db '0x33000000',0 ;tmp
txt_struct db 'struct ',0
txt_ends db 'ends',13,13,0
txt_mov db 'mov ',0
txt_xor db 'xor ',0
txt_or db 'or ',0
txt_cmp db 'cmp ',0
txt_call db 'call ',0
txt_jne_f db 'jne @f',0
txt_a_met db '@@:',0
txt_ah db 'ah',0
txt_eax db 'eax',0
txt_ebx db 'ebx',0
txt_ecx db 'ecx',0
txt_edx db 'edx',0
txt_edi db 'edi',0
txt_esi db 'esi',0
txt_align_4 db 'align 4',13,0
txt_d_poi db ':',0
txt_ret db 'ret',13,0
txt_i65p db '*65536+',0
txt_std_mouse_ed:
db 9,'stdcall [edit_box_mouse], ',0
txt_std_mouse_cb:
db 9,'stdcall [check_box_mouse], ',0
txt_std_key_ed:
db 9,'stdcall [edit_box_key], ',0
txt_incl:
db 'include ',0
txt_ebox:
db ' edit_box'
.end: db 0
txt_editb_draw:
db 9,'stdcall [edit_box_draw], ',0
txt_cbox_draw:
db 9,'stdcall [check_box_draw], ',0
txt_but_1:
db 'align 4',13,'button:',13,9,'mcall 17',13
txt_but_2:
db 9,'cmp ah,1',13,9,'jne still',13,'.exit:',13,9,'mcall -1',13
txt_but_3:
txt_key_1:
db 'align 4',13,'key:',13,9,'mcall 2',13
txt_key_2:
db 9,'jmp still',13
txt_key_3:
align 4
proc get_obj_id, p_obj:dword, txt_buf:dword
push eax ecx edx
mov eax,dword[p_obj]
sub eax,[tree2.data_info]
xor edx,edx
xor ecx,ecx
mov cx,word[tree2.info_size]
div ecx
mov edx,dword[txt_buf]
mov byte[edx],0
stdcall str_cat_value,edx,eax
pop edx ecx eax
ret
endp
;--- òåêñòîâûå ôóíêöèè ---
align 4
proc mem_clear, mem:dword, len:dword
push eax ecx edi
cld
xor al,al
mov edi, dword[mem]
mov ecx, dword[len]
repne stosb
pop edi ecx eax
ret
endp
align 4
proc str_cat, str1:dword, str2:dword
push eax ecx edi esi
mov esi,dword[str2]
stdcall str_len,esi
mov ecx,eax
inc ecx
mov edi,dword[str1]
stdcall str_len,edi
add edi,eax
cld
repne movsb
pop esi edi ecx eax
ret
endp
align 4
proc str_cat_value, str1:dword, value:dword
pushad
mov edi,[str1]
stdcall str_len,edi
add edi,eax
mov eax,[value]
call tl_convert_to_str
popad
ret
endp
;output:
; eax = strlen
align 4
proc str_len, str1:dword
mov eax,[str1]
@@:
cmp byte[eax],0
je @f
inc eax
jmp @b
@@:
sub eax,[str1]
ret
endp
;input:
; eax = value
; edi = string buffer
align 4
tl_convert_to_str:
pushad
stdcall mem_clear,edi,12
call .str
popad
ret
align 4
.str:
mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âõîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé
cmp eax,ecx ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
jb @f
xor edx,edx ;î÷èñòèòü edx
div ecx ;ðàçäåëèòü - îñòàòîê â edx
push edx ;ïîëîæèòü â ñòåê
;dec edi ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
call .str ;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
pop eax
@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
or al,0x30 ;äàííàÿ êîìàíäà êîðî÷å ÷åì äâå âûøå
stosb ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
ret