forked from KolibriOS/kolibrios
Updated Kolibri front-end, fixed deplibs, updated objects, updated fetchers, fix in libdom port binding for hubbub. Still need to add multi-threading for downloads, as well as cookies, POST requests and other fetcher stuff. And may be tweak input a bit.
git-svn-id: svn://kolibrios.org@4224 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
da4769d444
commit
4a605f1fb2
BIN
programs/network/netsurf/dependencies/lib/libcss.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libcss.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libcurl.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libcurl.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libdom.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libdom.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libhubbub.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libhubbub.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libnsbmp.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libnsbmp.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libnsfb.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libnsfb.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libnsgif.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libnsgif.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libparserutils.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libparserutils.a
Normal file
Binary file not shown.
BIN
programs/network/netsurf/dependencies/lib/libwapcaplet.a
Normal file
BIN
programs/network/netsurf/dependencies/lib/libwapcaplet.a
Normal file
Binary file not shown.
@ -4,5 +4,5 @@ OBJS := parser.o
|
|||||||
|
|
||||||
OUTFILE = libo.o
|
OUTFILE = libo.o
|
||||||
|
|
||||||
CFLAGS += -I ../../include/ -I ../../include/dom/ -I ../../ -I ../ -I ./ -I /home/sourcerer/kos_src/newenginek/kolibri/include
|
CFLAGS += -I ./ -I ../../include/ -I ../../src/ -I ../../../libhubbub/include/ -I ../../../libwapcaplet/include/
|
||||||
include $(MENUETDEV)/makefiles/Makefile_for_o_lib
|
include $(MENUETDEV)/makefiles/Makefile_for_o_lib
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
|
|
||||||
#include <dom/dom.h>
|
#include <dom/dom.h>
|
||||||
|
|
||||||
#include "errors.h"
|
|
||||||
|
//#include "errors.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include "core/document.h"
|
#include "core/document.h"
|
||||||
|
|
||||||
|
|
||||||
#include "core/string.h"
|
#include "core/string.h"
|
||||||
#include "core/node.h"
|
#include "core/node.h"
|
||||||
|
|
||||||
@ -472,15 +475,15 @@ static hubbub_error has_children(void *parser, void *node, bool *result)
|
|||||||
|
|
||||||
static hubbub_error form_associate(void *parser, void *form, void *node)
|
static hubbub_error form_associate(void *parser, void *form, void *node)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser;
|
dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser;
|
||||||
dom_html_form_element *form_ele = form;
|
dom_html_form_element *form_ele = form;
|
||||||
dom_node_internal *ele = node;
|
dom_node_internal *ele = node;
|
||||||
dom_html_document *doc = (dom_html_document *)ele->owner;
|
dom_html_document *doc = (dom_html_document *)ele->owner;
|
||||||
dom_exception err = DOM_NO_ERR;*/
|
dom_exception err = DOM_NO_ERR;
|
||||||
|
|
||||||
/* Determine the kind of the node we have here. */
|
/* Determine the kind of the node we have here. */
|
||||||
/*if (dom_string_caseless_isequal(ele->name,
|
if (dom_string_caseless_isequal(ele->name,
|
||||||
doc->memoised[hds_BUTTON])) {
|
doc->memoised[hds_BUTTON])) {
|
||||||
err = _dom_html_button_element_set_form(
|
err = _dom_html_button_element_set_form(
|
||||||
(dom_html_button_element *)node, form_ele);
|
(dom_html_button_element *)node, form_ele);
|
||||||
@ -516,7 +519,7 @@ static hubbub_error form_associate(void *parser, void *form, void *node)
|
|||||||
"Error in form_associate");
|
"Error in form_associate");
|
||||||
return HUBBUB_UNKNOWN;
|
return HUBBUB_UNKNOWN;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return HUBBUB_OK;
|
return HUBBUB_OK;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Sources
|
# Sources
|
||||||
OBJS := surface.o able.o ram.o linux.o sdl.o
|
OBJS := surface.o able.o ram.o linux.o sdl.o kolibri.o
|
||||||
|
|
||||||
|
|
||||||
OUTFILE = sup.o
|
OUTFILE = sup.o
|
||||||
|
|
||||||
|
@ -40,6 +40,29 @@ asm("popa");
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned kol_mouse_posw()
|
||||||
|
{
|
||||||
|
unsigned error;
|
||||||
|
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(1));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned kol_mouse_btn()
|
||||||
|
{
|
||||||
|
unsigned error;
|
||||||
|
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(2));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned kol_scancodes()
|
||||||
|
{
|
||||||
|
unsigned error;
|
||||||
|
asm volatile ("int $0x40":"=a"(error):"a"(66), "b"(1), "c"(1));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void kolibri_redraw(nsfb_t *nsfb){
|
void kolibri_redraw(nsfb_t *nsfb){
|
||||||
|
|
||||||
|
|
||||||
@ -47,16 +70,35 @@ void kolibri_redraw(nsfb_t *nsfb){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned kol_skin_h()
|
||||||
|
{
|
||||||
|
unsigned error;
|
||||||
|
asm volatile ("int $0x40":"=a"(error):"a"(48), "b"(4));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned kol_area(char *data)
|
||||||
|
{
|
||||||
|
unsigned error;
|
||||||
|
asm volatile ("int $0x40":"=a"(error):"a"(9), "b"(data), "c"(0xffffffff));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void kolibri_window_redraw(nsfb_t *nsfb){
|
void kolibri_window_redraw(nsfb_t *nsfb){
|
||||||
|
|
||||||
__menuet__window_redraw(1);
|
__menuet__window_redraw(1);
|
||||||
__menuet__define_window(100,100,nsfb->width,nsfb->height,0x43000080,0x800000FF,0x000080);
|
__menuet__define_window(100,100,nsfb->width+9,nsfb->height+kol_skin_h(),0x34000080,0x800000FF,"Netsurf");
|
||||||
__menuet__write_text(3,3,0xFFFFFF,"Netsurf",7);
|
//__menuet__write_text(3,3,0xFFFFFF,"Netsurf",7);
|
||||||
__menuet__debug_out("f65 is mighty!\n");
|
//__menuet__debug_out("f65 is mighty!\n");
|
||||||
|
|
||||||
//here put image pixels! it's 32bpp
|
//here put image pixels! it's 32bpp
|
||||||
f65(0,0, nsfb->width, nsfb->height, pixels);
|
f65(0,0, nsfb->width, nsfb->height, pixels);
|
||||||
__menuet__window_redraw(2);
|
__menuet__window_redraw(2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +126,9 @@ kolibricopy(nsfb_t *nsfb, nsfb_bbox_t *srcbox, nsfb_bbox_t *dstbox)
|
|||||||
tw = dstbox->x1 - dstbox->x0;
|
tw = dstbox->x1 - dstbox->x0;
|
||||||
th = dstbox->y1 - dstbox->y0;
|
th = dstbox->y1 - dstbox->y0;
|
||||||
|
|
||||||
char pst[255];
|
// char pst[255];
|
||||||
sprintf (pst, "Src %d,%d %dx%d Dst %d,%d %dx%d \n", x,y,w,h,tx,ty,tw,th);
|
// sprintf (pst, "Src %d,%d %dx%d Dst %d,%d %dx%d \n", x,y,w,h,tx,ty,tw,th);
|
||||||
__menuet__debug_out(pst);
|
// __menuet__debug_out(pst);
|
||||||
|
|
||||||
int px, py, pp;
|
int px, py, pp;
|
||||||
|
|
||||||
@ -135,6 +177,8 @@ static int kolibri_initialise(nsfb_t *nsfb)
|
|||||||
{
|
{
|
||||||
enum nsfb_format_e fmt;
|
enum nsfb_format_e fmt;
|
||||||
|
|
||||||
|
kol_scancodes();
|
||||||
|
|
||||||
pz=0;
|
pz=0;
|
||||||
pb=0;
|
pb=0;
|
||||||
|
|
||||||
@ -187,30 +231,110 @@ static int kolibri_finalise(nsfb_t *nsfb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned kol_mouse_posw()
|
|
||||||
{
|
int isup(int scan){
|
||||||
unsigned error;
|
return (scan&0x80)>>7;
|
||||||
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(1));
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int scan2key(int scan){
|
||||||
|
int keycode=(scan&0x0FF7F);
|
||||||
|
/* MAIN KB - NUMS */
|
||||||
|
if (keycode == 0x02) return NSFB_KEY_1;
|
||||||
|
if (keycode == 0x03) return NSFB_KEY_2;
|
||||||
|
if (keycode == 0x04) return NSFB_KEY_3;
|
||||||
|
if (keycode == 0x05) return NSFB_KEY_4;
|
||||||
|
if (keycode == 0x06) return NSFB_KEY_5;
|
||||||
|
if (keycode == 0x07) return NSFB_KEY_6;
|
||||||
|
if (keycode == 0x08) return NSFB_KEY_7;
|
||||||
|
if (keycode == 0x09) return NSFB_KEY_8;
|
||||||
|
if (keycode == 0x0A) return NSFB_KEY_9;
|
||||||
|
if (keycode == 0x0B) return NSFB_KEY_0;
|
||||||
|
|
||||||
|
if (keycode == 0x10) return NSFB_KEY_q;
|
||||||
|
if (keycode == 0x11) return NSFB_KEY_w;
|
||||||
|
if (keycode == 0x12) return NSFB_KEY_e;
|
||||||
|
if (keycode == 0x13) return NSFB_KEY_r;
|
||||||
|
if (keycode == 0x14) return NSFB_KEY_t;
|
||||||
|
if (keycode == 0x15) return NSFB_KEY_y;
|
||||||
|
if (keycode == 0x16) return NSFB_KEY_u;
|
||||||
|
if (keycode == 0x17) return NSFB_KEY_i;
|
||||||
|
if (keycode == 0x18) return NSFB_KEY_o;
|
||||||
|
if (keycode == 0x19) return NSFB_KEY_p;
|
||||||
|
if (keycode == 0x1A) return NSFB_KEY_LEFTBRACKET;
|
||||||
|
if (keycode == 0x1B) return NSFB_KEY_RIGHTBRACKET;
|
||||||
|
|
||||||
|
if (keycode == 0x1E) return NSFB_KEY_a;
|
||||||
|
if (keycode == 0x1F) return NSFB_KEY_s;
|
||||||
|
if (keycode == 0x20) return NSFB_KEY_d;
|
||||||
|
if (keycode == 0x21) return NSFB_KEY_f;
|
||||||
|
if (keycode == 0x22) return NSFB_KEY_g;
|
||||||
|
if (keycode == 0x23) return NSFB_KEY_h;
|
||||||
|
if (keycode == 0x24) return NSFB_KEY_j;
|
||||||
|
if (keycode == 0x25) return NSFB_KEY_k;
|
||||||
|
if (keycode == 0x26) return NSFB_KEY_l;
|
||||||
|
|
||||||
|
if (keycode == 0x2C) return NSFB_KEY_z;
|
||||||
|
if (keycode == 0x2D) return NSFB_KEY_x;
|
||||||
|
if (keycode == 0x2E) return NSFB_KEY_c;
|
||||||
|
if (keycode == 0x2F) return NSFB_KEY_v;
|
||||||
|
if (keycode == 0x30) return NSFB_KEY_b;
|
||||||
|
if (keycode == 0x31) return NSFB_KEY_n;
|
||||||
|
if (keycode == 0x32) return NSFB_KEY_m;
|
||||||
|
|
||||||
|
if (keycode == 0x27) return NSFB_KEY_SEMICOLON;
|
||||||
|
if (keycode == 0x28) return NSFB_KEY_QUOTEDBL;
|
||||||
|
if (keycode == 0x2B) return NSFB_KEY_BACKSLASH;
|
||||||
|
if (keycode == 0x33) return NSFB_KEY_COMMA;
|
||||||
|
if (keycode == 0x34) return NSFB_KEY_PERIOD;
|
||||||
|
if (keycode == 0x35) return NSFB_KEY_SLASH;
|
||||||
|
if (keycode == 0x0C) return NSFB_KEY_MINUS;
|
||||||
|
if (keycode == 0x0D) return NSFB_KEY_EQUALS;
|
||||||
|
|
||||||
|
if (keycode == 0x0E) return NSFB_KEY_BACKSPACE;
|
||||||
|
if (keycode == 0xE053) return NSFB_KEY_DELETE;
|
||||||
|
if (keycode == 0x2A) return NSFB_KEY_LSHIFT;
|
||||||
|
if (keycode == 0x36) return NSFB_KEY_RSHIFT;
|
||||||
|
|
||||||
|
if (keycode == 0x1C) return NSFB_KEY_RETURN;
|
||||||
|
|
||||||
|
if (keycode == 0xE04B) return NSFB_KEY_LEFT;
|
||||||
|
if (keycode == 0xE04D) return NSFB_KEY_RIGHT;
|
||||||
|
if (keycode == 0xE048) return NSFB_KEY_UP;
|
||||||
|
if (keycode == 0xE050) return NSFB_KEY_DOWN;
|
||||||
|
|
||||||
|
if (keycode == 0x3F) return NSFB_KEY_F5;
|
||||||
|
|
||||||
|
if (keycode == 0x39) return NSFB_KEY_SPACE;
|
||||||
|
if (keycode == 0x01) return NSFB_KEY_ESCAPE;
|
||||||
|
|
||||||
|
if (keycode == 0x38) return NSFB_KEY_LALT;
|
||||||
|
if (keycode == 0x1D) return NSFB_KEY_LCTRL;
|
||||||
|
if (keycode == 0xE038) return NSFB_KEY_RALT;
|
||||||
|
if (keycode == 0xE01D) return NSFB_KEY_RCTRL;
|
||||||
|
|
||||||
|
|
||||||
|
if (keycode == 0xE047) return NSFB_KEY_HOME;
|
||||||
|
if (keycode == 0xE04F) return NSFB_KEY_END;
|
||||||
|
if (keycode == 0xE049) return NSFB_KEY_PAGEUP;
|
||||||
|
if (keycode == 0xE051) return NSFB_KEY_PAGEDOWN;
|
||||||
|
|
||||||
|
return NSFB_KEY_UNKNOWN;
|
||||||
|
|
||||||
unsigned kol_mouse_btn()
|
|
||||||
{
|
|
||||||
unsigned error;
|
|
||||||
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(2));
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ispowerkey(int scan){
|
||||||
|
return (scan&0xE000)>>15;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool kolibri_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
|
static bool kolibri_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
|
||||||
{
|
{
|
||||||
int got_event;
|
int got_event;
|
||||||
|
static int scanfull=0;
|
||||||
|
|
||||||
nsfb = nsfb; /* unused */
|
nsfb = nsfb; /* unused */
|
||||||
|
|
||||||
|
|
||||||
got_event = __menuet__check_for_event();
|
got_event = __menuet__check_for_event();
|
||||||
|
|
||||||
if (got_event == 0) {
|
if (got_event == 0) {
|
||||||
@ -225,9 +349,39 @@ static bool kolibri_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (got_event==2) { //key pressed
|
if (got_event==2) { //key pressed
|
||||||
event->type = NSFB_EVENT_KEY_UP;
|
int scanz = __menuet__getkey();
|
||||||
event->value.keycode = __menuet__getkey();
|
|
||||||
|
//char dbs[64];
|
||||||
|
|
||||||
|
//__menuet__debug_out("KEY PRESSED\n");
|
||||||
|
|
||||||
|
// sprintf (dbs, "FULLKEY BEFORE: F:%x\n", scanfull);
|
||||||
|
//__menuet__debug_out(dbs);
|
||||||
|
|
||||||
|
if (scanz==0xE0) {
|
||||||
|
scanfull=0xE000;
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
scanfull=scanfull+scanz;
|
||||||
|
}
|
||||||
|
|
||||||
|
//sprintf (dbs, "FULLKEY AFTER: F:%x\n", scanfull);
|
||||||
|
//__menuet__debug_out(dbs);
|
||||||
|
|
||||||
|
|
||||||
|
if (isup(scanfull)==1) {
|
||||||
|
event->type = NSFB_EVENT_KEY_UP;} else {
|
||||||
|
event->type = NSFB_EVENT_KEY_DOWN;}
|
||||||
|
|
||||||
|
event->value.keycode = scan2key(scanfull);
|
||||||
|
|
||||||
|
//sprintf (dbs, "KEY: %x F:%x %d %d\n", scanz, scanfull, isup(scanz), scan2key(scanz));
|
||||||
|
//__menuet__debug_out(dbs);
|
||||||
|
|
||||||
|
scanfull=0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (got_event==3) { //key pressed
|
if (got_event==3) { //key pressed
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
* ::max_cached_fetch_handles in this ring.
|
* ::max_cached_fetch_handles in this ring.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "http.c"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
@ -155,7 +158,6 @@ lwc_intern_string("http", SLEN("http"), &scheme);
|
|||||||
|
|
||||||
bool fetch_curl_initialise(lwc_string *scheme)
|
bool fetch_curl_initialise(lwc_string *scheme)
|
||||||
{
|
{
|
||||||
|
|
||||||
LOG(("curl initi lwc\n"));
|
LOG(("curl initi lwc\n"));
|
||||||
return true; /* Always succeeds */
|
return true; /* Always succeeds */
|
||||||
}
|
}
|
||||||
@ -363,69 +365,75 @@ asm volatile ("int $0x40":"=a"(error):"a"(18), "b"(18), "c"(k));
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fetch_curl_process(struct fetch_curl_context *ctx) {
|
static void fetch_curl_process(struct fetch_curl_context *ctx) {
|
||||||
|
char ps[96], str[128];
|
||||||
int pid=execl ("/sys/network/downloader", ctx->path, 0);
|
sprintf(ps, "Yay! Path is %s", ctx->path);
|
||||||
|
execl ("/sys/@notify", ps, 0);
|
||||||
|
|
||||||
|
|
||||||
// while (is_pid(pid)) {
|
|
||||||
kill_pid(pid);
|
|
||||||
// }
|
|
||||||
|
|
||||||
pid=execl ("/sys/network/downloader", ctx->path, 0);
|
|
||||||
|
|
||||||
char ps[255];
|
|
||||||
sprintf(ps, "pid %d", pid);
|
|
||||||
execl ("/sys/network/@notify", ps, 0);
|
|
||||||
|
|
||||||
|
|
||||||
while (is_pid(pid));
|
|
||||||
|
|
||||||
|
|
||||||
sprintf(ps, "Yay! Finished");
|
|
||||||
execl ("/sys/network/@notify", ps, 0);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
char pzz[255];
|
|
||||||
sprintf(pzz, "Pid is %d", pid);
|
|
||||||
execl ("/sys/@notify", pzz, 0); */
|
|
||||||
//int status;
|
|
||||||
//waitpid(pid, &status, 0);
|
|
||||||
|
|
||||||
|
|
||||||
fetch_msg msg;
|
fetch_msg msg;
|
||||||
//const char * buf = "<html><body><h1>Hello, file fetcher!</h1></body></html>";
|
|
||||||
|
|
||||||
FILE *infile;
|
/* ERSATZ DOWNLOADER */
|
||||||
infile = fopen("/sys/.download", "rb");
|
|
||||||
|
|
||||||
if (infile == NULL) {
|
/*
|
||||||
printf("file does not exist.\n");
|
char zapzap[]="<html><body><h1>HOOLE!</h1></body></html>";
|
||||||
return -1;
|
size_t file_size=strlen(zapzap);
|
||||||
|
char *buffer = (char*)malloc(file_size * sizeof(char));
|
||||||
|
memcpy(buffer, zapzap, file_size * sizeof(char));
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
__menuet__debug_out("AHOY!\n");
|
||||||
|
struct http_msg *http_ahoy;
|
||||||
|
|
||||||
|
unsigned int wererat = 0;
|
||||||
|
char * pa=ctx->path;
|
||||||
|
asm volatile ("pusha");
|
||||||
|
wererat = http_get(pa);
|
||||||
|
asm volatile ("popa");
|
||||||
|
__menuet__debug_out("HTTP GOT!\n");
|
||||||
|
int result;
|
||||||
|
|
||||||
|
http_ahoy=wererat;
|
||||||
|
|
||||||
|
sprintf (str, "Header %d bytes, content %d bytes, recieved %d bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
|
||||||
|
__menuet__debug_out(str);
|
||||||
|
|
||||||
|
asm volatile ("pusha");
|
||||||
|
result = http_process(wererat);
|
||||||
|
asm volatile ("popa");
|
||||||
|
while (result == -1) {
|
||||||
|
asm volatile ("pusha");
|
||||||
|
result = http_process(wererat);
|
||||||
|
asm volatile ("popa");
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(infile, 0, SEEK_END);
|
http_ahoy=wererat;
|
||||||
size_t file_size = ftell(infile);
|
|
||||||
rewind(infile);
|
|
||||||
|
|
||||||
|
sprintf (str, "Header %d bytes, content %d bytes, recieved %d bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
|
||||||
|
__menuet__debug_out(str);
|
||||||
|
|
||||||
|
|
||||||
|
__menuet__debug_out("All content is here\n");
|
||||||
|
|
||||||
|
size_t file_size=http_ahoy->content_received;
|
||||||
char *buffer = (char*)malloc(file_size * sizeof(char));
|
char *buffer = (char*)malloc(file_size * sizeof(char));
|
||||||
if (buffer == NULL) {
|
memcpy(buffer, &(http_ahoy->data)+http_ahoy->header_length, file_size);
|
||||||
fclose(infile);
|
|
||||||
printf("Error allocating %d bytes.\n", file_size * sizeof(char));
|
// http_free(wererat);
|
||||||
return -1;
|
__menuet__debug_out("memcopied\n==\n");
|
||||||
}
|
|
||||||
size_t bytes_read = fread(buffer, sizeof(char), file_size, infile);
|
//__menuet__debug_out(buffer);
|
||||||
if (bytes_read != file_size) {
|
//__menuet__debug_out("memcopied\n==\n");
|
||||||
printf("Have read only %d bytes of %d.\n", bytes_read, file_size);
|
|
||||||
free(buffer);
|
|
||||||
fclose(infile);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fclose(infile);
|
|
||||||
|
|
||||||
|
|
||||||
|
//char zapzap[]="<html><body><h1>HOOLE!</h1></body></html>";
|
||||||
|
//file_size=strlen(zapzap);
|
||||||
|
//char *buffer = (char*)malloc(file_size * sizeof(char));
|
||||||
|
//memcpy(buffer, zapzap, file_size * sizeof(char));
|
||||||
|
|
||||||
|
|
||||||
/* fetch is going to be successful */
|
/* fetch is going to be successful */
|
||||||
@ -436,8 +444,6 @@ static void fetch_curl_process(struct fetch_curl_context *ctx) {
|
|||||||
* fetch_file_send_callback().
|
* fetch_file_send_callback().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__menuet__debug_out(fetch_filetype(ctx->path));
|
|
||||||
__menuet__debug_out("\n");
|
|
||||||
|
|
||||||
if (fetch_curl_send_header(ctx, "Content-Type: %s",
|
if (fetch_curl_send_header(ctx, "Content-Type: %s",
|
||||||
fetch_filetype(ctx->path)))
|
fetch_filetype(ctx->path)))
|
||||||
@ -447,7 +453,7 @@ static void fetch_curl_process(struct fetch_curl_context *ctx) {
|
|||||||
/* main data loop */
|
/* main data loop */
|
||||||
|
|
||||||
msg.type = FETCH_DATA;
|
msg.type = FETCH_DATA;
|
||||||
msg.data.header_or_data.buf = (const uint8_t *) buffer;
|
msg.data.header_or_data.buf = (const uint8_t *) buffer;//&(http_ahoy->data) ; //buffer;
|
||||||
msg.data.header_or_data.len = file_size;
|
msg.data.header_or_data.len = file_size;
|
||||||
fetch_curl_send_callback(&msg, ctx);
|
fetch_curl_send_callback(&msg, ctx);
|
||||||
|
|
||||||
|
86
programs/network/netsurf/netsurf/content/fetchers/http.c
Normal file
86
programs/network/netsurf/netsurf/content/fetchers/http.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include <menuet/os.h>
|
||||||
|
#define NULL 0
|
||||||
|
#define __stdcall __attribute__((stdcall))
|
||||||
|
|
||||||
|
extern int dll_load();
|
||||||
|
extern int mem_Free();
|
||||||
|
extern int mem_Alloc();
|
||||||
|
extern int mem_ReAlloc();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int kol_exit(){
|
||||||
|
__menuet__sys_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct http_msg {
|
||||||
|
unsigned int socket;
|
||||||
|
unsigned int flags;
|
||||||
|
unsigned int write_ptr;
|
||||||
|
unsigned int buffer_length;
|
||||||
|
unsigned int chunk_ptr;
|
||||||
|
unsigned int timestamp;
|
||||||
|
unsigned int status;
|
||||||
|
unsigned int header_length;
|
||||||
|
unsigned int content_length;
|
||||||
|
unsigned int content_received;
|
||||||
|
char data; //unknown size
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int (* __stdcall http_init)();
|
||||||
|
unsigned int (* __stdcall http_get) (char * url); //yay, it's NOT uint, but hey, C is stubborn, and I'm dumb
|
||||||
|
int (* __stdcall http_process) (unsigned int identifier);
|
||||||
|
void (* __stdcall http_free) (unsigned int identifier);
|
||||||
|
|
||||||
|
|
||||||
|
int HTTP_YAY(){
|
||||||
|
asm volatile ("pusha\n\
|
||||||
|
movl $mem_Alloc, %eax\n\
|
||||||
|
movl $mem_Free, %ebx\n\
|
||||||
|
movl $mem_ReAlloc, %ecx\n\
|
||||||
|
movl $dll_load, %edx\n\
|
||||||
|
movl http_init, %esi\n\
|
||||||
|
call *%esi\n\
|
||||||
|
popa");
|
||||||
|
}
|
||||||
|
|
||||||
|
///===========================
|
||||||
|
|
||||||
|
void HTTP_INIT()
|
||||||
|
{
|
||||||
|
IMP_ENTRY *imp;
|
||||||
|
|
||||||
|
imp = __kolibri__cofflib_load("/sys/lib/http.obj");
|
||||||
|
if (imp == NULL)
|
||||||
|
kol_exit();
|
||||||
|
|
||||||
|
http_init = ( __stdcall int(*)())
|
||||||
|
__kolibri__cofflib_getproc (imp, "lib_init");
|
||||||
|
if (http_init == NULL)
|
||||||
|
kol_exit();
|
||||||
|
|
||||||
|
http_get = ( __stdcall unsigned int (*)(char*))
|
||||||
|
__kolibri__cofflib_getproc (imp, "get");
|
||||||
|
if (http_get == NULL)
|
||||||
|
kol_exit();
|
||||||
|
|
||||||
|
http_free = ( __stdcall void (*)(unsigned int))
|
||||||
|
__kolibri__cofflib_getproc (imp, "free");
|
||||||
|
if (http_free == NULL)
|
||||||
|
kol_exit();
|
||||||
|
|
||||||
|
|
||||||
|
http_process = ( __stdcall int (*)(unsigned int))
|
||||||
|
__kolibri__cofflib_getproc (imp, "process");
|
||||||
|
if (http_process == NULL)
|
||||||
|
kol_exit();
|
||||||
|
|
||||||
|
__menuet__debug_out("HTTP init...\n");
|
||||||
|
HTTP_YAY();
|
||||||
|
|
||||||
|
__menuet__debug_out("ok...\n");
|
||||||
|
|
||||||
|
}
|
@ -435,7 +435,7 @@ process_cmdline(int argc, char** argv)
|
|||||||
fewidth = nsoption_int(window_width);
|
fewidth = nsoption_int(window_width);
|
||||||
feheight = nsoption_int(window_height);
|
feheight = nsoption_int(window_height);
|
||||||
} else {
|
} else {
|
||||||
fewidth = 800; //640;
|
fewidth = 790; //640;
|
||||||
feheight = 560; //400;
|
feheight = 560; //400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,6 +541,25 @@ main(int argc, char** argv)
|
|||||||
freopen( "stdout.log", "w", stdout );
|
freopen( "stdout.log", "w", stdout );
|
||||||
|
|
||||||
|
|
||||||
|
char p[256];
|
||||||
|
char **z;
|
||||||
|
z=0x20;
|
||||||
|
strcpy(p, *z);
|
||||||
|
|
||||||
|
__menuet__debug_out("PATH1...\n");
|
||||||
|
__menuet__debug_out(p);
|
||||||
|
__menuet__debug_out("PATH1...\n");
|
||||||
|
|
||||||
|
*(strrchr(p, '/')+1)='\0';
|
||||||
|
|
||||||
|
strcpy(strrchr(p, '/')+1, "res/");
|
||||||
|
|
||||||
|
__menuet__debug_out("PATH1...\n");
|
||||||
|
__menuet__debug_out(p);
|
||||||
|
__menuet__debug_out("PATH1...\n");
|
||||||
|
|
||||||
|
asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(p));
|
||||||
|
|
||||||
LOG(("Registering surfaces for SDL and RAM.."));
|
LOG(("Registering surfaces for SDL and RAM.."));
|
||||||
|
|
||||||
//extern nsfb_surface_rtns_t sdl_rtns;
|
//extern nsfb_surface_rtns_t sdl_rtns;
|
||||||
@ -553,13 +572,21 @@ main(int argc, char** argv)
|
|||||||
_nsfb_register_surface(NSFB_SURFACE_ABLE, &able_rtns, "able");
|
_nsfb_register_surface(NSFB_SURFACE_ABLE, &able_rtns, "able");
|
||||||
_nsfb_register_surface(NSFB_SURFACE_KOLIBRI, &kolibri_rtns, "kolibri");
|
_nsfb_register_surface(NSFB_SURFACE_KOLIBRI, &kolibri_rtns, "kolibri");
|
||||||
|
|
||||||
respaths = fb_init_resource("/hd0/1/res/:/bd0/1/res/:/tmp9/1/netsurf/res/:res/:fonts/");
|
|
||||||
|
//respaths = fb_init_resource("/kolibrios/:/hd0/1/res/:/bd0/1/res/:/tmp9/1/netsurf/res/:res/:fonts/:");
|
||||||
|
respaths = fb_init_resource(p);
|
||||||
|
|
||||||
options = filepath_find(respaths, "Choices");
|
options = filepath_find(respaths, "Choices");
|
||||||
messages = filepath_find(respaths, "messages");
|
messages = filepath_find(respaths, "messages");
|
||||||
|
|
||||||
netsurf_init(&argc, &argv, options, "res/messages");
|
__menuet__debug_out("===path to msg\n");
|
||||||
|
__menuet__debug_out(messages);
|
||||||
|
__menuet__debug_out("\n===path to msg\n");
|
||||||
|
|
||||||
|
//netsurf_init(&argc, &argv, options, "res/messages");
|
||||||
|
netsurf_init(&argc, &argv, options, messages);
|
||||||
|
extern HTTP_INIT();
|
||||||
|
HTTP_INIT();
|
||||||
LOG(("NS init okay"));
|
LOG(("NS init okay"));
|
||||||
|
|
||||||
free(messages);
|
free(messages);
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
179
programs/network/netsurf/netsurf/objs/dll.asm
Normal file
179
programs/network/netsurf/netsurf/objs/dll.asm
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
include 'proc32.inc'
|
||||||
|
|
||||||
|
macro __mov reg,a,b { ; mike.dld
|
||||||
|
if (~a eq)&(~b eq)
|
||||||
|
mpack reg,a,b
|
||||||
|
else if (~a eq)&(b eq)
|
||||||
|
mov reg,a
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls
|
||||||
|
__mov eax,a
|
||||||
|
__mov ebx,b
|
||||||
|
__mov ecx,c
|
||||||
|
__mov edx,d
|
||||||
|
__mov esi,e
|
||||||
|
__mov edi,f
|
||||||
|
int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
format ELF
|
||||||
|
section '.text' executable
|
||||||
|
|
||||||
|
public dll_load
|
||||||
|
public mem_Free
|
||||||
|
public mem_Alloc
|
||||||
|
public mem_ReAlloc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc dll_load, import_table:dword
|
||||||
|
mov esi, [import_table]
|
||||||
|
.next_lib:
|
||||||
|
mov edx, [esi]
|
||||||
|
or edx, edx
|
||||||
|
jz .exit
|
||||||
|
push esi
|
||||||
|
mov esi, [esi + 4]
|
||||||
|
mov edi, s_libdir.fname
|
||||||
|
@@:
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
or al, al
|
||||||
|
jnz @b
|
||||||
|
mcall 68, 19, s_libdir
|
||||||
|
or eax, eax
|
||||||
|
jz .fail
|
||||||
|
stdcall dll.Link, eax, edx
|
||||||
|
push eax
|
||||||
|
mov eax, [eax]
|
||||||
|
cmp dword[eax], 'lib_'
|
||||||
|
pop eax
|
||||||
|
jnz @f
|
||||||
|
stdcall dll.Init, [eax + 4]
|
||||||
|
@@:
|
||||||
|
pop esi
|
||||||
|
add esi, 8
|
||||||
|
jmp .next_lib
|
||||||
|
.exit:
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
.fail:
|
||||||
|
add esp, 4
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc dll.Link, exp:dword, imp:dword
|
||||||
|
push eax
|
||||||
|
mov esi, [imp]
|
||||||
|
test esi, esi
|
||||||
|
jz .done
|
||||||
|
.next:
|
||||||
|
lodsd
|
||||||
|
test eax, eax
|
||||||
|
jz .done
|
||||||
|
stdcall dll.GetProcAddress, [exp], eax
|
||||||
|
or eax, eax
|
||||||
|
jz @f
|
||||||
|
mov [esi - 4], eax
|
||||||
|
jmp .next
|
||||||
|
@@:
|
||||||
|
mov dword[esp], 0
|
||||||
|
.done:
|
||||||
|
pop eax
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc dll.Init, dllentry:dword
|
||||||
|
pushad
|
||||||
|
mov eax, mem_Alloc
|
||||||
|
mov ebx, mem_Free
|
||||||
|
mov ecx, mem_ReAlloc
|
||||||
|
mov edx, dll_load
|
||||||
|
stdcall [dllentry]
|
||||||
|
popad
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc dll.GetProcAddress, exp:dword, sz_name:dword
|
||||||
|
mov edx, [exp]
|
||||||
|
xor eax, eax
|
||||||
|
.next:
|
||||||
|
or edx, edx
|
||||||
|
jz .end
|
||||||
|
cmp dword[edx], 0
|
||||||
|
jz .end
|
||||||
|
stdcall strcmp, [edx], [sz_name]
|
||||||
|
test eax, eax
|
||||||
|
jz .ok
|
||||||
|
add edx, 8
|
||||||
|
jmp .next
|
||||||
|
.ok:
|
||||||
|
mov eax, [edx + 4]
|
||||||
|
.end:
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc strcmp, str1:dword, str2:dword
|
||||||
|
push esi edi
|
||||||
|
mov esi, [str1]
|
||||||
|
mov edi, [str2]
|
||||||
|
xor eax, eax
|
||||||
|
@@:
|
||||||
|
lodsb
|
||||||
|
scasb
|
||||||
|
jne .fail
|
||||||
|
or al, al
|
||||||
|
jnz @b
|
||||||
|
jmp .ok
|
||||||
|
.fail:
|
||||||
|
or eax, -1
|
||||||
|
.ok:
|
||||||
|
pop edi esi
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
s_libdir:
|
||||||
|
db '/sys/lib/'
|
||||||
|
.fname rb 32
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc mem_Alloc, size
|
||||||
|
push ebx ecx
|
||||||
|
mov ecx, [size]
|
||||||
|
mcall 68, 12
|
||||||
|
pop ecx ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc mem_ReAlloc, mptr, size
|
||||||
|
push ebx ecx edx
|
||||||
|
mov ecx, [size]
|
||||||
|
or ecx, ecx
|
||||||
|
jz @f
|
||||||
|
@@:
|
||||||
|
mov edx, [mptr]
|
||||||
|
or edx, edx
|
||||||
|
jz @f
|
||||||
|
@@:
|
||||||
|
mcall 68, 20
|
||||||
|
or eax, eax
|
||||||
|
jz @f
|
||||||
|
@@:
|
||||||
|
pop edx ecx ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
proc mem_Free, mptr
|
||||||
|
push ebx ecx
|
||||||
|
mov ecx,[mptr]
|
||||||
|
or ecx,ecx
|
||||||
|
jz @f
|
||||||
|
@@:
|
||||||
|
mcall 68, 13
|
||||||
|
pop ecx ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
;-----------------------------------------------------------------------------
|
BIN
programs/network/netsurf/netsurf/objs/dll.o
Normal file
BIN
programs/network/netsurf/netsurf/objs/dll.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user