summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/gui.c9
-rw-r--r--atari/gui.c11
-rw-r--r--beos/gui.cpp18
-rw-r--r--cocoa/NetsurfApp.m9
-rw-r--r--desktop/gui.h8
-rw-r--r--desktop/gui_factory.c6
-rw-r--r--desktop/gui_factory.h4
-rw-r--r--desktop/netsurf.c17
-rw-r--r--desktop/netsurf.h27
-rw-r--r--framebuffer/gui.c9
-rw-r--r--gtk/gui.c9
-rw-r--r--monkey/main.c9
-rw-r--r--riscos/gui.c9
-rw-r--r--windows/main.c20
14 files changed, 115 insertions, 50 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 9acdafd6f..4801325c4 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5240,7 +5240,7 @@ int main(int argc, char** argv)
int32 user = 0;
nserror ret;
Object *splash_window = ami_gui_splash_open();
- struct gui_table amiga_gui_table = {
+ struct netsurf_table amiga_table = {
.browser = &amiga_browser_table,
.window = &amiga_window_table,
.clipboard = amiga_clipboard_table,
@@ -5251,6 +5251,11 @@ int main(int argc, char** argv)
.search = amiga_search_table,
};
+ ret = netsurf_register(&amiga_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
/* Open popupmenu.library just to check the version.
* Versions older than 53.11 are dangerous, so we
* forcibly disable context menus if these are in use.
@@ -5297,7 +5302,7 @@ int main(int argc, char** argv)
if (ami_locate_resource(messages, "Messages") == false)
die("Cannot open Messages file");
- ret = netsurf_init(messages, &amiga_gui_table);
+ ret = netsurf_init(messages);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/atari/gui.c b/atari/gui.c
index 3796ae511..e5f5770ba 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -1079,7 +1079,7 @@ int main(int argc, char** argv)
struct stat stat_buf;
nsurl *url;
nserror ret;
- struct gui_table atari_gui_table = {
+ struct netsurf_table atari_table = {
.browser = &atari_browser_table,
.window = &atari_window_table,
.clipboard = &atari_clipboard_table,
@@ -1089,7 +1089,12 @@ int main(int argc, char** argv)
.search = atari_search_table,
};
- /* @todo logging file descriptor update belongs in a nslog_init callback */
+ ret = netsurf_register(&atari_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
+ /** @todo logging file descriptor update belongs in a nslog_init callback */
setbuf(stderr, NULL);
setbuf(stdout, NULL);
#ifdef WITH_DBG_LOGFILE
@@ -1121,7 +1126,7 @@ int main(int argc, char** argv)
/* common initialisation */
LOG(("Initialising core..."));
- ret = netsurf_init(messages, &atari_gui_table);
+ ret = netsurf_init(messages);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 21bbf11f1..4077a8580 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -1024,7 +1024,7 @@ int main(int argc, char** argv)
{
nserror ret;
BPath options;
- struct gui_table beos_gui_table = {
+ struct netsurf_table beos_table = {
&beos_browser_table,
beos_window_table,
beos_download_table,
@@ -1032,6 +1032,11 @@ int main(int argc, char** argv)
&beos_fetch_table
};
+ ret = netsurf_register(&beos_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
options.Append("x-vnd.NetSurf");
}
@@ -1057,7 +1062,7 @@ int main(int argc, char** argv)
/* common initialisation */
BPath messages = get_messages_path();
- ret = netsurf_init(messages.Path(), &beos_gui_table);
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
@@ -1076,7 +1081,7 @@ int gui_init_replicant(int argc, char** argv)
{
nserror ret;
BPath options;
- struct gui_table beos_gui_table = {
+ struct netsurf_table beos_table = {
&beos_browser_table,
beos_window_table,
beos_download_table,
@@ -1084,6 +1089,11 @@ int gui_init_replicant(int argc, char** argv)
&beos_fetch_table
};
+ ret = netsurf_register(&beos_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
options.Append("x-vnd.NetSurf");
}
@@ -1105,7 +1115,7 @@ int gui_init_replicant(int argc, char** argv)
/* common initialisation */
BPath messages = get_messages_path();
- ret = netsurf_init(messages.Path(), &beos_gui_table);
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
// FIXME: must not die when in replicant!
die("NetSurf failed to initialise");
diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m
index 45d31a122..3a9572309 100644
--- a/cocoa/NetsurfApp.m
+++ b/cocoa/NetsurfApp.m
@@ -184,7 +184,7 @@ int main( int argc, char **argv )
{
nsurl *url;
nserror error;
- struct gui_table cocoa_gui_table = {
+ struct netsurf_table cocoa_table = {
.browser = cocoa_browser_table,
.window = cocoa_window_table,
.clipboard = cocoa_clipboard_table,
@@ -194,6 +194,11 @@ int main( int argc, char **argv )
};
cocoa_autorelease();
+
+ error = netsurf_register(&cocoa_table);
+ if (error != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
const char * const messages = [[[NSBundle mainBundle] pathForResource: @"Messages" ofType: @""] UTF8String];
const char * const options = cocoa_get_options_file();
@@ -212,7 +217,7 @@ int main( int argc, char **argv )
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- error = netsurf_init(messages, &cocoa_gui_table);
+ error = netsurf_init(messages);
if (error != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/desktop/gui.h b/desktop/gui.h
index 0d4135a93..c0a5a4e21 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -521,11 +521,12 @@ struct gui_browser_table {
};
-/** Graphical user interface function table
+/**
+ * NetSurf operation function table
*
- * function table implementing GUI interface to browser core
+ * Function table implementing interface operations for the browser core.
*/
-struct gui_table {
+struct netsurf_table {
/**
* Browser table.
@@ -566,7 +567,6 @@ struct gui_table {
struct gui_utf8_table *utf8;
/**
- *
* Page search table.
*
* Provides routines for the interactive text search on a page.
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 8e3ce178d..756f5dd0e 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -21,8 +21,8 @@
#include "desktop/gui_factory.h"
#include "utils/file.h"
-/** The global GUI interface table */
-struct gui_table *guit = NULL;
+/** The global interface table */
+struct netsurf_table *guit = NULL;
@@ -541,7 +541,7 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
/* exported interface documented in desktop/gui_factory.h */
-nserror gui_factory_register(struct gui_table *gt)
+nserror gui_factory_register(struct netsurf_table *gt)
{
nserror err;
diff --git a/desktop/gui_factory.h b/desktop/gui_factory.h
index dc94b3a16..3c8661577 100644
--- a/desktop/gui_factory.h
+++ b/desktop/gui_factory.h
@@ -26,7 +26,7 @@
#include "desktop/gui.h"
/** The global operation table */
-extern struct gui_table *guit;
+extern struct netsurf_table *guit;
/** register and verify global operation table
*
@@ -34,6 +34,6 @@ extern struct gui_table *guit;
* @return NSERROR_OK on success or error code on faliure. On faliure
* global table will not be initialised
*/
-nserror gui_factory_register(struct gui_table *gt);
+nserror gui_factory_register(struct netsurf_table *gt);
#endif
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index c3653b574..1c9d880f7 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -110,11 +110,15 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query,
#define MINIMUM_MEMORY_CACHE_SIZE (2 * 1024 * 1024)
-/**
- * Initialise components used by gui NetSurf.
- */
+/* exported interface documented in desktop/netsurf.h */
+nserror netsurf_register(struct netsurf_table *table)
+{
+ /* register the operation handlers */
+ return gui_factory_register(table);
+}
-nserror netsurf_init(const char *messages, struct gui_table *gt)
+/* exported interface documented in desktop/netsurf.h */
+nserror netsurf_init(const char *messages)
{
nserror error;
struct utsname utsname;
@@ -148,11 +152,6 @@ nserror netsurf_init(const char *messages, struct gui_table *gt)
utsname.nodename, utsname.release,
utsname.version, utsname.machine));
- /* register the gui handlers */
- error = gui_factory_register(gt);
- if (error != NSERROR_OK)
- return error;
-
messages_load(messages);
/* corestrings init */
diff --git a/desktop/netsurf.h b/desktop/netsurf.h
index 77589c71c..60ec57845 100644
--- a/desktop/netsurf.h
+++ b/desktop/netsurf.h
@@ -27,15 +27,32 @@ extern const char * const netsurf_version;
extern const int netsurf_version_major;
extern const int netsurf_version_minor;
-struct gui_table;
+struct netsurf_table;
-/** Initialise netsurf core */
-nserror netsurf_init(const char *messages, struct gui_table *gt);
+/**
+ * Register operation table.
+ *
+ * @param table NetSurf operations table.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+nserror netsurf_register(struct netsurf_table *table);
-/** Run primary event loop */
+/**
+ * Initialise netsurf core.
+ *
+ * @param messages path to translation mesage file.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+nserror netsurf_init(const char *messages);
+
+/**
+ * Run event loop.
+ */
extern int netsurf_main_loop(void);
-/** finalise NetSurf core */
+/**
+ * Finalise NetSurf core
+ */
extern void netsurf_exit(void);
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 7d3e95c38..a3c4d9c30 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1805,7 +1805,7 @@ main(int argc, char** argv)
nsurl *url;
nserror ret;
nsfb_t *nsfb;
- struct gui_table framebuffer_gui_table = {
+ struct netsurf_table framebuffer_table = {
.browser = &framebuffer_browser_table,
.window = &framebuffer_window_table,
.clipboard = framebuffer_clipboard_table,
@@ -1813,6 +1813,11 @@ main(int argc, char** argv)
.utf8 = framebuffer_utf8_table,
};
+ ret = netsurf_register(&framebuffer_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
/* initialise logging. Not fatal if it fails but not much we
@@ -1832,7 +1837,7 @@ main(int argc, char** argv)
/* common initialisation */
messages = filepath_find(respaths, "Messages");
- ret = netsurf_init(messages, &framebuffer_gui_table);
+ ret = netsurf_init(messages);
free(messages);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
diff --git a/gtk/gui.c b/gtk/gui.c
index 3535fb8a9..8e12b7bfd 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1163,7 +1163,7 @@ int main(int argc, char** argv)
{
char *messages;
nserror ret;
- struct gui_table nsgtk_gui_table = {
+ struct netsurf_table nsgtk_table = {
.browser = &nsgtk_browser_table,
.window = nsgtk_window_table,
.clipboard = nsgtk_clipboard_table,
@@ -1172,6 +1172,11 @@ int main(int argc, char** argv)
.search = nsgtk_search_table,
};
+ ret = netsurf_register(&nsgtk_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
/* build the common resource path list */
respaths = nsgtk_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"GTK_RESPATH":./gtk/res");
@@ -1206,7 +1211,7 @@ int main(int argc, char** argv)
messages = filepath_find(respaths, "Messages");
/* core initialisation */
- ret = netsurf_init(messages, &nsgtk_gui_table);
+ ret = netsurf_init(messages);
free(messages);
if (ret != NSERROR_OK) {
fprintf(stderr, "NetSurf core failed to initialise (%s)\n",
diff --git a/monkey/main.c b/monkey/main.c
index 53fda7021..fe703f226 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -118,13 +118,18 @@ main(int argc, char **argv)
char *options;
char buf[PATH_MAX];
nserror ret;
- struct gui_table monkey_gui_table = {
+ struct netsurf_table monkey_table = {
.browser = &monkey_browser_table,
.window = monkey_window_table,
.download = monkey_download_table,
.fetch = monkey_fetch_table,
};
+ ret = netsurf_register(&monkey_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
/* Unbuffer stdin/out/err */
setbuf(stdin, NULL);
setbuf(stdout, NULL);
@@ -150,7 +155,7 @@ main(int argc, char **argv)
/* common initialisation */
messages = filepath_find(respaths, "Messages");
- ret = netsurf_init(messages, &monkey_gui_table);
+ ret = netsurf_init(messages);
free(messages);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
diff --git a/riscos/gui.c b/riscos/gui.c
index 7a505cb5a..ee450fa65 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -2483,7 +2483,7 @@ int main(int argc, char** argv)
int used = -1; /* slightly better with older OSLib versions */
os_error *error;
nserror ret;
- struct gui_table riscos_gui_table = {
+ struct netsurf_table riscos_table = {
.browser = &riscos_browser_table,
.window = riscos_window_table,
.clipboard = riscos_clipboard_table,
@@ -2494,6 +2494,11 @@ int main(int argc, char** argv)
.search = riscos_search_table,
};
+ ret = netsurf_register(&riscos_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
/* Consult NetSurf$Logging environment variable to decide if logging
* is required. */
error = xos_read_var_val_size("NetSurf$Logging", 0, os_VARTYPE_STRING,
@@ -2537,7 +2542,7 @@ int main(int argc, char** argv)
}
/* common initialisation */
- ret = netsurf_init(path, &riscos_gui_table);
+ ret = netsurf_init(path);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/windows/main.c b/windows/main.c
index 1fa713664..7cd6339d7 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -103,8 +103,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
nserror ret;
const char *addr;
nsurl *url;
- nserror error;
- struct gui_table win32_gui_table = {
+ struct netsurf_table win32_table = {
.browser = win32_browser_table,
.window = win32_window_table,
.clipboard = win32_clipboard_table,
@@ -115,6 +114,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
};
win32_fetch_table->get_resource_url = gui_get_resource_url;
+ ret = netsurf_register(&win32_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table registration failed");
+ }
+
if (SLEN(lpcli) > 0) {
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
}
@@ -160,7 +164,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* common initialisation */
messages = filepath_find(respaths, "messages");
- ret = netsurf_init(messages, &win32_gui_table);
+ ret = netsurf_init(messages);
free(messages);
if (ret != NSERROR_OK) {
free(options_file_location);
@@ -187,9 +191,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
LOG(("calling browser_window_create"));
- error = nsurl_create(addr, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
+ ret = nsurl_create(addr, &url);
+ if (ret == NSERROR_OK) {
+ ret = browser_window_create(BW_CREATE_HISTORY,
url,
NULL,
NULL,
@@ -197,8 +201,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
nsurl_unref(url);
}
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
+ if (ret != NSERROR_OK) {
+ warn_user(messages_get_errorcode(ret), 0);
} else {
netsurf_main_loop();
}