summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-09 00:09:44 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-09 00:09:44 +0000
commit433ef2c12a9b6e207343eb07326e8b7728cb5cac (patch)
tree842ae24bb7df97a7d7276fada761089be7cd7994
parent5562c9a553fe539d0d1fbf05dba89b1b1f577fae (diff)
parent4329c7a328f5841b9efdf74b7cd450b87f10f343 (diff)
downloadnetsurf-433ef2c12a9b6e207343eb07326e8b7728cb5cac.tar.gz
netsurf-433ef2c12a9b6e207343eb07326e8b7728cb5cac.tar.bz2
Merge branch 'chris/remove-libauto'
Remove dependency on libauto as using it is no longer recommended.
-rw-r--r--amiga/Makefile.target6
-rw-r--r--amiga/gui.c29
-rw-r--r--amiga/libs.c168
-rw-r--r--amiga/libs.h25
-rw-r--r--amiga/misc.h1
-rwxr-xr-xamiga/thumbnail.c1
6 files changed, 206 insertions, 24 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 8939dbc83..bb8b8173d 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -30,7 +30,7 @@ ifeq ($(HOST),amiga)
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
CFLAGS += -I /SDK/local/common/include/libpng12
- LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lauto -lpbl
+ LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lpbl
LDFLAGS += -lssl -lcrypto -ldom -lhubbub -lcss -lparserutils -lwapcaplet
else
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
@@ -53,7 +53,7 @@ else
ifeq ($(SUBTARGET),os3)
LDFLAGS += -lpbl -liconv
else
- LDFLAGS += -lauto -lpbl -liconv
+ LDFLAGS += -lpbl -liconv
endif
endif
@@ -69,7 +69,7 @@ S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c context_menu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
- sslcert.c gui_options.c print.c theme.c drag.c icon.c \
+ sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c \
agclass/amigaguide_class.c
diff --git a/amiga/gui.c b/amiga/gui.c
index 231bcb3e4..c45ef23ce 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -133,6 +133,7 @@
#include "amiga/hotlist.h"
#include "amiga/icon.h"
#include "amiga/launch.h"
+#include "amiga/libs.h"
#include "amiga/login.h"
#include "amiga/menu.h"
#include "amiga/misc.h"
@@ -167,11 +168,6 @@ struct ami_gui_tb_userdata {
};
struct MsgPort *appport;
-struct Library *KeymapBase = NULL;
-struct KeymapIFace *IKeymap = NULL;
-struct Library *ApplicationBase=NULL;
-struct ApplicationIFace *IApplication=NULL;
-
Class *urlStringClass;
BOOL locked_screen = FALSE;
@@ -408,16 +404,6 @@ bool ami_locate_resource(char *fullpath, const char *file)
static void ami_open_resources(void)
{
- /* Allocate ports/ASL and open libraries and devices */
-
- if((KeymapBase = OpenLibrary("keymap.library",37))) {
- IKeymap = (struct KeymapIFace *)GetInterface(KeymapBase,"main",1,NULL);
- }
-
- if((ApplicationBase = OpenLibrary("application.library", 53))) {
- IApplication = (struct ApplicationIFace *)GetInterface(ApplicationBase, "application", 2, NULL);
- }
-
urlStringClass = MakeStringClass();
if(!(appport = AllocSysObjectTags(ASOT_PORT,
@@ -2985,12 +2971,6 @@ static void gui_quit(void)
ami_openurl_close();
FreeStringClass(urlStringClass);
- if(IApplication) DropInterface((struct Interface *)IApplication);
- if(ApplicationBase) CloseLibrary(ApplicationBase);
-
- if(IKeymap) DropInterface((struct Interface *)IKeymap);
- if(KeymapBase) CloseLibrary(KeymapBase);
-
LOG(("Freeing scheduler"));
ami_schedule_free();
ami_schedule_close_timer();
@@ -3001,6 +2981,8 @@ static void gui_quit(void)
FreeVec(current_user_dir);
FreeVec(current_user_faviconcache);
FreeVec(current_user);
+
+ ami_libs_close();
}
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail)
@@ -5268,6 +5250,11 @@ int main(int argc, char** argv)
*/
nslog_init(NULL, &argc, argv);
+ /* Need to do this before opening any splash windows etc... */
+ if ((ami_libs_open() == false)) {
+ return 20; /* FAIL */
+ }
+
/* Open splash window */
Object *splash_window = ami_gui_splash_open();
diff --git a/amiga/libs.c b/amiga/libs.c
new file mode 100644
index 000000000..23b29fc42
--- /dev/null
+++ b/amiga/libs.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "amiga/libs.h"
+#include "utils/utils.h"
+#include "utils/log.h"
+
+#include <proto/exec.h>
+
+#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
+ LOG(("Opening %s v%d", LIB, LIBVER)); \
+ if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \
+ I##PREFIX = (struct PREFIX##IFace *)GetInterface(PREFIX##Base, INTERFACE, INTVER, NULL); \
+ } else { \
+ warn_user("CompError", LIB); \
+ if(FAIL == true) return false; \
+ }
+
+#define AMINS_LIB_CLOSE(PREFIX) \
+ if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \
+ if(PREFIX##Base) CloseLibrary(PREFIX##Base);
+
+#define AMINS_LIB_STRUCT(PREFIX) \
+ struct Library *PREFIX##Base; \
+ struct PREFIX##IFace *I##PREFIX;
+
+#define GraphicsBase GfxBase /* graphics.library is a bit weird */
+
+AMINS_LIB_STRUCT(Application);
+AMINS_LIB_STRUCT(Asl);
+AMINS_LIB_STRUCT(DataTypes);
+AMINS_LIB_STRUCT(Diskfont);
+AMINS_LIB_STRUCT(Graphics);
+AMINS_LIB_STRUCT(GadTools);
+AMINS_LIB_STRUCT(Icon);
+AMINS_LIB_STRUCT(IFFParse);
+AMINS_LIB_STRUCT(Intuition);
+AMINS_LIB_STRUCT(Keymap);
+AMINS_LIB_STRUCT(Layers);
+AMINS_LIB_STRUCT(Locale);
+AMINS_LIB_STRUCT(P96);
+AMINS_LIB_STRUCT(Workbench);
+
+AMINS_LIB_STRUCT(ARexx);
+AMINS_LIB_STRUCT(Bevel);
+AMINS_LIB_STRUCT(BitMap);
+AMINS_LIB_STRUCT(Chooser);
+AMINS_LIB_STRUCT(CheckBox);
+AMINS_LIB_STRUCT(ClickTab);
+AMINS_LIB_STRUCT(FuelGauge);
+AMINS_LIB_STRUCT(GetFile);
+AMINS_LIB_STRUCT(GetFont);
+AMINS_LIB_STRUCT(GetScreenMode);
+AMINS_LIB_STRUCT(Integer);
+AMINS_LIB_STRUCT(Label);
+AMINS_LIB_STRUCT(Layout);
+AMINS_LIB_STRUCT(ListBrowser);
+AMINS_LIB_STRUCT(RadioButton);
+AMINS_LIB_STRUCT(Requester);
+AMINS_LIB_STRUCT(Scroller);
+AMINS_LIB_STRUCT(Space);
+AMINS_LIB_STRUCT(SpeedBar);
+AMINS_LIB_STRUCT(String);
+AMINS_LIB_STRUCT(Window);
+
+
+bool ami_libs_open(void)
+{
+ AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false)
+ AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
+ AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1, true)
+ AMINS_LIB_OPEN("diskfont.library", 50, Diskfont, "main", 1, true)
+ AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
+ AMINS_LIB_OPEN("graphics.library", 50, Graphics, "main", 1, true)
+ AMINS_LIB_OPEN("icon.library", 50, Icon, "main", 1, true)
+ AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1, true)
+ AMINS_LIB_OPEN("intuition.library", 37, Intuition, "main", 1, true)
+ AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true)
+ AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true)
+ AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true)
+ AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true)
+ AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true)
+
+ /* BOOPSI classes.
+ * \todo These should be opened using OpenClass(), however as
+ * the macros all use the deprecated _GetClass() functions,
+ * we may as well just open them normally for now. */
+
+ AMINS_LIB_OPEN("classes/arexx.class", 50, ARexx, "main", 1, true)
+ AMINS_LIB_OPEN("images/bevel.image", 50, Bevel, "main", 1, true)
+ AMINS_LIB_OPEN("images/bitmap.image", 50, BitMap, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/checkbox.gadget", 50, CheckBox, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/chooser.gadget", 50, Chooser, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/clicktab.gadget", 50, ClickTab, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 50, FuelGauge, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getfile.gadget", 50, GetFile, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getfont.gadget", 50, GetFont, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 50, GetScreenMode, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/integer.gadget", 50, Integer, "main", 1, true)
+ AMINS_LIB_OPEN("images/label.image", 50, Label, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/layout.gadget", 50, Layout, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 50, ListBrowser, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 50, RadioButton, "main", 1, true)
+ AMINS_LIB_OPEN("classes/requester.class", 50, Requester, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/scroller.gadget", 50, Scroller, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/space.gadget", 50, Space, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/speedbar.gadget", 50, SpeedBar, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/string.gadget", 50, String, "main", 1, true)
+ AMINS_LIB_OPEN("classes/window.class", 50, Window, "main", 1, true)
+
+ return true;
+}
+
+void ami_libs_close(void)
+{
+ AMINS_LIB_CLOSE(ARexx)
+ AMINS_LIB_CLOSE(Bevel)
+ AMINS_LIB_CLOSE(BitMap)
+ AMINS_LIB_CLOSE(CheckBox)
+ AMINS_LIB_CLOSE(Chooser)
+ AMINS_LIB_CLOSE(ClickTab)
+ AMINS_LIB_CLOSE(FuelGauge)
+ AMINS_LIB_CLOSE(GetFile)
+ AMINS_LIB_CLOSE(GetFont)
+ AMINS_LIB_CLOSE(GetScreenMode)
+ AMINS_LIB_CLOSE(Integer)
+ AMINS_LIB_CLOSE(Label)
+ AMINS_LIB_CLOSE(Layout)
+ AMINS_LIB_CLOSE(ListBrowser)
+ AMINS_LIB_CLOSE(RadioButton)
+ AMINS_LIB_CLOSE(Requester)
+ AMINS_LIB_CLOSE(Scroller)
+ AMINS_LIB_CLOSE(Space)
+ AMINS_LIB_CLOSE(SpeedBar)
+ AMINS_LIB_CLOSE(String)
+ AMINS_LIB_CLOSE(Window)
+
+ AMINS_LIB_CLOSE(Application)
+ AMINS_LIB_CLOSE(Asl)
+ AMINS_LIB_CLOSE(DataTypes)
+ AMINS_LIB_CLOSE(Diskfont)
+ AMINS_LIB_CLOSE(GadTools)
+ AMINS_LIB_CLOSE(Graphics)
+ AMINS_LIB_CLOSE(Icon)
+ AMINS_LIB_CLOSE(IFFParse)
+ AMINS_LIB_CLOSE(Intuition)
+ AMINS_LIB_CLOSE(Keymap)
+ AMINS_LIB_CLOSE(Layers)
+ AMINS_LIB_CLOSE(Locale)
+ AMINS_LIB_CLOSE(P96)
+ AMINS_LIB_CLOSE(Workbench)
+}
+
diff --git a/amiga/libs.h b/amiga/libs.h
new file mode 100644
index 000000000..55e4799a4
--- /dev/null
+++ b/amiga/libs.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMIGA_LIBS_H
+#include <stdbool.h>
+
+bool ami_libs_open(void);
+void ami_libs_close(void);
+#endif
+
diff --git a/amiga/misc.h b/amiga/misc.h
index ce2d94793..9adbb7352 100644
--- a/amiga/misc.h
+++ b/amiga/misc.h
@@ -18,6 +18,7 @@
#ifndef AMIGA_MISC_H
#define AMIGA_MISC_H
+#include <exec/types.h>
extern struct gui_file_table *amiga_file_table;
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index 02b0aba51..ea681d269 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -39,6 +39,7 @@
#include "amiga/gui.h"
#include "amiga/bitmap.h"
+
bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
nsurl *url)
{