Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2838 → Rev 2839

/programs/network/htmlv/browser/TWB.h
9,7 → 9,7
 
char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 0.94e";
char version[]=" Text-based Browser 0.94u";
 
 
struct TWebBrowser {
30,7 → 30,7
link, ignor_text, li_tab, first_line_drawed;
 
 
dword text_colors[30],
dword text_colors[300],
text_color_index,
link_color,
bg_color;
39,6 → 39,9
stolbec,
tab_len;
char anchor[256];
int anchor_line_num;
char line[500],
tag[100],
tagparam[10000],
45,10 → 48,7
parametr[1200],
options[1000];
 
char anchor[256];
int anchor_line_num;
 
 
#include "include\history.h"
#include "include\colors.h"
#include "include\unicode_tags.h"
65,7 → 65,7
//#1
if (URL[0] == '#')
{
strcpy(#anchor, #URL+find_symbol(#URL, '#'));
strcpy(#anchor, #URL+strrchr(#URL, '#'));
strcpy(#URL, BrowserHistory.CurrentUrl());
74,10 → 74,10
return;
}
//liner.ru#1
if (find_symbol(#URL, '#')<>-1)
if (strrchr(#URL, '#')<>-1)
{
strcpy(#anchor, #URL+find_symbol(#URL, '#'));
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà
strcpy(#anchor, #URL+strrchr(#URL, '#'));
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà
}
 
GetNewUrl();
197,15 → 197,15
_CUT_ST_LEVEL_MARK:
if (editURL[find_symbol(#editURL, '/')-2]<>'/') // åñëè íå http://pagename.ua <-- íàõðåíà ýòà ñòðîêà???
if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http://pagename.ua <-- íàõðåíà ýòà ñòðîêà???
{
editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
}
IF (!strcmp(get_URL_part(3),"../")) //íà óðîâåíü ââåðõ
{
strcpy(#URL,#URL+3);
editURL[find_symbol(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
editURL[strrchr(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
goto _CUT_ST_LEVEL_MARK;
}
318,9 → 318,7
if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
#ifdef DEBUG_ON
debug("Start parsing");
#endif
for ( ; buf+filesize > bword; bword++;) {//ESBYTE[bword]
bukva = ESBYTE[bword];
438,7 → 436,7
//
if (stolbec + strlen(#line) > lines.column_max)
{
perenos_num = find_symbol(#line, ' ');
perenos_num = strrchr(#line, ' ');
strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
line[perenos_num] = 0x00;
NEXT_MARK:
465,9 → 463,7
ParseHTML(buf);
}
 
#ifdef DEBUG_ON
debug("End parsing");
#endif
DrawScroller(); //ðèñóåì ñêðîëë
}
 
568,14 → 564,16
{
if (rez)
{
text_color_index++;
text_colors[text_color_index] = text_colors[text_color_index-1];
 
_A_MARK:
if (!strcmp(#parametr, "href="))
{
if (stroka - 1 > lines.visible) || (stroka < -2) return;
if (link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã
if (link) && (text_color_index > 0) text_color_index--; //åñëè íå çàêðûò òýã
link = 1;
blink++;
text_color_index++;
text_colors[text_color_index] = link_color;
strcat(#page_links, #options);
strcat(#page_links, "|");
602,11 → 600,14
/////////////////////////
if (!chTag("font"))
{
IF (stroka - 1 > lines.visible) return;
if (rez)
{
text_color_index++;
text_colors[text_color_index] = text_colors[text_color_index-1];
COL_MARK:
if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
{
text_color_index++;
text_colors[text_color_index] = GetColor(#options);
}
IF(tagparam) {
613,7 → 614,9
GetNextParam();
GOTO COL_MARK;
}
IF(!rez) && (text_color_index > 0) text_color_index--;
}
else
if (text_color_index > 0) text_color_index--;
return;
}
//////////////////////////
694,18 → 697,18
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{
strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
temp[find_symbol(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
temp[strrchr(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
strcat(#temp, #options);
image=load_image(#temp);
w=DSWORD[image+4];
h=DSWORD[image+8];
}
if (!strcmp(#parametr,"alt="))
/*if (!strcmp(#parametr,"alt="))
{
strcpy(#tag, "[Image: ");
strcat(#tag, #options);
strcat(#tag, "]");
}
}*/
 
IF(tagparam)
{
758,7 → 761,7
META:
if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
{
strcpy(#options, #options[find_symbol(#options, '=')]); //ïîèñê â content=
strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
 
if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF);
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI);
/programs/network/htmlv/browser/include/colors.h
317,10 → 317,7
ELSE
FOR (ii=0; color_names[ii]!=0; ii++)
{
IF(!strcmp(color_str, color_names[ii]))
{
return colors[ii];
IF(!strcmp(color_str, color_names[ii])) return colors[ii];
}
}
return text_colors[0];
}
/programs/network/htmlv/browser/include/history.h
23,6 → 23,7
 
void UrlsHistory::AddUrl() //òóò íóæåí ââîäèìûé ýëåìåíò - äëÿ óíèâåðñàëüíîñòè
{
int i;
if (history_num>0) && (strcmp(#URL,#history_list[history_current].Item)==0) return;
 
if (history_current>=MAX_HISTORY_NUM-1)
/programs/network/htmlv/browser/include/menu_rmb.h
4,13 → 4,14
#define ITEM_WIDTH 138
 
char *ITEMS_LIST[]={
"View in Tinypad F3",
"View in TextEdit F4",
"-",
"KOI-8 Ctrl+K",
"UTF Ctrl+U",
"View in Tinypad F3",52,
"View in TextEdit F4",53,
"-",0,
"KOI-8 Ctrl+K",11,
"UTF Ctrl+U",21,
0};
 
 
proc_info MenuForm;
 
19,7 → 20,7
 
mouse mm;
int items_num, items_cur;
int id1, key;
int id1, key, i;
SetEventMask(100111b);
43,7 → 44,9
break;
case evButton:
ItemProcess(GetButtonID());
id1=GetButtonID()-10;
WB1.Scan(ITEMS_LIST[id1*2+1]);
ExitProcess();
break;
case evKey:
61,12 → 64,13
}
if (key==13)
{
ItemProcess(items_cur+10);
WB1.Scan(ITEMS_LIST[items_cur*2+1]);
ExitProcess();
}
break;
case evReDraw:
for (items_num=0; ITEMS_LIST[items_num]<>0; 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);
 
DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê
73,7 → 77,7
_ITEMS_DRAW:
for (i=0; i<items_num; i++;)
{
if (!strcmp(ITEMS_LIST[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);
82,22 → 86,12
DefineButton(0, i*ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT, i+10+BT_HIDE, 0xFFFFFF);
if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE;
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i],0);
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0);
}
}
}
 
void ItemProcess(int num_id)
{
if (num_id==10) WB1.Scan(52);
if (num_id==11) WB1.Scan(53);
//-----------------------
if (num_id==13) WB1.Scan(11); //KOI
if (num_id==14) WB1.Scan(21); //UTF
ExitProcess();
}
 
 
 
 
 
/programs/network/htmlv/browser/include/parce_tag.h
12,12 → 12,12
 
IF (kavichki)
{
i=find_symbol(#tagparam, kavichki);
i=strrchr(#tagparam, kavichki);
strcpy(#options, #tagparam + i);
}
ELSE
{
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=find_symbol(#tagparam, '=')+1;
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1;
i++;
strcpy(#options, #tagparam + i); //êîïèðóåì îïöèþ
/programs/network/htmlv/browser/include/some_code.h
27,7 → 27,7
 
void GetURLfromPageLinks(int id)
{
int j = 0;
int i, j = 0;
for (i = 0; i <= id - 401; i++)
{
do j++;
34,7 → 34,7
while (page_links[j] <>'|');
}
page_links[j] = 0x00;
strcpy(#URL, #page_links[find_symbol(#page_links, '|')]);
strcpy(#URL, #page_links[strrchr(#page_links, '|')]);
}
 
 
49,14 → 49,14
dword italic_buf;
int tile_height=2, //áóäåì âûâîäèòü äâóõïèêñåëüíûìè ïîëîñêàìè
shift=-2, //ñ äâóõïèêñåëüíûì ñìåùåíèåì
i;
i, skin_width;
 
italic_buf = mem_Alloc(w*h*3);
skin_width = GetSkinWidth();
CopyScreen(italic_buf, x+Form.left+2, y+Form.top+skin_width, w, h);
 
CopyScreen(italic_buf, x+Form.left+2, GetSkinWidth()+y+Form.top, w, h);
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);
 
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);
}
mem_Free(italic_buf);
}
/programs/network/htmlv/browser/include/unicode_tags.h
2,18 → 2,6
 
byte unicode_chars[] = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯àáâãäåæçèéêëìíîïðñh£\243i\105\244\0";
 
/* 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;
*/
 
char *unicode_tags[]={
"nbsp", " ",
74,7 → 62,7
"#1031", "\244",
 
"#8470", "N",
"bull", "-", //¢®®¡é¥ §¤¥áì â®çª 
"bull", "-", //âîîáùå çäåñü òî÷êà
"percnt","%",
 
0};
/programs/network/htmlv/lib/kolibri.h
148,6 → 148,8
$shr eax,8
}
 
//----------------------------------------
 
struct proc_info
{
#define SelfInfo -1
169,6 → 171,12
$int 0x40
}
 
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
{
$mov eax,34
$int 0x40
}
 
inline fastcall int GetProcessSlot( ECX)
{
EAX = 18;
183,7 → 191,20
$int 0x40
}
 
inline fastcall int CreateThread( ECX,EDX)
{
$mov eax,51
$mov ebx,1
$int 0x40
}
 
inline fastcall void SwitchToAnotherThread()
{
$mov eax,68
$mov ebx,1
$int 0x40
}
 
inline fastcall ExitProcess()
{
$mov eax,-1;
279,13 → 300,6
$int 0x40;
}
 
inline fastcall int CreateThread( ECX,EDX)
{
EAX = 51;
EBX = 1;
$int 0x40
}
 
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
{
EAX = 4;
/programs/network/htmlv/lib/libimg_lib.h
2,7 → 2,7
 
//library
dword libimg = #alibimg;
char alibimg[21] = "/sys/lib/libimg.obj\0"; //"libimg.obj\0";
char alibimg[21] = "/sys/lib/libimg.obj\0";
 
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
/programs/network/htmlv/lib/mem.h
26,9 → 26,15
}
 
//mem.ReAlloc
inline fastcall dword mem_ReAllocR( ECX, EDX)
{
$mov eax, 68
$mov ebx, 20
$int 0x40
}
 
stdcall dword mem_ReAlloc(dword mptr, size)
{
//$push ebx ecx edx
$push ebx
$push ecx
$push edx
41,7 → 47,6
$pop edx
$pop ecx
$pop ebx
//$pop edx ecx ebx
return EAX;
}
 
/programs/network/htmlv/lib/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 - ¢¥«¨ç¨­  ᬥ饭¨ï ¯à¨ ®¤­®ªà â­®¬ ­ ¦ â¨¨ ¡®ª®¢®© ª­®¯ª¨.
/programs/network/htmlv/lib/strings.h
1,16 → 1,19
//------------------------------------------------------------------------------
// strcmp( ESI, EDI)
// strlen( EDI)
// strcpy( EDI, ESI)
// strcat( EDI, ESI)
// strchr( ESI,BL)
// strrchr( ESI,BL)
// strstr( EBX, EDX)
//
// IntToStr( ESI)
// StrToInt()
// strcmp( ESI, EDI)
// find_symbol( ESI,BL)
// upcase( ESI)
// lowcase( ESI)
// strstr( EBX, EDX)
//------------------------------------------------------------------------------
 
 
inline fastcall unsigned int strlen( EDI)
{
$xor eax, eax
59,7 → 62,7
}
}
 
char buffer[11]="";
char buffer[11];
inline fastcall dword IntToStr( ESI)
{
$mov edi, #buffer
115,8 → 118,19
}
}
 
inline fastcall unsigned int find_symbol( ESI,BL)
inline fastcall unsigned int strchr( ESI,BL)
{
int jj=0;
do{
jj++;
$lodsb
IF(AL==BL) return jj;
} while(AL!=0);
}
 
 
inline fastcall unsigned int strrchr( ESI,BL)
{
int jj=0, last=-1;
do{
jj++;
169,7 → 183,7
sub ecx, esi
jbe ls2
mov edi, ebx
lea ebx, dsdword[ esi-1]
lea ebx, DSDWORD[ esi-1]
ls1: mov esi, edx
lodsb
repne scasb
181,7 → 195,7
pop edi
mov ecx, eax
jne ls1
lea eax, dsdword[ edi-1]
lea eax, DSDWORD[ edi-1]
jmp short ls3
ls2: xor eax, eax
ls3: