HTMLv 0.96b

git-svn-id: svn://kolibrios.org@2874 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-07-16 11:52:03 +00:00
parent 2cf14720b5
commit cd41d0ab26
11 changed files with 401 additions and 164 deletions

View File

@ -22,7 +22,7 @@
#define URL param #define URL param
char editURL[4096], char editURL[sizeof(URL)],
page_links[12000], page_links[12000],
header[300]; header[300];
@ -31,7 +31,7 @@ struct lines{
}; };
int mouse_dd; int mouse_dd;
edit_box edit1= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,248,#editURL,#mouse_dd,2,19,19}; edit_box edit1= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(editURL),#editURL,#mouse_dd,2,19,19};
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; //details in scroll_lib.h-- scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; //details in scroll_lib.h--
@ -183,7 +183,7 @@ void SetElementSizes()
void Draw_Window() void Draw_Window()
{ {
int j; int j;
DefineAndDrawWindow(215,100,WIN_W,WIN_H,0x73,0x00E4DFE1,0,0,0); DefineAndDrawWindow(215,100,WIN_W,WIN_H,0x73,0x00E4DFE1,0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì if (Form.status_window>2) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì
@ -215,7 +215,7 @@ void Draw_Window()
} }
int onLeft(dword right,left) {return Form.width-right-left;} int onLeft(dword right,left) {return Form.width-right-left;}
int onTop(dword down,up) {return Form.height-GetSkinWidth()-down-up;} int onTop(dword down,up) {return Form.height-GetSkinHeight()-down-up;}
stop: stop:

View File

@ -1,3 +1,15 @@
16.07.12 - 0.96b
- небольшие улучшения в обработке ссылок и изображений;
- включение обработки разрывов строк через меню.
14.07.12 - 0.96
- исправлен баг со строкой адреса
- исправлен баг с незакрытыми тегами <a>
- частично исправлен баг с длинными адресами урлов
- меню - новое окно
22.06.12 - 0.95
22.06.12 - 0.94c 22.06.12 - 0.94c
- испрвлена регрессия со ссылками; - испрвлена регрессия со ссылками;
- исправлена регрессия с ползунком; - исправлена регрессия с ползунком;

View File

@ -8,7 +8,7 @@ dword
char download_path[]="/rd/1/.download"; char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s="; char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 0.95"; char version[]=" Text-based Browser 0.96b";
struct TWebBrowser { struct TWebBrowser {
@ -46,7 +46,7 @@ char line[500],
tag[100], tag[100],
tagparam[10000], tagparam[10000],
parametr[1200], parametr[1200],
options[1000]; options[4096];
#include "include\history.h" #include "include\history.h"
#include "include\colors.h" #include "include\colors.h"
@ -78,16 +78,24 @@ void TWebBrowser::Scan(int id)
strcpy(#anchor, #URL+strrchr(#URL, '#')); strcpy(#anchor, #URL+strrchr(#URL, '#'));
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà
} }
GetNewUrl(); GetNewUrl();
if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
{ {
//if (strstr(#URL,"http:"))
RunProgram("/sys/media/kiv", #URL); RunProgram("/sys/media/kiv", #URL);
strcpy(#editURL, BrowserHistory.CurrentUrl()); strcpy(#editURL, BrowserHistory.CurrentUrl());
strcpy(#URL, BrowserHistory.CurrentUrl()); strcpy(#URL, BrowserHistory.CurrentUrl());
return; return;
} }
if (!strcmpn(#URL,"mailto:", 7))
{
RunProgram("@notify", #URL);
strcpy(#editURL, BrowserHistory.CurrentUrl());
strcpy(#URL, BrowserHistory.CurrentUrl());
return;
}
OpenPage(); OpenPage();
return; return;
@ -104,6 +112,13 @@ void TWebBrowser::Scan(int id)
case 021: //Ctrl+U case 021: //Ctrl+U
ReadHtml(_UTF); ReadHtml(_UTF);
break; break;
case 004: //Ctrl+D
ReadHtml(_DOS);
break;
case 001:
if (!pre_text) pre_text=2;
else pre_text=0;
break;
case BACK: case BACK:
if (!BrowserHistory.GoBack()) return; if (!BrowserHistory.GoBack()) return;
OpenPage(); OpenPage();
@ -186,18 +201,23 @@ void TWebBrowser::Scan(int id)
} }
char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/rd/", "/fd/", "/bd/", "/hd/", "/cd/", "/tmp/", 0};
//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){
void TWebBrowser::GetNewUrl(){ void TWebBrowser::GetNewUrl(){
IF (!strcmp(get_URL_part(2),"./")) strcpy(#URL, #URL+2); //èãíîðèì :) int i;
if (URL[0] <> '/') for (i=0; ABSOLUTE_LINKS[i]; i++)
&& (strcmp(get_URL_part(5),"http:")<>0) && (strcmp(get_URL_part(5),"mailt")<>0) && (strcmp(get_URL_part(5),"ftp:/")<>0) if (!strcmpn(#URL, ABSOLUTE_LINKS[i], strlen(ABSOLUTE_LINKS[i]))) return;
{
strcpy(#editURL, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
_CUT_ST_LEVEL_MARK: IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); //èãíîðèì :)
if (URL[0] == '/') strcpy(#URL, #URL+1);
strcpy(#editURL, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http://pagename.ua <-- íàõðåíà ýòà ñòðîêà??? _CUT_ST_LEVEL_MARK:
if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http://
{ {
editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
} }
@ -210,9 +230,9 @@ void TWebBrowser::GetNewUrl(){
} }
if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/"); if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/");
strcat(#editURL, #URL); //êëåèì íîâûé àäðåñ strcat(#editURL, #URL); //êëåèì íîâûé àäðåñ
strcpy(#URL, #editURL); strcpy(#URL, #editURL);
}
} }
@ -247,6 +267,7 @@ void TWebBrowser::OpenPage()
strcpy(#editURL, #URL); strcpy(#editURL, #URL);
BrowserHistory.AddUrl(); BrowserHistory.AddUrl();
strcpy(#header, #version); strcpy(#header, #version);
pre_text =0;
if (!strcmp(get_URL_part(5),"http:"))) if (!strcmp(get_URL_part(5),"http:")))
{ {
KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ
@ -266,7 +287,7 @@ void TWebBrowser::OpenPage()
Draw_Window(); Draw_Window();
return; return;
} }
lines.first = lines.all = 0; lines.first = lines.all =0;
ReadHtml(_WIN); ReadHtml(_WIN);
WB1.ShowPage(); WB1.ShowPage();
} }
@ -275,6 +296,7 @@ void TWebBrowser::OpenPage()
void TWebBrowser::ShowPage() void TWebBrowser::ShowPage()
{ {
edit1.size = edit1.pos = strlen(#editURL); edit1.size = edit1.pos = strlen(#editURL);
edit1.offset=0;
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
if (!filesize) if (!filesize)
@ -309,7 +331,7 @@ void TWebBrowser::ParseHTML(dword bword){
for (j = 400; j < blink + 1; j++;) DeleteButton(j); for (j = 400; j < blink + 1; j++;) DeleteButton(j);
blink = 400; blink = 400;
b_text = i_text = u_text = s_text = pre_text = blq_text = first_line_drawed = b_text = i_text = u_text = s_text = blq_text = first_line_drawed =
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
link_color = 0x0000FF; link_color = 0x0000FF;
bg_color = 0xFFFFFF; bg_color = 0xFFFFFF;
@ -317,10 +339,12 @@ void TWebBrowser::ParseHTML(dword bword){
strcpy(#page_links,"|"); strcpy(#page_links,"|");
strcpy(#header, #version); strcpy(#header, #version);
if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; if (pre_text<>2)
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; {
pre_text=0;
debug("Start parsing"); if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
}
for ( ; buf+filesize > bword; bword++;) for ( ; buf+filesize > bword; bword++;)
{ {
@ -462,7 +486,6 @@ void TWebBrowser::ParseHTML(dword bword){
if (stroka * 10 + 15 <= height) if (stroka * 10 + 15 <= height)
DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
if (lines.first == 0) lines.all = stroka; if (lines.first == 0) lines.all = stroka;
debug ("Pre end - anchor");
if (anchor) if (anchor)
{ {
//åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
@ -470,7 +493,6 @@ void TWebBrowser::ParseHTML(dword bword){
lines.first=anchor_line_num; lines.first=anchor_line_num;
ParseHTML(buf); ParseHTML(buf);
} }
debug("End parsing");
DrawScroller(); DrawScroller();
} }
@ -487,7 +509,6 @@ void TWebBrowser::DrawPage() //
//line = 123456789 //line = 123456789
//header = 1234 //header = 1234
//line = 56789 //line = 56789
debug("too long header");
strcpy(#temp, #line); strcpy(#temp, #line);
temp[sizeof(header)-strlen(#version)-2]=0; temp[sizeof(header)-strlen(#version)-2]=0;
strcpy(#header, #temp); strcpy(#header, #temp);
@ -495,7 +516,6 @@ void TWebBrowser::DrawPage() //
} }
else else
{ {
debug("normal header");
strcpy(#header, #line); strcpy(#header, #line);
line=0; line=0;
} }
@ -612,14 +632,17 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
{ {
if (rez) if (rez)
{ {
text_color_index++;
text_colors[text_color_index] = text_colors[text_color_index-1]; if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
_A_MARK: _A_MARK:
if (!strcmp(#parametr, "href=")) if (!strcmp(#parametr, "href="))
{ {
if (stroka - 1 > lines.visible) || (stroka < -2) return; if (stroka - 1 > lines.visible) || (stroka < -2) return;
if (link) && (text_color_index > 0) text_color_index--; //åñëè íå çàêðûò òýã
text_color_index++;
text_colors[text_color_index] = text_colors[text_color_index-1];
link = 1; link = 1;
blink++; blink++;
text_colors[text_color_index] = link_color; text_colors[text_color_index] = link_color;
@ -745,6 +768,7 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
IMG_TAG: IMG_TAG:
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl() if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{ {
if (!strcmpn(#URL, "http:", 5)) || (!strcmpn(#options, "http:", 5)) return;
strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
temp[strrchr(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / temp[strrchr(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
strcat(#temp, #options); strcat(#temp, #options);

View File

@ -53,12 +53,15 @@
</pre> </pre>
<!--ýňîăî ňĺęńňŕ çäĺńü <íĺň>--> <!--ýňîăî ňĺęńňŕ çäĺńü <íĺň>-->
<font color=#777777>
<a href='/sys/index.htm'>Index.htm</a><br> <a href='/SYS/index.htm'>Index.htm</a><br>
<a href='./index.htm'>Index.htm</a><br>
<a href='/sys/index.htm'>Íåçàêðûòûé òåã à - Index.htm<br>
<a href="/sys/kernel.mnt">Kernel.mnt</a><br> <a href="/sys/kernel.mnt">Kernel.mnt</a><br>
<a href="index.htm#2.1.4">index.htm#2.1.4</a><br> <a href="index.htm#2.1.4">index.htm#2.1.4</a><br>
<a href="#2.1.4">#2.1.4</a><br> <a href="#2.1.4">#2.1.4</a><br>
<a href="background.gif">Ôîíîâŕ˙ ęŕđňčíęŕ</a><br> <a href="background.gif">Ôîíîâŕ˙ ęŕđňčíęŕ</a><br>
</font>
<a href='1111111111111111111111111111111111111111111111111111111111111111 <a href='1111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111

View File

@ -6,9 +6,10 @@
char *ITEMS_LIST[]={ char *ITEMS_LIST[]={
"View in Tinypad F3",52, "View in Tinypad F3",52,
"View in TextEdit F4",53, "View in TextEdit F4",53,
"-",0,
"KOI-8 Ctrl+K",11, "KOI-8 Ctrl+K",11,
"UTF Ctrl+U",21, "UTF Ctrl+U",21,
"DOS Ctrl+D",04,
"Line breaks ON" ,01,
0}; 0};
@ -35,6 +36,11 @@ void menu_rmb()
id1=mm.y/ITEM_HEIGHT; id1=mm.y/ITEM_HEIGHT;
if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break; if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break;
if (mm.lkm) || (mm.pkm)
{
WB1.Scan(ITEMS_LIST[items_cur*2+1]);
ExitProcess();
}
if (items_cur<>id1) if (items_cur<>id1)
{ {
items_cur=id1; items_cur=id1;
@ -71,22 +77,17 @@ void menu_rmb()
case evReDraw: case evReDraw:
while (ITEMS_LIST[items_num*2]) items_num++; while (ITEMS_LIST[items_num*2]) items_num++;
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinWidth()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0,0,0); DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0);
DefineButton(0, 0, ITEM_WIDTH, ITEM_HEIGHT, 10+BT_HIDE+BT_NOFRAME, 0); //hack
DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê
_ITEMS_DRAW: _ITEMS_DRAW:
for (i=0; i<items_num; i++;) for (i=0; i<items_num; i++;)
{ {
if (!strcmp(ITEMS_LIST[i*2],"-"))
{
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, 0xFFFFFF);
DrawBar(1, i*ITEM_HEIGHT+1+9, ITEM_WIDTH-1, 1, 0x999999);
continue;
}
DefineButton(0, i*ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT, i+10+BT_HIDE, 0xFFFFFF);
if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE; if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE;
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0); WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0);
if (ITEMS_LIST[i*2+1]==1) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444);
} }
} }
} }

View File

@ -15,8 +15,8 @@
#define _UTF 3 #define _UTF 3
dword get_URL_part(byte len) { dword get_URL_part(int len) {
char temp1[1000]; char temp1[sizeof(URL)];
strcpy(#temp1, #URL); strcpy(#temp1, #URL);
temp1[len] = 0x00; temp1[len] = 0x00;
return #temp1; return #temp1;
@ -49,11 +49,11 @@ inline void Skew(dword x,y,w,h)
dword italic_buf; dword italic_buf;
int tile_height=2, //áóäåì âûâîäèòü äâóõïèêñåëüíûìè ïîëîñêàìè int tile_height=2, //áóäåì âûâîäèòü äâóõïèêñåëüíûìè ïîëîñêàìè
shift=-2, //ñ äâóõïèêñåëüíûì ñìåùåíèåì shift=-2, //ñ äâóõïèêñåëüíûì ñìåùåíèåì
i, skin_width; i, skin_height;
italic_buf = mem_Alloc(w*h*3); italic_buf = mem_Alloc(w*h*3);
skin_width = GetSkinWidth(); skin_height = GetSkinHeight();
CopyScreen(italic_buf, x+Form.left+2, y+Form.top+skin_width, w, h); CopyScreen(italic_buf, x+Form.left+2, y+Form.top+skin_height, w, h);
FOR (i=0;i*tile_height<h;i++) FOR (i=0;i*tile_height<h;i++)
PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i+1,i*tile_height+y); PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i+1,i*tile_height+y);

View File

@ -10,17 +10,17 @@ inline fastcall void wintodos( ESI)
} }
ELSE ELSE
{ {
IF (BL==178) ESBYTE[ESI] = 73; //I IF (BL==178) ESBYTE[ESI] = 73; //I
IF (BL==179) ESBYTE[ESI] = 105; //i IF (BL==179) ESBYTE[ESI] = 105; //i
IF (BL==175) ESBYTE[ESI] = 244; //J IF (BL==175) ESBYTE[ESI] = 244; //J
IF (BL==191) ESBYTE[ESI] = 245; //j IF (BL==191) ESBYTE[ESI] = 245; //j
IF (BL==170) ESBYTE[ESI] = 242; //E IF (BL==170) ESBYTE[ESI] = 242; //E
IF (BL==186) ESBYTE[ESI] = 243; //e IF (BL==186) ESBYTE[ESI] = 243; //e
IF (BL==168) ESBYTE[ESI] = 240; //ð IF (BL==168) ESBYTE[ESI] = 240; //ð
IF (BL==184) ESBYTE[ESI] = 'e'; //e IF (BL==184) ESBYTE[ESI] = 'e'; //e
IF (BL==180) ESBYTE[ESI] = 254; //ã IF (BL==180) ESBYTE[ESI] = 254; //ã
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34; IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45; IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
} }
ESI++; ESI++;
} }
@ -172,14 +172,7 @@ dword Hex2Symb(char* htmlcolor)
AL=symbol; AL=symbol;
} }
/*int hex2char(char c) /*
{
if (c <=9)
return (c+48);
return (c - 10 + 'a');
}
int hex2char(dword c) int hex2char(dword c)
{ {
if (c <=9) if (c <=9)

View File

@ -24,35 +24,12 @@ struct BDVK{
}; };
///////////////////////////
// Ïàğàìåòğû ôàéëà //
///////////////////////////
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; 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.func = 7;
run_file_70.param1 = run_file_70.param1 =
run_file_70.param3 = run_file_70.param3 =
@ -63,14 +40,13 @@ int RunProgram(dword run_path, run_param)
$mov eax,70 $mov eax,70
$mov ebx,#run_file_70.func $mov ebx,#run_file_70.func
$int 0x40 $int 0x40
RETURN EAX;
} }
/////////////////////////// ///////////////////////////
// Ńîçäŕíčĺ ďŕďęč // // Ńîçäŕíčĺ ďŕďęč //
/////////////////////////// ///////////////////////////
f70 create_dir_70; f70 create_dir_70;
void CreateFolder(dword new_folder_path) :int CreateFolder(dword new_folder_path)
{ {
create_dir_70.func = 9; create_dir_70.func = 9;
create_dir_70.param1 = create_dir_70.param1 =
@ -88,7 +64,7 @@ void CreateFolder(dword new_folder_path)
// Óäŕëĺíčĺ ôŕéëŕ/ďŕďęč // // Óäŕëĺíčĺ ôŕéëŕ/ďŕďęč //
//////////////////////////// ////////////////////////////
f70 del_file_70; f70 del_file_70;
void DeleteFile(dword del_file_path) :int DeleteFile(dword del_file_path)
{ {
del_file_70.func = 8; del_file_70.func = 8;
del_file_70.param1 = del_file_70.param1 =
@ -106,25 +82,43 @@ void DeleteFile(dword del_file_path)
// Ďđî÷čňŕňü ôŕéë // // Ďđî÷čňŕňü ôŕéë //
//////////////////////////// ////////////////////////////
f70 read_file_70; 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.func = 0;
read_file_70.param1 = pos; read_file_70.param1 = read_pos;
read_file_70.param2 = 0; 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.param4 = read_buffer;
read_file_70.rezerv = 0; read_file_70.rezerv = 0;
read_file_70.name = file_path; read_file_70.name = read_file_path;
$mov eax,70 $mov eax,70
$mov ebx,#read_file_70.func $mov ebx,#read_file_70.func
$int 0x40 $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; 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.func = 1;
read_dir_70.param1 = read_dir_70.param1 =
@ -136,46 +130,46 @@ int ReadDir(dword file_count, read_buffer, dir_path)
$mov eax,70 $mov eax,70
$mov ebx,#read_dir_70.func $mov ebx,#read_dir_70.func
$int 0x40 $int 0x40
} }
///////////////////////////
// Ïàðàìåòðû ôàéëà //
///////////////////////////
f70 getinfo_file_70;
BDVK getinfo_file_info;
:dword GetFileInfo(dword file_path)
{
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,#getinfo_file_70.func
$int 0x40
}
/////////////////////////// ///////////////////////////
// Ńęîďčđîâŕňü ôŕéë // // Ńęîďčđîâŕňü ôŕéë //
/////////////////////////// ///////////////////////////
f70 CopyFile_f; :int CopyFile(dword copy_from, copy_in)
inline fastcall dword CopyFile(dword EBX,ECX)
{ {
BDVK CopyFile_atr; BDVK CopyFile_atr;
dword s=EBX, d=ECX, cBufer=0; dword 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;
$mov eax, 70
$mov ebx, #CopyFile_f
$int 0x40
if (!EAX) if (! GetFileInfo(copy_from))
{ {
cBufer = malloc(CopyFile_atr.sizelo); mem_Init();
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s); cBufer = mem_Alloc(CopyFile_atr.sizelo);
if (! ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, copy_from))
IF (!EAX) if (! WriteFile(CopyFile_atr.sizelo, cBufer, copy_in)) return 1;
{
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
}
} }
return 0;
} }
@ -192,4 +186,4 @@ void ReadAttributes(dword read_buffer, file_path)
$mov eax,70 $mov eax,70
$mov ebx,#read_file_70.func $mov ebx,#read_file_70.func
$int 0x40 $int 0x40
} }

View File

@ -33,7 +33,7 @@ char program_path[4096];
struct mouse struct mouse
{ {
dword x,y,lkm,pkm,hor,vert; int x,y,lkm,pkm,hor,vert;
void get(); void get();
}; };
@ -165,7 +165,7 @@ struct proc_info
byte reserved[1024-71]; byte reserved[1024-71];
}; };
void GetProcessInfo( EBX, ECX) inline fastcall void GetProcessInfo( EBX, ECX)
{ {
$mov eax,9; $mov eax,9;
$int 0x40 $int 0x40
@ -205,12 +205,6 @@ inline fastcall void SwitchToAnotherThread()
$int 0x40 $int 0x40
} }
inline fastcall ExitProcess()
{
$mov eax,-1;
$int 0x40
}
inline fastcall int KillProcess( ECX) inline fastcall int KillProcess( ECX)
{ {
$mov eax,18; $mov eax,18;
@ -218,6 +212,23 @@ inline fastcall int KillProcess( ECX)
$int 0x40 $int 0x40
} }
inline fastcall int ExitSystem( ECX)
{
#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) //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
@ -228,7 +239,7 @@ inline fastcall int GetSystemLanguage()
$int 0x40 $int 0x40
} }
inline fastcall dword GetSkinWidth() inline fastcall dword GetSkinHeight()
{ {
$push ebx $push ebx
$mov eax,48 $mov eax,48
@ -244,12 +255,17 @@ inline fastcall void SetSystemSkin( ECX)
$int 0x40 $int 0x40
} }
inline fastcall dword GetScreenWidth() inline fastcall int GetScreenWidth()
{ {
EAX = 14; $mov eax, 14
EBX = 4;
$int 0x40 $int 0x40
$shr eax, 16 $shr eax, 16
}
inline fastcall int GetScreenHeight()
{
$mov eax, 14
$int 0x40
$and eax,0x0000FFFF $and eax,0x0000FFFF
} }
@ -260,7 +276,7 @@ inline fastcall dword LoadLibrary( ECX)
$int 0x40 $int 0x40
} }
byte fastcall TestBit( EAX, CL) inline fastcall int TestBit( EAX, CL)
{ {
$shr eax,cl $shr eax,cl
$and eax,1 $and eax,1
@ -269,17 +285,16 @@ byte fastcall TestBit( EAX, CL)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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 EAX = 12; // function 12:tell os about windowdraw
EBX = 1; EBX = 1;
$int 0x40 $int 0x40
EAX = 0;
EBX = x << 16 + sizeX; EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY; ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour; EDX = WindowType << 24 | WindowAreaColor;
ESI = headerType << 24 | headerColour;
$xor eax,eax
$int 0x40 $int 0x40
EAX = 12; // function 12:tell os about windowdraw EAX = 12; // function 12:tell os about windowdraw
@ -289,7 +304,7 @@ void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaC
inline fastcall MoveSize( EBX,ECX,EDX,ESI) inline fastcall MoveSize( EBX,ECX,EDX,ESI)
{ {
EAX = 67; $mov eax, 67
$int 0x40 $int 0x40
} }
@ -316,6 +331,13 @@ void CopyScreen(dword EBX, x, y, sizeX, sizeY)
$int 0x40; $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) void PutImage(dword EBX,w,h,x,y)
{ {
EAX = 7; EAX = 7;
@ -365,7 +387,7 @@ inline fastcall void DeleteButton( EDX)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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,width,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
@ -373,7 +395,7 @@ void DrawRegion(dword x,y,width,height,color1)
DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢  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,width+1,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢  DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
@ -381,7 +403,7 @@ void DrawRegion_3D(dword x,y,width,height,color1,color2)
DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã 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,y,width,height,0x94AECE,0x94AECE);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7); DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
@ -391,7 +413,7 @@ void DrawFlatButton(dword x,y,width,height,id,color,text)
WriteText(width/2+x+1,height/2-3+y,0x80,0,text,0); 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; int i;
float px=0, py=r, ii = r * 3.1415926 * 2; float px=0, py=r, ii = r * 3.1415926 * 2;

View File

@ -98,3 +98,113 @@ l1: lea esi, dsdword[ esi+ecx-4]
l2: 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*/

View File

@ -13,6 +13,71 @@
// strtok( ESI) // 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) inline fastcall unsigned int strlen( EDI)
{ {
@ -107,18 +172,6 @@ inline fastcall dword atoi( EDI)
} }
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) inline fastcall unsigned int strchr( ESI,BL)
{ {
int jj=0; int jj=0;
@ -203,6 +256,21 @@ ls3:
} }
} }
/* strtok( LPSTR dest, src, divs); /* strtok( LPSTR dest, src, divs);
src - óêàçàòåëü íà èñõîäíóþ ñòðîêó èëè ðåçóëüòàò ïðåäûäóùåãî âûçîâà src - óêàçàòåëü íà èñõîäíóþ ñòðîêó èëè ðåçóëüòàò ïðåäûäóùåãî âûçîâà
dest - óêàçàòåëü íà áóôåð, êóäà áóäåò ñêîïèðîâàíî ñëîâî dest - óêàçàòåëü íà áóôåð, êóäà áóäåò ñêîïèðîâàíî ñëîâî
@ -242,3 +310,13 @@ L3: MOV EAX, ESI
L4: POP ECX L4: POP ECX
} DSBYTE[ EDX] = 0; } 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