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

View File

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

View File

@ -12,7 +12,7 @@
}
if (error = GetFileInfo(from1, #CopyFile_atr1))
{
debug("Error: copyf->GetFileInfo");
debugln("Error: copyf->GetFileInfo");
return error;
}
if (isdir(from1))
@ -30,18 +30,18 @@
dword error, cbuf;
if (error = GetFileInfo(copy_from3, #CopyFile_atr))
{
debug("Error: CopyFile->GetFileInfo");
debugln("Error: CopyFile->GetFileInfo");
}
else
{
cbuf = malloc(CopyFile_atr.sizelo);
if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3))
{
debug("Error: CopyFile->ReadFile");
debugln("Error: CopyFile->ReadFile");
}
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);
@ -56,7 +56,7 @@
if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL))
{
debug("Error: CopyFolder->GetDir");
debugln("Error: CopyFolder->GetDir");
debug_error(from2, error);
free(dirbuf);
return error;
@ -64,7 +64,7 @@
if (chrnum(in2, '/')>2) && (error = CreateDir(in2))
{
debug("Error: CopyFolder->CreateDir");
debugln("Error: CopyFolder->CreateDir");
debug_error(in2, error);
free(dirbuf);
return error;
@ -90,7 +90,7 @@
copyf_Draw_Progress(filename);
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 :)
}
}
@ -157,6 +157,6 @@
:void debug_error(dword path, error_number)
{
if (path) debug(path);
debug(get_error(error_number));
if (path) debugln(path);
debugln(get_error(error_number));
}

View File

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

View File

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

View File

@ -33,7 +33,7 @@ void MailBoxNetworkProcess() {
SetMailBoxStatus(NULL, "Counting mail, awaiting answer...");
request_len = GetRequest("STAT", NULL);
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;
break;
@ -43,7 +43,7 @@ void MailBoxNetworkProcess() {
if (immbuffer[ticks-2]=='\n')
{
debug(#immbuffer);
debugln(#immbuffer);
if (strstr(#immbuffer,"+OK"))
{
strcpyb(#immbuffer, #param, "+OK ", " ");
@ -52,7 +52,7 @@ void MailBoxNetworkProcess() {
listbuffer = mem_Alloc(30*mail_list.count); //24* original
listpointer = listbuffer;
aim = SEND_NLIST;
debug("Receiving mail list...");
debugln("Receiving mail list...");
}
else
{
@ -65,7 +65,7 @@ void MailBoxNetworkProcess() {
WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer...");
request_len = GetRequest("LIST", NULL);
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;
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
{
aim = SEND_RETR;
debug("goto SEND_RETR");
debugln("goto SEND_RETR");
DrawMailBox();
*listpointer='\0';
@ -102,13 +102,13 @@ void MailBoxNetworkProcess() {
mailstart = malloc(mailsize);
if (!mailstart)
{
debug("alloc error!");
debugln("alloc error!");
aim=NULL;
break;
}
mailend = mailstart;
aim = GET_ANSWER_RETR;
debug("goto GET_ANSWER_RETR");
debugln("goto GET_ANSWER_RETR");
break;
case GET_ANSWER_RETR:
@ -117,7 +117,7 @@ void MailBoxNetworkProcess() {
mailend += ticks;
if (mailsize + mailstart - mailend - 2 < 0)
{
debug("Resizing buffer");
debugln("Resizing buffer");
mailsize += 4096;
mailstart = realloc(mailstart, mailsize);
if (!mailstart) { StopConnect("Realloc error!"); break;}
@ -357,7 +357,8 @@ void InitTWB() {
void DrawLetter() {
pre_text = 2;
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 'h':
debug("tmpdisk command line parameters:");
debug("a[number]s[size in MB] - add RAM disk");
debug("d[number] - delete RAM disk");
debugln("tmpdisk command line parameters:");
debugln("a[number]s[size in MB] - add RAM disk");
debugln("d[number] - delete RAM disk");
ExitProcess();
break;
case 'd': //óäŕëčňü äčńę
debug(DELETE_DISK_TEXT);
debugln(DELETE_DISK_TEXT);
del_disk.DiskId = param[1]-'0';
ioctl.handle = driver_handle;
ioctl.io_code = DEV_DEL_DISK;
@ -60,19 +60,19 @@ char Console_Work()
ioctl.out_size = 0;
break;
case 'a': //äîáŕâčňü äčńę
debug(ADD_DISK_TEXT);
debugln(ADD_DISK_TEXT);
disk_size= strchr(#param, 's');
if (!disk_size)
{
add_disk.DiskSize = GetFreeRAM() / 5;
debug(DONT_KNOW_DISK_SIZE_TEXT);
debugln(DONT_KNOW_DISK_SIZE_TEXT);
}
else
add_disk.DiskSize = atoi(#param+disk_size)*2048;
strcpy(#size_t, NEW_DISK_TEXT);
strcat(#size_t, itoa(add_disk.DiskSize/2048));
strcat(#size_t, " MB");
debug(#size_t);
debugln(#size_t);
add_disk.DiskId = param[1]-'0';
ioctl.handle = driver_handle;
ioctl.io_code = DEV_ADD_DISK;
@ -82,13 +82,13 @@ char Console_Work()
ioctl.out_size = 0;
break;
default:
debug("unknown command line parameters");
debug("use 'h' or '?' for help");
debugln("unknown command line parameters");
debugln("use 'h' or '?' for help");
ExitProcess();
}
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;
}