optimize and fix 't_edit'

git-svn-id: svn://kolibrios.org@6086 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-01-20 18:34:38 +00:00
parent 643e9a0c92
commit 8a4f974d14
3 changed files with 272 additions and 281 deletions

View File

@ -1,6 +1,6 @@
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj ; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS ; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 28.06.2014 IgorA ; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 20.01.2016 IgorA
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï ; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
;input: ;input:
@ -2124,190 +2124,190 @@ ted_text_colored:
;description: ;description:
; ”ã­ªæ¨ï ¤«ï ¯®¨áª  ¨ ¢ë¤¥«¥­¨ï ¯®¤á¢¥ç¥­ëå á«®¢ ; ”ã­ªæ¨ï ¤«ï ¯®¨áª  ¨ ¢ë¤¥«¥­¨ï ¯®¤á¢¥ç¥­ëå á«®¢
align 4 align 4
proc ted_text_find_sel_color proc ted_text_find_sel_color uses eax ebx ecx esi
locals locals
begPos dd ? ;­ ç «ì­ ï ¯®§¨æ¨ï begPos dd ? ;­ ç «ì­ ï ¯®§¨æ¨ï
endPos dd ? ;ª®­¥ç­ ï ¯®§¨æ¨ï endPos dd ? ;ª®­¥ç­ ï ¯®§¨æ¨ï
find db ? ;­ ©¤¥­® / ­¥ ­ ©¤¥­® find db ? ;­ ©¤¥­® / ­¥ ­ ©¤¥­®
f_color db ? ;¨­¤¥ªá æ¢¥â  ­ ©¤¥­®£® á«®¢  f_color db ? ;¨­¤¥ªá æ¢¥â  ­ ©¤¥­®£® á«®¢ 
endl endl
push eax ebx ecx esi
;eax = word_n ⥪ã騩 ­®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢  ¢ ᯨ᪥ ;eax = word_n ⥪ã騩 ­®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢  ¢ ᯨ᪥
;ebx = ¤«ï à §­ëå 楫¥© ;ebx = ¤«ï à §­ëå 楫¥©
;ecx = l_pos ¯®á«¥¤­¨© ­®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢  ¢ ᯨ᪥ ;ecx = l_pos ¯®á«¥¤­¨© ­®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢  ¢ ᯨ᪥
;esi = ¤«ï à §­ëå 楫¥©, ­®¬¥à ¯à®¢¥à塞®£® ᨬ¢®«  ¢ á«®¢¥ ;esi = ¤«ï à §­ëå 楫¥©, ­®¬¥à ¯à®¢¥à塞®£® ᨬ¢®«  ¢ á«®¢¥
mov dword[begPos],1 mov dword[begPos],1
mov dword[endPos],1 mov dword[endPos],1
mov byte[find],0 mov byte[find],0
mov byte[f_color],1 mov byte[f_color],1
@@: @@:
call ted_iterat_next call ted_iterat_next
cmp edx,ted_tex_1 cmp edx,ted_tex_1
jle @f jle @f
xor eax,eax xor eax,eax
mov al,byte[edx] mov al,byte[edx]
shl ax,2 ;eax*=4 shl ax,2 ;eax*=4
add eax,ted_arr_key_pos add eax,ted_arr_key_pos
mov eax,dword[eax] mov eax,dword[eax]
cmp eax,0 cmp eax,0
jl @b ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ jl @b ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){
mov ecx,eax mov ecx,eax
;while(l_pos<ted_key_words_count && Col[l_pos].Text[0]==Col[word_n].Text[0]) ;while(l_pos<ted_key_words_count && Col[l_pos].Text[0]==Col[word_n].Text[0])
.wh_1b: .wh_1b:
cmp ecx,ted_key_words_count cmp ecx,ted_key_words_count
jge .wh_1e jge .wh_1e
ColToIndexOffset ecx,esi ColToIndexOffset ecx,esi
mov bl,byte[esi] mov bl,byte[esi]
ColToIndexOffset eax,esi ColToIndexOffset eax,esi
cmp bl,byte[esi] cmp bl,byte[esi]
jne .wh_1e jne .wh_1e
inc ecx inc ecx
jmp .wh_1b jmp .wh_1b
.wh_1e: .wh_1e:
mov dword[begPos],edx ;bP=i; mov dword[begPos],edx ;bP=i;
mov esi,1 mov esi,1
align 4
.wh_2b: ;while(1){
call ted_iterat_next
.wh_2b: ;while(1){ ;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c)
call ted_iterat_next .wh_3b:
cmp ecx,eax
jle .wh_3e
dec ecx
ColToIndexOffset ecx,ebx
inc ecx
;cmp byte[ebx+esi],byte[edx]
mov bl,byte[ebx+esi]
cmp bl,byte[edx]
je .wh_3e
dec ecx
jmp .wh_3b
.wh_3e:
;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c) ColToIndexOffset eax,ebx
.wh_3b: cmp byte[ebx+esi],0
cmp ecx,eax jne .if_0 ;if(Col[word_n].Text[pos]==0){
jle .wh_3e mov dword[endPos],edx ;eP=i;
dec ecx ColToIndexOffset eax,ebx
ColToIndexOffset ecx,ebx mov bl,byte[ebx+MAX_COLOR_WORD_LEN+7]
inc ecx mov byte[f_color],bl ;f_color=Col[word_n].color;
;cmp byte[ebx+esi],byte[edx]
mov bl,byte[ebx+esi]
cmp bl,byte[edx]
je .wh_3e
dec ecx
jmp .wh_3b
.wh_3e:
ColToIndexOffset eax,ebx mov byte[find],1
cmp byte[ebx+esi],0 ColToIndexOffset eax,ebx ;... ebx = Col[word_n]
jne .if_0 ;if(Col[word_n].Text[pos]==0){ mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4]
mov dword[endPos],edx ;eP=i; cmp bl,0 ;if(Col[word_n].wwo)
ColToIndexOffset eax,ebx je .if_2n
mov bl,byte[ebx+MAX_COLOR_WORD_LEN+7] push edx
mov byte[f_color],bl ;f_color=Col[word_n].color; mov edx,dword[begPos]
call ted_iterat_perv
mov byte[find],1 btr bx,0 ;1-1
ColToIndexOffset eax,ebx ;... ebx = Col[word_n] jae .if_3e ;if(Col[word_n].wwo&1)
mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4] ;u1= !(isalnum(cont_s)||cont_s=='_')
cmp bl,0 ;if(Col[word_n].wwo) call isalnum
je .if_2n jae .if_3e
push edx mov byte[find],0
mov edx,dword[begPos] jmp .if_4e
call ted_iterat_perv .if_3e:
btr bx,0 ;1-1 btr bx,3 ;4-1
jae .if_3e ;if(Col[word_n].wwo&1) jae .if_4e ;if(Col[word_n].wwo&8)
;u1= !(isalnum(cont_s)||cont_s=='_') ;u1= !isalpha(cont_s);
call isalnum call isalpha
jae .if_3e jae .if_4e
mov byte[find],0 mov byte[find],0
.if_3e: .if_4e:
btr bx,3 ;4-1 mov edx,dword[endPos]
jae .if_4e ;if(Col[word_n].wwo&8) ;call ted_iterat_next
;u1= !isalpha(cont_s);
call isalpha
jae .if_4e
mov byte[find],0
.if_4e:
mov edx,dword[endPos] btr bx,1 ;2-1
; call ted_iterat_next jae .if_5e ;if(Col[word_n].wwo&2)
;u1= !(isalnum(cont_s)||cont_s=='_')
call isalnum
jae .if_5e
mov byte[find],0
jmp .if_6e
.if_5e:
btr bx,1 ;2-1 btr bx,4 ;5-1
jae .if_5e ;if(Col[word_n].wwo&2) jae .if_6e ;if(Col[word_n].wwo&16)
;u1= !(isalnum(cont_s)||cont_s=='_') ;u1= !isalpha(cont_s);
call isalnum call isalpha
jae .if_5e jae .if_6e
mov byte[find],0 mov byte[find],0
.if_5e: .if_6e:
btr bx,4 ;5-1 btr bx,2 ;3-1
jae .if_6e ;if(Col[word_n].wwo&16) jae .if_7e ;if(Col[word_n].wwo&4)
;u1= !isalpha(cont_s); ColToIndexOffset eax,ebx
call isalpha mov bx,word[ebx+MAX_COLOR_WORD_LEN+5]
jae .if_6e call ted_iterat_next_pos_char
mov byte[find],0 cmp edx,ted_tex_1
.if_6e: jle .if_7e
mov dword[endPos],edx
.if_7e:
btr bx,2 ;3-1 pop edx
jae .if_7e ;if(Col[word_n].wwo&4) .if_2n:
ColToIndexOffset eax,ebx ;if(i!=1){ // ­¥ ª®­¥æ ¤®ªã¬¥­â 
mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] ; cont_s=tex[eP].c;
call ted_iterat_next_pos_char ; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // ­¥ ¡ãª¢.-ç¨á«. ᨬ¢®«
cmp edx,ted_tex_1 ; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ­¥ ç¨á«. ᨬ¢®«
jle .if_7e ; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc);
mov dword[endPos],edx
.if_7e:
pop edx cmp eax,ecx
.if_2n: je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç­® ¯®á«¥¤­¥¥
; if(i!=1){ // ­¥ ª®­¥æ ¤®ªã¬¥­â  .if_0:
; cont_s=tex[eP].c;
; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // ­¥ ¡ãª¢.-ç¨á«. ᨬ¢®«
; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ­¥ ç¨á«. ᨬ¢®«
; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc);
cmp eax,ecx cmp edx,ted_tex_1
je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç­® ¯®á«¥¤­¥¥ jle .wh_2e ;if(i==1) break;
.if_0:
cmp edx,ted_tex_1 ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c)
jle .wh_2e ;if(i==1) break; .wh_4b:
cmp ecx,eax
jle .wh_4e
ColToIndexOffset eax,ebx
;cmp byte[ebx+esi],byte[edx]
mov bl,byte[ebx+esi]
cmp bl,byte[edx]
je .wh_4e
inc eax
jmp .wh_4b
.wh_4e:
;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) cmp eax,ecx
.wh_4b: je .wh_2e;if(word_n==l_pos) break;
cmp ecx,eax inc esi ;pos++;
jle .wh_4e jmp .wh_2b
ColToIndexOffset eax,ebx .wh_2e:
;cmp byte[ebx+esi],byte[edx]
mov bl,byte[ebx+esi]
cmp bl,byte[edx]
je .wh_4e
inc eax
jmp .wh_4b
.wh_4e:
cmp eax,ecx cmp byte[find],1 ;if(fnd)break;
je .wh_2e;if(word_n==l_pos) break; je @f
inc esi ;pos++; mov edx,dword[begPos];i=bP;
jmp .wh_2b jmp @b
.wh_2e: @@:
cmp byte[find],1 ;if(fnd)break; cmp byte[find],1
je @f jne .if_1e ;if(fnd){ // ¢ë¤¥«¥­¨¥ ­ ©¤¥­®£® ⥪áâ 
mov edx,dword[begPos];i=bP; ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){
jmp @b mov eax,dword[begPos]
@@: mov bl,byte[f_color]
mov byte[eax+1],bl ;tex[bP].col=f_color;
mov eax,dword[endPos]
mov byte[eax+1],0xff ;tex[eP].col=255;
;return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®­æ  ¢å®¦¤¥­¨ï
mov edx,dword[endPos]
call ted_get_text_perv_pos
jmp @f
.if_1e:
mov edx,ted_tex
@@:
cmp byte[find],1 ret
jne .if_1e ;if(fnd){ // ¢ë¤¥«¥­¨¥ ­ ©¤¥­®£® ⥪áâ 
; if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){
mov eax,dword[begPos]
mov bl,byte[f_color]
mov byte[eax+1],bl ;tex[bP].col=f_color;
mov eax,dword[endPos]
mov byte[eax+1],0xff ;tex[eP].col=255;
; return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®­æ  ¢å®¦¤¥­¨ï
mov edx,dword[endPos]
call ted_get_text_perv_pos
jmp @f
.if_1e:
mov edx,ted_tex
@@:
pop esi ecx ebx eax
ret
endp endp
;input: ;input:
@ -2315,62 +2315,59 @@ endp
;output: ;output:
; cf=1 if symbol is... ; cf=1 if symbol is...
align 4 align 4
tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;output:
; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ , æ¨äà  ¨«¨ '_'
align 4 align 4
isalnum: isalnum:
push eax ebx push eax ebx
mov al,byte[edx] ;al=offset movzx eax,byte[edx] ;al=offset
shr al,3 shr eax,3
and eax,11111b lea ebx,[tab_all_num]
lea ebx,[tab_all_num] add ebx,eax
add ebx,eax movzx ax,byte[edx] ;al=bit
mov ah,byte[ebx] and ax,111b
mov al,byte[edx] ;al=bit bt word[ebx],ax
and ax,111b pop ebx eax
mov bx,word[ebx] ret
btr bx,ax
pop ebx eax ;output:
ret ; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢  ¨«¨ '_'
align 4 align 4
isalpha: isalpha:
push eax ebx push eax ebx
mov al,byte[edx] ;al=offset movzx eax,byte[edx] ;al=offset
shr al,3 shr eax,3
and eax,11111b lea ebx,[tab_alpha]
lea ebx,[tab_alpha] add ebx,eax
add ebx,eax movzx ax,byte[edx] ;al=bit
mov ah,byte[ebx] and ax,111b
mov al,byte[edx] ;al=bit bt word[ebx],ax
and ax,111b pop ebx eax
mov bx,word[ebx] ret
btr bx,ax
pop ebx eax
ret
align 4 align 4
proc ted_show_help_f1, edit:dword proc ted_show_help_f1 uses eax edx edi, edit:dword
push eax edx edi mov edi,dword[edit]
mov edi,dword[edit]
call ted_get_pos_by_cursor call ted_get_pos_by_cursor
push edx push edx
call ted_iterat_next_color_tag call ted_iterat_next_color_tag
mov eax,edx mov eax,edx
pop edx pop edx
call ted_iterat_perv_color_tag call ted_iterat_perv_color_tag
cmp eax,ted_tex cmp eax,ted_tex
jle @f jle @f
cmp edx,ted_tex_1 cmp edx,ted_tex_1
jle @f jle @f
stdcall ted_find_help_id,eax stdcall ted_find_help_id,eax
@@: @@:
;call ted_draw_main_cursor ;call ted_draw_main_cursor
call ted_draw_help_f1 call ted_draw_help_f1
pop edi edx eax ret
ret
endp endp
;input: ;input:

View File

@ -43,7 +43,7 @@ ted_but_new_file:
call On_NewFile call On_NewFile
.ret_f: .ret_f:
mov byte[openfile_path],0 mov byte[openfile_path],0
mcall 71,1,hed mcall SF_SET_CAPTION,1,hed
pop ebx eax pop ebx eax
ret ret
@ -142,45 +142,47 @@ ted_but_open_file:
@@: @@:
cmp [OpenDialog_data.status],1 cmp [OpenDialog_data.status],1
jne .ret_f jne .ret_f
stdcall auto_open_syntax,[OpenDialog_data.openfile_path]
;¨é¥¬ ¥áâì «¨ ä ©« ¯®¤á¢¥âª¨ ¤«ï ®âªà뢠¥¬®£® ⥪á⮢®£® ä ©« 
mov esi,[OpenDialog_data.openfile_path]
call strlen
mov edx,openfile_path
add edx,eax
.f_beg:
cmp byte[edx],'.'
je .found
dec edx
cmp edx,openfile_path
jg .f_beg
.found:
inc edx ;edx - 㪠§ â¥«ì ­  à áè¨à¥­¨¥ ®âªàë⮣® ä ©« 
mov ebx,synt_auto_open
.cycle_0:
add ebx,32
stdcall strcmp,ebx,edx ;áà ¢­¨¢ ¥¬ à áè¨à¥­¨¥ ®âªàë⮣® ä ©«  á® §­ ç¥­¨ï¬¨ ®âªàëâ묨 á ini ä ©« 
test eax,eax
jz .ok
add ebx,32
cmp byte[ebx],0
jne .cycle_0
jmp .end_0
.ok: ;®âªàë⨥ ä ©«  ¯®¤á¢¥âª¨ ¢ § ¢¨á¨¬®á⨠®â ­ ©¤¥­­®£® à áè¨à¥­¨ï
sub ebx,32
;mov ecx,ebx
;mcall 71,1
call open_unpac_synt_file
.end_0:
stdcall [ted_open_file], tedit0,run_file_70,openfile_path stdcall [ted_open_file], tedit0,run_file_70,openfile_path
call ted_messages_after_open_file call ted_messages_after_open_file
.ret_f: .ret_f:
popad popad
ret ret
proc auto_open_syntax, of_path:dword
pushad
;¨é¥¬ ¥áâì «¨ ä ©« ¯®¤á¢¥âª¨ ¤«ï ®âªà뢠¥¬®£® ⥪á⮢®£® ä ©« 
mov esi,[of_path]
call strlen
mov edx,[of_path]
add edx,eax
.f_beg:
cmp byte[edx],'.'
je .found
dec edx
cmp edx,[of_path]
jg .f_beg
.found:
inc edx ;edx - 㪠§ â¥«ì ­  à áè¨à¥­¨¥ ®âªàë⮣® ä ©« 
mov ebx,synt_auto_open
.cycle_0:
add ebx,32
stdcall strcmp,ebx,edx ;áà ¢­¨¢ ¥¬ à áè¨à¥­¨¥ ®âªàë⮣® ä ©«  á® §­ ç¥­¨ï¬¨ ®âªàëâ묨 á ini ä ©« 
test eax,eax
jz .ok
add ebx,32
cmp byte[ebx],0
jne .cycle_0
jmp .end_0
.ok: ;®âªàë⨥ ä ©«  ¯®¤á¢¥âª¨ ¢ § ¢¨á¨¬®á⨠®â ­ ©¤¥­­®£® à áè¨à¥­¨ï
sub ebx,32
stdcall open_unpac_synt_file,ebx
.end_0:
popad
ret
endp
;description: ;description:
; äã­ªæ¨ï á®åà ­¥­¨ï ä ©«  á ¢ë§®¢®¬ ®ª­  ¤¨ «®£  ; äã­ªæ¨ï á®åà ­¥­¨ï ä ©«  á ¢ë§®¢®¬ ®ª­  ¤¨ «®£ 
align 4 align 4
@ -269,8 +271,7 @@ proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
jne @f jne @f
stdcall dword[tl_node_get_data], tree1 stdcall dword[tl_node_get_data], tree1
mov [fn_col_option],eax mov [fn_col_option],eax
mov ebx,eax stdcall open_unpac_synt_file,eax
call open_unpac_synt_file
cmp ebx,-1 cmp ebx,-1
je @f je @f
@ -282,13 +283,13 @@ endp
;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á  ;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
;input: ;input:
; ebx - 㪠§ â¥«ì ­  ¨¬ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á  (¡¥§ ¯ã⨠¨ ¯ ¯ª¨ info) ; f_name - 㪠§ â¥«ì ­  ¨¬ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á  (¡¥§ ¯ã⨠¨ ¯ ¯ª¨ info)
;output: ;output:
; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©«  ; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
; ecx - à §àãè ¥âáï ; ecx - à §àãè ¥âáï
align 4 align 4
open_unpac_synt_file: proc open_unpac_synt_file uses eax edi esi, f_name:dword
push eax edi esi mov ebx,[f_name]
mov edi,last_open_synt_file mov edi,last_open_synt_file
stdcall strcmp,ebx,edi ;áà ¢­¨¢ ¥¬ ¨¬ï ¯®¤ª«î祭­®£® ä ©«  á ¯®¤ª«î祭­ë¬ à ­¥¥ ä ©«®¬ stdcall strcmp,ebx,edi ;áà ¢­¨¢ ¥¬ ¨¬ï ¯®¤ª«î祭­®£® ä ©«  á ¯®¤ª«î祭­ë¬ à ­¥¥ ä ©«®¬
test eax,eax test eax,eax
@ -296,14 +297,14 @@ push eax edi esi
;ª®¯¨à㥬 ¨¬ï ¯®¤ª«î祭­®£® ä ©«  (¤«ï ¨§¡¥¦ ­¨ï ¯®¢â®à­ëå ¯®¤ª«î祭¨©) ;ª®¯¨à㥬 ¨¬ï ¯®¤ª«î祭­®£® ä ©«  (¤«ï ¨§¡¥¦ ­¨ï ¯®¢â®à­ëå ¯®¤ª«î祭¨©)
mov esi,ebx mov esi,ebx
mov ecx,32 mov ecx,32/4
cld cld
rep movsb rep movsd
copy_path ebx,fn_syntax_dir,syntax_path,0 copy_path ebx,fn_syntax_dir,syntax_path,0
copy_path syntax_path,sys_path,file_name,0 copy_path syntax_path,sys_path,file_name,0
mov edi, tedit0 mov edi, tedit0
mov [run_file_70.Function], 0 mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0 mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0 mov [run_file_70.Flags], 0
mov ecx, ted_syntax_file_size mov ecx, ted_syntax_file_size
@ -311,7 +312,7 @@ push eax edi esi
m2m dword[run_file_70.Buffer], ted_syntax_file m2m dword[run_file_70.Buffer], ted_syntax_file
mov byte[run_file_70+20], 0 mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name mov [run_file_70.FileName], file_name
mcall 70, run_file_70 mcall SF_FILE, run_file_70
cmp ebx,-1 cmp ebx,-1
jne .end_0 jne .end_0
call ted_on_init_synt_err call ted_on_init_synt_err
@ -337,8 +338,8 @@ push eax edi esi
.end_unpack: .end_unpack:
stdcall [ted_init_syntax_file], tedit0 stdcall [ted_init_syntax_file], tedit0
@@: @@:
pop esi edi eax
ret ret
endp
;description: ;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª  ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
@ -403,7 +404,7 @@ but_find_key_w:
cmp byte[wnd_k_words_run],0 cmp byte[wnd_k_words_run],0
jne @f jne @f
pushad pushad
mcall 51,1,prop_start,thread_coords mcall SF_CREATE_THREAD,1,prop_start,thread_coords
popad popad
@@: @@:
ret ret

View File

@ -3,11 +3,7 @@
use32 use32
org 0x0 org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x01 dd 1, start, i_end, mem, stacktop
dd start
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd file_name ; command line dd file_name ; command line
dd sys_path dd sys_path
@ -21,6 +17,7 @@ include '../../proc32.inc'
;include '../../config.inc' ;include '../../config.inc'
include '../../macros.inc' include '../../macros.inc'
include '../../dll.inc' include '../../dll.inc'
include '../../KOSfuncs.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../system/desktop/trunk/kglobals.inc' include '../../system/desktop/trunk/kglobals.inc'
@ -59,14 +56,14 @@ macro load_image_file path,buf,size
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax mov [buf],eax
mov [run_file_70.Function], 0 mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0 mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0 mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size mov [run_file_70.Count], dword size
m2m [run_file_70.Buffer], eax m2m [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0 mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name mov [run_file_70.FileName], file_name
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff cmp ebx,0xffffffff
je @f je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
@ -84,14 +81,14 @@ icon_tl_sys dd 0 ;㪠
align 4 align 4
start: start:
mcall 48,3,sc,sizeof.sys_colors_new mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.sys_colors_new
mcall 68,11 mcall SF_SYS_MISC,SSF_HEAP_INIT
or eax,eax or eax,eax
jz button.exit jz button.exit
mcall 66,1,1 ;scan code mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
mcall 40,0xC0000027 mcall SF_SET_EVENTS_MASK,0xC0000027
mov esi,file_name mov esi,file_name
call strlen call strlen
@ -107,7 +104,7 @@ mov ebp,lib0
.test_lib_open: .test_lib_open:
cmp dword [ebp+ll_struc_size-4],0 cmp dword [ebp+ll_struc_size-4],0
jz @f jz @f
mcall -1 ;exit not correct mcall SF_TERMINATE_PROCESS ;exit not correct
@@: @@:
add ebp,ll_struc_size add ebp,ll_struc_size
cmp ebp,load_lib_end cmp ebp,load_lib_end
@ -209,7 +206,7 @@ mov ebp,lib0
mov dword[tree1.data_img],eax mov dword[tree1.data_img],eax
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á  copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
mcall 70,tree_file_struct mcall SF_FILE,tree_file_struct
cmp ebx,-1 cmp ebx,-1
je .end_dir_init je .end_dir_init
@ -272,13 +269,13 @@ mov ebp,lib0
@@: @@:
;--- load color option file --- ;--- load color option file ---
mov ebx,dword[fn_col_option] stdcall open_unpac_synt_file,[fn_col_option]
call open_unpac_synt_file
;--- get cmd line --- ;--- get cmd line ---
cmp byte[openfile_path+3],0 ;openfile_path cmp byte[openfile_path+3],0 ;openfile_path
je @f ;if file names exist je @f ;if file names exist
mov esi,openfile_path mov esi,openfile_path
stdcall auto_open_syntax,esi
call strlen ;eax=strlen call strlen ;eax=strlen
call but_no_msg_OpenFile call but_no_msg_OpenFile
@@: @@:
@ -291,7 +288,7 @@ red_win:
align 4 align 4
still: still:
mcall 10 mcall SF_WAIT_EVENT
cmp dword[exit_code],1 cmp dword[exit_code],1
je button.exit je button.exit
@ -309,28 +306,24 @@ still:
align 4 align 4
draw_window: draw_window:
mcall 12,1 mcall SF_REDRAW,SSF_BEGIN_DRAW
mov edx,[sc.work] mov edx,[sc.work]
or edx,0x73000000 or edx,0x73000000
mov edi,hed mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed
mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4]
mcall 9,procinfo,-1 mcall SF_THREAD_INFO,procinfo,-1
mov edi,tedit0 ;§­ ç¥­¨¥ edi ­ã¦­® ¤«ï EvSize ¨ ted_wnd_t mov edi,tedit0 ;§­ ç¥­¨¥ edi ­ã¦­® ¤«ï EvSize ¨ ted_wnd_t
call EvSize call EvSize
movzx ebx,word[procinfo.client_box.width] movzx ebx,word[procinfo.client_box.width]
inc bx inc bx
mcall 13,,ted_wnd_t ;¢¥àå­¨© ¯àאַ㣮«ì­¨ª, ¤«ï ®ç¨á⪨ ¢¥àå­¥© ¯ ­¥«¨ mcall SF_DRAW_RECT,,ted_wnd_t ;¢¥àå­¨© ¯àאַ㣮«ì­¨ª, ¤«ï ®ç¨á⪨ ¢¥àå­¥© ¯ ­¥«¨
call draw_but_toolbar call draw_but_toolbar
stdcall [kmainmenu_draw], [main_menu] stdcall [kmainmenu_draw], [main_menu]
stdcall [ted_draw], tedit0 stdcall [ted_draw], tedit0
mcall 12,2 mcall SF_REDRAW,SSF_END_DRAW
ret ret
align 4 align 4
@ -363,7 +356,7 @@ endp
align 4 align 4
key: key:
mcall 66,3 ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
xor esi,esi xor esi,esi
mov ecx,1 mov ecx,1
test al,0x03 ;[Shift] test al,0x03 ;[Shift]
@ -385,8 +378,8 @@ key:
or esi,KM_NUMLOCK or esi,KM_NUMLOCK
@@: @@:
mcall 26,2,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë
mcall 2 ;¯®«ãç ¥¬ ª®¤ ­ ¦ â®© ª« ¢¨è¨ mcall SF_GET_KEY
stdcall [tl_key], tree1 stdcall [tl_key], tree1
test word [edit2.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬ test word [edit2.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
@ -415,7 +408,7 @@ key:
align 4 align 4
button: button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨ mcall SF_GET_BUTTON
cmp ah,3 cmp ah,3
jne @f jne @f
call ted_but_new_file call ted_but_new_file
@ -531,7 +524,7 @@ button:
stdcall [ted_delete], tedit0 stdcall [ted_delete], tedit0
stdcall [tl_data_clear], tree1 stdcall [tl_data_clear], tree1
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0 edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0