summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--content/fetch.c7
-rw-r--r--content/handlers/css/css.c2
-rw-r--r--desktop/netsurf.c2
-rw-r--r--frontends/kolibrios/#main.c#331
-rw-r--r--frontends/kolibrios/Makefile3
-rw-r--r--frontends/kolibrios/fb/gui.c46
-rw-r--r--utils/log.c12
8 files changed, 36 insertions, 371 deletions
diff --git a/Makefile b/Makefile
index fd62802ea..8fa65d827 100644
--- a/Makefile
+++ b/Makefile
@@ -530,12 +530,12 @@ else
KOL_LIBC := $(HOME)/kolibrios/contrib/sdk/sources/newlib/libc/include/
KOL_LIB_DIR := $(HOME)/kolibrios/contrib/sdk/lib
LIB_LDFLAGS := -L$(KOL_LIB_DIR) -lfreetype -lpng16
- OS_LDFLAGS := -static -S -Tapp-dynamic.lds --image-base 0
+ OS_LDFLAGS := -static -S -Tapp-dynamic.lds --image-base 0 -Map netsurf-kolibrios.map
NS_INCLUDE := $(PREFIX)/include
NS_LIB_LDFLAGS := -L$(PREFIX)/lib/ -lnsbmp -lnsutils -lwapcaplet -lsvgtiny -lnsgif -lutf8proc -lcss -lnsfb -lparserutils -ldom -lhubbub -lz
- CFLAGS += -c -fno-ident -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U__BSD_VISIBLE -I$(KOL_LIBC) -I$(NS_INCLUDE)
+ CFLAGS += -c -fno-ident -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U__BSD_VISIBLE -I$(KOL_LIBC) -I$(NS_INCLUDE)
LDFLAGS += $(OS_LDFLAGS) $(NS_LIB_LDFLAGS) $(LIB_LDFLAGS) -lgcc -lc.dll
endif
diff --git a/content/fetch.c b/content/fetch.c
index 666b9e30e..d6e98e1f4 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -70,7 +70,7 @@
/** Verbose fetcher logging */
#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) debug_board_printf(x); debug_board_printf("\n");
+#define FETCH_LOG(x...) LOG(x)
#else
#define FETCH_LOG(x...)
#endif
@@ -300,12 +300,14 @@ nserror fetcher_init(void)
return ret;
}
#endif
+
#ifdef _TARGET_IS_KOLIBRIOS
ret = fetch_httplib_kolibri_register();
if (ret != NSERROR_OK) {
return ret;
}
#endif
+
ret = fetch_data_register();
if (ret != NSERROR_OK) {
return ret;
@@ -593,6 +595,7 @@ fetch_start(nsurl *url,
/* exported interface documented in content/fetch.h */
void fetch_abort(struct fetch *f)
{
+ debug_board_printf("---- fetch.c : fetch_abort for fetch 0x%x\n", f);
assert(f);
FETCH_LOG("fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
nsurl_access(f->url));
@@ -773,7 +776,7 @@ void fetch_remove_from_queues(struct fetch *fetch)
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- FETCH_LOG("Setting HTTP code to %ld", http_code);
+ FETCH_LOG("Setting HTTP code to %ld for fetch 0x%x", http_code, fetch);
fetch->http_code = http_code;
}
diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c
index 997eb5115..ffff14fd1 100644
--- a/content/handlers/css/css.c
+++ b/content/handlers/css/css.c
@@ -259,6 +259,8 @@ bool nscss_process_data(struct content *c, const char *data, unsigned int size)
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
}
+ debug_board_printf("Processing css_data of size : %u\n", size);
+
return (error == CSS_OK || error == CSS_NEEDDATA);
}
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 3baa936f3..7df46f8cf 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -184,7 +184,7 @@ nserror netsurf_init(const char *store_path)
/* set backing store target limit */
hlcache_parameters.llcache.store.limit = nsoption_uint(disc_cache_size);
- /* set backing store hysterissi to 20% */
+ /* set backing store hysterisis to 20% */
hlcache_parameters.llcache.store.hysteresis = (hlcache_parameters.llcache.store.limit * 20) / 100;;
/* set the path to the backing store */
diff --git a/frontends/kolibrios/#main.c# b/frontends/kolibrios/#main.c#
deleted file mode 100644
index b65f2c4eb..000000000
--- a/frontends/kolibrios/#main.c#
+++ /dev/null
@@ -1,331 +0,0 @@
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "kolibrios/kolibri_debug.h"
-#include "kolibrios/kolibri_gui.h"
-
-#include "utils/errors.h"
-
-#include "utils/messages.h"
-#include "utils/filepath.h"
-#include "utils/nsoption.h"
-#include "utils/nsurl.h"
-
-#include "desktop/gui_table.h" /* netsurf_table struct */
-#include "desktop/gui_misc.h" /* gui_browser_table struct */
-#include "desktop/gui_window.h" /* gui_window_table struct */
-#include "desktop/netsurf.h" /* for netsurf_register */
-#include "image/bitmap.h" /* for gui_bitmap_table struct */
-#include "desktop/gui_clipboard.h" /* gui_clipboard_table struct */
-#include "desktop/gui_download.h" /* gui_download_table struct */
-#include "desktop/gui_fetch.h" /* gui_fetch_table struct */
-#include "desktop/browser.h"
-
-#include "utils/file.h" /* gui_file_table struct */
-#include "desktop/gui_utf8.h" /* gui_utf8_table struct */
-#include "desktop/gui_search.h" /* gui_search_table struct */
-#include "desktop/searchweb.h" /* gui_search_web_table struct */
-#include "content/backing_store.h" /* gui_llcache_table struct */
-
-/* #include "kolibrios/browser_table.h" */
-/* #include "kolibrios/window_table.h" */
-/* #include "kolibrios/download_table.h" */
-/* #include "kolibrios/clipboard_table.h" */
-/* #include "kolibrios/gui_fetch_table.h" */
-/* #include "kolibrios/bitmap_table.h" */
-/* #include "kolibrios/gui_file_table.h" */
-/* #include "kolibrios/gui_llcache_table.h" */
-/* #include "kolibrios/gui_search_table.h" */
-/* #include "kolibrios/gui_search_web_table.h" */
-/* #include "kolibrios/gui_utf8_table.h" */
-
-#include "kolibrios/kolibri_http.h"
-#include <libnsfb.h>
-#include <libnsfb_plot.h>
-#include <libnsfb_event.h>
-#include <libnsfb_surface.h>
-
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "utils/filepath.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "desktop/browser.h"
-#include "desktop/textinput.h"
-#include "desktop/browser_history.h"
-#include "desktop/plotters.h"
-#include "desktop/gui_window.h"
-#include "desktop/gui_misc.h"
-#include "desktop/netsurf.h"
-
-#include "framebuffer/gui.h"
-#include "framebuffer/fbtk.h"
-#include "framebuffer/framebuffer.h"
-#include "framebuffer/schedule.h"
-#include "framebuffer/findfile.h"
-#include "framebuffer/image_data.h"
-#include "framebuffer/font.h"
-#include "framebuffer/clipboard.h"
-#include "framebuffer/fetch.h"
-#include "framebuffer/bitmap.h"
-
-/**************************************************
-Make life easier with these path specifiers here.
-***************************************************/
-/* #define KOLIBRI_FONTFILE "/usbhd0/1/kolibrios/res/sans.ttf" */
-/* #define KOLIBRI_RESPATH "/usbhd0/1/kolibrios/res/" */
-/* #define FILE_KOLIBRI_RESPATH "file:///usbhd0/1/kolibrios/res/" */
-/************************************************/
-
-char **respaths; /** resource search path vector */
-
-extern struct gui_browser_table framebuffer_browser_table;
-extern struct gui_window_table framebuffer_window_table ;
-extern struct gui_clipboard_table *framebuffer_clipboard_table ;
-extern struct gui_fetch_table *framebuffer_fetch_table ;
-extern struct gui_utf8_table *framebuffer_utf8_table ;
-extern struct gui_bitmap_table *framebuffer_bitmap_table ;
-
-extern const char *fename;
-extern int febpp;
-extern int fewidth;
-extern int feheight;
-extern const char *feurl;
-extern bool nslog_stream_configure(FILE *fptr);
-extern struct fbtk_bitmap pointer_image;
-extern fbtk_widget_t *fbtk;
-
-static void die(const char *error)
-{
- debug_board_write_str(error);
- debug_board_write_str('\n');
- exit(1);
-}
-
-/* Inspired from monkey, but without the GTK bloat */
-static char **nskolibri_init_resource(const char *resource_path)
-{
- char **langv = {"de", "en_US", "en", "C"};
- char **pathv; /* resource path string vector */
- char **respath; /* resource paths vector */
-
- pathv = filepath_path_to_strvec(resource_path);
- respath = filepath_generate(pathv, langv);
- filepath_free_strvec(pathv);
-
- return respath;
-}
-
-static nserror set_defaults(struct nsoption_s *defaults)
-{
- /* Set defaults for absent option strings */
- nsoption_setnull_charp(cookie_file, *respaths);
- nsoption_setnull_charp(cookie_jar, *respaths);
- //TODO: This creates an nsoptions error in macro expansion...
-
- return NSERROR_OK;
-}
-
-/**
- * Main entry point from Kolibri OS.
- */
-extern struct http_msg;
-
-int
-main(int argc, char** argv)
-{
- struct browser_window *bw;
- char *options;
- char *messages;
- nsurl *url;
- nserror ret;
- nsfb_t *nsfb;
-
- struct netsurf_table framebuffer_table = {
- .browser = &framebuffer_browser_table,
- .window = &framebuffer_window_table,
- .clipboard = framebuffer_clipboard_table,
- .fetch = framebuffer_fetch_table,
- .utf8 = framebuffer_utf8_table,
- .bitmap = framebuffer_bitmap_table,
- };
-
-
-
- /* Initialize HTTP Library */
- ret = kolibri_http_init();
- if (ret == 0)
- debug_board_write_str("Netsurf: KolibriOS HTTP Library Initialized.\n");
- else {
- debug_board_write_str("Netsurf: HTTP Library initialization failed..\n");
- return ret;
- }
-
- /* Initialize BoxLib Library for GUI textboxes, etc */
- ret = kolibri_gui_init();
- if (ret == 0)
- debug_board_write_str("Netsurf: KolibriOS BOXLIB Library Initialized.\n");
- else {
- debug_board_write_str("Netsurf: BOXLIB Library initialization failed..\n");
- return ret;
- }
-
- /* End of KolibriOS specific libraries initialization phase */
- debug_board_write_str("Netsurf: Trying to register nskolibri_table.\n");
-
- ret = netsurf_register(&framebuffer_table);
- if (ret != NSERROR_OK) {
- die("NetSurf operation table failed registration");
- }
-
- /* Drop the last slash if caller provided it. */
-
- char current_dir[100];
- int i = 0;
-
- for(i = strlen(argv[0]); i>=0; i--)
- {
- if(argv[0][i]=='/') {
- strncpy(current_dir, argv[0], i+1);
- i++;
- current_dir[i++] = 'r';
- current_dir[i++] = 'e';
- current_dir[i++] = 's';
- current_dir[i++] = '\0';
- break;
- }
- }
-
-
- respaths = (char **) malloc(sizeof(char **));
- *respaths = malloc(i);
- strcpy(*respaths, current_dir);
-
- debug_board_write_str("\nCWD: ");
- debug_board_write_str(*respaths);
- debug_board_write_str("\n");
-
- /* __asm__ __volatile__("int3"); */
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
-
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- die("Options failed to initialise");
- }
- options = filepath_find(respaths, "Choices");
- nsoption_read(options, nsoptions);
- free(options);
- nsoption_commandline(&argc, argv, nsoptions);
-
- /* message init */
- messages = filepath_find(respaths, "Messages");
- ret = messages_add_from_file(messages);
- free(messages);
- if (ret != NSERROR_OK) {
- debug_board_write_str("Message translations failed to load\n");
- }
-
- /* common initialisation */
- ret = netsurf_init(NULL);
- if (ret != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- /* Override, since we have no support for non-core SELECT menu */
- nsoption_set_bool(core_select_menu, true);
- /* Do we really need to parse command line in KolibriOS?
- Most users will use the GUI to trigger NS .
- TODO: Look at this later.
- */
-
- /* if (process_cmdline(argc,argv) != true) */
- /* die("unable to process command line.\n"); */
-
- /* Move the initialization stuff from process_cmdline() to here */
- /* fename = "sdl"; */
-
- extern nsfb_surface_rtns_t kolibri_rtns;
- _nsfb_register_surface(NSFB_SURFACE_KOLIBRI, &kolibri_rtns, "kolibri");
-
- extern nsfb_surface_rtns_t ram_rtns;
- _nsfb_register_surface(NSFB_SURFACE_RAM, &ram_rtns, "ram");
-
- /* fewidth = nsoption_int(window_width); */
- /* if (fewidth <= 0) { */
- /* fewidth = 800; */
- /* } */
-
- /* feheight = nsoption_int(window_height); */
- /* if (feheight <= 0) { */
- /* feheight = 600; */
- /* } */
-
- fename = "kolibri";
- febpp = 32;
- fewidth = 800;
- feheight = 600;
-
- // feurl = "board.kolibrios.org/ucp.php?i=pm&mode=compose";
- feurl = "ashmew2.me";
- /* feurl = "kolibrios.org"; */
- /* feurl = "file://usbhd0/1/kolibrios/res/welcome.html"; */
- nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
- if (nsfb == NULL)
- die("Unable to initialise framebuffer");
-
- framebuffer_set_cursor(&pointer_image);
-
- if (fb_font_init() == false)
- die("Unable to initialise the font system");
-
- fbtk = fbtk_init(nsfb);
-
- fbtk_enable_oskb(fbtk);
-
- urldb_load_cookies(nsoption_charp(cookie_file));
-
- /* create an initial browser window */
-
- debug_board_write_str("calling browser_window_create\n");
-
- ret = nsurl_create(feurl, &url);
- if (ret == NSERROR_OK) {
- ret = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
-
- if (ret != NSERROR_OK) {
- warn_user(messages_get_errorcode(ret), 0);
- } else {
- debug_board_write_str("calling framebuffer run\n");
-
- framebuffer_run();
-
- debug_board_write_str("framebuffer run returned. \n");
-
- debug_board_write_str("Killing browser window.\n");
- browser_window_destroy(bw);
- }
-
- debug_board_write_str("Calling netsurf_exit()\n");
- netsurf_exit();
-
- if (fb_font_finalise() == false)
- LOG("Font finalisation failed.");
-
- /* finalise options */
- nsoption_finalise(nsoptions, nsoptions_default);
-
- free(*respaths);
- free(respaths);
- return 0;
-}
diff --git a/frontends/kolibrios/Makefile b/frontends/kolibrios/Makefile
index cec54d287..dcc5c9366 100644
--- a/frontends/kolibrios/Makefile
+++ b/frontends/kolibrios/Makefile
@@ -148,9 +148,10 @@ EXETARGET := nskolibrios
DESTDIR := $(PREFIX)/bin
DESTRESDIR := $(PREFIX)/res
KOLIBRI_RES_DIR := $(HOME)/NETSURFLIBS/netsurf/frontends/kolibrios/res
-
+RELEASENAME :=
# make install is buggy with -jN when it cannot find the EXETARGET as it tries to install it before it is created.
install-kolibrios:
$(Q)$(MKDIR) -p $(DESTDIR)
$(Q)install $(EXETARGET) $(DESTDIR)/netsurf-kolibrios
$(Q)cp -r $(KOLIBRI_RES_DIR) $(DESTRESDIR)
+ $(Q)cp netsurf-kolibrios.map $(DESTDIR)/
diff --git a/frontends/kolibrios/fb/gui.c b/frontends/kolibrios/fb/gui.c
index 453ade67f..469c06494 100644
--- a/frontends/kolibrios/fb/gui.c
+++ b/frontends/kolibrios/fb/gui.c
@@ -490,6 +490,9 @@ process_cmdline(int argc, char** argv)
feurl = NETSURF_HOMEPAGE;
}
+ /* Remove me! */
+ feurl = "http://www.kolibrios.org";
+
/* NS on KolibriOS does not support option parsing (yet) */
/* while((opt = getopt_long(argc, argv, "f:b:w:h:", */
@@ -2091,8 +2094,7 @@ static struct gui_misc_table framebuffer_misc_table = {
* /param argv The argument string vector.
* /return The return code to the OS
*/
-int
-main(int argc, char** argv)
+int main(int argc, char** argv)
{
struct browser_window *bw;
char *options;
@@ -2111,42 +2113,42 @@ main(int argc, char** argv)
.layout = framebuffer_layout_table,
};
- ret = netsurf_register(&framebuffer_table);
- if (ret != NSERROR_OK) {
- die("NetSurf operation table failed registration");
- }
- /* The only restriction is that the kolibrios netsurf binary should be in the same
- directory as another "res" directory */
+ /* fix args */
+#define MKARGV(i,opt) argv[i] = (char *) malloc(strlen(opt) + 1); strcpy(argv[i], opt);
+#define ARGC 3
+MKARGV(1, "-V");
+MKARGV(2, "/tmp0/1/netsurf.log");
+MKARGV(ARGC, "\0");
+
+ argc = ARGC;
+ /* args fixed */
+
+ /* The only restriction is that the kolibrios-netsurf binary and the res/ directory should be in the same directory. */
/* On Kolibrios, argv[0] is the absolute path to the binary */
char *respath = strdup(argv[0]);
- int i;
- for(i = strlen(respath) - 1; i > 0; i--) {
+ for(int i = strlen(respath) - 1; i > 0; i--) {
if(respath[i] == '/') {
- respath[i+1] = 'r';
- respath[i+2] = 'e';
- respath[i+3] = 's';
- respath[i+4] = '\0';
+ strcpy((respath+i), "res");
break;
}
}
- assert(i!=0);
- debug_board_printf(" --- argv[0] : %s\n\n", argv[0]);
- debug_board_printf(" --- respath : %s\n\n", respath);
+ ret = netsurf_register(&framebuffer_table);
+ if (ret != NSERROR_OK)
+ die("NetSurf operation table failed registration");
+
respaths = fb_init_resource(respath);
/* initialise logging. Abort on failure for KolibriOS. */
ret = nslog_init(nslog_stream_configure, &argc, argv);
- if (ret != NSERROR_OK) {
+ if (ret != NSERROR_OK)
die("Logging failed to initialise. This is required to run on KolibriOS.");
- }
/* user options setup */
ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
+ if (ret != NSERROR_OK)
die("Options failed to initialise");
- }
options = filepath_find(respaths, "Choices");
nsoption_read(options, nsoptions);
@@ -2175,7 +2177,7 @@ main(int argc, char** argv)
extern struct nsfb_surface_rtns_t kolibri_rtns;
_nsfb_register_surface(NSFB_SURFACE_KOLIBRI, &kolibri_rtns, "kolibri");
-
+
extern struct nsfb_surface_rtns_t ram_rtns;
_nsfb_register_surface(NSFB_SURFACE_RAM, &ram_rtns, "ram");
diff --git a/utils/log.c b/utils/log.c
index f54430305..15a7a9e75 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -173,7 +173,6 @@ static const char *nslog_gettime(void)
void nslog_log(const char *file, const char *func, int ln, const char *format, ...)
{
-#ifndef _TARGET_IS_KOLIBRIOS
va_list ap;
fprintf(logfile, "%s %s:%i %s: ", nslog_gettime(), file, ln, func);
@@ -185,17 +184,6 @@ void nslog_log(const char *file, const char *func, int ln, const char *format, .
va_end(ap);
fputc('\n', logfile);
-#else
- va_list ap;
- char message[1000];
-
- va_start(ap, format);
- vsprintf(message, format, ap);
- va_end(ap);
-
- debug_board_printf(message);
- debug_board_printf("\n");
-#endif
}
#endif