Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9361 → Rev 9362

/programs/cmm/lib/obj/box_lib.h
136,6 → 136,28
ESI.edit_box.size = strlen(ed_text);
}
 
:dword EditBox_CreateStandart(dword width, left, top, maxlen, text, flags)
{
dword eb, i;
eb = malloc(sizeof(edit_box));
for (i = 0; i < sizeof(edit_box); i++) ESBYTE[eb + i] = 0;
ESDWORD[eb] = width;
ESDWORD[eb + 4] = left;
ESDWORD[eb + 8] = top;
ESDWORD[eb + 12] = 0xffffff;
ESDWORD[eb + 16] = 0x94AECE;
ESDWORD[eb + 20] = 0xffffff;
ESDWORD[eb + 24] = 0xffffff;
ESDWORD[eb + 28] = 0x10000000;
ESDWORD[eb + 32] = maxlen;
ESDWORD[eb + 36] = text;
ESDWORD[eb + 40] = 0;
ESDWORD[eb + 44] = flags;
ESDWORD[eb + 48] = 0;
ESDWORD[eb + 52] = 0;
return eb;
}
 
struct scroll_bar
{
word size_x,
/programs/cmm/template/t.c
1,27 → 1,82
#define MEMSIZE 4096*40
#define MEMSIZE 1024*100
 
#include "../lib/kolibri.h"
#include "../lib/collection.h"
#include "../lib/gui.h"
#include "../lib/fs.h"
 
#include "../lib/obj/http.h"
#include "../lib/obj/console.h"
 
collection links;
#include "urls.h"
 
_http http;
char accept_language[]= "Accept-Language: en\n";
 
int url_id=0;
 
void main()
{
proc_info Form;
char savepath[100];
load_dll(libHTTP, #http_lib_init,1);
load_dll(libConsole, #con_init, 0);
 
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE);
loop() switch(WaitEvent())
con_init stdcall (70, 40, 70, 1020, "Web stability test");
urls_add();
con_write_asciiz stdcall ("Redirect is not handled yet.\n");
con_write_asciiz stdcall ("All pages are saved into /tmp0/1\n\n");
con_write_asciiz stdcall ("Downloading pages...\n\n");
pause(100);
get_next_url();
 
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
loop() switch(@WaitEventTimeout(200))
{
case evMouse:
mouse.get();
break;
case evNetwork:
if (!http.receive_result) {
sprintf(#savepath, "/tmp0/1/%s.htm", links.get(url_id)+7);
CreateFile(http.content_received, http.content_pointer, #savepath);
free(http.content_pointer);
http_free stdcall (http.transfer);
http.transfer=0;
con_write_asciiz stdcall ("\n");
get_next_url();
}
if (http.transfer) {
http.receive();
} else {
con_write_asciiz stdcall (" => FAILED\n");
get_next_url();
}
}
}
 
case evKey:
@GetKeyScancode();
if (AL == SCAN_CODE_ESC) @ExitProcess();
break;
void get_next_url()
{
char get_url[2500];
dword url;
 
case evReDraw:
sc.get();
DefineAndDrawWindow(100, 100, 300, 250, 0x34, sc.work, "Template app", 0);
GetProcessInfo(#Form, SelfInfo);
url_id++;
url = links.get(url_id);
 
if (!url) {
con_write_asciiz stdcall ("Download complete.");
con_exit stdcall (0);
ExitProcess();
} else {
con_write_asciiz stdcall (itoa(url_id));
con_write_asciiz stdcall (". ");
con_write_asciiz stdcall (links.get(url_id));
 
if (!strncmp(url,"https:",6)) {
sprintf(#get_url, "http://gate.aspero.pro/?site=%s", url);
} else if (!strncmp(url,"http:",5)) {
sprintf(#get_url, "%s", url);
} else {
get_next_url();
}
 
http.get(#get_url);
}
}