From 02bbaa3e8855cc632dfca42a8bf06a59a3cecf2a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 13 Oct 2014 15:08:16 +0100 Subject: [PATCH] split version info into its own header and remove unnecessary nesurf.h includes The netsurf.h header should *only* contain the registration, core initialisation and finalisation methods. Version information is best placed in its own header. Also remove any unneeded inclusion of this header limiting it to solely the places the relevant API is required. --- amiga/arexx.c | 1 + amiga/gui.c | 1 + amiga/menu.c | 14 ++++++----- atari/about.c | 3 +-- atari/ctxmenu.c | 1 - atari/download.c | 1 - atari/rootwin.c | 1 - atari/statusbar.c | 1 - atari/toolbar.c | 1 - beos/about.cpp | 2 +- beos/fetch_rsrc.cpp | 1 - beos/scaffolding.cpp | 1 + beos/window.cpp | 1 - cocoa/gui.m | 1 - content/fetch.c | 1 - content/fetchers/about.c | 1 - content/fetchers/curl.c | 1 - content/fetchers/data.c | 1 - content/fetchers/file.c | 1 - desktop/netsurf.c | 29 +++++++++++------------ desktop/netsurf.h | 8 +------ desktop/version.c | 20 ++++++++++++++++ desktop/version.h | 43 ++++++++++++++++++++++++++++++++++ gtk/about.c | 2 +- javascript/jsapi/navigator.bnd | 2 +- monkey/dispatch.c | 1 - riscos/dialog.c | 2 +- riscos/download.c | 1 - riscos/iconbar.c | 1 - riscos/menus.c | 1 - riscos/save.c | 2 +- test/llcache.c | 19 ++++++++++++++- test/nsurl.c | 19 ++++++++++++++- utils/useragent.c | 2 +- windows/about.c | 2 +- windows/gui.c | 1 - 36 files changed, 133 insertions(+), 57 deletions(-) create mode 100644 desktop/version.h diff --git a/amiga/arexx.c b/amiga/arexx.c index 3bac0c249..4130dbb6d 100644 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -26,6 +26,7 @@ #include "utils/nsoption.h" #include "desktop/browser_private.h" +#include "desktop/version.h" #include #include diff --git a/amiga/gui.c b/amiga/gui.c index c01e29499..70b165efc 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -27,6 +27,7 @@ #include "desktop/hotlist.h" #include "desktop/mouse.h" #include "desktop/netsurf.h" +#include "desktop/version.h" #include "desktop/save_complete.h" #include "desktop/scrollbar.h" #include "desktop/searchweb.h" diff --git a/amiga/menu.c b/amiga/menu.c index 19888f75b..d3af00ee3 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -38,6 +38,14 @@ #include +#include "utils/nsoption.h" +#include "desktop/hotlist.h" +#include "desktop/browser_private.h" +#include "desktop/gui.h" +#include "desktop/textinput.h" +#include "desktop/version.h" +#include "utils/messages.h" + #include "amiga/arexx.h" #include "amiga/bitmap.h" #include "amiga/clipboard.h" @@ -50,18 +58,12 @@ #include "amiga/history_local.h" #include "amiga/hotlist.h" #include "amiga/menu.h" -#include "utils/nsoption.h" #include "amiga/print.h" #include "amiga/search.h" #include "amiga/theme.h" #include "amiga/tree.h" #include "amiga/utf8.h" #include "amiga/schedule.h" -#include "desktop/hotlist.h" -#include "desktop/browser_private.h" -#include "desktop/gui.h" -#include "desktop/textinput.h" -#include "utils/messages.h" /* This is here temporarily until we get a new SDK */ #define LABEL_MenuMode (LABEL_Dummy+12) diff --git a/atari/about.c b/atari/about.c index 174e27b20..9cd64d227 100644 --- a/atari/about.c +++ b/atari/about.c @@ -32,11 +32,10 @@ #include "testament.h" #include "utils/useragent.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "utils/nsurl.h" #include "utils/messages.h" - #include "curl/curlver.h" diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index f782c6e19..94e12219c 100644 --- a/atari/ctxmenu.c +++ b/atari/ctxmenu.c @@ -29,7 +29,6 @@ #include #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/browser.h" #include "desktop/browser_private.h" #include "desktop/mouse.h" diff --git a/atari/download.c b/atari/download.c index 7e44cda89..11a84347f 100755 --- a/atari/download.c +++ b/atari/download.c @@ -28,7 +28,6 @@ #include "content/urldb.h" #include "content/fetch.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "utils/nsoption.h" #include "desktop/save_complete.h" #include "desktop/textinput.h" diff --git a/atari/rootwin.c b/atari/rootwin.c index b3eb34957..d6da2d857 100755 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -38,7 +38,6 @@ #include "utils/log.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/browser.h" #include "desktop/browser_private.h" #include "desktop/mouse.h" diff --git a/atari/statusbar.c b/atari/statusbar.c index 121762bc4..7036c0ffe 100755 --- a/atari/statusbar.c +++ b/atari/statusbar.c @@ -29,7 +29,6 @@ #include "utils/log.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/browser.h" #include "desktop/mouse.h" #include "desktop/plotters.h" diff --git a/atari/toolbar.c b/atari/toolbar.c index 86460918b..3e0d6d396 100644 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -29,7 +29,6 @@ #include "utils/log.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/browser.h" #include "desktop/browser_history.h" #include "desktop/browser_private.h" diff --git a/beos/about.cpp b/beos/about.cpp index 2483a22c1..bfa9908c7 100644 --- a/beos/about.cpp +++ b/beos/about.cpp @@ -21,7 +21,7 @@ #include #include extern "C" { -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "utils/log.h" #include "testament.h" #include "utils/useragent.h" diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp index f2224d1ba..67d0f3555 100644 --- a/beos/fetch_rsrc.cpp +++ b/beos/fetch_rsrc.cpp @@ -35,7 +35,6 @@ extern "C" { #include "content/fetch.h" #include "content/fetchers.h" #include "content/urldb.h" -#include "desktop/netsurf.h" #include "utils/nsoption.h" #include "utils/log.h" #include "utils/messages.h" diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp index b701b98f0..4881e8a41 100644 --- a/beos/scaffolding.cpp +++ b/beos/scaffolding.cpp @@ -56,6 +56,7 @@ extern "C" { #include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/netsurf.h" +#include "desktop/version.h" #include "desktop/plotters.h" #include "utils/nsoption.h" #include "desktop/textinput.h" diff --git a/beos/window.cpp b/beos/window.cpp index 886e20622..a8c7e8600 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -27,7 +27,6 @@ extern "C" { #include "desktop/browser_private.h" #include "desktop/mouse.h" #include "utils/nsoption.h" -#include "desktop/netsurf.h" #include "desktop/textinput.h" #include "desktop/font.h" #include "utils/log.h" diff --git a/cocoa/gui.m b/cocoa/gui.m index 5c8089e33..33bd6f0a3 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -28,7 +28,6 @@ #import "cocoa/schedule.h" #import "desktop/gui.h" -#import "desktop/netsurf.h" #import "desktop/browser_private.h" #import "utils/nsoption.h" #import "desktop/textinput.h" diff --git a/content/fetch.c b/content/fetch.c index 9a0796294..195f61fb7 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -40,7 +40,6 @@ #include #include "utils/config.h" -#include "desktop/netsurf.h" #include "desktop/gui_factory.h" #include "utils/corestrings.h" #include "utils/nsoption.h" diff --git a/content/fetchers/about.c b/content/fetchers/about.c index d9c37127f..18528cda7 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -50,7 +50,6 @@ #include "content/fetchers.h" #include "content/fetchers/about.h" #include "content/urldb.h" -#include "desktop/netsurf.h" #include "utils/nsoption.h" #include "utils/corestrings.h" #include "utils/log.h" diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 51b0f9974..4bd72a20e 100644 --- a/content/fetchers/curl.c +++ b/content/fetchers/curl.c @@ -41,7 +41,6 @@ #include #include "utils/config.h" -#include "desktop/netsurf.h" #include "desktop/gui_factory.h" #include "utils/corestrings.h" #include "utils/nsoption.h" diff --git a/content/fetchers/data.c b/content/fetchers/data.c index 94ba63827..52da9a416 100644 --- a/content/fetchers/data.c +++ b/content/fetchers/data.c @@ -34,7 +34,6 @@ #include "content/fetchers.h" #include "content/fetchers/data.h" #include "content/urldb.h" -#include "desktop/netsurf.h" #include "utils/corestrings.h" #include "utils/nsoption.h" #include "utils/log.h" diff --git a/content/fetchers/file.c b/content/fetchers/file.c index f08be6288..acb30c07a 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -42,7 +42,6 @@ #include -#include "desktop/netsurf.h" #include "desktop/gui_factory.h" #include "utils/corestrings.h" #include "utils/nsoption.h" diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 78ec8ab4c..39cee2e2b 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -23,11 +23,17 @@ #include #include #include - #include #include "utils/config.h" #include "utils/utsname.h" +#include "utils/nsoption.h" +#include "utils/corestrings.h" +#include "utils/log.h" +#include "utils/url.h" +#include "utils/utf8.h" +#include "utils/utils.h" +#include "utils/messages.h" #include "content/content_factory.h" #include "content/fetchers.h" #include "content/hlcache.h" @@ -36,23 +42,16 @@ #include "css/css.h" #include "image/image.h" #include "image/image_cache.h" -#include "desktop/netsurf.h" -#include "desktop/browser.h" -#include "desktop/system_colour.h" -#include "desktop/gui_factory.h" -#include "utils/nsoption.h" -#include "desktop/searchweb.h" - #include "javascript/js.h" - #include "render/html.h" #include "render/textplain.h" -#include "utils/corestrings.h" -#include "utils/log.h" -#include "utils/url.h" -#include "utils/utf8.h" -#include "utils/utils.h" -#include "utils/messages.h" + +#include "desktop/netsurf.h" +#include "desktop/version.h" +#include "desktop/browser.h" +#include "desktop/system_colour.h" +#include "desktop/searchweb.h" +#include "desktop/gui_factory.h" /** speculative pre-conversion small image size * diff --git a/desktop/netsurf.h b/desktop/netsurf.h index ff098f437..45a445747 100644 --- a/desktop/netsurf.h +++ b/desktop/netsurf.h @@ -1,5 +1,5 @@ /* - * Copyright 2003 Phil Mellor + * Copyright 2014 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -19,13 +19,8 @@ #ifndef _NETSURF_DESKTOP_NETSURF_H_ #define _NETSURF_DESKTOP_NETSURF_H_ -#include #include "utils/errors.h" -extern const char * const netsurf_version; -extern const int netsurf_version_major; -extern const int netsurf_version_minor; - struct netsurf_table; /** @@ -49,5 +44,4 @@ nserror netsurf_init(const char *messages, const char *store_path); */ extern void netsurf_exit(void); - #endif diff --git a/desktop/version.c b/desktop/version.c index 44d58715f..03918eabe 100644 --- a/desktop/version.c +++ b/desktop/version.c @@ -1,5 +1,25 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "testament.h" +#include "desktop/version.h" + const char * const netsurf_version = "3.3 (Dev" #if defined(CI_BUILD) " CI #" CI_BUILD diff --git a/desktop/version.h b/desktop/version.h new file mode 100644 index 000000000..7ab8eb425 --- /dev/null +++ b/desktop/version.h @@ -0,0 +1,43 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * + * Version information interface. + */ + +#ifndef _NETSURF_DESKTOP_VERSION_H_ +#define _NETSURF_DESKTOP_VERSION_H_ + +/** + * User friendly version string. + */ +extern const char * const netsurf_version; + +/** + * NetSuf browser major version number. + */ +extern const int netsurf_version_major; + +/** + * NetSuf browser minor version number. + */ +extern const int netsurf_version_minor; + +#endif diff --git a/gtk/about.c b/gtk/about.c index 84fb067c4..27c164a10 100644 --- a/gtk/about.c +++ b/gtk/about.c @@ -28,7 +28,7 @@ #include "utils/messages.h" #include "utils/nsoption.h" #include "desktop/browser.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "gtk/compat.h" #include "gtk/gui.h" diff --git a/javascript/jsapi/navigator.bnd b/javascript/jsapi/navigator.bnd index 94be63687..dee2cc23f 100644 --- a/javascript/jsapi/navigator.bnd +++ b/javascript/jsapi/navigator.bnd @@ -21,7 +21,7 @@ preamble %{ #include #include -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "utils/config.h" #include "utils/nsoption.h" #include "utils/useragent.h" diff --git a/monkey/dispatch.c b/monkey/dispatch.c index 4329ca100..9d022560c 100644 --- a/monkey/dispatch.c +++ b/monkey/dispatch.c @@ -25,7 +25,6 @@ #include "utils/utils.h" #include "utils/ring.h" -#include "desktop/netsurf.h" #include "monkey/dispatch.h" typedef struct cmdhandler { diff --git a/riscos/dialog.c b/riscos/dialog.c index 0244860cc..97c4f7b68 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -40,7 +40,7 @@ #include "utils/nsurl.h" #include "utils/url.h" #include "utils/utils.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "desktop/browser.h" #include "riscos/configure.h" diff --git a/riscos/download.c b/riscos/download.c index f52bbe88d..ab730eb36 100644 --- a/riscos/download.c +++ b/riscos/download.c @@ -45,7 +45,6 @@ #include "oslib/wimpspriteop.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/download.h" #include "utils/nsoption.h" #include "utils/log.h" diff --git a/riscos/iconbar.c b/riscos/iconbar.c index 6f0c7e083..9ca58c595 100644 --- a/riscos/iconbar.c +++ b/riscos/iconbar.c @@ -37,7 +37,6 @@ #include "utils/messages.h" #include "utils/utils.h" #include "utils/nsurl.h" -#include "desktop/netsurf.h" #include "desktop/browser.h" #include "riscos/gui.h" diff --git a/riscos/menus.c b/riscos/menus.c index 4158d23af..0b36c2665 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -42,7 +42,6 @@ #include "desktop/cookie_manager.h" #include "desktop/browser.h" #include "desktop/gui.h" -#include "desktop/netsurf.h" #include "desktop/textinput.h" #include "riscos/dialog.h" diff --git a/riscos/save.c b/riscos/save.c index cc8612bb5..588b9df32 100644 --- a/riscos/save.c +++ b/riscos/save.c @@ -46,7 +46,7 @@ #include "content/hlcache.h" #include "desktop/hotlist.h" #include "desktop/global_history.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "desktop/save_complete.h" #include "desktop/save_text.h" #include "desktop/thumbnail.h" diff --git a/test/llcache.c b/test/llcache.c index 643ff7f87..ae162b170 100644 --- a/test/llcache.c +++ b/test/llcache.c @@ -1,3 +1,21 @@ +/* + * Copyright 2011 John Mark Bell + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -16,7 +34,6 @@ * Things that we'd reasonably expect to have to implement * ******************************************************************************/ -/* desktop/netsurf.h */ bool verbose_log; /* utils/utils.h */ diff --git a/test/nsurl.c b/test/nsurl.c index 20774c41f..bd7dc80dc 100644 --- a/test/nsurl.c +++ b/test/nsurl.c @@ -1,3 +1,21 @@ +/* + * Copyright 2011 John Mark Bell + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -5,7 +23,6 @@ #include -#include "desktop/netsurf.h" #include "utils/corestrings.h" #include "utils/log.h" #include "utils/nsurl.h" diff --git a/utils/useragent.c b/utils/useragent.c index 91f43636c..16ed67a75 100644 --- a/utils/useragent.c +++ b/utils/useragent.c @@ -22,7 +22,7 @@ #include "utils/config.h" #include "utils/utsname.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "utils/log.h" #include "utils/useragent.h" diff --git a/windows/about.c b/windows/about.c index 74bca0ed9..fca417ade 100644 --- a/windows/about.c +++ b/windows/about.c @@ -24,7 +24,7 @@ #include "utils/utils.h" #include "utils/messages.h" -#include "desktop/netsurf.h" +#include "desktop/version.h" #include "utils/log.h" #include "windows/gui.h" diff --git a/windows/gui.c b/windows/gui.c index 091caca2b..0d148f2cc 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -35,7 +35,6 @@ #include "desktop/browser_history.h" #include "desktop/browser.h" #include "desktop/mouse.h" -#include "desktop/netsurf.h" #include "utils/nsoption.h" #include "desktop/plotters.h" #include "desktop/textinput.h"