/programs/cmm/lib/copyf.h |
---|
1,24 → 1,15 |
//copyf - copy file or folder with content |
:int copyf(dword from1, in1) |
// универсальность добавления / |
:void copyf(dword from1, in1) |
{ |
dword error; |
BDVK CopyFile_atr1; |
if (!from1) || (!in1) |
{ |
notify("Error: too less copyf params!"); |
notify(from1); |
notify(in1); |
return; |
} |
if (error = GetFileInfo(from1, #CopyFile_atr1)) |
{ |
if (!from1) || (!in1) { notify("Error: too less copyf params!"); notify(from1); notify(in1); return; } |
error = GetFileInfo(from1, #CopyFile_atr1); |
if (error) |
debug("Error: copyf->GetFileInfo"); |
return error; |
} |
if (isdir(from1)) |
return CopyFolder(from1, in1); |
else |
return CopyFile(from1, in1); |
if (isdir(from1)) CopyFolder(from1, in1); else CopyFile(from1, in1); |
} |
:int CopyFile(dword copy_from3, copy_in3) |
25,71 → 16,78 |
{ |
BDVK CopyFile_atr; |
dword error, cbuf; |
if (error = GetFileInfo(copy_from3, #CopyFile_atr)) |
debug("Error: CopyFile->GetFileInfo"); |
debug(copy_from3); |
error = GetFileInfo(copy_from3, #CopyFile_atr); |
if (error) |
{debug("Error: CopyFile->GetFileInfo"); debug(copy_from3);} |
else |
{ |
cbuf = malloc(CopyFile_atr.sizelo); |
if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3)) |
error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3); |
if (error) |
debug("Error: CopyFile->ReadFile"); |
else |
{ |
if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debug("Error: CopyFile->WriteFile"); |
error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3); |
if (error) debug("Error: CopyFile->WriteFile"); |
} |
} |
free(cbuf); |
if (error) debug_error(copy_from3, error); |
if (error) debug(copy_from3); |
return error; |
} |
:int CopyFolder(dword from2, in2) |
:void CopyFolder(dword from2, in2) |
{ |
dword dirbuf, fcount, i, filename; |
char copy_from2[4096], copy_in2[4096], error; |
dword dirbuf, fcount, filename; |
int i, error, isdir; |
char copy_from2[4096], copy_in2[4096]; |
if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) |
error = GetDir(#dirbuf, #fcount, from2); |
if (error) |
{ |
debug("Error: CopyFolder->GetDir"); |
debug_error(from2, error); |
debug_error(in2, error); |
free(dirbuf); |
return error; |
return; |
} |
if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) |
if ((strcmp(in2, "/sys")!=0) && (strcmp(in2, "/tmp9/1")!=0)) |
{ |
debug("Error: CopyFolder->CreateDir"); |
debug_error(in2, error); |
free(dirbuf); |
return error; |
error = CreateDir(in2); |
if (error) debug_error(in2, error); |
} |
chrcat(in2, '/'); |
chrcat(from2, '/'); |
for (i=0; i<fcount; i++) |
{ |
filename = i*304+dirbuf+72; |
isdir = TestBit(ESDWORD[filename-40], 4); |
if (isdir) |
{ |
if ( (!strcmp(filename, ".")) || (!strcmp(filename, "..")) ) continue; |
strcpy(#copy_from2, from2); |
chrcat(#copy_from2, '/'); |
strcpy(#copy_in2, in2); |
strcat(#copy_from2, filename); |
strcpy(#copy_in2, in2); |
chrcat(#copy_in2, '/'); |
strcat(#copy_in2, filename); |
if ( TestBit(ESDWORD[filename-40], 4) ) //isdir? |
{ |
if ( (!strcmp(filename, ".")) || (!strcmp(filename, "..")) ) continue; |
CopyFolder(#copy_from2, #copy_in2); |
} |
else |
{ |
strcpy(#copy_from2, from2); |
strcat(#copy_from2, filename); |
strcpy(#copy_in2, in2); |
strcat(#copy_in2, filename); |
copyf_Action(filename); |
if (error=CopyFile(#copy_from2, #copy_in2)) |
{ |
if (fabs(error)==8) { debug("Stop copying."); break;} //TODO: may be need grobal var like stop_all |
error=CopyFile(#copy_from2, #copy_in2); // #2 :) |
if (CopyFile(#copy_from2, #copy_in2)!=0) CopyFile(#copy_from2, #copy_in2); // #2 :) |
} |
} |
} |
free(dirbuf); |
return error; |
} |
/programs/cmm/lib/file_system.h |
---|
187,14 → 187,8 |
return 0; |
} |
enum |
:int GetDir(dword dir_buf, file_count, path) |
{ |
DIRS_ALL, |
DIRS_NOROOT, |
DIRS_ONLYREAL |
}; |
:int GetDir(dword dir_buf, file_count, path, doptions) |
{ |
dword buf, fcount, error; |
buf = malloc(32); |
error = ReadDir(0, buf, path); |
204,17 → 198,8 |
buf = realloc(buf, fcount+1*304+32); |
ReadDir(fcount, buf, path); |
//fcount=EBX; |
if (doptions == DIRS_ONLYREAL) |
{ |
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
} |
if (doptions == DIRS_NOROOT) |
{ |
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
} |
ESDWORD[dir_buf] = buf; |
ESDWORD[file_count] = fcount; |
} |
/programs/cmm/lib/socket.h |
---|
21,7 → 21,7 |
$int 0x40 |
} |
inline fastcall dword ReadSocket( ECX) |
inline fastcall dword ReadSocket( ECX) //ecx - handle |
{ |
$mov eax,53 |
$mov ebx,3 |
/programs/cmm/lib/kolibri.h |
---|
240,13 → 240,6 |
$int 0x40 |
} |
inline fastcall void SendWindowMessage( ECX, EDX) |
{ |
$mov eax, 72 |
$mov ebx, 1 |
$int 0x40 |
} |
inline fastcall int KillProcess( ECX) |
{ |
$mov eax,18; |
/programs/cmm/lib/strings.h |
---|
12,7 → 12,6 |
// strlwr( ESI) --- kyrillic symbols may not work |
// strttl( EDX) |
// strtok( ESI) |
// chrnum(dword searchin, char symbol) |
// strcpyb(dword searchin, copyin, startstr, endstr) --- copy string between strings |
// strnumb(dword searchin, startstr, endstr) --- get number between strings |
//------------------------------------------------------------------------------ |
/programs/cmm/lib/edit_box_lib.h |
---|
0,0 → 1,49 |
//BOX_LIB |
dword boxlib = #aEdit_box_lib; //Asper |
char aEdit_box_lib[22]="/sys/lib/box_lib.obj\0"; //Asper |
dword edit_box_draw = #aEdit_box_draw; |
dword edit_box_key = #aEdit_box_key; |
dword edit_box_mouse = #aEdit_box_mouse; |
dword version_ed = #aVersion_ed; |
dword am__ = 0x0; |
dword bm__ = 0x0; |
char aEdit_box_draw[9] = "edit_box\0"; |
char aEdit_box_key[13] = "edit_box_key\0"; |
char aEdit_box_mouse[15] = "edit_box_mouse\0"; |
char aVersion_ed[11] = "version_ed\0"; |
char aCheck_box_draw [15] = "check_box_draw\0"; |
char aCheck_box_mouse [16] = "check_box_mouse\0"; |
char aVersion_ch [11] = "version_ch\0"; |
char aOption_box_draw [16] = "option_box_draw\0"; |
char aOption_box_mouse[17] = "option_box_mouse\0"; |
char aVersion_op [11] = "version_op\0" ; |
struct edit_box{ |
dword width, left, top, color, shift_color, focus_border_color, blur_border_color, |
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old; |
}; |
//ed_width equ [edi] ;è¨à¨ ª®¬¯®¥â |
//ed_left equ [edi+4] ;¯®«®¦¥¨¥ ¯® ®á¨ å |
//ed_top equ [edi+8] ;¯®«®¦¥¨¥ ¯® ®á¨ ã |
//ed_color equ [edi+12] ;梥â ä® ª®¬¯®¥â |
//shift_color equ [edi+16] ;=0x6a9480 |
//ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®¥â |
//ed_blur_border_color equ [edi+24] ;梥⠥ ªâ¨¢®£® ª®¬¯®¥â |
//ed_text_color equ [edi+28] ;梥â ⥪áâ |
//ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦® ¬ ªá¨¬ «ì® ¢¢¥á⨠|
//ed_text equ [edi+36] ;㪠§ â¥«ì ¡ãä¥à |
//ed_flags equ [edi+40] ;ä« £¨ |
//ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢ |
//ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à |
//ed_offset equ [edi+50] ;ᬥ饨¥ |
//cl_curs_x equ [edi+54] ;¯à¥¤ë¤ãé ï ª®®à¤¨ â ªãàá®à ¯® å |
//cl_curs_y equ [edi+58] ;¯à¥¤ë¤ãé ï ª®®à¤¨ â ªãàá®à ¯® ã |
//ed_shift_pos equ [edi+62] ;¯®«®¦¥¨¥ ªãàá®à |
//ed_shift_pos_old equ [edi+66] ;áâ ஥ ¯®«®¦¥¨¥ ªãàá®à |