WebView 0.99.71: couple of fixes

git-svn-id: svn://kolibrios.org@4645 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2014-03-14 19:06:48 +00:00
parent 99b65dc390
commit bddab0d593
7 changed files with 50 additions and 45 deletions

View File

@ -30,14 +30,14 @@
#include "img\URLgoto.txt"; #include "img\URLgoto.txt";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.7"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.71";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm"; unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n\0"; char accept_language[]= "Accept-Language: ru\n\0";
#else #else
char version[]=" Text-based Browser 0.99.7"; char version[]=" Text-based Browser 0.99.71";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -207,12 +207,12 @@ void main()
} }
else else
{ {
if (o_bufpointer) o_bufpointer = free(o_bufpointer);
ESI = http_transfer; ESI = http_transfer;
bufpointer = ESI.http_msg.content_ptr; bufpointer = ESI.http_msg.content_ptr;
bufsize = ESI.http_msg.content_received; bufsize = ESI.http_msg.content_received;
http_free stdcall (http_transfer); http_free stdcall (http_transfer);
http_transfer=0; http_transfer=0;
SetPageDefaults();
Draw_Window(); // stop button => refresh button Draw_Window(); // stop button => refresh button
} }
} }
@ -469,28 +469,33 @@ void StopLoading()
mem_Free(EAX); // free data mem_Free(EAX); // free data
http_transfer=0; http_transfer=0;
bufsize = 0; bufsize = 0;
PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
} }
}
void SetPageDefaults()
{
strcpy(#header, #version);
pre_text = 0;
WB1.list.count = WB1.list.first = 0;
stroka = 0;
cur_encoding = _DEFAULT;
if (o_bufpointer) o_bufpointer = free(o_bufpointer);
anchor_line_num=WB1.list.first; anchor_line_num=WB1.list.first;
anchor[0]='|'; anchor[0]='|';
} }
void OpenPage() void OpenPage()
{ {
if (http_transfer<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
StopLoading(); StopLoading();
strcpy(#editURL, #URL); strcpy(#editURL, #URL);
BrowserHistory.AddUrl(); BrowserHistory.AddUrl();
strcpy(#header, #version);
pre_text =0;
WB1.list.ClearList();
if (strncmp(#URL,"http:",5)==0) if (strncmp(#URL,"http:",5)==0)
{ {
_PutImage(88,10, 24,24, #stop_btn);
http_get stdcall (#URL, #accept_language); http_get stdcall (#URL, #accept_language);
http_transfer = EAX; http_transfer = EAX;
cur_encoding = _DEFAULT;
IF (http_transfer < 0) notify("Error from HTTP lib"); IF (http_transfer < 0) notify("Error from HTTP lib");
Draw_Window();
return;
} }
else else
{ {
@ -498,12 +503,11 @@ void OpenPage()
bufsize = EBX; bufsize = EBX;
if (!bufsize) return; if (!bufsize) return;
mem_Free(bufpointer); mem_Free(bufpointer);
cur_encoding = _DEFAULT;
if (o_bufpointer) o_bufpointer = free(o_bufpointer);
bufpointer = mem_Alloc(bufsize); bufpointer = mem_Alloc(bufsize);
SetPageDefaults();
ReadFile(0, bufsize, bufpointer, #URL); ReadFile(0, bufsize, bufpointer, #URL);
ShowPage();
} }
ShowPage();
} }
void ShowPage() void ShowPage()

View File

@ -11,8 +11,8 @@ struct sysdir
int i; int i;
strcpy(#sysdir.name, tName); strcpy(#sysdir.name, tName);
strcpy(#sysdir.path, tPath); strcpy(#sysdir.path, tPath);
debug(#sysdir.name); debugln(#sysdir.name);
debug(#sysdir.path); debugln(#sysdir.path);
$mov eax, 30 $mov eax, 30
$mov ebx, 3 $mov ebx, 3
ECX = #sysdir; ECX = #sysdir;

View File

@ -12,7 +12,7 @@
} }
if (error = GetFileInfo(from1, #CopyFile_atr1)) if (error = GetFileInfo(from1, #CopyFile_atr1))
{ {
debug("Error: copyf->GetFileInfo"); debugln("Error: copyf->GetFileInfo");
return error; return error;
} }
if (isdir(from1)) if (isdir(from1))
@ -30,18 +30,18 @@
dword error, cbuf; dword error, cbuf;
if (error = GetFileInfo(copy_from3, #CopyFile_atr)) if (error = GetFileInfo(copy_from3, #CopyFile_atr))
{ {
debug("Error: CopyFile->GetFileInfo"); debugln("Error: CopyFile->GetFileInfo");
} }
else else
{ {
cbuf = malloc(CopyFile_atr.sizelo); cbuf = malloc(CopyFile_atr.sizelo);
if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3)) if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3))
{ {
debug("Error: CopyFile->ReadFile"); debugln("Error: CopyFile->ReadFile");
} }
else else
{ {
if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debug("Error: CopyFile->WriteFile"); if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debugln("Error: CopyFile->WriteFile");
} }
} }
free(cbuf); free(cbuf);
@ -56,7 +56,7 @@
if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL))
{ {
debug("Error: CopyFolder->GetDir"); debugln("Error: CopyFolder->GetDir");
debug_error(from2, error); debug_error(from2, error);
free(dirbuf); free(dirbuf);
return error; return error;
@ -64,7 +64,7 @@
if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) if (chrnum(in2, '/')>2) && (error = CreateDir(in2))
{ {
debug("Error: CopyFolder->CreateDir"); debugln("Error: CopyFolder->CreateDir");
debug_error(in2, error); debug_error(in2, error);
free(dirbuf); free(dirbuf);
return error; return error;
@ -90,7 +90,7 @@
copyf_Draw_Progress(filename); copyf_Draw_Progress(filename);
if (error=CopyFile(#copy_from2, #copy_in2)) if (error=CopyFile(#copy_from2, #copy_in2))
{ {
if (fabs(error)==8) { debug("Stop copying."); break;} //TODO: may be need grobal var like stop_all if (fabs(error)==8) { debugln("Stop copying."); break;} //TODO: may be need grobal var like stop_all
error=CopyFile(#copy_from2, #copy_in2); // #2 :) error=CopyFile(#copy_from2, #copy_in2); // #2 :)
} }
} }
@ -157,6 +157,6 @@
:void debug_error(dword path, error_number) :void debug_error(dword path, error_number)
{ {
if (path) debug(path); if (path) debugln(path);
debug(get_error(error_number)); debugln(get_error(error_number));
} }

View File

@ -338,7 +338,7 @@ inline fastcall int PlaySpeaker( ESI)
$int 0x40 $int 0x40
} }
inline fastcall void debug( EDX) inline fastcall void debugln( EDX)
{ {
$push eax $push eax
$push ebx $push ebx

View File

@ -418,7 +418,7 @@ void debugi(dword d_int)
{ {
char tmpch[12]; char tmpch[12];
itoa_(#tmpch, d_int); itoa_(#tmpch, d_int);
debug(#tmpch); debugln(#tmpch);
} }

View File

@ -33,7 +33,7 @@ void MailBoxNetworkProcess() {
SetMailBoxStatus(NULL, "Counting mail, awaiting answer..."); SetMailBoxStatus(NULL, "Counting mail, awaiting answer...");
request_len = GetRequest("STAT", NULL); request_len = GetRequest("STAT", NULL);
Send(socketnum, #request, request_len, 0); Send(socketnum, #request, request_len, 0);
if (EAX == 0xffffffff) { debug("Error sending STAT. Retry..."w); break;} if (EAX == 0xffffffff) { debugln("Error sending STAT. Retry..."w); break;}
aim = GET_ANSWER_NSTAT; aim = GET_ANSWER_NSTAT;
break; break;
@ -43,7 +43,7 @@ void MailBoxNetworkProcess() {
if (immbuffer[ticks-2]=='\n') if (immbuffer[ticks-2]=='\n')
{ {
debug(#immbuffer); debugln(#immbuffer);
if (strstr(#immbuffer,"+OK")) if (strstr(#immbuffer,"+OK"))
{ {
strcpyb(#immbuffer, #param, "+OK ", " "); strcpyb(#immbuffer, #param, "+OK ", " ");
@ -52,7 +52,7 @@ void MailBoxNetworkProcess() {
listbuffer = mem_Alloc(30*mail_list.count); //24* original listbuffer = mem_Alloc(30*mail_list.count); //24* original
listpointer = listbuffer; listpointer = listbuffer;
aim = SEND_NLIST; aim = SEND_NLIST;
debug("Receiving mail list..."); debugln("Receiving mail list...");
} }
else else
{ {
@ -65,7 +65,7 @@ void MailBoxNetworkProcess() {
WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer..."); WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer...");
request_len = GetRequest("LIST", NULL); request_len = GetRequest("LIST", NULL);
Send(socketnum, #request, request_len, 0); Send(socketnum, #request, request_len, 0);
if (EAX == 0xffffffff) {debug("Error while sending LIST. Retry..."); break;} if (EAX == 0xffffffff) {debugln("Error while sending LIST. Retry..."); break;}
else aim = GET_ANSWER_NLIST; else aim = GET_ANSWER_NLIST;
break; break;
@ -78,7 +78,7 @@ void MailBoxNetworkProcess() {
if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
{ {
aim = SEND_RETR; aim = SEND_RETR;
debug("goto SEND_RETR"); debugln("goto SEND_RETR");
DrawMailBox(); DrawMailBox();
*listpointer='\0'; *listpointer='\0';
@ -102,13 +102,13 @@ void MailBoxNetworkProcess() {
mailstart = malloc(mailsize); mailstart = malloc(mailsize);
if (!mailstart) if (!mailstart)
{ {
debug("alloc error!"); debugln("alloc error!");
aim=NULL; aim=NULL;
break; break;
} }
mailend = mailstart; mailend = mailstart;
aim = GET_ANSWER_RETR; aim = GET_ANSWER_RETR;
debug("goto GET_ANSWER_RETR"); debugln("goto GET_ANSWER_RETR");
break; break;
case GET_ANSWER_RETR: case GET_ANSWER_RETR:
@ -117,7 +117,7 @@ void MailBoxNetworkProcess() {
mailend += ticks; mailend += ticks;
if (mailsize + mailstart - mailend - 2 < 0) if (mailsize + mailstart - mailend - 2 < 0)
{ {
debug("Resizing buffer"); debugln("Resizing buffer");
mailsize += 4096; mailsize += 4096;
mailstart = realloc(mailstart, mailsize); mailstart = realloc(mailstart, mailsize);
if (!mailstart) { StopConnect("Realloc error!"); break;} if (!mailstart) { StopConnect("Realloc error!"); break;}
@ -357,7 +357,8 @@ void InitTWB() {
void DrawLetter() { void DrawLetter() {
pre_text = 2; pre_text = 2;
bufsize = strlen(mdata); bufsize = strlen(mdata);
if (bufsize) WB1.ParseHTML(mdata); WB1.Prepare(bufsize, mdata);
if (bufsize) WB1.Parse();
} }

View File

@ -44,13 +44,13 @@ char Console_Work()
{ {
case '?': //ďîěîůü ďî ęîěěŕíäŕě case '?': //ďîěîůü ďî ęîěěŕíäŕě
case 'h': case 'h':
debug("tmpdisk command line parameters:"); debugln("tmpdisk command line parameters:");
debug("a[number]s[size in MB] - add RAM disk"); debugln("a[number]s[size in MB] - add RAM disk");
debug("d[number] - delete RAM disk"); debugln("d[number] - delete RAM disk");
ExitProcess(); ExitProcess();
break; break;
case 'd': //óäŕëčňü äčńę case 'd': //óäŕëčňü äčńę
debug(DELETE_DISK_TEXT); debugln(DELETE_DISK_TEXT);
del_disk.DiskId = param[1]-'0'; del_disk.DiskId = param[1]-'0';
ioctl.handle = driver_handle; ioctl.handle = driver_handle;
ioctl.io_code = DEV_DEL_DISK; ioctl.io_code = DEV_DEL_DISK;
@ -60,19 +60,19 @@ char Console_Work()
ioctl.out_size = 0; ioctl.out_size = 0;
break; break;
case 'a': //äîáŕâčňü äčńę case 'a': //äîáŕâčňü äčńę
debug(ADD_DISK_TEXT); debugln(ADD_DISK_TEXT);
disk_size= strchr(#param, 's'); disk_size= strchr(#param, 's');
if (!disk_size) if (!disk_size)
{ {
add_disk.DiskSize = GetFreeRAM() / 5; add_disk.DiskSize = GetFreeRAM() / 5;
debug(DONT_KNOW_DISK_SIZE_TEXT); debugln(DONT_KNOW_DISK_SIZE_TEXT);
} }
else else
add_disk.DiskSize = atoi(#param+disk_size)*2048; add_disk.DiskSize = atoi(#param+disk_size)*2048;
strcpy(#size_t, NEW_DISK_TEXT); strcpy(#size_t, NEW_DISK_TEXT);
strcat(#size_t, itoa(add_disk.DiskSize/2048)); strcat(#size_t, itoa(add_disk.DiskSize/2048));
strcat(#size_t, " MB"); strcat(#size_t, " MB");
debug(#size_t); debugln(#size_t);
add_disk.DiskId = param[1]-'0'; add_disk.DiskId = param[1]-'0';
ioctl.handle = driver_handle; ioctl.handle = driver_handle;
ioctl.io_code = DEV_ADD_DISK; ioctl.io_code = DEV_ADD_DISK;
@ -82,13 +82,13 @@ char Console_Work()
ioctl.out_size = 0; ioctl.out_size = 0;
break; break;
default: default:
debug("unknown command line parameters"); debugln("unknown command line parameters");
debug("use 'h' or '?' for help"); debugln("use 'h' or '?' for help");
ExitProcess(); ExitProcess();
} }
driver_rezult = RuleDriver(#ioctl); driver_rezult = RuleDriver(#ioctl);
if (driver_rezult<7) debug(rezult_text[driver_rezult]); if (driver_rezult<7) debugln(rezult_text[driver_rezult]);
return driver_rezult; return driver_rezult;
} }