From db9a61710d955b5b8784fbe6a092af925fe11c58 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 22 Sep 2011 11:18:01 +0000 Subject: [PATCH] HTMLv 23.70 git-svn-id: svn://kolibrios.org@2228 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/htmlv/browser/HTMLv.c-- | 2 +- programs/network/htmlv/browser/History.txt | 6 ++ programs/network/htmlv/browser/TWB.h-- | 92 ++++++++++++++----- .../network/htmlv/browser/include/acid=1.htm | 80 ++++++++++++++++ .../htmlv/browser/include/some_code.h-- | 2 - .../htmlv/browser/include/unicode_tags.h-- | 73 +++++++++++++++ 6 files changed, 227 insertions(+), 28 deletions(-) create mode 100644 programs/network/htmlv/browser/include/acid=1.htm create mode 100644 programs/network/htmlv/browser/include/unicode_tags.h-- diff --git a/programs/network/htmlv/browser/HTMLv.c-- b/programs/network/htmlv/browser/HTMLv.c-- index c6f17b4428..b61d473571 100644 --- a/programs/network/htmlv/browser/HTMLv.c-- +++ b/programs/network/htmlv/browser/HTMLv.c-- @@ -24,7 +24,7 @@ dword max_kolvo_strok, max_kolvo_stolbcov, kolichestvo; -int za_kadrom, +int za_kadrom, razm_scrl, mouse_dd; diff --git a/programs/network/htmlv/browser/History.txt b/programs/network/htmlv/browser/History.txt index b6e859bc3b..73d8f9ab12 100644 --- a/programs/network/htmlv/browser/History.txt +++ b/programs/network/htmlv/browser/History.txt @@ -1,3 +1,9 @@ +22.09.11 -- v0.70 -- 11.3 +- (&), + ; +- CapsLock ( Mario); +- - ( Mario). + 13.09.11 -- v0.69 -- 11.2 - ; - ; diff --git a/programs/network/htmlv/browser/TWB.h-- b/programs/network/htmlv/browser/TWB.h-- index 1aac28707a..69fc8eb6b5 100644 --- a/programs/network/htmlv/browser/TWB.h-- +++ b/programs/network/htmlv/browser/TWB.h-- @@ -18,7 +18,7 @@ dword j, char download_path[]="/rd/1/.download"; //char search_path[]="http://nova.rambler.ru/search?words="; char search_path[]="http://nigma.ru/index.php?s="; - char version[]=" Text-based Browser 23.69"; + char version[]=" Text-based Browser 23.70"; struct TWebBrowser { @@ -37,6 +37,7 @@ TWebBrowser WB1; #include "include\history.h--" #include "include\colors.h--" +#include "include\unicode_tags.h--" void TWebBrowser::Scan(dword id) { IF (id > 399) { @@ -57,7 +58,6 @@ void TWebBrowser::Scan(dword id) { } // switch (id) { case 011: - case 004: ReadHtml(); break; case BACK: @@ -185,6 +185,7 @@ void ReadHtml(byte DO_LOAD) IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=''; downloader_id = RunProgram("/sys/network/downloader", #URL); IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); + RunProgram("/sys/network/downloader", #URL); RETURN; } file_size stdcall (#download_path); @@ -192,6 +193,7 @@ void ReadHtml(byte DO_LOAD) ELSE file_size stdcall (#URL); filesize = EBX; + IF (!filesize) return; //Lee 22.09 mem_Free(buf); buf = mem_Alloc(filesize); ReadFile(0, filesize, buf, #URL); @@ -221,6 +223,9 @@ void TWebBrowser::Load(dword adress) { edit_box_draw stdcall(#edit1); // ReadHtml(LETS_LOAD); + + IF (!filesize) return; //Lee 22.09 + wintodos(buf); ParseHTML(buf, filesize); IF(!strlen(buf)) { @@ -266,6 +271,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){ line = ''; copystr("|", #page_links); IF(!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; // + //IF(!strcmp(#URL + strlen(#URL) - 4, ".rtf")) pre_text = 1; IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; IF(za_kadrom == 0) || (WindowRePaint) DrawBar(left, top, width - 15, 15, 0xFFFFFF); // for (; buf + fsize > bword; bword++;) { @@ -338,44 +344,80 @@ void TWebBrowser::ParseHTML(dword bword, fsize){ bukva=Hex2Symb(#temp); IF (bukva) goto DEFAULT_MARK; - break; - case '&': + break; + /*case '\\': // rtf + IF(strcmp(#URL + strlen(#URL) - 4, ".rtf")<>0) goto DEFAULT_MARK; + + bword++; + IF (ESBYTE[bword] =='\'') + { + bword++; + bukva=ESBYTE[bword]; + copystr(#bukva, #temp); + + bword++; + bukva=ESBYTE[bword]; + copystr(#bukva, #temp + strlen(#temp)); + + bukva=Hex2Symb(#temp); + IF (bukva) goto DEFAULT_MARK; + } + else + { + FOR (j=0; (ESBYTE[bword] <>'\\') && (buf + fsize < bword); j++; bword++;) + { + bukva = ESBYTE[bword]; + copystr(#bukva, #tag + strlen(#tag)); + } + IF ((!strcmp(#tag, "par\0x0a")) || (!strcmp(#tag, "par\0x0b"))) stroka++; + tag=''; + bword--; + } + break;*/ + + case '&': //   IF(ignor_text) break; bword++; - j = 0; - WHILE(ESBYTE[bword] <>';') && (j < 7) { + tag=''; + FOR (j=0; (ESBYTE[bword] <>';') && (j < 7); j++; bword++;) + { bukva = ESBYTE[bword]; copystr(#bukva, #tag + strlen(#tag)); - bword++; - j++; } - bukva = ''; // - IF(!strcmp("nbsp", #tag)) copystr(" ", #line + strlen(#line)); - IF(!strcmp("copy", #tag)) || (!strcmp("#169", #tag)) copystr("(c)", #line + strlen(#line)); - IF(!strcmp("reg", #tag)) || (!strcmp("#174", #tag)) copystr("(r)", #line + strlen(#line)); + + FOR (j=0; unicode_tags[j]!=0; j+=2;) + { + IF(!strcmp(#tag, unicode_tags[j])) + { + copystr(unicode_tags[j+1], #line + strlen(#line)); + break 1; + } + } + rez = StrToInt(#tag + 1) - 1040; - IF(tag[1] == '1') && (strlen(#tag) == 5) bukva = utf100tmmv_mas[rez]; - IF(!strcmp("bdquo", #tag)) copystr(",,", #line + strlen(#line)); - IF(!strcmp("amp", #tag)) || (!strcmp("#38", #tag)) bukva = '&'; - IF(!strcmp("lt", #tag)) || (!strcmp("#60", #tag)) bukva = '<'; - IF(!strcmp("gt", #tag)) || (!strcmp("#62", #tag)) bukva = '>'; - IF(!strcmp("minus", #tag)) || (!strcmp("#8722", #tag)) bukva = '-'; - IF(!strcmp("#151", #tag)) || (!strcmp("#149", #tag)) || (!strcmp("ndash", #tag)) bukva = '-'; - IF(!strcmp("#39", #tag)) || (!strcmp("#96", #tag)) bukva = '\''; - IF(!strcmp("quot", #tag)) || (!strcmp("#34", #tag)) || (!strcmp("ldquo", #tag)) || (!strcmp("rdquo", #tag)) bukva = '"'; - tag = ''; - //break; + IF(tag[1] == '1') && (rez>1040) && (rez<1118) && (strlen(#tag) == 5) + { + bukva = utf100tmmv_mas[rez]; + copystr(#bukva, #line + strlen(#line)); + break; + } + + WriteDebug("Unknown tag"); + WriteDebug(#tag); + copystr(#tag, #line + strlen(#line)); // , - + break; default: DEFAULT_MARK: IF(ignor_text) break; IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue; // - if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) { + if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) + { copystr(#line + find_symbol(#line, ' '), #temp); // line[find_symbol(#line, ' ')] = 0x00; NEXT_MARK: IF(stroka - 1 > max_kolvo_strok) && (za_kadrom <>0) break 1; //... WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); // - TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); // + TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); // copystr(#temp, #line); } IF(pre_text == 0) && (bukva == ' ') && (stolbec == 0) && (strlen(#line) == 0) CONTINUE; diff --git a/programs/network/htmlv/browser/include/acid=1.htm b/programs/network/htmlv/browser/include/acid=1.htm new file mode 100644 index 0000000000..19d2d37f9a --- /dev/null +++ b/programs/network/htmlv/browser/include/acid=1.htm @@ -0,0 +1,80 @@ + + + + + + + + + + HTML Viewer
+
+ cp1251(Win), koi-8 (Linux, *BSD, ), + cp866 (DOS) .

