/programs/network/htmlv/browser/HTMLv.c-- |
---|
File deleted |
/programs/network/htmlv/browser/HTMLv.c |
---|
0,0 → 1,198 |
//HTML Viewer in C-- |
//Copyright 2007-2012 by Veliant & Leency |
//Asper, lev, Lrz, Barsuk, Nable. |
//home icon - rachel fu, GPL licence |
#include "..\lib\kolibri.h" |
#include "..\lib\encoding.h" |
#include "..\lib\file_system.h" |
#include "img\toolbar_icons.c" |
#include "img\URLgoto.txt"; |
#include "..\lib\mem.h" |
#include "..\lib\libio_lib.h" |
#include "..\lib\libimg_lib.h" |
#include "..\lib\edit_box_lib.h" |
#include "..\lib\dll.h" |
#include "..\lib\scroll_bar\scroll_lib.h" |
//ïåðåìåííûå |
char URL[4096], |
editURL[4096], |
page_links[12000], |
header[512]; |
struct lines{ |
int visible, all, first, column_max; |
}; |
int mouse_dd; |
edit_box edit1= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,248,#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-- |
proc_info Form; |
dword stak[100]; //ìåíþ ÏÊÌ |
mouse m; |
#include "TWB.h" |
#include "include\menu_rmb.h" |
void main() |
{ |
int btn; |
byte key; |
int half_scroll_size; |
mem_Init(); |
load_dll2(libio, #libio_init,1); |
load_dll2(libimg, #libimg_init,1); |
load_dll2(boxlib, #edit_box_draw,0); |
load_dll2(#abox_lib, #boxlib_init,0); |
if (param) strcpy(#URL, #param); |
else strcpy(#URL, "/sys/index.htm"); |
strcpy(#editURL, #URL); |
WB1.OpenPage(); |
SetEventMask(0x27); |
loop() |
{ |
WaitEventTimeout(2); |
switch(EAX & 0xFF) |
{ |
CASE evMouse: |
/*scrollbar_v_mouse (#scroll1); //êîí÷åíûé ñêðîëë ïðèòîðìàæèìàåò, èä¸ì "ñâîèì ïóò¸ì" |
if (lines.first <> scroll1.position) |
{ |
lines.first = scroll1.position; |
WB1.ParseHTML(buf, filesize); |
//break; |
};*/ |
btn=GetSlot(Form.ID); |
IF (btn<>ActiveProcess()) break; //åñëè îêíî íå àêòèâíî íà ñîáûòèÿ ìûøè íå ðåàãèðóåì |
edit_box_mouse stdcall (#edit1); |
m.get(); |
if (m.pkm) && (m.y>WB1.top) && (m.y<Form.height) && (filesize) |
{ |
CreateThread(#menu_rmb,#stak); |
} |
IF (m.vert==65535) //ïðîêðóòêà êîë¸ñèêîì |
{ |
IF (lines.first==0) break; |
IF (lines.first>3) lines.first-=2; ELSE lines.first=1; |
WB1.Scan(ID1); |
break; |
} |
IF (m.vert==1) |
{ |
IF(lines.visible+lines.first+3>=lines.all) WB1.Scan(181); |
ELSE { |
lines.first+=2; |
WB1.Scan(ID2); |
} |
break; |
} |
IF (lines.all<lines.visible) break; |
half_scroll_size = WB1.height - 16 * lines.visible / lines.all - 3 /2; |
if (m.x>=WB1.width-14) && (m.x<=WB1.width+6) |
&& (m.y>WB1.top+16) && (m.y<WB1.top+WB1.height-16) |
&& (lines.all>lines.visible) while (m.lkm) |
{ |
IF (half_scroll_size/2+WB1.top>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size/2+WB1.top; //åñëè êóðñîð íàä îêíîì |
btn=lines.first; //ñîõðàíÿåì ñòàðîå êîëè÷åñòâî |
lines.first = m.y -half_scroll_size -WB1.top * lines.all / WB1.height; |
IF (lines.visible+lines.first>lines.all) lines.first=lines.all-lines.visible; |
IF (btn<>lines.first) WB1.ParseHTML(buf, filesize); //÷òîá ëèøíèé ðàç íå ïåðåðèñîâûâàòü |
m.get(); |
} |
break; |
case evButton: |
btn=GetButtonID(); |
IF (btn==1) |
{ |
KillProcess(downloader_id); |
ExitProcess(); |
} |
ELSE |
{ |
WB1.Scan(btn); |
} |
break; |
case evKey: |
key = GetKey(); |
if (edit1.flags == 66) || (edit1.flags == 98) SWITCH(key) //åñëè àêòèâíà ñòðîêà àäðåñà èãíîðèðóåì íåêîòîðûå êíîïêè |
{ CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } |
WB1.Scan(key); |
_EDIT_MARK: |
IF (key<>0x0d) && (key<>183) && (key<>184) && (key<>173) {EAX=key<<8; edit_box_key stdcall(#edit1);} //àäðåñíàÿ ñòðîêà |
break; |
case evReDraw: |
Draw_Window(); |
break; |
default: |
if (downloader_id<>0) |
{ |
if (GetProcessSlot(downloader_id)<>0) break; |
downloader_id=0; |
lines.first = lines.all = 0; |
WB1.ReadHtml(_WIN); |
Draw_Window(); |
} |
} |
} |
} |
void Draw_Window() |
{ |
int j; |
DefineAndDrawWindow(215,100,640,480,0x73,0x00E4DFE1,0,0,0); |
GetProcessInfo(#Form, SelfInfo); |
if (Form.status_window>2) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì |
{ |
DrawTitle(#header); |
return; |
} |
if (Form.height<120) MoveSize(OLD,OLD,OLD,120); |
if (Form.width<280) MoveSize(OLD,OLD,280,OLD); |
PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); |
if (GetProcessSlot(downloader_id)<>0) PutImage(#stop_btn,24,24,88,10); |
DrawBar(200,0,onLeft(200,9),43,0xE4DFE1); //çàêðàøèâàåì ôîí ïîä òóëáàðîì |
DrawBar(0,42,onLeft(5,4),1,0xE2DBDC); //âûïóêëîñòü |
DrawBar(0,43,onLeft(5,4),1,0xD2CED0); //âûïóêëîñòü |
for (j=0; j<5; j++) DefineButton(j*37+11, 7, 29, 29, 300+j+BT_HIDE, 0x00E4DFE1); |
PutImage(#URLgoto,40,19,onLeft(57,0),14); |
DefineButton(onLeft(37,0),15, 18, 16, GOTOURL+BT_HIDE, 0xE4DFE1); |
DefineButton(onLeft(56,0),15, 17, 16, SEARCHWEB+BT_HIDE, 0xE4DFE1); |
DrawRegion(205,14,onLeft(58,205),18,0x94AECE); //îáîäîê ïîëîñû àäðåñà |
DrawRegion(206,15,onLeft(59,205),16,0xE4ECF3); |
edit1.width=Form.width-266; |
WB1.top=44; |
WB1.width=Form.width-13; |
WB1.height=onTop(43,5); |
lines.column_max = WB1.width - 30 / 6; |
lines.visible = WB1.height - 3 / 10 - 2; |
WB1.ShowPage(); |
} |
int onLeft(dword right,left) {return Form.width-right-left;} |
int onTop(dword down,up) {return Form.height-GetSkinWidth()-down-up;} |
stop: |
/programs/network/htmlv/browser/TWB.h |
---|
9,16 → 9,18 |
char download_path[]="/rd/1/.download"; |
char search_path[]="http://nigma.ru/index.php?s="; |
char version[]=" Text-based Browser 0.94"; |
char version[]=" Text-based Browser 0.94b"; |
struct TWebBrowser { |
int left, top, width, height; |
void DrawScroller(); |
void Scan(int); |
void OpenPage(); |
void ReadHtml(byte); |
void ShowPage(); |
void ParseHTML(dword, dword); |
void Scan(int); |
void WhatTextStyle(int left1, top1, width1); |
void DrawScroller(); |
}; |
TWebBrowser WB1; |
64,8 → 66,8 |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
lines_first=lines_all-lines_visible; |
ShowPage(#URL); |
lines.first=lines.all-lines.visible; |
ShowPage(); |
return; |
} |
//liner.ru#1 |
88,18 → 90,16 |
return; |
} |
IF(lines_all < lines_visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
{ CASE 183: CASE 184: CASE 180: CASE 181: return; } |
switch (id) |
{ |
case 011: //Ctrk+K |
ReadHtml(); |
koitodos(buf); |
ReadHtml(_KOI); |
break; |
case 021: //Ctrl+U |
ReadHtml(); |
utf8rutodos(buf); |
ReadHtml(_UTF); |
break; |
case BACK: |
if (!BrowserHistory.GoBack()) return; |
125,7 → 125,7 |
Draw_Window(); |
return; |
} |
anchor_line_num=lines_first; //âåñ¸ëûé êîñòûëü :Ð |
anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
anchor[0]='|'; |
OpenPage(); |
return; |
151,30 → 151,30 |
return; |
case ID1: //ìîòàåì ââåðõ |
IF(lines_first <= 0) return; |
lines_first--; |
IF(lines.first <= 0) return; |
lines.first--; |
break; |
case ID2: //ìîòàåì âíèç |
IF(lines_visible + lines_first >= lines_all) return; |
lines_first++; |
IF(lines.visible + lines.first >= lines.all) return; |
lines.first++; |
break; |
case 183: //PgDown |
IF(lines_first == lines_all - lines_visible) return; |
lines_first += lines_visible + 2; |
IF(lines_visible + lines_first > lines_all) lines_first = lines_all - lines_visible; |
IF(lines.first == lines.all - lines.visible) return; |
lines.first += lines.visible + 2; |
IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
BREAK; |
case 184: //PgUp |
IF(lines_first == 0) RETURN; |
lines_first -= lines_visible - 2; |
IF(lines_first < 0) lines_first = 0; |
IF(lines.first == 0) RETURN; |
lines.first -= lines.visible - 2; |
IF(lines.first < 0) lines.first = 0; |
BREAK; |
case 180: //home |
IF(lines_first == 0) RETURN; |
lines_first = 0; |
IF(lines.first == 0) RETURN; |
lines.first = 0; |
BREAK; |
case 181: //end |
IF (lines_first == lines_all - lines_visible) RETURN; |
lines_first = lines_all - lines_visible; |
IF (lines.first == lines.all - lines.visible) RETURN; |
lines.first = lines.all - lines.visible; |
BREAK; |
default: |
RETURN; |
214,7 → 214,7 |
void ReadHtml() |
void TWebBrowser::ReadHtml(byte dest) |
{ |
if (!strcmp(get_URL_part(5),"http:"))) |
file_size stdcall (#download_path); |
230,10 → 230,14 |
ReadFile(0, filesize, buf, #download_path); |
else |
ReadFile(0, filesize, buf, #URL); |
if (dest==_WIN) wintodos(buf); |
if (dest==_UTF) utf8rutodos(buf); |
if (dest==_KOI) koitodos(buf); |
} |
void OpenPage() |
void TWebBrowser::OpenPage() |
{ |
if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); |
KillProcess(downloader_id); |
258,14 → 262,13 |
Draw_Window(); |
return; |
} |
lines_first = lines_all = 0; |
ReadHtml(); |
if (filesize) wintodos(buf); |
WB1.ShowPage(#URL); |
lines.first = lines.all = 0; |
ReadHtml(_WIN); |
WB1.ShowPage(); |
} |
void TWebBrowser::ShowPage(dword adress) |
void TWebBrowser::ShowPage() |
{ |
edit1.size = edit1.pos = strlen(#editURL); |
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà |
295,7 → 298,7 |
byte ignor_param = 0; |
char temp[768]; |
stroka = -lines_first; |
stroka = -lines.first; |
stolbec = 0; |
for (j = 400; j < blink + 1; j++;) DeleteButton(j); |
420,12 → 423,12 |
IF(ignor_text) break; |
IF(!pre_text) && (bukva == ' ') && (!strcmp(#line + strlen(#line) - 1, " ")) continue; |
// |
if (stolbec + strlen(#line) >lines_column_max) |
if (stolbec + strlen(#line) >lines.column_max) |
{ |
strcpy(#temp, #line + find_symbol(#line, ' ')); //ïåðåíîñ ïî ñëîâàì |
line[find_symbol(#line, ' ')] = 0x00; |
NEXT_MARK: |
IF(stroka - 1 > lines_visible) && (lines_first <>0) break 1; //óõîäèì... |
IF(stroka - 1 > lines.visible) && (lines.first <>0) break 1; //óõîäèì... |
WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //âûâîä ñòðîêè |
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
strcpy(#line, #temp); |
437,16 → 440,16 |
if (strcmp(#URL + strlen(#URL) - 4, ".txt")<>0) && (!body_present) |
DrawBar(left, top, width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó åñëè êàêîé-òî ðàõèò íå ñîçäàë òåã áîäè |
if (lines_visible * 10 + 25 <= height) |
DrawBar(left, lines_visible * 10 + top + 25, width - 15, -lines_visible * 10 + height - 25, bg_color); |
if (lines.visible * 10 + 25 <= height) |
DrawBar(left, lines.visible * 10 + top + 25, width - 15, -lines.visible * 10 + height - 25, bg_color); |
if (stroka * 10 + 15 <= height) |
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; |
if (anchor) |
{ |
anchor=''; |
lines_first=anchor_line_num; |
lines.first=anchor_line_num; |
ParseHTML(buf, filesize); |
} |
536,7 → 539,7 |
IF(!chTag("q")) strcat(#line, "\""); |
//âûâîä íà ýêðàí |
if (stroka >= 0) && (stroka - 2 < lines_visible) && (line) && (!anchor) |
if (stroka >= 0) && (stroka - 2 < lines.visible) && (line) && (!anchor) |
{ |
WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0); //ìîæåò òóò ðèñîâàòü áåëóþ ñòðîêó? |
IF (b_text) { $add ebx, 1<<16 $int 0x40 } |
556,7 → 559,7 |
{ |
if (!strcmp(#anchor, #options)) |
{ |
anchor_line_num=lines_first+stroka; |
anchor_line_num=lines.first+stroka; |
} |
} |
595,7 → 598,7 |
_A_MARK: |
if (!strcmp(#parametr, "href=")) |
{ |
if (stroka - 1 > lines_visible) || (stroka < -2) return; |
if (stroka - 1 > lines.visible) || (stroka < -2) return; |
if (link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
link = 1; |
blink++; |
608,7 → 611,7 |
{ |
if (!strcmp(#anchor, #options)) |
{ |
anchor_line_num=lines_first+stroka; |
anchor_line_num=lines.first+stroka; |
} |
} |
if (tagparam) |
626,7 → 629,7 |
///////////////////////// |
if (!chTag("font")) |
{ |
IF (stroka - 1 > lines_visible) return; |
IF (stroka - 1 > lines.visible) return; |
COL_MARK: |
if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
{ |
689,7 → 692,7 |
li_text = rez; |
IF(rez == 0) return; |
TextGoDown(left1, top1, width1); |
IF(stroka > -1) && (stroka - 2 < lines_visible) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0); |
IF(stroka > -1) && (stroka - 2 < lines.visible) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0); |
return; |
} |
//////////////////////////// |
746,7 → 749,7 |
top1=WB1.top; |
} |
if (top1>WB1.top+WB1.height-h-15) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó IF (stroka - 2 < lines_visible) |
if (top1>WB1.top+WB1.height-h-15) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó IF (stroka - 2 < lines.visible) |
{ |
h=WB1.top+WB1.height-top1-15; |
} |
775,21 → 778,10 |
{ |
strcpy(#options, #options[find_symbol(#options, '=')]); //ïîèñê â content= |
IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) |
{ |
ReadHtml(); |
utf8rutodos(buf); |
if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); |
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); |
if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS); |
} |
IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) |
{ |
ReadHtml(); |
koitodos(buf); |
} |
IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) |
{ |
ReadHtml(); |
} |
} |
if (tagparam) |
{ |
GetNextParam(); |
806,7 → 798,7 |
IF(blq_text == 1) stolbec = 8; |
ELSE stolbec = 0; |
IF(li_text == 1) stolbec = li_tab * 5; |
IF(stroka >= 0) && (stroka - 2 < lines_visible) && (!anchor) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color); |
IF(stroka >= 0) && (stroka - 2 < lines.visible) && (!anchor) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color); |
} |
813,9 → 805,9 |
//ñêðîëë |
void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå |
{ |
scroll1.max_area = lines_all; |
scroll1.cur_area = lines_visible; |
scroll1.position = lines_first; |
scroll1.max_area = lines.all; |
scroll1.cur_area = lines.visible; |
scroll1.position = lines.first; |
scroll1.all_redraw=1; |
scroll1.start_x=Form.width-28; //left + width - 15 |
/programs/network/htmlv/browser/compile.bat |
---|
1,6 → 1,6 |
..\C--\c-- HTMLv.c-- |
..\C--\c-- HTMLv.c |
del HTMLv |
rename HTMLv.com HTMLv |
rem ..\C--\kpack HTMLv |
pause |
del warning.txt |
pause |
/programs/network/htmlv/browser/include/some_code.h |
---|
9,10 → 9,10 |
#define ID1 178 |
#define ID2 177 |
#define WINDOWS 0 |
#define DOS 1 |
#define KOI 2 |
#define UTF 3 |
#define _WIN 0 |
#define _DOS 1 |
#define _KOI 2 |
#define _UTF 3 |
dword get_URL_part(byte len) { |
/programs/network/htmlv/lib/file_system.h-- |
---|
File deleted |
/programs/network/htmlv/lib/libimg_lib.h-- |
---|
File deleted |
/programs/network/htmlv/lib/encoding.h-- |
---|
File deleted |
/programs/network/htmlv/lib/libio_lib.h-- |
---|
File deleted |
/programs/network/htmlv/lib/mem.h-- |
---|
File deleted |
/programs/network/htmlv/lib/edit_box_lib.h-- |
---|
File deleted |
/programs/network/htmlv/lib/kolibri.h-- |
---|
File deleted |
/programs/network/htmlv/lib/random.h-- |
---|
File deleted |
\ No newline at end of file |
/programs/network/htmlv/lib/dll.h-- |
---|
File deleted |
/programs/network/htmlv/lib/dll.h |
---|
0,0 → 1,173 |
//Asper |
char a_libdir[43] = "/sys/lib/\0"; |
//proc dll.Load, import_table:dword |
int dll_Load(dword import_table) |
{ |
$mov esi, import_table |
@next_lib: $mov edx, DSDWORD[esi] |
$or edx,edx |
$jz exit_ |
$push esi |
$mov esi,DSDWORD[esi+4] |
$mov edi,#a_libdir |
$push edi |
$push esi |
EAX=strlen(#a_libdir); |
$pop esi |
$pop edi |
$add edi, eax //9 |
@loc01: $lodsb |
$stosb |
$or al,al |
$jnz loc01 |
//IntToStr(EBX); |
//$push edx |
//WriteDebug(#a_libdir); |
//$pop edx |
//mcall 68,19,a_libdir |
$mov eax, 68 |
$mov ebx, 19 |
$mov ecx,#a_libdir |
$int 0x40 |
$or eax,eax |
$jz fail |
//stdcall dll.Link,eax,edx |
dll_Link(EAX, EDX); |
$push eax |
$mov eax, DSDWORD [eax] |
$cmp DSDWORD [eax], 'lib_' |
$pop eax |
//$jnz loc02 |
//IntToStr(EBX); |
//$push eax |
//WriteDebug(DSDWORD[EAX]); |
//$pop eax |
//stdcall dll.Init,[eax+4] |
//dll_Init(DSDWORD[EAX]); //dll_Init(DSDWORD[EAX+4]); |
@loc02: |
$pop esi |
$add esi,8 |
$jmp next_lib |
@exit_: $xor eax,eax |
return 0; |
@fail: $add esp,4 |
$xor eax,eax |
$inc eax |
return -1; |
} |
//proc dll.Link, exp:dword,imp:dword |
void dll_Link(dword exp, imp) |
{ |
$push eax |
$mov esi, imp |
$test esi, esi |
$jz done |
@next: $lodsd |
$test eax,eax |
$jz done |
//stdcall dll.GetProcAddress,[exp],eax |
dll_GetProcAddress(exp,EAX); |
$or eax,eax |
$jz loc03 |
$mov DSDWORD[esi-4],eax |
$jmp next |
@loc03: |
$mov DSDWORD[esp],0 |
@done: $pop eax |
} |
//proc dll.Init, dllentry:dword |
void dll_Init(dword dllentry) |
{ |
$pushad |
EAX=#mem_Alloc; |
EBX=#mem_Free; |
ECX=#mem_ReAlloc; |
EDX=#dll_Load; |
DSDWORD [dllentry+4] stdcall (); |
$popad |
} |
//proc dll.GetProcAddress, exp:dword,sz_name:dword |
dword dll_GetProcAddress(dword exp, sz_name) |
{ |
$push esi |
$mov edx, exp |
$xor eax,eax |
@next: $or edx,edx |
$jz end_ |
$cmp edx,0 |
$jz end_ |
strcmp(DSDWORD[EDX],sz_name); |
$test eax,eax |
$jz ok |
$add edx,8 |
$jmp next |
@ok: |
$mov eax, DSDWORD[edx+4] |
@end_: |
$pop esi |
return EAX; |
} |
int load_dll2(dword dllname, import_table, byte need_init) |
{ |
//dword dllentry=0; |
// load DLL |
$mov eax, 68 |
$mov ebx, 19 |
ECX=dllname; |
$int 0x40 |
$test eax, eax |
$jz exit01 |
// initialize import |
$mov edx,eax |
ESI=import_table; |
@import_loop01: |
$lodsd |
$test eax,eax |
$jz import_done01 |
$push edx |
@import_find01: |
$mov ebx,DSDWORD[EDX] |
$test ebx, ebx |
$jz exit01 |
$push eax |
@nex101: |
$mov cl,DSBYTE[EAX]; |
$cmp cl,DSBYTE[EBX]; |
$jnz import_find_next01 |
$test cl,cl |
$jz import_found01 |
$inc eax |
$inc ebx |
$jmp nex101 |
@import_find_next01: |
$pop eax |
$add edx, 8 |
$jmp import_find01 |
@import_found01: |
$pop eax |
$mov eax,DSDWORD[edx+4] |
$mov DSDWORD[esi-4],eax |
$pop edx |
$jmp import_loop01 |
@import_done01: |
IF (need_init) dll_Init(EDX); |
return 0; |
@exit01: |
return -1; |
} |
/programs/network/htmlv/lib/edit_box_lib.h |
---|
0,0 → 1,49 |
//BOX_LIB |
dword boxlib = #aEdit_box_lib; //Asper |
char aEdit_box_lib[22]="/sys/lib/box_lib.obj\0"; //Asper |
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 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 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; |
}; |
//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/network/htmlv/lib/encoding.h |
---|
0,0 → 1,190 |
void wintodos(dword ESI) |
{ |
while (BL=ESBYTE[ESI]) |
{ |
IF (BL>=192) |
{ |
IF (BL>=240) ESBYTE[ESI] = BL - 16; |
ELSE ESBYTE[ESI] = BL - 64; |
} |
ELSE |
{ |
IF (BL==178) ESBYTE[ESI] = 73; //I |
IF (BL==179) ESBYTE[ESI] = 105; //i |
IF (BL==175) ESBYTE[ESI] = 244; //J |
IF (BL==191) ESBYTE[ESI] = 245; //j |
IF (BL==170) ESBYTE[ESI] = 242; //E |
IF (BL==186) ESBYTE[ESI] = 243; //e |
IF (BL==168) ESBYTE[ESI] = 240; //ð |
IF (BL==184) ESBYTE[ESI] = 'e'; //e |
IF (BL==180) ESBYTE[ESI] = 254; //ã |
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34; |
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45; |
} |
ESI++; |
} |
} |
byte mas[66] = "î ¡æ¤¥ä£å¨©ª«¬®¯ïàáâ㦢ìë§èíéçê "; |
void koitodos(dword EDI) |
{ |
WHILE (BL=ESBYTE[EDI]) |
{ |
IF (BL >= 0xC0) |
{ |
BL -= 0xC0; |
ESBYTE[EDI] = mas[BL]; |
} |
//IF (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i'; |
EDI++; |
} |
} |
//Asper, lev |
//uncomplete |
int utf8rutodos(dword ESI) //- |
{ |
EDI=ESI; |
while (BL=ESBYTE[ESI]) |
{ |
IF (BL == 0xD0) || (BL == 0xD1) EDI--; |
else IF (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; //ø |
else IF (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; //ì |
//0xE2 0x80 - ñãðóïïèðîâàòü |
else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) |
SWITCH (ESBYTE[ESI+2]) |
{ |
case 0x93: //long defis |
CASE 0x94: |
{ |
ESBYTE[EDI] = '-'; |
ESI+=2; |
BREAK; |
} |
CASE 0xA2: //central point |
{ |
ESBYTE[EDI] = '*'; |
ESI+=2; |
BREAK; |
} |
CASE 0xA6: //ìíîãîòî÷èå |
{ |
ESBYTE[EDI] = ESBYTE[EDI+1] = ESBYTE[EDI+2] = '.'; |
EDI+=2; |
ESI+=2; |
break; |
} |
} |
//0xC2 ñãðóïïèðîâàòü |
else IF (BL == 0xC2) //òàáëèöó ïåðåêîäèðîâîê? |
SWITCH(ESBYTE[ESI+1]) { |
case 0xAB: //" |
CASE 0xBB: //" |
{ |
ESBYTE[EDI] = '\"'; |
ESI++; |
BREAK; |
} |
CASE 0xB7: // _ |
{ |
ESBYTE[EDI] = '_'; |
ESI++; |
BREAK; |
} |
CASE 0xA0: // Alt+160 - íåðàçáèâàþùèé ïðîáåë |
{ |
ESBYTE[EDI] = ' '; |
ESI++; |
BREAK; |
} |
CASE 0xB0: // ãðàäóñ |
{ |
ESBYTE[EDI] = '\29'; |
ESI++; |
BREAK; |
} |
CASE 0xA9: // (c) |
{ |
ESWORD[EDI] = 'c('; |
// ESBYTE[EDI] = '('; |
// ESBYTE[EDI+1] = 'c'; |
ESBYTE[EDI+2] = ')'; |
EDI+=2; |
ESI++; |
BREAK; |
} |
CASE 0xAE: // (r) |
{ |
ESWORD[EDI] = 'r('; |
ESBYTE[EDI+2] = ')'; |
EDI+=2; |
ESI++; |
break; |
} |
} |
ELSE IF (BL >= 0x90) && (BL <= 0xAF) |
{ |
BL -= 0x10; |
ESBYTE[EDI] = BL; |
} |
ELSE IF (BL >= 0x80) && (BL <= 0x8F) |
{ |
BL += 0x60; |
ESBYTE[EDI] = BL; |
} |
ELSE IF (BL >= 0xB0) && (BL <= 0xBF) |
{ |
BL -= 0x10; |
ESBYTE[EDI] = BL; |
} |
ELSE ESBYTE[EDI] = BL; |
ESI++; |
EDI++; |
} |
WHILE (EDI<ESI) |
{ |
ESBYTE[EDI] = ' '; |
EDI++; |
} |
} |
//------------------------------------------------------------------------------ |
dword Hex2Symb(char* htmlcolor) |
{ |
dword j=0, symbol=0; |
char ch=0x00; |
FOR (;j<2;j++) |
{ |
ch=ESBYTE[htmlcolor+j]; |
IF (ch==0x0d) || (ch=='\9') RETURN ''; |
IF ((ch>='0') && (ch<='9')) ch -= '0'; |
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; |
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; |
symbol = symbol*0x10 + ch; |
} |
wintodos(#symbol); |
AL=symbol; |
} |
/*int hex2char(char c) |
{ |
if (c <=9) |
return (c+48); |
return (c - 10 + 'a'); |
} |
int hex2char(dword c) |
{ |
if (c <=9) |
return (c+48); |
return (c - 10 + 'a'); |
}*/ |
/programs/network/htmlv/lib/file_system.h |
---|
0,0 → 1,195 |
struct f70{ |
dword func; |
dword param1; |
dword param2; |
dword param3; |
dword param4; |
char rezerv; |
dword name; |
}; |
struct BDVK{ |
dword attr; |
byte type_name; |
byte rez1, rez2, rez3; |
dword timecreate; |
dword datecreate; |
dword timelastaccess; |
dword datelastaccess; |
dword timelastedit; |
dword datelastedit; |
dword sizelo; |
dword sizehi; |
char name[518]; |
}; |
/////////////////////////// |
// Ïàðàìåòðû ôàéëà // |
/////////////////////////// |
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) |
{ |
run_file_70.func = 7; |
run_file_70.param1 = |
run_file_70.param3 = |
run_file_70.param4 = |
run_file_70.rezerv = 0; |
run_file_70.param2 = run_param; |
run_file_70.name = run_path; |
$mov eax,70 |
$mov ebx,#run_file_70.func |
$int 0x40 |
RETURN EAX; |
} |
/////////////////////////// |
// Ñîçäàíèå ïàïêè // |
/////////////////////////// |
f70 create_dir_70; |
void CreateFolder(dword new_folder_path) |
{ |
create_dir_70.func = 9; |
create_dir_70.param1 = |
create_dir_70.param2 = |
create_dir_70.param3 = |
create_dir_70.param4 = |
create_dir_70.rezerv = 0; |
create_dir_70.name = new_folder_path; |
$mov eax,70 |
$mov ebx,#create_dir_70.func |
$int 0x40 |
} |
//////////////////////////// |
// Óäàëåíèå ôàéëà/ïàïêè // |
//////////////////////////// |
f70 del_file_70; |
void DeleteFile(dword del_file_path) |
{ |
del_file_70.func = 8; |
del_file_70.param1 = |
del_file_70.param2 = |
del_file_70.param3 = |
del_file_70.param4 = |
del_file_70.rezerv = 0; |
del_file_70.name = del_file_path; |
$mov eax,70 |
$mov ebx,#del_file_70.func |
$int 0x40 |
} |
//////////////////////////// |
// Ïðî÷èòàòü ôàéë // |
//////////////////////////// |
f70 read_file_70; |
int ReadFile(dword pos, file_size, read_buffer, file_path) |
{ |
read_file_70.func = 0; |
read_file_70.param1 = pos; |
read_file_70.param2 = 0; |
read_file_70.param3 = file_size; |
read_file_70.param4 = read_buffer; |
read_file_70.rezerv = 0; |
read_file_70.name = file_path; |
$mov eax,70 |
$mov ebx,#read_file_70.func |
$int 0x40 |
} |
/////////////////////////// |
// Ïðî÷èòàòü ïàïêó // |
/////////////////////////// |
f70 read_dir_70; |
int ReadDir(dword file_count, read_buffer, dir_path) |
{ |
read_dir_70.func = 1; |
read_dir_70.param1 = |
read_dir_70.param2 = |
read_dir_70.rezerv = 0; |
read_dir_70.param3 = file_count; |
read_dir_70.param4 = read_buffer; |
read_dir_70.name = dir_path; |
$mov eax,70 |
$mov ebx,#read_dir_70.func |
$int 0x40 |
} |
/////////////////////////// |
// Ñêîïèðîâàòü ôàéë // |
/////////////////////////// |
f70 CopyFile_f; |
inline fastcall dword CopyFile(dword EBX,ECX) |
{ |
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; |
$mov eax, 70 |
$mov ebx, #CopyFile_f |
$int 0x40 |
if (!EAX) |
{ |
cBufer = malloc(CopyFile_atr.sizelo); |
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s); |
IF (!EAX) |
{ |
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 |
} |
} |
} |
//Asper |
void ReadAttributes(dword read_buffer, file_path) |
{ |
read_file_70.func = 5; |
read_file_70.param1 = 0; |
read_file_70.param2 = 0; |
read_file_70.param3 = 0; |
read_file_70.param4 = read_buffer; |
read_file_70.rezerv = 0; |
read_file_70.name = file_path; |
$mov eax,70 |
$mov ebx,#read_file_70.func |
$int 0x40 |
} |
/programs/network/htmlv/lib/kolibri.h |
---|
0,0 → 1,568 |
//CODED by Veliant, Leency, Nable. GNU GPL licence. |
#startaddress 0 |
#code32 TRUE |
char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
dword os_version = 0x00000001; |
dword start_addr = #main; |
dword final_addr = #stop+32; |
dword alloc_mem = #0x00100000; |
dword x86esp_reg = #0x00100000; |
dword I_Param = #param; |
dword I_Path = #program_path; |
char param[4096]; |
char program_path[4096]; |
//Events |
#define evMouse 6 |
#define evButton 3 |
#define evKey 2 |
#define evReDraw 1 |
#define OLD -1 |
#define true 1 |
#define false 0 |
//Button options |
#define BT_DEL 0x80000000 |
#define BT_HIDE 0x40000000 |
#define BT_NOFRAME 0x20000000 |
//------------------------------------------------------------------------- |
struct mouse |
{ |
dword x,y,lkm,pkm,hor,vert; |
void get(); |
}; |
void mouse::get() |
{ |
EAX = 37; |
EBX = 1; |
$int 0x40 |
$mov ebx, eax |
$shr eax, 16 |
$and ebx,0x0000FFFF |
x = EAX; |
y = EBX; |
EAX = 37; |
EBX = 2; |
$int 0x40 |
$mov ebx, eax |
$and eax, 0x00000001 |
$shr ebx, 1 |
$and ebx, 0x00000001 |
lkm = EAX; |
pkm = EBX; |
EAX = 37; //áªà®«« |
EBX = 7; |
$int 0x40 |
$mov ebx, eax |
$shr eax, 16 |
$and ebx,0x0000FFFF |
//hor = EAX; |
vert = EBX; |
} |
struct system_colors |
{ |
dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph; |
void get(); |
}; |
void system_colors::get() |
{ |
EAX = 48; |
EBX = 3; |
ECX = #frame; |
EDX = 40; |
$int 0x40 |
} |
//------------------------------------------------------------------------------ |
inline fastcall dword WaitEvent() |
{ |
$mov eax,10 |
$int 0x40 |
} |
inline fastcall dword CheckEvent() |
{ |
$mov eax,11 |
$int 0x40 |
} |
inline fastcall dword WaitEventTimeout( EBX) |
{ |
$mov eax,23 |
$int 0x40 |
} |
inline fastcall SetEventMask( EBX) |
{ |
$mov eax,40 |
$int 0x40 |
} |
inline fastcall ScancodesGeting(){ |
$mov eax,66 |
$mov ebx,1 |
$mov ecx,1 //᪠ª®¤ë |
$int 0x40 |
} |
inline fastcall word GetKey() //+Gluk fix |
{ |
$push edx |
@getkey: |
$mov eax,2 |
$int 0x40 |
$cmp eax,1 |
$jne getkeyi |
$mov ah,dh |
$jmp getkeyii //jz? |
@getkeyi: |
$mov dh,ah |
$jmp getkey |
@getkeyii: |
$pop edx |
$shr eax,8 |
} |
inline fastcall Pause( EBX) |
{ |
$mov eax, 5 |
$int 0x40 |
} |
//------------------------------------------------------------------------------ |
inline fastcall word GetButtonID() |
{ |
$mov eax,17 |
$int 0x40 |
$shr eax,8 |
} |
struct proc_info |
{ |
#define SelfInfo -1 |
dword use_cpu; |
word pos_in_stack,num_slot,rezerv1; |
char name[11]; |
char rezerv2; |
dword adress,use_memory,ID,left,top,width,height; |
word status_slot,rezerv3; |
dword work_left,work_top,work_width,work_height; |
char status_window; |
void GetInfo( ECX); |
byte reserved[1024-71]; |
}; |
void GetProcessInfo( EBX, ECX) |
{ |
$mov eax,9; |
$int 0x40 |
} |
int GetProcessSlot( ECX) //ECX = process ID |
{ |
EAX = 18; |
EBX = 21; |
$int 0x40; |
} |
inline fastcall int ActiveProcess() |
{ |
EAX = 18; |
EBX = 7; |
$int 0x40 |
} |
inline fastcall ExitProcess() |
{ |
$mov eax,-1; |
$int 0x40 |
} |
inline fastcall int KillProcess( ECX) |
{ |
$mov eax,18; |
$mov ebx,18; |
$int 0x40 |
} |
//------------------------------------------------------------------------------ |
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
inline fastcall int GetSystemLanguage() |
{ |
EAX = 26; |
EBX = 5; |
$int 0x40 |
} |
inline fastcall void DrawTitle( ECX) |
{ |
EAX = 71; |
EBX = 1; |
$int 0x40; |
} |
inline fastcall dword GetSkinWidth() |
{ |
$push ebx |
$mov eax,48 |
$mov ebx,4 |
$int 0x40 |
$pop ebx |
} |
inline fastcall void SetSystemSkin(ECX){ |
EAX = 48; |
EBX = 8; |
$int 0x40 |
} |
inline fastcall dword GetScreenWidth() |
{ |
EAX = 14; |
EBX = 4; |
$int 0x40 |
$shr eax, 16 |
$and eax,0x0000FFFF |
} |
inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
{ |
EAX = 67; |
$int 0x40 |
} |
inline fastcall dword LoadLibrary( ECX) |
{ |
$mov eax, 68 |
$mov ebx, 19 |
$int 0x40 |
} |
//------------------------------------------------------------------------------ |
inline fastcall dword strlen( EDI) |
{ |
EAX=0; |
ECX=-1; |
$REPNE $SCASB |
EAX-=2+ECX; |
} |
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 |
} |
} |
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; |
} |
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 find_symbol( ESI,BL) |
{ |
int jj=0, last=-1; |
do{ |
jj++; |
$lodsb |
IF(AL==BL) last=jj; |
} while(AL!=0); |
return last; |
} |
inline fastcall dword upcase( ESI) |
{ |
do{ |
AL=DSBYTE[ESI]; |
IF(AL>='a')IF(AL<='z')DSBYTE[ESI]=AL&0x5f; |
ESI++; |
}while(AL!=0); |
} |
inline fastcall lowcase( ESI) |
{ |
do{ |
$LODSB |
IF(AL>='A')&&(AL<='Z'){ |
AL+=0x20; |
DSBYTE[ESI-1]=AL; |
CONTINUE; |
} |
}while(AL!=0); |
} |
byte fastcall TestBit( EAX, CL) |
{ |
$shr eax,cl |
$and eax,1 |
} |
//------------------------------------------------------------------------------ |
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI) |
{ |
EAX = 12; // function 12:tell os about windowdraw |
EBX = 1; |
$int 0x40 |
EBX = x << 16 + sizeX; |
ECX = y << 16 + sizeY; |
EDX = mainAreaType << 24 | mainAreaColour; |
ESI = headerType << 24 | headerColour; |
$xor eax,eax |
$int 0x40 |
EAX = 12; // function 12:tell os about windowdraw |
EBX = 2; |
$int 0x40 |
} |
inline fastcall int CreateThread( ECX,EDX) |
{ |
EAX = 51; |
EBX = 1; |
$int 0x40 |
} |
inline fastcall int GetSlot( ECX) |
{ |
EAX = 18; |
EBX = 21; |
$int 0x40 |
} |
inline fastcall int GetActiveProcess() |
{ |
EAX = 18; |
EBX = 7; |
$int 0x40 |
} |
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
{ |
EAX = 4; |
EBX = x<<16+y; |
ECX = fontType<<24+color; |
$int 0x40; |
} |
void CopyScreen(dword EBX, x, y, sizeX, sizeY) |
{ |
EAX = 36; |
ECX = sizeX << 16 + sizeY; |
EDX = x << 16 + y; |
$int 0x40; |
} |
void PutImage(dword EBX,w,h,x,y) |
{ |
EAX = 7; |
ECX = w<<16+h; |
EDX = x<<16+y; |
$int 0x40 |
} |
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
{ |
EAX = 65; |
ECX = w<<16+h; |
EDX = x<<16+y; |
EBP = 0; |
$int 0x40 |
} |
inline fastcall void PutPixel( EBX,ECX,EDX) |
{ |
EAX=1; |
$int 0x40 |
} |
void DrawBar(dword x,y,w,h,EDX) |
{ |
EAX = 13; |
EBX = x<<16+w; |
ECX = y<<16+h; |
$int 0x40 |
} |
void DefineButton(dword x,y,w,h,EDX,ESI) |
{ |
EAX = 8; |
$push edx |
EDX += BT_DEL; //âíà÷àëå óäàëÿåì êíîïó ñ ýòè èä, ïîòîì ñîçäà¸ì |
$int 0x40; |
EBX = x<<16+w; |
ECX = y<<16+h; |
$pop edx |
$int 0x40 |
} |
inline fastcall void DeleteButton( EDX) |
{ |
EAX = 8; |
EDX += BT_DEL; |
$int 0x40; |
} |
:void DrawRegion(dword x,y,width,height,color1) |
{ |
DrawBar(x,y,width,1,color1); //¯®«®á £®à ᢥàåã |
DrawBar(x,y+height,width,1,color1); //¯®«®á £®à ᨧã |
DrawBar(x,y,1,height,color1); //¯®«®á ¢¥àåã á«¥¢ |
DrawBar(x+width,y,1,height+1,color1); //¯®«®á ¢¥àåã á¯à ¢ |
} |
: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); //¯®«®á á«¥¢ |
DrawBar(x+width,y+1,1,height,color2); //¯®«®á á¯à ¢ |
DrawBar(x,y+height,width,1,color2); //¯®«®á £®à ᨧã |
} |
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); |
DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª |
IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª®¯ª |
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); |
} |
:void DrawCircle(int x, y, r) |
{ |
int i; float px=0, py=r, ii = r * 3.1415926 * 2; |
FOR (i = 0; i < ii; i++) |
{ |
PutPixel(px + x, y - py, 0); |
px = py / r + px; |
py = -px / r + py; |
} |
} |
//------------------------------------------------------------------------------ |
inline fastcall void debug( EDX) |
{ |
$push ebx |
$push ecx |
$mov eax, 63 |
$mov ebx, 1 |
next_char: |
$mov ecx, DSDWORD[edx] |
$or cl, cl |
$jz done |
$int 0x40 |
$inc edx |
$jmp next_char |
done: |
$mov cl, 13 |
$int 0x40 |
$mov cl, 10 |
$int 0x40 |
$pop ecx |
$pop ebx |
} |
/programs/network/htmlv/lib/libimg_lib.h |
---|
0,0 → 1,104 |
//Asper |
//library |
dword libimg = #alibimg; |
char alibimg[21] = "/sys/lib/libimg.obj\0"; //"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/network/htmlv/lib/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/network/htmlv/lib/mem.h |
---|
0,0 → 1,95 |
//mem.Init |
dword mem_Init() |
{ |
$push ebx |
$mov eax, 68 |
$mov ebx, 11 |
$int 0x40 |
$pop ebx |
return EAX; |
} |
//mem.Alloc |
dword mem_Alloc(dword size) |
{ |
$push ebx |
$push ecx |
$mov eax, 68 |
$mov ebx, 12 |
$mov ecx, size |
$int 0x40 |
$pop ecx |
$pop ebx |
return EAX; |
} |
//mem.ReAlloc |
stdcall dword mem_ReAlloc(dword mptr, size) |
{ |
//$push ebx ecx edx |
$push ebx |
$push ecx |
$push edx |
$mov eax, 68 |
$mov ebx, 20 |
$mov ecx, size |
$mov edx, mptr |
$int 0x40 |
$pop edx |
$pop ecx |
$pop ebx |
//$pop edx ecx ebx |
return EAX; |
} |
//mem.Free |
void mem_Free(dword mptr) |
{ |
$push eax |
$push ebx |
$push ecx |
$mov eax, 68 |
$mov ebx, 13 |
$mov ecx, mptr |
$test ecx, ecx |
$jz end0 |
$int 0x40 |
@end0: |
$pop ecx |
$pop ebx |
$pop eax |
} |
//stdcall dword ?? |
inline fastcall mem_Move( 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: |
} |
} |
/programs/network/htmlv/lib/memory.h |
---|
0,0 → 1,66 |
#code32 TRUE |
inline fastcall dword malloc(dword ECX){ |
dword size, heap; |
#speed |
size = ECX; |
EAX = 68; |
EBX = 11; |
$int 0x40; |
heap = EAX; |
IF (size<=heap) |
{ |
EAX = 68; |
EBX = 12; |
ECX = size; |
$int 0x40; |
} |
ELSE EAX=-1; |
#codesize |
} |
inline fastcall dword free(dword ECX){ |
#speed |
EAX = 68; |
EBX = 13; |
$int 0x40; |
#codesize |
} |
inline fastcall dword realloc(dword ECX, EDX){ |
#speed |
EAX = 68; |
EBX = 20; |
$int 0x40; |
#codesize |
} |
inline 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: |
} |
} |
/programs/network/htmlv/lib/random.h |
---|
0,0 → 1,52 |
/******************************************************************************* |
MenuetOS MineSweeper |
Copyright (C) 2003 Ivan Poddubny |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
*******************************************************************************/ |
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë |
:int random(int max) |
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî |
{ |
$rdtsc // eax & edx |
$xor eax,edx |
$not eax |
EBX = generator; |
$ror ebx,3 |
$xor ebx,0xdeadbeef |
EBX += EAX; |
generator = EBX; |
EAX += EBX; |
EAX = EAX % max; |
return EAX; |
} |
:randomize() |
// initialize random number generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë |
{ |
asm |
{ |
mov eax,3 |
int 0x40 |
ror eax,16 |
} |
generator = EAX; |
} |
/programs/network/htmlv/lib/scroll_bar/scroll_lib.h-- |
---|
File deleted |
/programs/network/htmlv/lib/scroll_bar/scroll_dll.h-- |
---|
File deleted |
/programs/network/htmlv/lib/scroll_bar/scroll_dll.h |
---|
0,0 → 1,43 |
:int load_dll3(dword dllname, import_table) |
{ |
EAX = 68; |
EBX = 19; |
ECX = dllname; |
$int 0x40 |
IF(EAX==0) GOTO exit3; |
EDX = EAX; |
ESI = import_table; |
@import_loop3: |
$lodsd |
IF(EAX==0) GOTO import_done3; |
$push edx |
@import_find3: |
EBX = DSDWORD[EDX]; |
IF(EBX==0) GOTO exit3; |
$push eax |
@next3: |
CL = DSBYTE[EAX]; |
$cmp CL,DSBYTE[EBX]; |
$jnz import_find_next3 |
IF (CL==0) GOTO import_found3; |
EAX++; |
EBX++; |
goto next3; |
@import_find_next3: |
$pop eax |
EDX = EDX + 8; |
goto import_find3; |
@import_found3: |
$pop ebx |
EAX = DSDWORD[EDX+4]; |
DSDWORD[ESI-4] = EAX; |
$pop edx |
goto import_loop3; |
@import_done3: |
return 0; |
@exit3: |
return -1; |
} |
/programs/network/htmlv/lib/scroll_bar/scroll_lib.h |
---|
0,0 → 1,95 |
//lev |
//:dword boxlib = #abox_lib; |
:char abox_lib[]="/sys/lib/box_lib.obj"; |
:char aboxlib_init[] = "lib_init"; |
:char aScrollbar_v_draw = "scrollbar_v_draw"; |
:char aScrollbar_v_mouse = "scrollbar_v_mouse"; |
:char aScrollbar_h_draw = "scrollbar_h_draw"; |
:char aScrollbar_h_mouse = "scrollbar_h_mouse"; |
:char aVersion_scrollbar = "version_scrollbar"; |
dword boxlib_init = #aboxlib_init; |
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 sc_am__ = 0x0; |
dword sc_bm__ = 0x0; |
struct scroll_bar |
{ |
//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] |
}; |
/*scroll_bar scroll1 = { |
18,//word size_x, |
200, //start_x, |
398, //size_y, |
44,//start_y; |
18,//dword btn_height, |
0,//type, |
115,//max_area, (100+cur_area) |
15,//cur_area, |
0,//position, |
0xeeeeee,//bckg_col, |
0xD2CED0,//frnt_col, |
0x555555,//line_col, |
0,//redraw; |
0,//word delta, |
0,//delta2, |
0,//r_size_x, |
0,//r_start_x, |
0,//r_size_y, |
0,//r_start_y; |
0,//dword m_pos, |
0,//m_pos_2, |
0,//m_keys, |
0,//run_size, |
0,//position2, |
0,//work_size, |
1,//all_redraw, |
1//ar_offset; |
};*/ |
//btn_height - ¢ëá®â ¡®ª®¢ëå ª®¯®ª («¥¢ ï ¨ ¯à ¢ ï ¤«ï £®à¨§. ¨ ¢¥àåïï ¨ ¨¦ïï ¤«ï ¢¥àâ.) |
//type - type - 0-1-2, ®áâ «ìë¥ ¢ë£«ï¤ïâ ª ª 0. |
//max_area - ®¡« áâì ¬ ªá¨¬ «ì ï, ªâã «ì® ª®£¤ ¥ ¢« §¨â ¢ ®â®¡à ¦ ¥¬ãî ®¡« áâì, â.¥. á«ãç © ªâ¨¢®á⨠ª®¬¯®¥â (¢¥áì ¬ ªá¨¬ «ìë© à §¬¥à ¤®ªã¬¥â ) |
//cur_area - à §¬¥à ¡¥£ãª //®¡« áâì ®â®¡à ¦ ¥¬ ï (ª ª ï ç áâì ¤®ªã¬¥â ¢« §¨â ¢ íªà ) |
//position - ¯®§¨æ¨ï ¡¥£ãª ¨§¬¥ï¥¬ ï ®â 0 ¤® § 票ï (max_area-cur_area) |
//bckg_col - 梥⠢ãâ२©, ¯à¨¬¥ï¥âáï ¤«ï ®¡« á⥩ ¬¥¦¤ã ¡¥£ãª®¬ ¨ ª®ª ¬¨ |
//frnt_col - 梥â àã¦ë©, ¯à¨¬¥ï¥âáï ¤«ï ®¡« á⥩ ®â«¨çëå ®â ¯à¨¬¥ï¥¬ëå ¢ bckg_col |
//line_col - 梥⠫¨¨© ¨ áâ५®ª ª®¯ª å |
//redraw - ¨¤¨ª â®à ¥®¡å®¤¨¬®á⨠¯¥à¥à¨á®¢ª¨ ã¯à ¢«ï¥¬®© ®¡« á⨠ãç¨âë¢ ï ¨§¬¥¥¨¥ position ¨ cur_area |
//delta2 - ¨¤¨ª â®à § å¢ â 䮪ãá áªà®««¡ ஬ (㤥ঠ¨¥ ¡¥£ãª ) |
//all_redraw - ä« £ ãáâ ¢«¨¢ ¥¬ë© ¢ 1 ¤«ï ¯¥à¥à¨á®¢ª¨ ¢á¥£® ª®¬¯®¥â , ¥á«¨ ¯®áâ ¢¨âì 0, â® ¯¥à¥à¨á®¢ª ¯à®¨á室¨â ⮫쪮 ¤«ï ®¡« á⨠¡¥£ãª . ¢¥¤¥® ¤«ï ãáª®à¥¨ï ®âà¨á®¢ª¨, ¯®áª®«ìªã ¥ ¢® ¢á¥å á«ãç ïå âॡã¥âáï ¯à¨ã¤¨â¥ì® ®âà¨á®¢ë¢ âì ¢á¥ ç á⨠ª®¬¯®¥â . ®£¤ ¢ë§ë¢ ¥âáï ¯® ᮡëâ¨î ¬ëè¨ ¢á¥£¤ ®âà¨á®¢ë¢ ¥âáï á ¬¨¬ ª®¬¯®¥â®¬ á® § 票¥¬ 0. |
//ar_offset - ¢¥«¨ç¨ á¬¥é¥¨ï ¯à¨ ®¤®ªà ⮬ ¦ ⨨ ¡®ª®¢®© ª®¯ª¨. |