From 1ab60232c863b83e932609a4711fe1b742c32565 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 26 Jul 2021 07:21:58 +0000 Subject: [PATCH] WebView: various fixes git-svn-id: svn://kolibrios.org@9089 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/TWB/parse_tag.h | 42 ++-------------------------- programs/cmm/browser/TWB/special.h | 2 ++ programs/cmm/browser/WebView.c | 7 +++-- programs/cmm/browser/res/test.htm | 42 ++++++++++++++++------------ programs/cmm/lib/kolibri.h | 2 +- 5 files changed, 33 insertions(+), 62 deletions(-) diff --git a/programs/cmm/browser/TWB/parse_tag.h b/programs/cmm/browser/TWB/parse_tag.h index 7fa07b6b55..5a7724c983 100644 --- a/programs/cmm/browser/TWB/parse_tag.h +++ b/programs/cmm/browser/TWB/parse_tag.h @@ -1,4 +1,3 @@ - struct _tag { char name[32]; @@ -10,7 +9,6 @@ struct _tag dword number; bool is(); bool parse(); - void debug_tag(); dword get_next_param(); dword get_value_of(); signed get_number_of(); @@ -18,11 +16,7 @@ struct _tag bool _tag::is(dword _text) { - if ( !strcmp(#name, _text) ) { - return true; - } else { - return false; - } + return streq(#name, _text); } bool _tag::parse(dword _bufpos, bufend) @@ -63,38 +57,22 @@ bool _tag::parse(dword _bufpos, bufend) closepos = strchr(bufpos, '>'); whitepos = strchrw(bufpos, bufend-bufpos); - if (debug_mode) { - if (!closepos) debugln("null closepos"); - if (!whitepos) debugln("null whitepos"); - } - if (!whitepos) || (whitepos > closepos) { //no param strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name))); - debug_tag(); bufpos = closepos; } else { //we have param while (chrlnum(whitepos, '\"', closepos - whitepos)%2) { //alt="Next>>" - /* - openpos = strchr(closepos+1, '<'); - closepos = strchr(closepos+1, '>'); - if (openpos) && (openpos < closepos) { - closepos = openpos - 1; - break; - } - */ if (!openpos = strchr(closepos+1, '<')) break; if (openpos < strchr(closepos+1, '>')) break; if (!closepos = EAX) {closepos = bufend;break;} } strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name))); - debug_tag(); bufpos = closepos; params = malloc(closepos - whitepos + 1); strncpy(params, whitepos, closepos - whitepos); - if (debug_mode) { debug("params: "); debugln(params+1); } paramsend = params + closepos - whitepos; while (paramsend = get_next_param(params, paramsend-1)); free(params); @@ -120,16 +98,6 @@ _RET: return retok; } -void _tag::debug_tag() -{ - if (debug_mode) { - debugch('<'); - if (!opened) debugch('/'); - debug(#name); - debugln(">"); - } -} - dword _tag::get_next_param(dword ps, pe) { // "ps" - param start @@ -189,12 +157,6 @@ dword _tag::get_next_param(dword ps, pe) attributes.add(attr); values.add(val); - if (debug_mode) { - debug("atr: "); debugln(attr); - debug("val: "); debugln(val); - debugch('\n'); - } - if (pe==ps) return NULL; return pe; } @@ -213,7 +175,7 @@ dword _tag::get_value_of(dword _attr_name) signed _tag::get_number_of(dword _attr_name) { if (get_value_of(_attr_name)) { - number = atoi(tag.value); + number = atoi(value); } else { number = 0; } diff --git a/programs/cmm/browser/TWB/special.h b/programs/cmm/browser/TWB/special.h index 2e23b8f35d..f2a834c522 100644 --- a/programs/cmm/browser/TWB/special.h +++ b/programs/cmm/browser/TWB/special.h @@ -11,6 +11,7 @@ char *unicode_symbols[]={ "#171","<<", "laquo","<<", "#174","(r)", "reg", "(r)", "#187",">>", "raquo",">>", +"hellip", "...", "trade", "[TM]", "bdquo", ",,", @@ -80,6 +81,7 @@ bool GetUnicodeSymbol(dword _line, line_size, bufpos, buf_end) { if (__isWhite(ESBYTE[bufpos])) {bufpos--; break;} if (ESBYTE[bufpos] == ';') || (bufpos >= buf_end) break; + if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ESBYTE[bufpos])) {bufpos--; break;} special_code[i] = ESBYTE[bufpos]; } special_code[i] = '\0'; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 40cb2c5697..de10c63c71 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -1,4 +1,4 @@ -//Copyright 2007-2020 by Veliant & Leency +//Copyright 2007-2021 by Veliant & Leency //Asper, lev, Lrz, Barsuk, Nable, hidnplayr... //===================================================// @@ -234,6 +234,7 @@ void main() } LoadInternalPage(http.content_pointer, http.content_received); free(http.content_pointer); + DrawOmnibox(); } else if (http_get_type==IMG) { _IMG_RES: @@ -426,10 +427,10 @@ void EventAllTabsClick(dword _n) void EventEditSource() { if (check_is_the_adress_local(history.current())) { - RunProgram("/rd/1/quark", history.current()); + RunProgram("/rd/1/develop/cedit", history.current()); } else { CreateFile(WB1.bufsize, WB1.bufpointer, "/tmp0/1/WebView_tmp.htm"); - if (!EAX) RunProgram("/rd/1/quark", "/tmp0/1/WebView_tmp.htm"); + if (!EAX) RunProgram("/rd/1/develop/cedit", "/tmp0/1/WebView_tmp.htm"); } } diff --git a/programs/cmm/browser/res/test.htm b/programs/cmm/browser/res/test.htm index 588656f2c2..b90960ce72 100644 --- a/programs/cmm/browser/res/test.htm +++ b/programs/cmm/browser/res/test.htm @@ -6,22 +6,28 @@ KolibriN10 Kolibri Store -os-menuet.narod.ru -coolthemes.narod.ru -fdd5-25.net -mestack.narod.ru -dgmag.in -baravy.by/me/b.html - -artcon.ru -acmp.ru -cnn 1996 -vetusware.com -old-dos.ru -nubo.ru -samlib.ru/b - -UmVirt Conis -LOR +Simplest: +bash.im opennet -bash.im \ No newline at end of file +LOR +baravy.by/me/b.html +samlib.ru/b +mirrors.pdp-11.ru + +Simple: +dgmag.in +os-menuet.narod.ru +mestack.narod.ru +coolthemes.narod.ru +vetusware.com + +Moderate: +fdd5-25 +acmp.ru +old-dos.ru + +Complex: +artcon.ru +cnn 1996 +nubo.ru +electromyne.de \ No newline at end of file diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index a4f7861560..d3f8ddae88 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -187,7 +187,7 @@ struct proc_info word status_slot,rezerv3; dword cleft,ctop,cwidth,cheight; char status_window; - byte reserved[1024-71-8]; + byte reserved[1024-71]; }; :void GetProcessInfo(dword _process_struct_pointer, _process_id)