Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3443 → Rev 3444

/programs/cmm/lib/edit_box_lib.h
File deleted
/programs/cmm/lib/copyf.h
1,15 → 1,24
// универсальность добавления /
 
:void copyf(dword from1, in1)
//copyf - copy file or folder with content
:int copyf(dword from1, in1)
{
dword error;
BDVK CopyFile_atr1;
if (!from1) || (!in1) { notify("Error: too less copyf params!"); notify(from1); notify(in1); return; }
error = GetFileInfo(from1, #CopyFile_atr1);
if (error)
if (!from1) || (!in1)
{
notify("Error: too less copyf params!");
notify(from1);
notify(in1);
return;
}
if (error = GetFileInfo(from1, #CopyFile_atr1))
{
debug("Error: copyf->GetFileInfo");
return error;
}
if (isdir(from1))
return CopyFolder(from1, in1);
else
if (isdir(from1)) CopyFolder(from1, in1); else CopyFile(from1, in1);
return CopyFile(from1, in1);
}
 
:int CopyFile(dword copy_from3, copy_in3)
16,78 → 25,71
{
BDVK CopyFile_atr;
dword error, cbuf;
debug(copy_from3);
error = GetFileInfo(copy_from3, #CopyFile_atr);
if (error)
{debug("Error: CopyFile->GetFileInfo"); debug(copy_from3);}
if (error = GetFileInfo(copy_from3, #CopyFile_atr))
debug("Error: CopyFile->GetFileInfo");
else
{
cbuf = malloc(CopyFile_atr.sizelo);
error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3);
if (error)
if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3))
debug("Error: CopyFile->ReadFile");
else
{
error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3);
if (error) debug("Error: CopyFile->WriteFile");
if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debug("Error: CopyFile->WriteFile");
}
}
free(cbuf);
if (error) debug(copy_from3);
if (error) debug_error(copy_from3, error);
return error;
}
 
:void CopyFolder(dword from2, in2)
:int CopyFolder(dword from2, in2)
{
dword dirbuf, fcount, filename;
int i, error, isdir;
char copy_from2[4096], copy_in2[4096];
dword dirbuf, fcount, i, filename;
char copy_from2[4096], copy_in2[4096], error;
 
error = GetDir(#dirbuf, #fcount, from2);
if (error)
if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL))
{
debug("Error: CopyFolder->GetDir");
debug_error(from2, error);
debug_error(in2, error);
free(dirbuf);
return;
return error;
}
if ((strcmp(in2, "/sys")!=0) && (strcmp(in2, "/tmp9/1")!=0))
if (chrnum(in2, '/')>2) && (error = CreateDir(in2))
{
error = CreateDir(in2);
if (error) debug_error(in2, error);
debug("Error: CopyFolder->CreateDir");
debug_error(in2, error);
free(dirbuf);
return 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, '/');
strcat(#copy_from2, filename);
strcpy(#copy_in2, in2);
strcat(#copy_from2, filename);
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 (CopyFile(#copy_from2, #copy_in2)!=0) CopyFile(#copy_from2, #copy_in2); // #2 :)
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 :)
}
}
}
free(dirbuf);
return error;
}
 
 
/programs/cmm/lib/file_system.h
187,8 → 187,14
return 0;
}
 
:int GetDir(dword dir_buf, file_count, path)
enum
{
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);
198,8 → 204,17
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/kolibri.h
240,6 → 240,13
$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/socket.h
21,7 → 21,7
$int 0x40
}
 
inline fastcall dword ReadSocket( ECX) //ecx - handle
inline fastcall dword ReadSocket( ECX)
{
$mov eax,53
$mov ebx,3
/programs/cmm/lib/strings.h
12,6 → 12,7
// 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
//------------------------------------------------------------------------------