Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2873 → Rev 2874

/programs/network/htmlv/lib/encoding.h
172,14 → 172,7
AL=symbol;
}
 
/*int hex2char(char c)
{
if (c <=9)
return (c+48);
 
return (c - 10 + 'a');
}
 
/*
int hex2char(dword c)
{
if (c <=9)
/programs/network/htmlv/lib/file_system.h
25,33 → 25,10
 
 
///////////////////////////
// Ïàðàìåòðû ôàéëà //
///////////////////////////
f70 getinfo_file_70;
BDVK getinfo_file_info;
dword GetFileInfo(dword file_name)
{
getinfo_file_70.func = 5;
getinfo_file_70.param1 =
getinfo_file_70.param2 =
getinfo_file_70.param3 =
getinfo_file_70.param4 = #getinfo_file_info;
getinfo_file_70.rezerv = 0;
getinfo_file_70.name = file_name;
$mov eax,70
$mov ebx,#getinfo_file_70.func
$int 0x40
IF (EAX == 0) {
EAX = #getinfo_file_info;
}
}
 
 
///////////////////////////
// Çàïóñê ïðîãðàììû //
///////////////////////////
f70 run_file_70;
int RunProgram(dword run_path, run_param)
:int RunProgram(dword run_path, run_param)
{
run_file_70.func = 7;
run_file_70.param1 =
63,7 → 40,6
$mov eax,70
$mov ebx,#run_file_70.func
$int 0x40
RETURN EAX;
}
 
///////////////////////////
70,7 → 46,7
// Ñîçäàíèå ïàïêè //
///////////////////////////
f70 create_dir_70;
void CreateFolder(dword new_folder_path)
:int CreateFolder(dword new_folder_path)
{
create_dir_70.func = 9;
create_dir_70.param1 =
88,7 → 64,7
// Óäàëåíèå ôàéëà/ïàïêè //
////////////////////////////
f70 del_file_70;
void DeleteFile(dword del_file_path)
:int DeleteFile(dword del_file_path)
{
del_file_70.func = 8;
del_file_70.param1 =
106,25 → 82,43
// Ïðî÷èòàòü ôàéë //
////////////////////////////
f70 read_file_70;
int ReadFile(dword pos, file_size, read_buffer, file_path)
:int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path)
{
read_file_70.func = 0;
read_file_70.param1 = pos;
read_file_70.param1 = read_pos;
read_file_70.param2 = 0;
read_file_70.param3 = file_size;
read_file_70.param3 = read_file_size;
read_file_70.param4 = read_buffer;
read_file_70.rezerv = 0;
read_file_70.name = file_path;
read_file_70.name = read_file_path;
$mov eax,70
$mov ebx,#read_file_70.func
$int 0x40
}
 
////////////////////////////
// Çàïèñàòü ôàéë //
////////////////////////////
f70 write_file_70;
:int WriteFile(dword write_file_size, write_buffer, write_file_path)
{
write_file_70.func = 2;
write_file_70.param1 = 0;
write_file_70.param2 = 0;
write_file_70.param3 = write_file_size;
write_file_70.param4 = write_buffer;
write_file_70.rezerv = 0;
write_file_70.name = write_file_path;
$mov eax,70
$mov ebx,#write_file_70.func
$int 0x40
}
 
///////////////////////////
// Ïðî÷èòàòü ïàïêó //
///////////////////////////
f70 read_dir_70;
int ReadDir(dword file_count, read_buffer, dir_path)
:int ReadDir(dword file_count, read_buffer, dir_path)
{
read_dir_70.func = 1;
read_dir_70.param1 =
138,45 → 132,45
$int 0x40
}
 
 
///////////////////////////
// Ñêîïèðîâàòü ôàéë //
// Ïàðàìåòðû ôàéëà //
///////////////////////////
f70 CopyFile_f;
inline fastcall dword CopyFile(dword EBX,ECX)
f70 getinfo_file_70;
BDVK getinfo_file_info;
:dword GetFileInfo(dword file_path)
{
BDVK CopyFile_atr;
dword s=EBX, d=ECX, cBufer=0;
CopyFile_f.func = 5;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
CopyFile_f.param3 = 0;
CopyFile_f.param4 = #CopyFile_atr;
CopyFile_f.rezerv = 0;
CopyFile_f.name = s;
getinfo_file_70.func = 5;
getinfo_file_70.param1 =
getinfo_file_70.param2 =
getinfo_file_70.param3 = 0;
getinfo_file_70.param4 = #getinfo_file_info;
getinfo_file_70.rezerv = 0;
getinfo_file_70.name = file_path;
$mov eax, 70
$mov ebx, #CopyFile_f
$mov ebx,#getinfo_file_70.func
$int 0x40
}
if (!EAX)
 
///////////////////////////
// Ñêîïèðîâàòü ôàéë //
///////////////////////////
:int CopyFile(dword copy_from, copy_in)
{
cBufer = malloc(CopyFile_atr.sizelo);
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s);
BDVK CopyFile_atr;
dword cBufer=0;
IF (!EAX)
if (! GetFileInfo(copy_from))
{
CopyFile_f.func = 2;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
CopyFile_f.param3 = CopyFile_atr.sizelo;
CopyFile_f.param4 = cBufer;
CopyFile_f.rezerv = 0;
CopyFile_f.name = d;
$mov eax, 70
$mov ebx, #CopyFile_f
$int 0x40
mem_Init();
cBufer = mem_Alloc(CopyFile_atr.sizelo);
if (! ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, copy_from))
if (! WriteFile(CopyFile_atr.sizelo, cBufer, copy_in)) return 1;
}
return 0;
}
}
 
 
//Asper
192,4 → 186,4
$mov eax,70
$mov ebx,#read_file_70.func
$int 0x40
}
}
/programs/network/htmlv/lib/kolibri.h
33,7 → 33,7
 
struct mouse
{
dword x,y,lkm,pkm,hor,vert;
int x,y,lkm,pkm,hor,vert;
void get();
};
 
165,7 → 165,7
byte reserved[1024-71];
};
 
void GetProcessInfo( EBX, ECX)
inline fastcall void GetProcessInfo( EBX, ECX)
{
$mov eax,9;
$int 0x40
205,19 → 205,30
$int 0x40
}
 
inline fastcall ExitProcess()
inline fastcall int KillProcess( ECX)
{
$mov eax,-1;
$mov eax,18;
$mov ebx,18;
$int 0x40
}
 
inline fastcall int KillProcess( ECX)
inline fastcall int ExitSystem( ECX)
{
$mov eax,18;
$mov ebx,18;
#define TURN_OFF 2
#define REBOOT 3
#define KERNEL 4
$mov eax, 18
$mov ebx, 9
$int 0x40
}
 
inline fastcall ExitProcess()
{
$mov eax,-1;
$int 0x40
}
 
//------------------------------------------------------------------------------
 
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
228,7 → 239,7
$int 0x40
}
 
inline fastcall dword GetSkinWidth()
inline fastcall dword GetSkinHeight()
{
$push ebx
$mov eax,48
244,12 → 255,17
$int 0x40
}
 
inline fastcall dword GetScreenWidth()
inline fastcall int GetScreenWidth()
{
EAX = 14;
EBX = 4;
$mov eax, 14
$int 0x40
$shr eax, 16
}
 
inline fastcall int GetScreenHeight()
{
$mov eax, 14
$int 0x40
$and eax,0x0000FFFF
}
 
260,7 → 276,7
$int 0x40
}
 
byte fastcall TestBit( EAX, CL)
inline fastcall int TestBit( EAX, CL)
{
$shr eax,cl
$and eax,1
269,17 → 285,16
 
//------------------------------------------------------------------------------
 
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI)
{
EAX = 12; // function 12:tell os about windowdraw
EBX = 1;
$int 0x40
EAX = 0;
EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour;
$xor eax,eax
EDX = WindowType << 24 | WindowAreaColor;
$int 0x40
 
EAX = 12; // function 12:tell os about windowdraw
289,7 → 304,7
 
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
{
EAX = 67;
$mov eax, 67
$int 0x40
}
 
316,6 → 331,13
$int 0x40;
}
 
dword GetPixelColor(dword x, x_size, y)
{
$mov eax, 35
EBX= y*x_size+x;
$int 0x40
}
 
void PutImage(dword EBX,w,h,x,y)
{
EAX = 7;
365,7 → 387,7
 
//------------------------------------------------------------------------------
 
void DrawRegion(dword x,y,width,height,color1)
:void DrawRegion(dword x,y,width,height,color1)
{
DrawBar(x,y,width,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
373,7 → 395,7
DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢ 
}
 
void DrawRegion_3D(dword x,y,width,height,color1,color2)
:void DrawRegion_3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
381,7 → 403,7
DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã
}
 
void DrawFlatButton(dword x,y,width,height,id,color,text)
:void DrawFlatButton(dword x,y,width,height,id,color,text)
{
DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
391,7 → 413,7
WriteText(width/2+x+1,height/2-3+y,0x80,0,text,0);
}
 
void DrawCircle(int x, y, r)
:void DrawCircle(int x, y, r)
{
int i;
float px=0, py=r, ii = r * 3.1415926 * 2;
/programs/network/htmlv/lib/mem.h
98,3 → 98,113
l2:
}
}
 
 
/*:void fastcall memsetz( EDI, ECX)
{
asm {
XOR EAX, EAX
MOV EDX, ECX
SHR ECX, 2
REP STOSD
MOV ECX, EDX
AND ECX, 3
REP STOSB
}
}
 
:void fastcall memset( EDI, ECX, AL)
{
asm {
MOV AH, AL
MOVZX EDX, AX
SHL EAX, 16
OR EAX, EDX
MOV EDX, ECX
SHR ECX, 2
REP STOSD
MOV ECX, EDX
AND ECX, 3
REP STOSB
}
}
 
:void fastcall memcpy( EDI, ESI, ECX)
{
asm {
MOV EDX, ECX
SHR ECX, 2
REP MOVSD
MOV ECX, EDX
AND ECX, 3
REP MOVSB
}
}
 
:void fastcall memsetd( EDI, ECX, EAX)
{
asm {
REP STOSD
}
}
 
:void fastcall memcpyd( EDI, ESI, ECX)
{
asm {
REP MOVSD
}
}
 
:void fastcall memmov( EDI, ESI, ECX)
{
asm {
MOV EAX, ECX
CMP EDI, ESI
JG L1
JE L2
SAR ECX, 2
JS L2
REP MOVSD
MOV ECX, EAX
AND ECX, 3
REP MOVSB
JMP SHORT L2
L1: LEA ESI, DSDWORD[ ESI+ECX-4]
LEA EDI, DSDWORD[ EDI+ECX-4]
SAR ECX, 2
JS L2
STD
REP MOVSD
MOV ECX, EAX
AND ECX, 3
ADD ESI, 3
ADD EDI, 3
REP MOVSB
CLD
L2:
}
}
 
:long fastcall memcmp( ESI, EDI, ECX)
{
asm {
MOV EAX, ECX
SHR ECX, 2
REPE CMPSD
MOV ECX, EAX
AND ECX, 3
REPE CMPSB
XOR EAX, EAX
XOR ECX, ECX
MOV AL, DSBYTE[ ESI-1]
MOV CL, DSBYTE[ EDI-1]
SUB EAX, ECX
}
}*/
 
 
/*#define memzset memsetz
#define memset0 memsetz
#define mem0set memsetz
#define memset32 memsetd
#define memcpy32 memcpyd*/
/programs/network/htmlv/lib/strings.h
13,7 → 13,72
// strtok( ESI)
//------------------------------------------------------------------------------
 
