Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3106 → Rev 3107

/programs/cmm/lib/scroll_lib.h
File deleted
/programs/cmm/lib/memory.h
File deleted
/programs/cmm/lib/truetype.h
File deleted
/programs/cmm/lib/network.h
File deleted
/programs/cmm/lib/libimg_lib.h
File deleted
/programs/cmm/lib/libio_lib.h
File deleted
/programs/cmm/lib/figures.h
1,3 → 1,5
//#include "strings.h"
 
void DrawRectangle(dword x,y,width,height,color1)
{
DrawBar(x,y,width,1,color1);
/programs/cmm/lib/kolibri.h
35,7 → 35,7
 
struct mouse
{
int x,y,lkm,pkm,hor,vert;
signed int x,y,lkm,pkm,hor,vert;
void get();
};
 
121,17 → 121,17
inline fastcall word GetKey() //+Gluk fix
{
$push edx
@getkey:
GETKEY:
$mov eax,2
$int 0x40
$cmp eax,1
$jne getkeyi
$jne GETKEYI
$mov ah,dh
$jmp getkeyii //jz?
@getkeyi:
$jmp GETKEYII //jz?
GETKEYI:
$mov dh,ah
$jmp getkey
@getkeyii:
$jmp GETKEY
GETKEYII:
$pop edx
$shr eax,8
}
187,8 → 187,8
word status_slot,rezerv3;
dword work_left,work_top,work_width,work_height;
char status_window;
void GetInfo( ECX);
byte reserved[1024-71];
dword cwidth,cheight;
byte reserved[1024-71-8];
};
 
inline fastcall void GetProcessInfo( EBX, ECX)
195,6 → 195,8
{
$mov eax,9;
$int 0x40
DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
}
 
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
320,14 → 322,14
$push ecx
$mov eax, 63
$mov ebx, 1
next_char:
NEXT_CHAR:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz done
$jz DONE
$int 0x40
$inc edx
$jmp next_char
done:
$jmp NEXT_CHAR
DONE:
$mov cl, 13
$int 0x40
$mov cl, 10
361,15 → 363,6
$int 0x40
}
 
inline fastcall DeleteAllButtons()
{
EAX = 12; // function 12:tell os about windowdraw
EBX = 1;
$int 0x40
EBX = 2;
$int 0x40
}
 
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
{
$mov eax, 67
383,14 → 376,25
$int 0x40;
}
 
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
void WriteTextB(dword x,y,byte fontType, dword color, EDX)
{
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$int 0x40;
$add ebx, 1<<16
$int 0x40
}
 
