Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6731 → Rev 6732

/programs/cmm/vfc/32user32.h
0,0 → 1,154
 
 
:static int __wsprintfproc;
:static int cdecl __wsprintf(int buff,mask,...){
char buffer[MAX_PATH];
char bufnum[32];
int bufferlen;
int param;
int length;
int pad;
 
struct _wsprintf_mf{
int precision;
int width;
int minus ;
int plus ;
int diez ;
int zero ;
byte upcase ;
byte _signed;//
}mf;
 
$push EBX,ESI,EDI;
param=#mask[sizeof(mask)];
length=0;
EDX=mask;
EBX=buff;
for(;;){
mf=0;
mf.precision=0x7FFF;
REPEATSMALL:
if(!DSCHAR[EDX]){
AL=0;
$call __wsprintfproc;
$pop EDI,ESI,EBX;
return length;
}
if(DSCHAR[EDX]!='%'){
WRITECHAR: AL=DSCHAR[EDX];$call __wsprintfproc; EDX++;GOTO REPEATSMALL;
}
 
GETMASK:
EDX++;
SWITCH(DSCHAR[EDX]){
CASE '-': mf.minus++;goto GETMASK;
CASE '+': mf.plus ++;goto GETMASK;
CASE '#': mf.diez ++;goto GETMASK;
CASE '0': mf.zero ++;EDX++;
}
 
WHILE(DSCHAR[EDX]>='0')&&(DSCHAR[EDX]<='9'){
$push EDX;mf.width=mf.width*10+DSCHAR[EDX]-'0';$pop EDX;EDX++;
}
if(DSCHAR[EDX]=='.'){
mf.precision=0;
GETPRECISION:
EDX++;
if(DSCHAR[EDX]>='0')
&&(DSCHAR[EDX]<='9'){
$push EDX;mf.precision=mf.precision*10+DSCHAR[EDX]-'0';$pop EDX;
GOTO GETPRECISION;
}
}
if(DSCHAR[EDX]=='l'){
EDX++;
}
if(DSCHAR[EDX]=='h'){
EDX++;
}
if(DSCHAR[EDX]<'a'){mf.upcase=1;}
SWITCH(DSCHAR[EDX]|0x20){
CASE 'c': buffer=DSCHAR[param];bufferlen=1;goto FORMAT;
CASE 's': if(!DSDWORD[param])DSDWORD[param]="(null)";//??????
FOR(bufferlen=0;bufferlen<mf.precision;bufferlen++){
AL=DSCHAR[DSDWORD[param]+bufferlen];
if(!AL)BREAK;
buffer[bufferlen]=AL;
}
goto FORMAT;
}
 
//á ᨬ¢®«ì­ë¬¨ ¯®ª®­ç¨«¨. ⥯¥àì ç¨á«®¢ë¥
if(mf.precision==0x7FFF){mf.precision=mf.width;}
if(!mf.precision)mf.precision=1;
if(DSCHAR[EDX]|0x20=='x'){
$push EDX;
EDI=0;//cnt
EDX=DSDWORD[param];
WHILE(EDX){
AL=DL&0xF+0x30;if(AL>'9'){AL+='A'-'9'-1;if(!mf.upcase)AL|=0x20;}
bufnum[EDI]=AL;EDI++;EDX>>=4;
}
$pop EDX;
WHILE(EDI<mf.precision){bufnum[EDI]='0';EDI++;}
if(mf.diez){bufnum[EDI]=DSCHAR[EDX];EDI++;bufnum[EDI]='0';EDI++;}
FOR(bufferlen=0;EDI;bufferlen++){
EDI--;buffer[bufferlen]=bufnum[EDI];
}
goto FORMAT;
}
switch(DSCHAR[EDX]){
CASE 'i':
CASE 'd': $push EDX;EDX=DSDWORD[param];
if(int EDX<0){-EDX;mf._signed++;}
GOTO WRITEINT;
CASE 'u': $push EDX;mf.plus=0;EDX=DSDWORD[param];
WRITEINT:
EDI=0;//cnt
WHILE(EDX){
EAX=0;EDX><EAX;EAX/=10;EDX><EAX;bufnum[EDI]=AL+'0';EDI++;
}
WHILE(EDI<mf.precision){bufnum[EDI]='0';EDI++;}
if(mf._signed){bufnum[EDI]='-';EDI++;}
ELSE
if(mf.plus){bufnum[EDI]='+';EDI++;}
FOR(bufferlen=0;EDI;bufferlen++){
EDI--;buffer[bufferlen]=bufnum[EDI];
}
$pop EDX;
FORMAT:
EDX++;
param+=sizeof(int);
pad=mf.width-bufferlen;if(pad<0)pad=0;
if(!mf.minus)$call FRM;
FOR(EDI=0;EDI<bufferlen;EDI++){AL=buffer[EDI];$call __wsprintfproc;}
if(mf.minus)$call FRM;
BREAK;
default:
goto WRITECHAR;
}
}//for(;;)
FRM: WHILE(pad){AL=' ';$call __wsprintfproc;pad--;}$ret;
}
 