+ + +C +r +e +a +t +e +d +b +y +L +e +e +n +c +y
+
+ 2008 + +

+ :

    +
  1. +
  2. +
  3. +
  4. +
  5. +
+

+
+ +
+!
+    !
+        !
+
+              ...
+
+
+ +
+ , + . . + . - : " & < > •   © ® „ “ — . ' . + +

+

+

+ + +1 ' +2 " +3 ↑ +4 &uarr +5 ↓ +6 « +7 » +8 > +9 − +10 < +11 > +12 – +13 ’ +14 “ + + + diff --git a/programs/network/htmlv/browser/include/some_code.h-- b/programs/network/htmlv/browser/include/some_code.h-- index 4943e923f3..0ac8ea7506 100644 --- a/programs/network/htmlv/browser/include/some_code.h-- +++ b/programs/network/htmlv/browser/include/some_code.h-- @@ -17,8 +17,6 @@ #define DONT_LOAD 0 #define LETS_LOAD 1 -byte utf100tmmv_mas[77] = "hsi\244j"; - dword get_URL_part(byte len) { char temp1[1000]; diff --git a/programs/network/htmlv/browser/include/unicode_tags.h-- b/programs/network/htmlv/browser/include/unicode_tags.h-- new file mode 100644 index 0000000000..383b5caab0 --- /dev/null +++ b/programs/network/htmlv/browser/include/unicode_tags.h-- @@ -0,0 +1,73 @@ + + +byte utf100tmmv_mas[77] = "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", " ", +"#38", " ", + +"copy", "(c)", +"#169", "(c)", + +"reg", "(r)", +"#174", "(r)", + +"bdquo", ",,", + +"amp", "&", +"#38", "&", + +"lt", "<", +"#60", "<", + +"gt", ">", +"#62", ">", + +"minus", "-", +"ndash", "-", +"#8722", "-", +"#8211", "-", +"#151", "-", +"#149", "-", + +"rsquo", "'", +"#39", "'", +"#96", "'", +"#8217", "'", + +"quot", "\"", +"#34", "\"", +"ldquo", "\"", +"rdquo", "\"", +"#8222","\"", +"#8221", "\"", + +"laquo", "<<", +"raquo", ">>", + +"uarr", "\24", +"darr", "\25", +"rarr", "\26", +"larr", "\27", + +"#1028","\242", +"#1030","I", +"#1031","\244", + +"#8470","N", +"percnt","%", + +0};