void WriteText(dword x,y,byte fontType, dword color, EDX)
{
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$xor esi, esi
$int 0x40;
}
 
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
{
EAX = 47;
448,6 → 452,7
 
void DrawBar(dword x,y,w,h,EDX)
{
if (h<=0) || (h>65000) return; //bad boy :)
EAX = 13;
EBX = x<<16+w;
ECX = y<<16+h;
457,11 → 462,23
void DefineButton(dword x,y,w,h,EDX,ESI)
{
EAX = 8;
$push edx
EDX += BT_DEL;
$int 0x40;
$pop edx
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
 
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
{
EAX = 8;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
 
inline fastcall void DeleteButton( EDX)
{
EAX = 8;
/programs/cmm/lib/lib.obj/box_lib.h
0,0 → 1,95
//BOX_LIB - Asper
dword boxlib = #aEdit_box_lib;
char aEdit_box_lib[22]="/sys/lib/box_lib.obj\0";
 
dword box_lib_init = #aboxlib_init;
 
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 scrollbar_v_draw = #aScrollbar_v_draw;
dword scrollbar_v_mouse = #aScrollbar_v_mouse;
dword scrollbar_h_draw = #aScrollbar_h_draw;
dword scrollbar_h_mouse = #aScrollbar_h_mouse;
dword version_scrollbar = #aVersion_scrollbar;
 
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 aboxlib_init[9] = "lib_init\0";
char aScrollbar_v_draw[17] = "scrollbar_v_draw\0";
char aScrollbar_v_mouse[18] = "scrollbar_v_mouse\0";
char aScrollbar_h_draw[17] = "scrollbar_h_draw\0";
char aScrollbar_h_mouse[18] = "scrollbar_h_mouse\0";
char aVersion_scrollbar[18] = "version_scrollbar\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;
};
 
struct scroll_bar
{
word size_x,// equ [edi]
start_x,// equ [edi+2]
size_y,// equ [edi+4]
start_y;// equ [edi+6]
dword btn_height, //equ [edi+8]
type,// equ [edi+12]
max_area,// equ [edi+16]
cur_area,// equ [edi+20]
position,// equ [edi+24]
bckg_col,// equ [edi+28]
frnt_col,// equ [edi+32]
line_col,// equ [edi+36]
redraw;// equ [edi+40]
word delta,// equ [edi+44]
delta2,// equ [edi+46]
r_size_x,// equ [edi+48]
r_start_x,// equ [edi+50]
r_size_y,// equ [edi+52]
r_start_y;// equ [edi+54]
dword m_pos,// equ [edi+56]
m_pos_2,// equ [edi+60]
m_keys,// equ [edi+64]
run_size,// equ [edi+68]
position2,// equ [edi+72]
work_size,// equ [edi+76]
all_redraw,// equ [edi+80]
ar_offset;// equ [edi+84]
};
 
//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] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
/programs/cmm/lib/lib.obj/iconv.h
1,4 → 1,4
//Network library
//convert text characters
 
dword iconv_lib = #a_iconv_lib;
char a_iconv_lib[19]="/sys/lib/iconv.obj\0";
29,7 → 29,7
cd = EAX;
if (cd!=0)
{
debug("iconv: semething is wrong with stdcall iconv()");
debug("iconv: something is wrong with stdcall iconv()");
debug(itoa(cd));
debug("in_len");
debug(itoa(in_len));
/programs/cmm/lib/lib.obj/libimg_lib.h
0,0 → 1,104
//Asper
 
//library
dword libimg = #alibimg;
char alibimg[21] = "/sys/lib/libimg.obj\0";
 
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw;
//dword img_flip = #aimg_flip;
//dword img_rotate = #aimg_rotate;
 
dword am1__ = 0x0;
dword bm1__ = 0x0;
 
//import libimg , \
char alibimg_init[9] = "lib_init\0";
char aimg_is_img[11] = "img_is_img\0";
char aimg_to_rgb2[12] = "img_to_rgb2\0";
char aimg_decode[11] = "img_decode\0";
char aimg_destroy[12] = "img_destroy\0";
char aimg_draw[9] = "img_draw\0";
//char aimg_flip[9] = "img_flip\0";
//char aimg_rotate[11] = "img_rotate\0 ";
 
 
 
dword load_image(dword filename)
{
//align 4
dword img_data=0;
dword img_data_len=0;
dword fh=0;
dword image=0;
 
byte tmp_buf[40];
$and img_data, 0
//$mov eax, filename
//$push eax
//invoke file.open, eax, O_READ
file_open stdcall (filename, O_READ);
$or eax, eax
$jnz loc05
$stc
return 0;
@loc05:
$mov fh, eax
//invoke file.size
file_size stdcall (filename);
$mov img_data_len, ebx
//stdcall mem.Alloc, ebx
mem_Alloc(EBX);
$test eax, eax
$jz error_close
$mov img_data, eax
//invoke file.read, [fh], eax, [img_data_len]
file_read stdcall (fh, EAX, img_data_len);
$cmp eax, -1
$jz error_close
$cmp eax, img_data_len
$jnz error_close
//invoke file.close, [fh]
file_close stdcall (fh);
$inc eax
$jz error_
//; img.decode checks for img.is_img
//; //invoke img.is_img, [img_data], [img_data_len]
//; $or eax, eax
//; $jz exit
//invoke img.decode, [img_data], [img_data_len], 0
EAX=img_data;
img_decode stdcall (EAX, img_data_len,0);
$or eax, eax
$jz error_
$cmp image, 0
$pushf
$mov image, eax
//call init_frame
$popf
//call update_image_sizes
mem_Free(img_data);//free_img_data(img_data);
$clc
return image;
 
@error_free:
//invoke img.destroy, [image]
img_destroy stdcall (image);
$jmp error_
 
@error_pop:
$pop eax
$jmp error_
@error_close:
//invoke file.close, [fh]
file_close stdcall (fh);
@error_:
mem_Free(img_data);
$stc
return 0;
}
/programs/cmm/lib/lib.obj/libio_lib.h
0,0 → 1,36
//Asper
 
//library
dword libio = #alibio;
char alibio[21] = "/sys/lib/libio.obj\0"; //"libio.obj\0";
 
dword libio_init = #alibio_init;
dword file_size = #afile_size;
dword file_open = #afile_open;
dword file_read = #afile_read;
dword file_close = #afile_close;
 
dword am2__ = 0x0;
dword bm2__ = 0x0;
 
 
//import libio , \
char alibio_init[9] = "lib_init\0";
char afile_size[11] = "file_size\0";
char afile_open[12] = "file_open\0";
char afile_read[11] = "file_read\0";
char afile_close[12] = "file_close\0";
 
//align 4
//dword fh=0;
 
#define O_BINARY 0
#define O_READ 1
#define O_WRITE 2
#define O_CREATE 4
#define O_SHARE 8
#define O_TEXT 16
 
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/programs/cmm/lib/lib.obj/network.h
0,0 → 1,65
//Network library
 
dword network_lib = #a_network_lib;
char a_network_lib[21]="/sys/lib/network.obj\0";
 
dword network_lib_init = #aLib_init;
dword inet_addr = #aInet_addr; //"192.168.0.1" -> dword IP
dword inet_ntoa = #aInet_ntoa;
dword getaddrinfo = #aGetaddrinfo;
dword getaddrinfo_start = #aGetaddrinfo_start;
dword getaddrinfo_process = #aGetaddrinfo_process;
dword getaddrinfo_abort = #aGetaddrinfo_abort;
dword freeaddrinfo = #aFreeaddrinfo;
 
dword am3__ = 0x0;
dword bm3__ = 0x0;
 
char aLib_init[9] = "lib_init\0";
char aInet_addr[10] = "inet_addr\0";
char aInet_ntoa[10] = "inet_ntoa\0";
char aGetaddrinfo[12] = "getaddrinfo\0";
char aGetaddrinfo_start[18] = "getaddrinfo_start\0";
char aGetaddrinfo_process[20] = "getaddrinfo_process\0";
char aGetaddrinfo_abort[18] = "getaddrinfo_abort\0";
char aFreeaddrinfo[13] = "freeaddrinfo\0";
 
/*
addr соответствует IP 10.101.102.103
itoa((addr&0xFF000000)>>24) равно 103
itoa((addr&0xFF0000)>>16) —это 102
itoa((addr&0xFF00)>>8) — это 101
itoa(addr&0xFF) — это 10
*/
 
dword GetIPfromAdress(dword addr)
{
dword lpointer, IPa;
getaddrinfo stdcall (addr, 0, 0, #lpointer);
if (EAX!=0) IPa = 0; else IPa = DSDWORD[DSDWORD[lpointer+24]+4];
freeaddrinfo stdcall (lpointer);
return IPa;
}
 
/*
//Convert the string from standard IPv4 dotted notation to integer IP addr.
inet_addr stdcall ("192.168.0.1");
server_IP = EAX;
 
 
char* __stdcall inet_ntoa(struct in_addr in);
Convert the Internet host address to standard IPv4 dotted notation.
 
getaddrinfo(__in const char* hostname, __in const char* servname,
__in const struct addrinfo* hints, __out struct addrinfo **res);
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
*/
/programs/cmm/lib/lib.obj/truetype.h
0,0 → 1,29
//ýòî âñòàâèòü ïîñëå çàãðóçêè îñíîâíûõ áèáëèîòåê
char fontinfo[28];
dword libtruetype = #att;
char att[] = "/sys/lib/truetype.obj"; //"truetype.obj\0";
dword truetype = #att_truetype;
dword get_length = #att_get_length;
dword get_width = #att_get_width;
dword text_out = #att_text_out;
dword init_font = #att_init_font;
dword am3__ = 0x0;
dword bm3__ = 0x0;
//import libimg , \
char att_truetype[] = "truetype";
char att_get_length[] = "get_length";
char att_get_width[] = "get_width";
char att_text_out[] = "text_out";
char att_init_font[] = "init_font";
//load_dll2(libtruetype, #truetype,0);
//à ýòî - â ìîìåíò îòðèñîâêè îêíà
//text_out stdcall (#text, -1, 40, 0xFF0000, 100, 100);
/programs/cmm/lib/mem.h
1,5 → 1,5
//mem.Init
dword mem_Init()
 
dword mem_init()
{
$push ebx
$mov eax, 68
10,8 → 10,7
return EAX;
}
 
//mem.Alloc
dword mem_Alloc(dword size)
dword malloc(dword size)
{
$push ebx
$push ecx
25,8 → 24,7
return EAX;
}
 
//mem.ReAlloc
stdcall dword mem_ReAlloc(dword mptr, size)
stdcall dword realloc(dword mptr, size)
{
$push ebx
$push ecx
43,8 → 41,7
return EAX;
}
 
//mem.Free
void mem_Free(dword mptr)
dword free(dword mptr)
{
$push eax
$push ebx
59,10 → 56,10
$pop ecx
$pop ebx
$pop eax
return 0;
}
 
//stdcall dword ??
inline fastcall mem_Move( EDI, ESI, ECX)
inline fastcall memmov( EDI, ESI, ECX)
{
asm {
MOV EAX, ECX
92,6 → 89,10
}
}
 
#define mem_Alloc malloc
#define mem_ReAlloc realloc
#define mem_Free free
#define mem_Init mem_init
 
/*:void fastcall memsetz( EDI, ECX)
{
106,7 → 107,7
}
}
 
:void fastcall memset( EDI, ECX, AL)
:void fastcall memset( EDI, ECX, AL) //copy AL to EDI of ECX num (void *dest, size_t, char c )
{
asm {
MOV AH, AL
/programs/cmm/lib/strings.h
1,7 → 1,7
//------------------------------------------------------------------------------
// strcmp( ESI, EDI)
// strlen( EDI)
// strcpy( EDI, ESI)
// strcpy( EDI, ESI) --- 0 if ==
// strcat( EDI, ESI)
// strchr( ESI,BL)
// strrchr( ESI,BL)
9,9 → 9,11
// itoa( ESI)
// atoi( EAX)
// strupr( ESI)
// strlwr( ESI) ----- âîçìîæíî íå ïîääåðæèâàåò êèðèëëèöó
// strlwr( ESI) --- kyrillic symbols may not work
// strttl( EDX)
// strtok( ESI)
// strcpyb(dword searchin, copyin, startstr, endstr) --- copy string between strings
//chrnum(dword searchin, char symbol) --- count of symbol in string
//------------------------------------------------------------------------------
 
inline fastcall signed int strcmp( ESI, EDI)
49,39 → 51,6
}
 
 
 
/*
 
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
94,11 → 63,11
inline fastcall strcpy( EDI, ESI)
{
$cld
l2:
L2:
$lodsb
$stosb
$test al,al
$jnz l2
$jnz L2
}
 
 
156,17 → 125,17
 
$mov eax, esi
$push -'0'
f2:
F2:
$xor edx, edx
$div ecx
$push edx
$test eax, eax
$jnz f2
f3:
$jnz F2
F3:
$pop eax
$add al, '0'
$stosb
$jnz f3
$jnz F3
$mov al, '\0'
$stosb
186,7 → 155,7
BL=DSBYTE[ESI]-'0';
EAX=EAX*10+EBX;
ESI++;
}while(DSBYTE[ESI]>0);
}while(DSBYTE[ESI]>='0');
IF(DSBYTE[EDI]=='-') -EAX;
}
 
294,9 → 263,37
}
}
 
//
void strcpyb(dword searchin, copyin, startstr, endstr)
{
dword startp, endp;
startp = strstr(searchin, startstr) + strlen(startstr);
endp = strstr(startp, endstr);
if (startp==endp) return;
do
{
DSBYTE[copyin] = DSBYTE[startp];
copyin++;
startp++;
}
while (startp<endp);
DSBYTE[copyin] = '\0';
}
 
int chrnum(dword searchin, char symbol)
{
int num = 0;
while(DSBYTE[searchin])
{
if (DSBYTE[searchin] == symbol) num++;
searchin++;
}
return num;
}
 
 
 
 
/* strtok( LPSTR dest, src, divs);
src - óêàçàòåëü íà èñõîäíóþ ñòðîêó èëè ðåçóëüòàò ïðåäûäóùåãî âûçîâà
dest - óêàçàòåëü íà áóôåð, êóäà áóäåò ñêîïèðîâàíî ñëîâî