:int cdecl wsprintf(...)inline{
__wsprintfproc=#WSP;
goto __wsprintf;
WSP: DSCHAR[EBX]=AL;EBX++;$ret;
}
 
:void FillMemory(int dest,len,byt){
EDI = dest;
ECX = len;
AL = byt;
$cld $rep $stosb
}
 
//#define CopyMemory memmov
:void CopyMemory(int dest,src,len){
EDI = dest;
ESI = src;
ECX = len;
$cld $rep $movsb
}
/programs/cmm/vfc/Tupfile.lua
0,0 → 1,6
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("vfc.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "vfc.com")
/programs/cmm/vfc/build.bat
0,0 → 1,5
@del vfc
@c-- vfc.c
@move vfc.com vfc
@del warning.txt
@pause
/programs/cmm/vfc/if.h
0,0 → 1,181
int verthoriz=0;
int shownums=1;
 
char str[MAX_PATH];
word attr[MAX_PATH];
 
printstrat(int x,y,size,_text,_attr)
{
int i;
for (i=0; i<size; i++)
{
con_set_flags stdcall (ESBYTE[i*2+_attr]);
con_set_cursor_pos stdcall (x+i,y);
con_write_string stdcall (_text+i, 1);
}
}
 
 
drawline(int x,y,width,linex,s1,s2,ln)
{
int i;
int s1l;
int s2l;
int c1,c2;
char temp[10];
int x2,width2;
 
 
s1l=-1;
s2l=-1;
if(s1!=-1)s1l=strlen(s1);
if(s2!=-1)s2l=strlen(s2);
 
FillMemory(#attr,width*2,0x1F);
str[0]='º'; str[x+width-1]='º';
 
if(s1==-1)
{
FillMemory(#str[1],width-2,'ú');
FillMemory(#attr[2],width-2*2,7);
}else{//áâப  ¯à¨áãâáâ¢ã¥â
x2=1;
width2=width;
if(shownums)
{
wsprintf(#temp,"%6d",ln+1);
for(i=0;i<6;i++)
{
str[i+1]=temp[i];
attr[i+1]=0x19;
}
str[7]='³';
x2+=7;
width2-=7;
}
if(s1>0)&&(s2>0)&&(!strcmp(s1,s2))
{//áâப¨ ᮢ¯ ¤ îâ
for(i=0;i<width2-2;i++)
if(i+linex<s1l)str[x2+i]=DSBYTE[s1+i+linex];else str[x2+i]=' ';
}else
{
for(i=0;i<width2-2;i++)
{
if(i+linex<s1l)c1=DSBYTE[s1+i+linex]; else c1=' ';
if(i+linex<s2l)c2=DSBYTE[s2+i+linex]; else c2=' ';
str[x2+i]=c1;
if(c1==c2)attr[x2+i]=0x4F;else attr[x2+i]=0x4E;
}
}
}
printstrat(x,y,width,#str,#attr);
}
 
drawborder(dword x1,y1,xs1,ys1,fname,line)
char temp[MAX_PATH];
int titlelen;
{
int i,j;
 
FillMemory(#str,xs1,'Í');
FillMemory(#attr,xs1*2,0x1F);
 
str[0]='È'; str[xs1-1]='¼';
printstrat(x1,y1+ys1-1,xs1,#str,#attr); //­¨¦­ïï áâà®çª 
 
str[0]='É'; str[xs1-1]='»';
titlelen=xs1-4;
if(!shownums)titlelen-=8;
if(strlen(fname)>titlelen)wsprintf(#temp," ...%s ",strlen(fname)+fname-titlelen+3);
else wsprintf(#temp," %s ",fname);
for(i=0;temp[i];i++){ str[i+1]=temp[i]; attr[i+1]=0x1E; }
if(!shownums)
{
wsprintf(#temp,"[%6d]",line);
CopyMemory(xs1-9+#str,#temp,8);
FillMemory(xs1-8*2+#attr,12,0x19);
}
printstrat(x1,y1,xs1,#str,#attr);
}
 
printpanel(dword line,linex ,x1,y1,xs1,ys1 ,x2,y2,xs2,ys2)
{
int i,j;
int s,d,sl,dl;
int line1,line2;
 
for(j=line;j<srcfilenums.Count;j++){ s=srcfilenums.At(j); if(s!=-1)BREAK; }
if(s==-1)s=srcfilelines.Count-1;
drawborder(x1,y1,xs1,ys1,srcfilename,s+1);
 
for(j=line;j<dstfilenums.Count;j++){ d=dstfilenums.At(j); if(d!=-1)BREAK; }
if(d==-1)d=dstfilelines.Count-1;
drawborder(x2,y2,xs2,ys2,dstfilename,d+1);
for(j=0;j<ys1-2;j++)
{
if(j+line<srcfilenums.Count)s=srcfilenums.At(j+line); else s=-1;
line1=s;
if(s!=-1)s=srcfilelines.At(s);
if(j+line<dstfilenums.Count)d=dstfilenums.At(j+line); else d=-1;
line2=d;
if(d!=-1)d=dstfilelines.At(d);
drawline(x1,y1+j+1,xs1,linex,s,d,line1);
drawline(x2,y2+j+1,xs2,linex,d,s,line2);
}
}
 
 
ifinit()
int linenum=0;
int linex=0;
int ys;
int sbi_x, sbi_y;
{
load_dll(libConsole, #con_init, 0);
con_init stdcall (122, 40, 122, 800, #window_title);
 
linenum=diffs.At(0);
 
sbi_x = 122;
sbi_y = 800;
 
sbi_y--;
ys=sbi_y-2;
 
if(linenum+ys>srcfilenums.Count)linenum=srcfilenums.Count-ys;
if(linenum<0) linenum=0;
 
@redraw:
if(!verthoriz)
{
printpanel(linenum,linex
,0,0
,sbi_x/2 ,sbi_y
,sbi_x/2 ,0
,sbi_x/2 ,sbi_y
);
ys=sbi_y-2;
}
else
{
printpanel(linenum,linex
,0,0
,sbi_x ,sbi_y/2
,0 ,sbi_y/2
,sbi_x ,sbi_y/2
);
if(sbi_y&1)
{
FillMemory(#str,sbi_x,'°');
FillMemory(#attr,sbi_x*2,0);
printstrat(0,sbi_y-1,sbi_x,#str,#attr);
}
ys=sbi_y/2-2;
}
 
if (!ys) goto redraw;
else {
con_set_cursor_pos stdcall (2,0);
ExitProcess();
}
}
/programs/cmm/vfc/objects.h
0,0 → 1,182
 
 
struct TCollection{
int Count;//itemcunt
int Delta;//increase buffer Delta
int Items;//pointer to array of item pointers
int Limit;//currently allocated size (in elements) of Items list
 
TCollection( int ALimit,ADelta );
~TCollection( void );
 
int At( int Index );
void AtDelete( int Index );
void AtFree( int Index );
void AtInsert( int Index, Item );
void DeleteAll( void );
void Free( int Item );
void FreeAll( void );
void FreeItem( int Item );
void Insert( int Item );
void SetLimit( int ALimit );
};
 
:int TCollection::At( int Index )
{
return DSDWORD[ Index*sizeof(int)+Items ];
}
 
:void TCollection::AtDelete( int Index )
{
// if(Index<0)||(Index>=Count){/*Error(coIndexError);*/return;}
ECX = Count-Index-1;
EDI = Index*sizeof(int)+Items; ESI = EDI+4; $cld; $rep;$movsd;
Count --;
}
 
:void TCollection::AtFree( int Index )
{
int Item = At( Index);
AtDelete( Index );
FreeItem( Item );
}
 
:void TCollection::AtInsert( int Index, Item )
{
$pushfd
IF( Count == Limit )
{
SetLimit( Count+Delta );
}
ECX = Count-Index;
EDI = Count*sizeof(int)+Items;
ESI = EDI-4; $std $rep $movsd $cld
DSDWORD[ EDI ] = Item;
Count ++;
$popfd
}
 
:void TCollection::DeleteAll()
{
Count=0;
}
 
:void TCollection::Free( int Item )
{
Delete( Item );
FreeItem( Item );
}
 
:void TCollection::FreeAll( void )
{
int I;
FOR( I = 0; I < Count; I ++ )FreeItem( At(I) );
Count = 0;
}
 
:void TCollection::FreeItem( int Item )
{
IF( Item )free( Item );//+++Dispose(PObject(Item), Done);
}
 
:void TCollection::Insert( int Item )
{
AtInsert( Count, Item );
}
 
:void TCollection::SetLimit( int ALimit )
{
int AItems;
 
IF( ALimit < Count )ALimit = Count;
IF( ALimit != Limit )
{
IF( !ALimit ) AItems = 0;
ELSE
{
AItems = malloc(ALimit*sizeof(int) );
IF( Count )&&( Items )
{
CopyMemory( AItems, Items, Limit*sizeof(int) );
}
}
IF( Limit )free( Items );
Items = AItems;
Limit = ALimit;
}
}
 
:TCollection::TCollection( int ALimit, ADelta )
{
Items = 0;
Count = 0;
Limit = 0;
Delta = ADelta;
SetLimit( ALimit );
return this;
}
 
:TCollection::~TCollection( void )
{
FreeAll();
SetLimit(0);
}
 
struct TSortedCollection:TCollection
{
int comparemethod;
int Duplicates;
 
TSortedCollection( int ALimit, ADelta );
 
int Compare( int Key1, Key2 );
void Insert( int Item );
int Search( int Key, Index );
};
 
:int TSortedCollection::Compare( int Key1, Key2 )
{
strcmp( Key1, Key2 );
}
 
:TSortedCollection::TSortedCollection( int ALimit, ADelta )
:TCollection( ALimit, ADelta );
{
comparemethod=#Compare;
return this;
}
 
:void TSortedCollection::Insert( int Item )
{
int i;
IF( !Search(/*KeyOf(*/Item/*)*/,#i) ) || ( Duplicates )AtInsert( i, Item );
}
 
 
:int TSortedCollection::Search( int Key, Index )
{
int L, H, I, C;
int S;
 
S = 0;
L = 0;
H = Count-1;
WHILE( L <= H )
{
I = L+H >> 1;
ECX = I*sizeof(int)+Items;
comparemethod( this, /*KeyOf(*/DSDWORD[ECX]/*)*/, Key );
C = EAX;
IF( C < 0 ){ L = I+1; }
ELSE
{
H = I-1;
IF( !C ){
S = 1;
IF( !Duplicates )L = I;
}
}
}
DSDWORD[ Index ]=L;
return S;
}
/programs/cmm/vfc/vfc.c
0,0 → 1,209
//visual text comparer
//by den po - jdp@bk.ru
 
#define MEMSIZE 4096 * 60
#include "../lib/io.h"
#include "../lib/strings.h"
#include "../lib/obj/console.h"
IO io1, io2;
 
#define MAX_PATH 260
 
#include "32user32.h"
#include "objects.h"
#include "vfc_gui.h"
 
#define mincmpstrings 2
#define maxcmpstrings 10
#define maxcmpoffset 100
 
char window_title[] = "Visual Text Comparer (Diff tool)";
 
char* srcfilename;
char* dstfilename;
dword srcfile;
dword dstfile;
dword srcfilesize;
dword dstfilesize;
TCollection srcfilelines; //file lines
TCollection dstfilelines;
TCollection srcfilenums; //lines numbers
TCollection dstfilenums;
 
struct TSimpleCollection:TSortedCollection
{
TSimpleCollection();
int Compare( int Key1, Key2 );
};
int TSimpleCollection::Compare( int Key1, Key2 ){
return Key1-Key2;
}
TSimpleCollection::TSimpleCollection():TSortedCollection(1000,1000);
{
comparemethod=#Compare;
}
 
TSimpleCollection diffs; //list of differing strings
dword srcfilelinks; //pointer to the previos line with the same first symbol
dword dstfilelinks; //
 
getstrings(dword srcfile,srcfilesize,srcfilelines){
ECX=srcfilesize;
ESI=srcfile;
WHILE(ECX){
$push ECX,ESI
EAX=srcfilelines;
EAX.TCollection.Insert(ESI);
$pop ESI,ECX
WHILE(ECX){
$cld $lodsb ECX--;
if(AL==0x0D)||(AL==0x0A)DSBYTE[ESI-1]=0;
if(AL==0x0D)&&(DSBYTE[ESI]==0x0A){$lodsb;ECX--;}
if(AL==0x0D)||(AL==0x0A)BREAK;
}
}
}
 
#include "if.h"
 
bool getparam()
{
int i, param_len = strlen(#param);
if (param[0]=='"') {
for (i=1; i<param_len; i++) if (param[i]=='"') param[i]=NULL;
srcfilename = #param + 1;
dstfilename = #param + strlen(#param) + 3;
return true;
}
notify("'Wrong params specified. Use next format:\nAPPPATH \"PARAM1\" \"PARAM2\"' -E");
return false;
}
 
main(){
if (param[0]) getparam();
if (!srcfilename) || (!dstfilename) gui(); else console();
}
 
console() {
int i;
int p;
int bs,bd,bsc,bdc,bsp,bdp;
int cache[256];
char s1;
int s2;
 
srcfile = io1.read(srcfilename);
dstfile = io2.read(dstfilename);
 
srcfilesize = io1.FILES_SIZE;
dstfilesize = io2.FILES_SIZE;
 
if (!srcfile) die("'First file not found' -E");
if (!dstfile) die("'Second file not found' -E");
srcfilelines.TCollection(srcfilesize/40,8192);
dstfilelines.TCollection(dstfilesize/40,8192);
//fill line pointers
getstrings(srcfile,srcfilesize,#srcfilelines);
getstrings(dstfile,dstfilesize,#dstfilelines);
srcfilenums.TCollection(srcfilelines.Count,1000);
dstfilenums.TCollection(dstfilelines.Count,1000);
 
srcfilelinks=malloc(srcfilelines.Count*4);
dstfilelinks=malloc(dstfilelines.Count*4);
 
//fill links on the next strings with the same first symbols
FillMemory(#cache,sizeof(cache),-1); i=srcfilelines.Count;
WHILE(i){
i--;
EBX=srcfilelines.At(i); EBX=DSBYTE[EBX];
DSDWORD[i<<2+srcfilelinks]=cache[EBX*4];
cache[EBX*4]=i;
}
FillMemory(#cache,sizeof(cache),-1); i=dstfilelines.Count;
WHILE(i){
i--;
EBX=dstfilelines.At(i); EBX=DSBYTE[EBX];
DSDWORD[i<<2+dstfilelinks]=cache[EBX*4];
cache[EBX*4]=i;
}
 
diffs.TSimpleCollection();
 
while( bsp < srcfilelines.Count ) || ( bdp < dstfilelines.Count )
{
////////////////////////////////////////////////////////
bsc=0;
p=dstfilelines.At(bdp);//current dst position
s1=DSBYTE[p];
bs=bsp+1;//found src line, bsc - number of matched
while( bs != -1 )//no next line starting with the same symbols
&&(bs-bsp<=maxcmpoffset)//check for 100 lines depth
&&(bs<srcfilelines.Count)
{
s2=srcfilelines.At(bs);
if(!strcmp(p,s2))
{//line found
bsc=1;
WHILE(bsc<maxcmpstrings)//counting number of matching lines
&&(bdp+bsc<dstfilelines.Count)
&&(bs+bsc<srcfilelines.Count)
&&(!strcmp(dstfilelines.At(bdp+bsc),srcfilelines.At(bs+bsc)))bsc++;
BREAK;
}
if(DSBYTE[s2]==s1)bs=DSDWORD[bs<<2+srcfilelinks];else bs++;
}
bdc=0;
p=srcfilelines.At(bsp);//current src position
s1=DSBYTE[p];
bd=bdp+1;//found dst line, bsc - number of matched
while( bd != -1 )//no next line starting with the same symbols
&&(bd-bdp<=maxcmpoffset)//check for 100 lines depth
&&(bd<dstfilelines.Count)
{
s2=dstfilelines.At(bd);
if(!strcmp(p,s2))
{
bdc=1;
WHILE(bdc<maxcmpstrings)//counting number of matching lines
&&(bsp+bdc<srcfilelines.Count)
&&(bd+bdc<dstfilelines.Count)
&&(!strcmp(srcfilelines.At(bsp+bdc),dstfilelines.At(bd+bdc)))bdc++;
BREAK;
}
if(DSBYTE[s2]==s1)bd=DSDWORD[bd<<2+dstfilelinks];else bd++;
}
 
if(bsc<bdc)
if(bd-bdp<bdc)
||(bdc>=mincmpstrings)
{
WHILE(bdp<bd){
diffs.Insert(srcfilenums.Count);
srcfilenums.Insert(-1); dstfilenums.Insert(bdp); bdp++;
}
continue;
}
 
if(strcmp(srcfilelines.At(bsp),dstfilelines.At(bdp)))diffs.Insert(srcfilenums.Count);
//lines are equal
srcfilenums.Insert(bsp); bsp++;
dstfilenums.Insert(bdp); bdp++;
CONTINUE;
}
 
free(srcfilelinks);
free(dstfilelinks);
 
if(!diffs.Count)
notify("'Nothing to compare' -E");
else ifinit();
 
diffs.DeleteAll(); delete diffs;
dstfilenums.DeleteAll(); delete dstfilenums;
srcfilenums.DeleteAll(); delete srcfilenums;
dstfilelines.DeleteAll(); delete dstfilelines;
srcfilelines.DeleteAll(); delete srcfilelines;
free(dstfile);
free(srcfile);
}
/programs/cmm/vfc/vfc_gui.h
0,0 → 1,106
#include "../lib/gui.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/patterns/simple_open_dialog.h"
 
char default_dir[] = "/rd/1";
od_filter filter2 = {0,0};
 
int mouse_dd1, mouse_dd2;
char src_box_text[4096];
char dst_box_text[4096];
edit_box src_box = {340,20,35,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(src_box_text),#src_box_text,#mouse_dd1, 10b};
edit_box dst_box = {340,20,95,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(dst_box_text),#dst_box_text,#mouse_dd2, 0b};
 
#define BID_EXIT_PRC 01
#define BID_SRC_OPEN 10
#define BID_DST_OPEN 11
#define BID_COMPARE 12
 
proc_info Form;
 
void gui()
{
word btn;
char run_param[4096];
load_dll(boxlib, #box_lib_init,0);
load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog);
SetEventMask(0x27);
 
loop() switch(WaitEvent())
{
case evMouse:
edit_box_mouse stdcall (#src_box);
edit_box_mouse stdcall (#dst_box);
break;
 
case evButton:
btn = GetButtonID();
switch (btn)
{
case BID_EXIT_PRC:
ExitProcess();
case BID_SRC_OPEN:
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#src_box_text, #openfile_path);
src_box.size = src_box.pos
= src_box.shift = src_box.shift_old = strlen(#src_box_text);
}
break;
case BID_DST_OPEN:
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#dst_box_text, #openfile_path);
dst_box.size = dst_box.pos
= dst_box.shift = dst_box.shift_old = strlen(#dst_box_text);
}
break;
case BID_COMPARE:
sprintf(#run_param, "\"%s\" \"%s\"", #src_box_text, #dst_box_text);
io.run(#program_path+1, #run_param);
break;
}
break;
case evKey:
GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
if (key_scancode == SCAN_CODE_TAB) {
if ( src_box.flags & 10b ) {
src_box.flags -= 10b;
dst_box.flags += 10b;
} else {
src_box.flags += 10b;
dst_box.flags -= 10b;
}
edit_box_draw stdcall (#src_box);
edit_box_draw stdcall (#dst_box);
}
EAX = key_editbox;
edit_box_key stdcall (#src_box);
EAX = key_editbox;
edit_box_key stdcall (#dst_box);
break;
case evReDraw:
draw_window();
break;
}
}
 
void draw_window()
{
system.color.get();
DefineAndDrawWindow(215, 100, 450, 195 + skin_height, 0x34, system.color.work, #window_title);
GetProcessInfo(#Form, SelfInfo);
 
WriteText(src_box.left-2, src_box.top-21, 0x90, system.color.work_text, "First file:");
WriteText(dst_box.left-2, dst_box.top-21, 0x90, system.color.work_text, "Second file:");
DrawEditBox(#src_box);
DrawEditBox(#dst_box);
DrawStandartCaptButton(src_box.left + src_box.width + 15, src_box.top-3, BID_SRC_OPEN, "...");
DrawStandartCaptButton(dst_box.left + dst_box.width + 15, dst_box.top-3, BID_DST_OPEN, "...");
DrawStandartCaptButton(dst_box.left - 2, dst_box.top + 40, BID_COMPARE, "Compare");
}