inline fastcall signed int strcmp( ESI, EDI)
{
loop()
{
IF (DSBYTE[ESI]<DSBYTE[EDI]) RETURN -1;
IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
IF (DSBYTE[ESI]=='\0') RETURN 0;
ESI++;
EDI++;
}
}
 
 
inline fastcall signed int strncmp( ESI, EDI, ECX)
{
asm {
MOV EBX, EDI
XOR EAX, EAX
MOV EDX, ECX
OR ECX, ECX
JE L1
REPNE SCASB
SUB EDX, ECX
MOV ECX, EDX
MOV EDI, EBX
XOR EBX, EBX
REPE CMPSB
MOV AL, DSBYTE[ ESI-1]
MOV BL, DSBYTE[ EDI-1]
SUB EAX, EBX
L1:
}
}
 
/*
 
inline fastcall signed int strcmpi( ESI,EDI)
uses EBX
{
do{
$lodsb
IF(AL>='a')&&(AL<='z')AL-=0x20;
BL=DSBYTE[(E)DI];
IF(BL>='a')&&(BL<='z')BL-=0x20;
AL-=BL;
IF(!ZEROFLAG)BREAK;
(E)DI++;
}while(BL!=0);
}
 
inline char STRNCMPI((E)SI,(E)DI,(E)CX)
{
(E)AX=0;
LOOPNZ((E)CX){
$lodsb
IF(AL>='a')&&(AL<='z')AL-=0x20;
AH=DSBYTE[EDI];
IF(AH>='a')&&(AH<='z')AH-=0x20;
EDI++;
IF(AL==0)||(AH==0)||(AL!=AH)BREAK;
}
AL=AL-AH;
}*/
 
 
 
inline fastcall unsigned int strlen( EDI)
{
$xor eax, eax
107,18 → 172,6
}
 
 
inline fastcall signed int strcmp( ESI, EDI)
{
loop()
{
IF (DSBYTE[ESI]<DSBYTE[EDI]) RETURN -1;
IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
IF (DSBYTE[ESI]=='\0') RETURN 0;
ESI++;
EDI++;
}
}
 
inline fastcall unsigned int strchr( ESI,BL)
{
int jj=0;
203,6 → 256,21
}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* strtok( LPSTR dest, src, divs);
src - óêàçàòåëü íà èñõîäíóþ ñòðîêó èëè ðåçóëüòàò ïðåäûäóùåãî âûçîâà
dest - óêàçàòåëü íà áóôåð, êóäà áóäåò ñêîïèðîâàíî ñëîâî
242,3 → 310,13
L4: POP ECX
} DSBYTE[ EDX] = 0;
}
 
#define strncpy strcpyn
#define strnmov strmovn
#define stricmp strcmpi
#define strcmpn strncmp
#define strncmpi strcmpni
#define stricmpn strcmpni
#define strnicmp strcmpni
#define strincmp strcmpni
#define strcmpin strcmpni