forked from KolibriOS/kolibrios
WebView 1.9: tweaks for better view, reworked source view
git-svn-id: svn://kolibrios.org@7746 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4d5b6935a6
commit
8256819a57
@ -22,6 +22,8 @@ struct TWebBrowser {
|
||||
_style style;
|
||||
DrawBufer DrawBuf;
|
||||
int zoom;
|
||||
bool opened; //is this a "start tag" or "end tag"
|
||||
void SetPageDefaults();
|
||||
void Prepare();
|
||||
void SetStyle();
|
||||
void DrawStyle();
|
||||
@ -36,7 +38,6 @@ struct TWebBrowser {
|
||||
|
||||
bool
|
||||
link,
|
||||
ignor_text,
|
||||
cur_encoding,
|
||||
t_html,
|
||||
t_body;
|
||||
@ -112,8 +113,10 @@ void TWebBrowser::DrawStyle()
|
||||
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
||||
if (style.u) DrawBuf.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
||||
if (link) {
|
||||
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, text_colors[text_color_index]);
|
||||
PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom); //TODO: set bigger underline_h for style.h
|
||||
if (streq[0]=' ') && (line[1]==NULL) {} else {
|
||||
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, text_colors[text_color_index]);
|
||||
PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom);
|
||||
}
|
||||
}
|
||||
stolbec += stolbec_len;
|
||||
}
|
||||
@ -125,14 +128,10 @@ void TWebBrowser::LoadInternalPage(dword bufpos, in_filesize){
|
||||
Prepare();
|
||||
}
|
||||
//============================================================================================
|
||||
void TWebBrowser::Prepare(){
|
||||
word bukva[2];
|
||||
dword j;
|
||||
byte ignor_param;
|
||||
dword bufpos;
|
||||
dword line_len;
|
||||
style.b = style.u = style.s = style.h = style.blq = t_html = t_body =
|
||||
style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0;
|
||||
void TWebBrowser::SetPageDefaults()
|
||||
{
|
||||
style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
|
||||
style.li = link = text_color_index = text_colors[0] = style.li_tab = false;
|
||||
style.align = ALIGN_LEFT;
|
||||
link_color_inactive = 0x0000FF;
|
||||
link_color_active = 0xFF0000;
|
||||
@ -141,26 +140,23 @@ void TWebBrowser::Prepare(){
|
||||
DrawBuf.Fill(0, page_bg);
|
||||
PageLinks.Clear();
|
||||
strcpy(#header, #version);
|
||||
cur_encoding = CH_NULL;
|
||||
draw_y = body_magrin;
|
||||
stolbec = 0;
|
||||
line = 0;
|
||||
zoom = 1;
|
||||
//for plaint text use CP866 for other UTF
|
||||
if (strstri(bufpointer, "html")!=-1)
|
||||
{
|
||||
debugln("<html> found");
|
||||
style.pre = false;
|
||||
cur_encoding = CH_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
debugln("no <html>");
|
||||
style.pre = true;
|
||||
cur_encoding = CH_NULL;
|
||||
}
|
||||
}
|
||||
//============================================================================================
|
||||
void TWebBrowser::Prepare(){
|
||||
word bukva[2];
|
||||
dword j;
|
||||
bool ignor_param;
|
||||
dword bufpos;
|
||||
dword line_len;
|
||||
SetPageDefaults();
|
||||
if (strstri(bufpointer, "<html")==-1) style.pre = true; //show linebreaks for a plaint text
|
||||
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
||||
{
|
||||
if (ignor_text) && (ESBYTE[bufpos]!='<') continue;
|
||||
bukva = ESBYTE[bufpos];
|
||||
switch (bukva)
|
||||
{
|
||||
@ -201,7 +197,7 @@ void TWebBrowser::Prepare(){
|
||||
{
|
||||
bufpos++;
|
||||
}
|
||||
bufpos+=3;
|
||||
bufpos+=2;
|
||||
break;
|
||||
}
|
||||
tag = attr = tagparam = ignor_param = NULL;
|
||||
@ -216,18 +212,39 @@ void TWebBrowser::Prepare(){
|
||||
else
|
||||
{
|
||||
ignor_param = true;
|
||||
if (!ignor_text) && (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
|
||||
if (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
|
||||
}
|
||||
bufpos++;
|
||||
}
|
||||
strlwr(#tag);
|
||||
|
||||
// ignore text inside the next tags
|
||||
if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) {
|
||||
for (j=10; j>0; j--) tag[j]=tag[j-1];
|
||||
tag[0] = '/';
|
||||
j = strstri(bufpos, #tag);
|
||||
if (j!=-1) {
|
||||
bufpos = j;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
|
||||
if (tagparam) GetNextParam();
|
||||
Perenos();
|
||||
DrawStyle();
|
||||
line = NULL;
|
||||
if (tag) SetStyle();
|
||||
|
||||
if (tag[0] == '/')
|
||||
{
|
||||
opened = 0;
|
||||
strcpy(#tag, #tag+1);
|
||||
}
|
||||
else opened = 1;
|
||||
|
||||
if (tag) && (!istag("span")) && (!istag("i")) && (!istag("svg")) {
|
||||
Perenos();
|
||||
DrawStyle();
|
||||
line = NULL;
|
||||
if (tag) SetStyle();
|
||||
}
|
||||
strlcpy(#oldtag, #tag, sizeof(oldtag));
|
||||
tag = attr = tagparam = ignor_param = NULL;
|
||||
break;
|
||||
@ -270,25 +287,15 @@ void TWebBrowser::Perenos()
|
||||
void TWebBrowser::SetStyle() {
|
||||
char img_path[4096];
|
||||
int left1 = body_magrin + list.x;
|
||||
bool opened;
|
||||
int meta_encoding;
|
||||
if (tag[0] == '/')
|
||||
{
|
||||
opened = 0;
|
||||
strcpy(#tag, #tag+1);
|
||||
}
|
||||
else opened = 1;
|
||||
if (istag("html")) {
|
||||
t_html = opened;
|
||||
return;
|
||||
}
|
||||
if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) { ignor_text = opened; return; }
|
||||
if (istag("form")) if (!opened) ignor_text = false;
|
||||
if(istag("title")) {
|
||||
if (opened) header=NULL;
|
||||
return;
|
||||
}
|
||||
if (ignor_text) return;
|
||||
|
||||
IF(istag("q"))
|
||||
{
|
||||
@ -360,14 +367,20 @@ void TWebBrowser::SetStyle() {
|
||||
else if (text_color_index > 0) text_color_index--;
|
||||
return;
|
||||
}
|
||||
if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) {
|
||||
IF(oldtag[0] != 'h') NewLine();
|
||||
if (istag("div")) {
|
||||
if (streq(#oldtag,"div")) && (opened) return;
|
||||
NewLine();
|
||||
//IF (oldtag[0] != 'h')
|
||||
return;
|
||||
}
|
||||
if (istag("header")) || (istag("article")) || (istag("footer")) || (istag("figure")) {
|
||||
NewLine();
|
||||
return;
|
||||
}
|
||||
if (istag("p")) {
|
||||
IF(oldtag[0] == 'h') return;
|
||||
IF (oldtag[0] == 'h') || (streq(#oldtag,"td")) || (streq(#oldtag,"p")) return;
|
||||
NewLine();
|
||||
IF(opened) NewLine();
|
||||
//IF(opened) NewLine();
|
||||
return;
|
||||
}
|
||||
if (istag("br")) { NewLine(); return; }
|
||||
@ -383,7 +396,9 @@ void TWebBrowser::SetStyle() {
|
||||
do{
|
||||
if (isattr("src=")) strcpy(#img_path, #val);
|
||||
if (isattr("alt=")) sprintf(#line, "[%s]", #val);
|
||||
if (isattr("title=")) sprintf(#line, "[%s]", #val);
|
||||
} while(GetNextParam());
|
||||
debugln(#val);
|
||||
style.image = true;
|
||||
text_color_index++;
|
||||
text_colors[text_color_index] = 0x9A6F29;
|
||||
@ -455,8 +470,10 @@ void TWebBrowser::SetStyle() {
|
||||
$push edi;
|
||||
NewLine();
|
||||
$pop edi;
|
||||
draw_y += 10;
|
||||
DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI);
|
||||
NewLine();
|
||||
draw_y += 10;
|
||||
return;
|
||||
}
|
||||
if (istag("meta")) || (istag("?xml")) {
|
||||
@ -477,7 +494,7 @@ void TWebBrowser::SetStyle() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================================
|
||||
void TWebBrowser::BufEncode(dword set_new_encoding)
|
||||
{
|
||||
if (cur_encoding == set_new_encoding) return;
|
||||
|
@ -64,6 +64,7 @@ PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0
|
||||
bool LinksArray::HoverAndProceed(dword mx, my)
|
||||
{
|
||||
int i;
|
||||
if (!count) return true;
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
|
||||
|
@ -1,11 +1,4 @@
|
||||
bool GetNextParam() {
|
||||
if (!old_tag_parser_mode)
|
||||
return GetNextParam_NEW();
|
||||
else
|
||||
return GetNextParam_OLD();
|
||||
}
|
||||
|
||||
bool GetNextParam_NEW()
|
||||
bool GetNextParam()
|
||||
{
|
||||
byte quotes = NULL;
|
||||
int i;
|
||||
@ -74,44 +67,3 @@ bool GetNextParam_NEW()
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int GetNextParam_OLD()
|
||||
{
|
||||
byte kavichki=0;
|
||||
int i = strlen(#tagparam) - 1;
|
||||
|
||||
if (!tagparam) return 0;
|
||||
|
||||
WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/')))
|
||||
{
|
||||
IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i];
|
||||
tagparam[i] = 0x00;
|
||||
i--;
|
||||
}
|
||||
|
||||
if (kavichki)
|
||||
{
|
||||
i = strrchr(#tagparam, kavichki);
|
||||
strlcpy(#val, #tagparam + i, sizeof(val));
|
||||
}
|
||||
else
|
||||
{
|
||||
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1;
|
||||
i++;
|
||||
strlcpy(#val, #tagparam + i, sizeof(val));
|
||||
|
||||
WHILE (val[0] == ' ') strcpy(#val, #val+1);
|
||||
ESBYTE[strchr(#val, ' ')] = NULL;
|
||||
}
|
||||
tagparam[i] = 0x00;
|
||||
|
||||
FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--)
|
||||
{
|
||||
IF (tagparam[i] == '=') //dirty fix (kludge)
|
||||
tagparam[i + 1] = 0x00;
|
||||
}
|
||||
strlcpy(#attr, #tagparam + i + 1, sizeof(attr));
|
||||
tagparam[i] = 0x00;
|
||||
strlwr(#attr);
|
||||
return 1;
|
||||
}
|
@ -30,7 +30,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
#ifdef LANG_RUS
|
||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.85";
|
||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.9";
|
||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||
@ -47,7 +47,7 @@ char link_menu[] =
|
||||
"Š®¯¨à®¢ âì áá뫪ã
|
||||
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
||||
#else
|
||||
char version[]="Text-based Browser 1.85";
|
||||
char version[]="Text-based Browser 1.9";
|
||||
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
||||
?define T_LAST_SLIDE "This slide is the last"
|
||||
char loading[] = "Loading...<br>";
|
||||
@ -88,7 +88,6 @@ dword panel_color = 0xE3E2E2;
|
||||
dword border_color = 0x8C8C8C;
|
||||
|
||||
bool debug_mode = false;
|
||||
bool old_tag_parser_mode = false;
|
||||
|
||||
progress_bar wv_progress_bar;
|
||||
bool souce_mode = false;
|
||||
@ -115,7 +114,7 @@ enum {
|
||||
#include "download_manager.h"
|
||||
|
||||
char editURL[sizeof(URL)];
|
||||
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19};
|
||||
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,NULL,19,19};
|
||||
|
||||
#define SKIN_Y 24
|
||||
|
||||
@ -263,7 +262,7 @@ void SetElementSizes()
|
||||
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
|
||||
Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
|
||||
WB1.list.wheel_size = 7 * basic_line_h;
|
||||
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
||||
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1;
|
||||
WB1.list.visible = WB1.list.h;
|
||||
if (WB1.list.w!=WB1.DrawBuf.bufw) {
|
||||
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 800*20);
|
||||
@ -377,11 +376,6 @@ void ProcessEvent(dword id__)
|
||||
if (debug_mode) notify("'Debug mode ON'-I");
|
||||
else notify("'Debug mode OFF'-I");
|
||||
return;
|
||||
case SCAN_CODE_F11:
|
||||
old_tag_parser_mode ^= 1;
|
||||
if (old_tag_parser_mode) notify("'Old tag parser ON'-I");
|
||||
else notify("'Old tag parser OFF'-I");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,6 +392,7 @@ void StopLoading()
|
||||
http.transfer=0;
|
||||
bufsize = 0;
|
||||
bufpointer = free(bufpointer);
|
||||
pause(10);
|
||||
}
|
||||
wv_progress_bar.value = 0;
|
||||
DrawOmnibox();
|
||||
|
@ -24,7 +24,7 @@ char save_to[4096] = "/tmp0/1/Downloads";
|
||||
proc_info DL_Form;
|
||||
char downloader_edit[10000];
|
||||
char filepath[4096];
|
||||
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit)-2,#downloader_edit,0,2,19,19};
|
||||
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19};
|
||||
progress_bar pb = {0, CONX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
||||
//progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
||||
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
|
||||
|
@ -1,10 +1,10 @@
|
||||
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
|
||||
enum { TAG, OPTION_VALUE, TEXT, COMMENT, SCRIPT};
|
||||
|
||||
//you are butifull, you are butifull
|
||||
dword ShowSource()
|
||||
{
|
||||
dword new_buf, new_buf_start, i;
|
||||
int mode;
|
||||
dword new_buf, new_buf_start, i, j;
|
||||
int opened_font=0;
|
||||
int mode = TEXT;
|
||||
|
||||
if (souce_mode) return;
|
||||
souce_mode = true;
|
||||
@ -18,70 +18,81 @@ dword ShowSource()
|
||||
switch (ESBYTE[i])
|
||||
{
|
||||
case '<':
|
||||
if (mode == COMMENT)
|
||||
{
|
||||
if (mode == TEXT) && (!strncmp(i+1,"script", 6)) {
|
||||
mode = SCRIPT;
|
||||
strcpy(new_buf, "<font color=#00f><script</font><font color=#994500>"); opened_font++;
|
||||
new_buf+=54;
|
||||
i+=6;
|
||||
break;
|
||||
}
|
||||
if (mode == COMMENT) || (mode == SCRIPT) && (!strncmp(i+1,"/script>", 8)) {
|
||||
mode = TEXT;
|
||||
while (opened_font) {
|
||||
strcpy(new_buf, "</font>"); opened_font--;
|
||||
new_buf+=7;
|
||||
}
|
||||
strcpy(new_buf, "<font color=#00f></script></font>");
|
||||
new_buf+=39;
|
||||
i+=8;
|
||||
break;
|
||||
}
|
||||
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-') {
|
||||
mode = COMMENT;
|
||||
strcpy(new_buf, "<font color=#bbb><"); opened_font++;
|
||||
new_buf+=21;
|
||||
break;
|
||||
}
|
||||
if (mode == TEXT) {
|
||||
mode = TAG;
|
||||
strcpy(new_buf, "<font color=#00f><"); opened_font++;
|
||||
new_buf+=21;
|
||||
break;
|
||||
}
|
||||
if (mode == COMMENT) || (mode == SCRIPT) {
|
||||
strcpy(new_buf, "<");
|
||||
new_buf+=4;
|
||||
break;
|
||||
}
|
||||
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
|
||||
{
|
||||
strcpy(new_buf, "<font color=#bbb><");
|
||||
new_buf+=21;
|
||||
mode = COMMENT;
|
||||
break;
|
||||
}
|
||||
if (mode != COMMENT)
|
||||
{
|
||||
strcpy(new_buf, "<font color=#00f><");
|
||||
new_buf+=21;
|
||||
mode = TAG;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '>':
|
||||
if (mode == OPTION_VALUE) //fix non-closed quote in TAG
|
||||
{
|
||||
strcpy(new_buf, ""</font>");
|
||||
new_buf+=13;
|
||||
mode = TAG;
|
||||
break;
|
||||
}
|
||||
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
|
||||
{
|
||||
strcpy(new_buf, "></font>");
|
||||
new_buf+=11;
|
||||
if (mode == OPTION_VALUE) { //fix non-closed quote in TAG
|
||||
mode = TEXT;
|
||||
while (opened_font) {
|
||||
strcpy(new_buf, ""</font>"); opened_font--;
|
||||
new_buf+=13;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (mode == COMMENT)
|
||||
{
|
||||
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-') {
|
||||
mode = TEXT;
|
||||
strcpy(new_buf, "></font>"); opened_font--;
|
||||
new_buf+=11;
|
||||
break;
|
||||
}
|
||||
if (mode == COMMENT) || (mode == SCRIPT) {
|
||||
strcpy(new_buf, ">");
|
||||
new_buf+=4;
|
||||
break;
|
||||
}
|
||||
if (mode == TAG)
|
||||
{
|
||||
strcpy(new_buf, "></font>");
|
||||
new_buf+=11;
|
||||
if (mode == TAG) {
|
||||
mode = TEXT;
|
||||
strcpy(new_buf, "></font>"); opened_font--;
|
||||
new_buf+=11;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\"':
|
||||
case '\'':
|
||||
if (mode == TAG)
|
||||
{
|
||||
strcpy(new_buf, "<font color=#f0f>'");
|
||||
new_buf+=22;
|
||||
if (mode == TAG) {
|
||||
mode = OPTION_VALUE;
|
||||
strcpy(new_buf, "<font color=#F301F2>'"); opened_font++;
|
||||
new_buf+=25;
|
||||
break;
|
||||
}
|
||||
if (mode == OPTION_VALUE)
|
||||
{
|
||||
strcpy(new_buf, "'</font>");
|
||||
new_buf+=12;
|
||||
if (mode == OPTION_VALUE) {
|
||||
mode = TAG;
|
||||
strcpy(new_buf, "'</font>"); opened_font--;
|
||||
new_buf+=12;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -96,6 +107,9 @@ dword ShowSource()
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
|
||||
|
||||
char* C_HL_keywords[] = {
|
||||
"switch", "if", "while", "for", "break", "continue", "return", "else",
|
||||
"union", "typedef", "static", "class", "case", "#include",
|
||||
|
@ -41,7 +41,6 @@ dword panel_color = 0xE3E2E2;
|
||||
dword border_color = 0x8C8C8C;
|
||||
|
||||
bool debug_mode = false;
|
||||
bool old_tag_parser_mode = false;
|
||||
|
||||
bool open_in_a_new_window = false;
|
||||
|
||||
|
@ -29,10 +29,12 @@ void test2()
|
||||
ci.add(1);
|
||||
ci.add(2);
|
||||
ci.add(3);
|
||||
for (i=0; i<ci.count; i++) debugi(ci.get(i)); //-> 0 1 2 3
|
||||
debugln("-> 0 1 2 3");
|
||||
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 2 3
|
||||
ci.count--;
|
||||
ci.count--;
|
||||
ci.add(4);
|
||||
for (i=0; i<ci.count; i++) debugi(ci.get(i)); //-> 0 1 4
|
||||
debugln("-> 0 1 4");
|
||||
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 4
|
||||
ci.drop();
|
||||
}
|
@ -42,18 +42,13 @@ inline fastcall void debugln( EDX)
|
||||
debugch(10);
|
||||
}
|
||||
|
||||
inline void debugi(dword d_int)
|
||||
:void debugval(dword text,number)
|
||||
{
|
||||
char tmpch[12];
|
||||
itoa_(#tmpch, d_int);
|
||||
debug(text);
|
||||
debug(": ");
|
||||
itoa_(#tmpch, number);
|
||||
debugln(#tmpch);
|
||||
}
|
||||
|
||||
:void debugval(dword text,number)
|
||||
{
|
||||
debug(text);
|
||||
debug(": ");
|
||||
debugi(number);
|
||||
}
|
||||
|
||||
#endif
|
@ -37,10 +37,9 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
|
||||
cd = EAX;
|
||||
if (cd!=0)
|
||||
{
|
||||
debugln("iconv: something is wrong with stdcall iconv()");
|
||||
debugi(cd);
|
||||
debug("in_len:"); debugi(in_len);
|
||||
debug("out_len:"); debugi(out_len);
|
||||
debugval("iconv: something is wrong with stdcall iconv()", cd);
|
||||
debugval("in_len", in_len);
|
||||
debugval("out_len", out_len);
|
||||
new_buf = free(new_buf);
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ byte letter_icons[sizeof(file "img/letter_icons.raw")] = FROM "img/letter_icons.
|
||||
#include "img/letter_icons.h"
|
||||
|
||||
_http http = {0};
|
||||
bool old_tag_parser_mode = false;
|
||||
bool debug_mode = false;
|
||||
char accept_language[]= "Accept-Language: ru\n";
|
||||
|
||||
|
@ -107,15 +107,15 @@ void MailBoxNetworkProcess() {
|
||||
aim=NULL;
|
||||
break;
|
||||
}
|
||||
debug("mailsize: "); debugi(mailsize);
|
||||
debugval("mailsize", mailsize);
|
||||
aim = GET_ANSWER_RETR;
|
||||
debugln("goto GET_ANSWER_RETR");
|
||||
break;
|
||||
|
||||
case GET_ANSWER_RETR:
|
||||
debug("mailsize: "); debugi(mailsize);
|
||||
debug("mailstart: "); debugi(mailstart);
|
||||
debug("mailend: "); debugi(mailend);
|
||||
debugval("mailsize", mailsize);
|
||||
debugval("mailstart", mailstart);
|
||||
debugval("mailend", mailend);
|
||||
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
||||
if (ticks == 0xffffffff) break;
|
||||
mailend = mailend + ticks;
|
||||
|
@ -123,20 +123,16 @@ void ProcessBase64()
|
||||
int clean_mailstart;
|
||||
|
||||
b_start = strstr(mailstart, "?B?");
|
||||
debug("b_size");
|
||||
debugi(b_start);
|
||||
debugval("b_size", b_start);
|
||||
if (b_start)
|
||||
{
|
||||
b_end = strstr(b_start, "?=");
|
||||
debug("b_end");
|
||||
debugi(b_end);
|
||||
debugval("b_end", b_end);
|
||||
b_size = b_end - b_start;
|
||||
debug("b_size");
|
||||
debugi(b_size);
|
||||
debugval("b_size", b_size);
|
||||
b_buf = malloc(b_size);
|
||||
strcpyb(mailstart, b_buf, "?B?", "?=");
|
||||
debug("b_buf");
|
||||
debug(b_buf);
|
||||
debugval("b_buf", b_buf);
|
||||
|
||||
base64_decode stdcall (b_buf, b_buf, b_size-3);
|
||||
ConvertToDOS(b_buf, mailstart);
|
||||
|
Loading…
Reference in New Issue
Block a user