Eolite 1.36

git-svn-id: svn://kolibrios.org@3043 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-11-15 22:03:43 +00:00
parent 5012225aed
commit eb083dc46f
12 changed files with 269 additions and 253 deletions

View File

@ -20,7 +20,7 @@ int BUTTON_HEIGHT=18;
#define ONLY_OPEN 2 #define ONLY_OPEN 2
//ïåðåìåííûå //ïåðåìåííûå
#define title "Eolite File Manager v1.35" #define title "Eolite File Manager v1.36"
dword selection_col = 0x94AECE; dword selection_col = 0x94AECE;
dword lpanel_col = 0x00699C; dword lpanel_col = 0x00699C;
@ -224,8 +224,9 @@ void main()
IF (show_actions==1) show_actions=0; ELSE show_actions=1; IF (show_actions==1) show_actions=0; ELSE show_actions=1;
Actions(); Actions();
break; break;
case 78: case 78: //rescan devices
IF (show_dev_name==1) show_dev_name=0; ELSE show_dev_name=1; Tip(56, "Devices", 78, "-");
Pause(10);
GetSystemDiscs(); GetSystemDiscs();
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
DrawSystemDiscs(); DrawSystemDiscs();
@ -522,39 +523,6 @@ void List_ReDraw()
TVScroll(); TVScroll();
} }
/*#include "def_file.txt"
#define CELL_SIZE 58
void List_ReDraw()
{
int i,
po_gor, po_ver,
on_xx, name_len;
po_gor=onLeft(22,197)/CELL_SIZE;
po_ver=onTop(57,6)/CELL_SIZE;
for (j=0; j<po_ver; j++;) for (i=0; i<po_gor; i++;)
{
if (j*po_gor+i+za_kadrom>=count)
{
DrawBar(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,0xFFFFFF);
continue;
}
DefineButton(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,j*po_gor+i+201+BT_HIDE,0xFFFFFF);
DrawBar(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,0xFFFFFF);
off=file_mas[j*po_gor+i+za_kadrom]*304 + buf+72;
name_len=strlen(off);
if (name_len>9) name_len=9;
on_xx=-name_len*3+29;
WriteText(i*CELL_SIZE+193+on_xx,j*CELL_SIZE+57+CELL_SIZE-16,0,0,off,name_len);
if (!TestBit(ESDWORD[off-40], 4))
PutImage(#file32,32,32,i*CELL_SIZE+197+9,j*CELL_SIZE+57+5);
else
PutImage(#folder32,32,32,i*CELL_SIZE+197+9,j*CELL_SIZE+57+5);
}
TVScroll();
}*/
void Line_ReDraw(dword color, filenum){ void Line_ReDraw(dword color, filenum){
dword text_col=0, name_len, dword text_col=0, name_len,

View File

@ -1,3 +1,10 @@
15.11.12 -- v1.36
- устранена утечка памяти при сканировании устройств;
- частично устранён вылет программы на больших папках (спасибо SoUrcerer за
то, что научил пользоваться отладчиком);
- ограничение на количесво устройств изменено с 10 на 20;
- обновление кода.
12.11.12 -- v1.35 12.11.12 -- v1.35
- теперь окно не обрабатывает клавиши если свёрнуто в заголовок; - теперь окно не обрабатывает клавиши если свёрнуто в заголовок;
- фикс для строки адреса; - фикс для строки адреса;

View File

@ -1,5 +1,5 @@
del Eolite del Eolite
@..\C--\c-- Eolite.c-- @..\C--\c-- Eolite.c-- /lst
rename Eolite.com Eolite rename Eolite.com Eolite
rem ..\C--\kpack Eolite rem ..\C--\kpack Eolite
del warning.txt del warning.txt

View File

@ -39,7 +39,7 @@ void about_dialog()
DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite"); DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite");
DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè
PutPaletteImage(#logo,85,85,43,7,#logo_pal); PutPaletteImage(#logo,85,85,43,7,#logo_pal);
WriteText(46,100,0x90,0xBF40BF,"Eolite v1.34",0); WriteText(46,100,0x90,0xBF40BF,"Eolite v1.36",0);
$add ebx, 1<<16 $add ebx, 1<<16
$int 0x40 $int 0x40
WriteText(55,120,0x80,0,"Developers:",0); WriteText(55,120,0x80,0,"Developers:",0);

View File

@ -2,17 +2,17 @@
path_string disk_list[20]; path_string disk_list[20];
int disc_num; int disc_num;
dword devbuf;
void GetSystemDiscs() void GetSystemDiscs()
{ {
char dev_name[10], sys_discs[10]; unsigned char dev_name[10], sys_discs[10];
int i1, j1, dev_num, dev_disc_num; unsigned int i1, j1, dev_num, dev_disc_num;
dword devbuf;
disc_num=0;
disc_num=0;
if (devbuf) free(devbuf);
devbuf= malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè devbuf= malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
ReadDir(10, devbuf, "/"); ReadDir(19, devbuf, "/");
dev_num = EBX; dev_num = EBX;
for (i1=0; i1<dev_num; i1++) for (i1=0; i1<dev_num; i1++)
{ {
@ -46,23 +46,47 @@ void DrawSystemDiscs()
DrawBar(2,56,15,onTop(21,41),lpanel_col); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà DrawBar(2,56,15,onTop(21,41),lpanel_col); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
DrawBar(177,56,15,onTop(21,41),lpanel_col); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà DrawBar(177,56,15,onTop(21,41),lpanel_col); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
//ñïèñîê äèñêîâ //ñïèñîê äèñêîâ
if (show_dev_name) Tip(56, "Devices", 78, "="); Tip(56, "Devices", 78, "=");
else Tip(56, "Devices", 78, "-");
for (i=0;i<disc_num;i++) for (i=0;i<disc_num;i++)
{ {
DrawBar(17,i*16+74,160,17,0xFFFFFF); //áåëîå DrawBar(17,i*16+74,160,17,0xFFFFFF); //ôîí
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
copystr("Unknown ",#disc_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü strcpy(#dev_name, #disk_list[i].Item);
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê dev_name[strlen(#dev_name)-1]=NULL;
copystr(#disk_list[i].Item, #dev_name); switch(dev_name[1])
dev_name[strlen(#dev_name)-1]=''; {
IF (dev_name[1]=='r') { dev_icon=0; copystr("RAM disk ",#disc_name); } case 'r':
IF (dev_name[1]=='c') { dev_icon=1; copystr("CD-ROM ",#disc_name); } dev_icon=0;
IF (dev_name[1]=='f') { dev_icon=2; copystr("Floppy disk ",#disc_name); } strcpy(#disc_name, "RAM disk ");
IF (dev_name[1]=='t') { dev_icon=4; copystr("Virtual disk ",#disc_name); } break;
IF (dev_name[1]=='h') || (dev_name[1]=='b') copystr("Hard disk ",#disc_name); case 'c':
copystr(#dev_name,#disc_name+strlen(#disc_name)); dev_icon=1;
// strcpy(#disc_name, "CD-ROM ");
break;
case 'f':
dev_icon=2;
strcpy(#disc_name, "Floppy disk ");
break;
case 'h':
case 'b':
dev_icon=3;
strcpy(#disc_name, "Hard disk ");
break;
case 't':
dev_icon=4;
strcpy(#disc_name, "RAM disk ");
//temp[0]=dev_name[4]; //ŕőóĺňü ńčńňĺěŕ
//temp[1]=NULL;
//DefineButton(17+143,i*16+74,16,16,StrToInt(#temp)+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
//WriteText(45+121,i*16+79,0x80,0xAC0000,"-",0);
//WriteText(45+121,i*16+79+1,0x80,0xAC0000,"-",0);
break;
default:
dev_icon=3; //ďî-óěîë÷ŕíčţ óńňđîéńňâî âűăë˙äčň ęŕę ćĺńň˙ę íî ýňî íĺďđŕâčëüíî
strcpy(#disc_name, "Unknown ");
}
strcat(#disc_name, #dev_name);
if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name,0); if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name,0);
else WriteText(45,i*16+79,0x80,0,#dev_name,0); else WriteText(45,i*16+79,0x80,0,#dev_name,0);
PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76); PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76);

View File

@ -61,6 +61,9 @@ char *ext[]={
"jpeg",19, "jpeg",19,
"raw", 19, "raw", 19,
"psd", 19, "psd", 19,
"wbmp",19,
"tiff",19,
"tif", 19,
"ico", 20, "ico", 20,
"cur", 20, "cur", 20,
"ani", 20, "ani", 20,

View File

@ -6,7 +6,7 @@
#define PARAM 2 #define PARAM 2
#define OPTION 3 #define OPTION 3
char NOTIFY_PATH[7]="@notify"; #define NOTIFY_PATH "@notify";
unsigned char *ERROR_TEXT[]={ unsigned char *ERROR_TEXT[]={
"Code #0 - No error", "Code #0 - No error",
@ -43,7 +43,7 @@ void GetIni(byte onload)
ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini"); ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini");
IF (EAX<>6) //åñëè ôàéëà ñ íàñòðîéêàìè òóïî íåò ïå÷àëüêà IF (EAX<>6) //åñëè ôàéëà ñ íàñòðîéêàìè òóïî íåò ïå÷àëüêà
{ {
IF (onload==1) RunProgram(#NOTIFY_PATH, "Eolite.ini not found. Defaults will be used."); IF (onload==1) RunProgram(NOTIFY_PATH, "Eolite.ini not found. Defaults will be used.");
IF (onload==0) goto RUN_AS_PROGRAM; IF (onload==0) goto RUN_AS_PROGRAM;
} }
fsize=EBX; fsize=EBX;
@ -120,7 +120,7 @@ void Write_Error(int error_number)
} }
if (curbtn>=0) Line_ReDraw(0xFF0000, curbtn); if (curbtn>=0) Line_ReDraw(0xFF0000, curbtn);
Pause(5); Pause(5);
RunProgram(#NOTIFY_PATH, #error); RunProgram(NOTIFY_PATH, #error);
//DrawBar(192,onTop(0, BUTTON_HEIGHT+7),onLeft(27,192),BUTTON_HEIGHT,0xFF0000); //DrawBar(192,onTop(0, BUTTON_HEIGHT+7),onLeft(27,192),BUTTON_HEIGHT,0xFF0000);
//WriteText(205,onTop(-5, BUTTON_HEIGHT+7),0x80,0xFFFFFF,#error,0); //WriteText(205,onTop(-5, BUTTON_HEIGHT+7),0x80,0xFFFFFF,#error,0);
} }

View File

@ -14,24 +14,24 @@ void ShowMessage(dword message)
dword ConvertSize(dword bytes) dword ConvertSize(dword bytes)
{ {
byte size_prefix[8], temp[3]; unsigned char size_prefix[8], size_nm[4];
IF (bytes>=1073741824) copystr(" Gb",#temp); if (bytes>=1073741824) copystr(" Gb",#size_nm);
ELSE IF (bytes>=1048576) copystr(" Mb",#temp); else if (bytes>=1048576) copystr(" Mb",#size_nm);
ELSE IF (bytes>=1024) copystr(" Kb",#temp); else if (bytes>=1024) copystr(" Kb",#size_nm);
ELSE copystr(" b ",#temp); else copystr(" b ",#size_nm);
WHILE (bytes>1023) bytes/=1024; while (bytes>1023) bytes/=1024;
copystr(IntToStr(bytes),#size_prefix); copystr(IntToStr(bytes),#size_prefix);
copystr(#temp,#size_prefix+strlen(#size_prefix)); copystr(#size_nm,#size_prefix+strlen(#size_prefix));
EAX=#size_prefix; return #size_prefix;
} }
inline fastcall void TVScroll() { //Ïðîêðóòêà inline fastcall void TVScroll() { //Ïðîêðóòêà
dword on_y; dword on_y;
IF (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,0xE4DFE1,""); return;} if (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,0xE4DFE1,""); return;}
on_y = za_kadrom * onTop(22,57) / count +57; on_y = za_kadrom * onTop(22,57) / count +57;
scroll_size=onTop(22,57) * but_num - but_num / count; scroll_size=onTop(22,57) * but_num - but_num / count;
IF (scroll_size<20) scroll_size = 20; //óñòàíàâëèâàåì ìèíèìàëüíûé ðàçìåð ñêðîëëà if (scroll_size<20) scroll_size = 20; //óńňŕíŕâëčâŕĺě ěčíčěŕëüíűé đŕçěĺđ ńęđîëëŕ
IF (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+but_num>=count) on_y=onTop(23+scroll_size,0); //äëÿ áîëüøîãî ñïèñêà if (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+but_num>=count) on_y=onTop(23+scroll_size,0); //äë˙ áîëüřîăî ńďčńęŕ
DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,0xE4DFE1,"");//ïîëçóíîê DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,0xE4DFE1,"");//ïîëçóíîê
DrawBar(onLeft(26,0),57,15,on_y-57,0xCED0D0);//ïîëå äî ïîëçóíêà DrawBar(onLeft(26,0),57,15,on_y-57,0xCED0D0);//ïîëå äî ïîëçóíêà
DrawBar(onLeft(26,0),on_y+scroll_size+1,15,onTop(22,57)-scroll_size-on_y+56,0xCED0D0); //ïîëå ïîñëå ïîëçóíêà DrawBar(onLeft(26,0),on_y+scroll_size+1,15,onTop(22,57)-scroll_size-on_y+56,0xCED0D0); //ïîëå ïîñëå ïîëçóíêà

View File

@ -2,53 +2,52 @@
void Sort_by_Size(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1 void Sort_by_Size(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{ {
int i = a; int iss = a;
IF (a >= b) return; IF (a >= b) return;
FOR (j = a; j <= b; j++) FOR (j = a; j <= b; j++)
IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;}
{ file_mas[i] >< file_mas[j]; i++;} Sort_by_Size (a, iss-2);
Sort_by_Size (a, i-2); Sort_by_Size (iss, b);
Sort_by_Size (i, b);
} }
void Sort_by_Name(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1 void Sort_by_Name(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{ {
int i = a; int isn = a;
IF (a >= b) return; IF (a >= b) return;
FOR (j = a; j <= b; j++) FOR (j = a; j <= b; j++)
IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[i] >< file_mas[j]; i++;} IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
Sort_by_Name(a, i-2); Sort_by_Name(a, isn-2);
Sort_by_Name(i, b); Sort_by_Name(isn, b);
} }
void Sort_by_Type(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1 void Sort_by_Type(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{ {
int i=a; int jst, ist=a;
int n; int n;
dword offset=buf+72; unsigned char filename1[256], filename2[256];
byte filename1[256], filename2[256]; unsigned char ext1[256], ext2[256];
IF (a >= b) return; IF (a >= b) return;
for (j = a; j <= b; j++) for (jst = a; jst <= b; jst++)
{ {
// ext1[0]=ext2[0]=filename1[0]=filename2[0]=NULL;
copystr(file_mas[j]*304 + offset, #filename1); copystr(file_mas[jst]*304 + buf+72, #filename1);
copystr(file_mas[b]*304 + offset, #filename2); copystr(file_mas[b]*304 + buf+72, #filename2);
n=strlen(#filename1)-1; n=strlen(#filename1)-1;
WHILE (filename1[n]<>'.') && (n>0) n--; WHILE (filename1[n]<>'.') && (n>0) n--;
IF (n) copystr(#filename1+n+1, #filename1); IF (n) copystr(#filename1+n+1, #ext1);
n=strlen(#filename2)-1; n=strlen(#filename2)-1;
WHILE (filename2[n]<>'.') && (n>0) n--; WHILE (filename2[n]<>'.') && (n>0) n--;
IF (n) copystr(#filename2+n+1, #filename2); IF (n) copystr(#filename2+n+1, #ext2);
//
n=strcmp(#filename1, #filename2); n=strcmp(#ext1, #ext2);
IF (n<0) { file_mas[i] >< file_mas[j]; i++;} IF (n<0) { file_mas[ist] >< file_mas[jst]; ist++;}
IF (n==0) && (strcmp(file_mas[j]*304 + offset, file_mas[b]*304 + offset)<=0) { file_mas[i] >< file_mas[j]; i++;} IF (n==0) && (strcmp(#filename1, #filename2)<=0) { file_mas[ist] >< file_mas[jst]; ist++;}
} }
Sort_by_Type(a, i-2); Sort_by_Type(a, ist-2);
Sort_by_Type(i, b); Sort_by_Type(ist, b);
} }

View File

@ -28,8 +28,8 @@ struct BDVK{
//////////////////////////// ////////////////////////////
// Ńîçäŕňü ôŕéë // // Ńîçäŕňü ôŕéë //
//////////////////////////// ////////////////////////////
/*f70 create_file_70; f70 create_file_70;
void CreateFile(dword file_size, read_buffer, file_path) int CreateFile(dword file_size, read_buffer, file_path)
{ {
create_file_70.func = 2; create_file_70.func = 2;
create_file_70.param1 = 0; create_file_70.param1 = 0;
@ -41,13 +41,13 @@ void CreateFile(dword file_size, read_buffer, file_path)
$mov eax,70 $mov eax,70
$mov ebx,#create_file_70.func $mov ebx,#create_file_70.func
$int 0x40 $int 0x40
} */ }
//////////////////////////// ////////////////////////////
// Ďđî÷čňŕňü ôŕéë // // Ďđî÷čňŕňü ôŕéë //
//////////////////////////// ////////////////////////////
f70 read_file_70; f70 read_file_70;
void ReadFile(dword pos, file_size, read_buffer, file_path) int ReadFile(dword pos, file_size, read_buffer, file_path)
{ {
read_file_70.func = 0; read_file_70.func = 0;
read_file_70.param1 = pos; read_file_70.param1 = pos;

View File

@ -15,6 +15,7 @@ dword I_Path = #program_path;
char param[4096]; char param[4096];
char program_path[4096]; char program_path[4096];
#include "lib\strings.h"
//Events //Events
#define evMouse 6 #define evMouse 6
@ -211,153 +212,6 @@ inline fastcall void MoveSize( EBX,ECX,EDX,ESI){
$int 0x40 $int 0x40
} }
//------------------------------------------------------------------------------
inline fastcall dword strlen( EDI)
{
asm {
xor ecx, ecx
xor eax, eax
dec ecx
repne scasb
sub eax, 2
sub eax, ecx
}
}
inline fastcall copystr( ESI,EDI)
{
$cld
l1:
$lodsb
$stosb
$test al,al
$jnz l1
}
char buffer[11];
inline fastcall dword IntToStr( ESI)
{
$mov edi, #buffer
$mov ecx, 10
$test esi, esi
$jns f1
$mov al, '-'
$stosb
$neg esi
f1:
$mov eax, esi
$push -'0'
f2:
$xor edx, edx
$div ecx
$push edx
$test eax, eax
$jnz f2
f3:
$pop eax
$add al, '0'
$stosb
$jnz f3
$mov eax, #buffer
$ret
}
inline fastcall dword StrToInt()
{
ESI=EDI=EAX;
IF(DSBYTE[ESI]=='-')ESI++;
EAX=0;
BH=AL;
do{
BL=DSBYTE[ESI]-'0';
EAX=EAX*10+EBX;
ESI++;
}while(DSBYTE[ESI]>0);
IF(DSBYTE[EDI]=='-') -EAX;
}
dword StrToCol(char* htmlcolor)
{
dword j, color=0;
char ch=0x00;
FOR (j=0; j<6; j++)
{
ch=ESBYTE[htmlcolor+j];
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
}
return color;
}
inline fastcall 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 unsigned int strchr(ESI,BL)
{
int jj=0, last=-1;
do{
jj++;
$lodsb
IF(AL==BL) last=jj;
} while(AL!=0);
return last;
}
inline fastcall TitleCase( EDX)
{
AL=DSBYTE[EDX];
IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f;
IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //à-ï
IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //à-ï
do{
EDX++;
AL=DSBYTE[EDX];
IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;}
IF(AL>='')&&(AL<='<EFBFBD>')DSBYTE[EDX]=AL|0x20; // 
IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //à-ï
}while(AL!=0);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline fastcall void PutPixel( EBX,ECX,EDX) inline fastcall void PutPixel( EBX,ECX,EDX)
{ {
@ -438,9 +292,6 @@ void PutImage(dword EBX,w,h,x,y)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline fastcall void debug( EDX) inline fastcall void debug( EDX)
{ {
$push eax
$push ebx
$push ecx
$mov eax, 63 $mov eax, 63
$mov ebx, 1 $mov ebx, 1
next_char: next_char:
@ -455,7 +306,4 @@ done:
$int 0x40 $int 0x40
$mov cl, 10 $mov cl, 10
$int 0x40 $int 0x40
$pop eax
$pop ebx
$pop ecx
} }

View File

@ -0,0 +1,167 @@
//CODED by Veliant, Leency 2008-2012. GNU GPL licence.
inline fastcall dword strlen( EDI)
{
asm {
xor ecx, ecx
xor eax, eax
dec ecx
repne scasb
sub eax, 2
sub eax, ecx
}
}
inline fastcall copystr( ESI,EDI)
{
$cld
l1:
$lodsb
$stosb
$test al,al
$jnz l1
}
char buffer[11];
inline fastcall dword IntToStr( ESI)
{
$mov edi, #buffer
$mov ecx, 10
$test esi, esi
$jns f1
$mov al, '-'
$stosb
$neg esi
f1:
$mov eax, esi
$push -'0'
f2:
$xor edx, edx
$div ecx
$push edx
$test eax, eax
$jnz f2
f3:
$pop eax
$add al, '0'
$stosb
$jnz f3
$mov eax, #buffer
$ret
}
inline fastcall dword StrToInt()
{
ESI=EDI=EAX;
IF(DSBYTE[ESI]=='-')ESI++;
EAX=0;
BH=AL;
do{
BL=DSBYTE[ESI]-'0';
EAX=EAX*10+EBX;
ESI++;
}while(DSBYTE[ESI]>0);
IF(DSBYTE[EDI]=='-') -EAX;
}
dword StrToCol(char* htmlcolor)
{
dword j, color=0;
char ch=0x00;
FOR (j=0; j<6; j++)
{
ch=ESBYTE[htmlcolor+j];
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
}
return color;
}
inline fastcall 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, last=-1;
do{
jj++;
$lodsb
IF(AL==BL) last=jj;
} while(AL!=0);
return last;
}
inline fastcall TitleCase( EDX)
{
AL=DSBYTE[EDX];
IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f;
IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //à-ï
IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //à-ï
do{
EDX++;
AL=DSBYTE[EDX];
IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;}
IF(AL>='')&&(AL<='<EFBFBD>')DSBYTE[EDX]=AL|0x20; // 
IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //à-ï
}while(AL!=0);
}
inline fastcall strcpy( EDI, ESI)
{
$cld
l2:
$lodsb
$stosb
$test al,al
$jnz l2
}
inline fastcall strcat( EDI, ESI)
{
asm {
mov ebx, edi
xor ecx, ecx
xor eax, eax
dec ecx
repne scasb
dec edi
mov edx, edi
mov edi, esi
xor ecx, ecx
xor eax, eax
dec ecx
repne scasb
xor ecx, 0ffffffffh
mov edi, edx
mov edx, ecx
mov eax, edi
shr ecx, 2
rep movsd
mov ecx, edx
and ecx, 3
rep movsb
mov eax, ebx
}
}