27#include <proto/exec.h>
28#include <proto/intuition.h>
29#include <proto/utility.h>
31#include <graphics/gfxbase.h>
35#include <proto/arexx.h>
36#include <proto/bevel.h>
37#include <proto/bitmap.h>
38#include <proto/button.h>
39#include <proto/chooser.h>
40#include <proto/checkbox.h>
41#include <proto/clicktab.h>
42#include <proto/fuelgauge.h>
43#include <proto/getfile.h>
44#include <proto/getfont.h>
45#include <proto/getscreenmode.h>
46#include <proto/integer.h>
47#include <proto/label.h>
48#include <proto/layout.h>
49#include <proto/listbrowser.h>
50#include <proto/radiobutton.h>
51#include <proto/scroller.h>
52#include <proto/space.h>
53#include <proto/speedbar.h>
54#include <proto/string.h>
55#include <proto/window.h>
59#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
60 NSLOG(netsurf, INFO, "Opening %s v%d", LIB, LIBVER); \
61 if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
62 NSLOG(netsurf, INFO, " -> opened v%d.%d", ((struct Library *)PREFIX##Base)->lib_Version, ((struct Library *)PREFIX##Base)->lib_Revision); \
63 I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, INTERFACE, INTVER, NULL); \
64 if(I##PREFIX == NULL) { \
65 NSLOG(netsurf, INFO, "Failed to get %s interface v%d of %s", INTERFACE, INTVER, LIB); \
66 AMINS_LIB_CLOSE(PREFIX) \
68 STRPTR error = ASPrintf("Unable to open interface %s v%d\nof %s v%ld (fatal error - not an OS4 lib?)", INTERFACE, INTVER, LIB, LIBVER); \
69 ami_misc_fatal_error(error); \
75 NSLOG(netsurf, INFO, "Failed to open %s v%d", LIB, LIBVER); \
77 STRPTR error = ASPrintf("Unable to open %s v%ld (fatal error)", LIB, LIBVER); \
78 ami_misc_fatal_error(error); \
84#define AMINS_LIB_CLOSE(PREFIX) \
85 if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \
86 if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base); \
90#define AMINS_LIB_STRUCT(PREFIX) \
91 struct PREFIX##Base *PREFIX##Base = NULL; \
92 struct PREFIX##IFace *I##PREFIX = NULL;
94#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
95 NSLOG(netsurf, INFO, "Opening %s v%d", CLASS, CLASSVER); \
96 if((PREFIX##Base = OpenClass(CLASS, CLASSVER, &PREFIX##Class))) { \
97 NSLOG(netsurf, INFO, " -> opened v%d.%d", ((struct Library *)PREFIX##Base)->lib_Version, ((struct Library *)PREFIX##Base)->lib_Revision); \
98 if(NEEDINTERFACE == true) { \
99 NSLOG(netsurf, INFO, " + interface"); \
100 I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, "main", 1, NULL); \
101 if(I##PREFIX == NULL) { \
102 NSLOG(netsurf, ERROR, "Failed to get main interface v1 of %s", CLASS); \
106 if(PREFIX##Class == NULL) { \
107 NSLOG(netsurf, INFO, "Failed to open %s v%d", CLASS, CLASSVER); \
108 STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", CLASS, CLASSVER); \
109 ami_misc_fatal_error(error); \
114#define AMINS_CLASS_CLOSE(PREFIX) \
115 if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \
116 if(PREFIX##Base) CloseClass(PREFIX##Base); \
120#define AMINS_CLASS_STRUCT(PREFIX) \
121 struct ClassLibrary *PREFIX##Base = NULL; \
122 struct PREFIX##IFace *I##PREFIX = NULL; \
123 Class *PREFIX##Class = NULL;
126#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
127 NSLOG(netsurf, INFO, "Opening %s v%d", LIB, LIBVER); \
128 if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
129 NSLOG(netsurf, INFO, " -> opened v%d.%d", ((struct Library *)PREFIX##Base)->lib_Version, ((struct Library *)PREFIX##Base)->lib_Revision); \
131 NSLOG(netsurf, INFO, "Failed to open %s v%d", LIB, LIBVER); \
133 STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", LIB, LIBVER); \
134 ami_misc_fatal_error(error); \
140#define AMINS_LIB_CLOSE(PREFIX) \
141 if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base); \
144#define AMINS_LIB_STRUCT(PREFIX) \
145 struct PREFIX##Base *PREFIX##Base = NULL;
147#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
148 NSLOG(netsurf, INFO, "Opening %s v%d", CLASS, CLASSVER); \
149 if((PREFIX##Base = OpenLibrary(CLASS, CLASSVER))) { \
150 NSLOG(netsurf, INFO, " -> opened v%d.%d", ((struct Library *)PREFIX##Base)->lib_Version, ((struct Library *)PREFIX##Base)->lib_Revision); \
151 PREFIX##Class = CLASSGET##_GetClass(); \
153 if(PREFIX##Class == NULL) { \
154 NSLOG(netsurf, INFO, "Failed to open %s v%d", CLASS, CLASSVER); \
155 STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", CLASS, CLASSVER); \
156 ami_misc_fatal_error(error); \
161#define AMINS_CLASS_CLOSE(PREFIX) \
162 if(PREFIX##Base) CloseLibrary(PREFIX##Base); \
165#define AMINS_CLASS_STRUCT(PREFIX) \
166 struct Library *PREFIX##Base = NULL; \
167 Class *PREFIX##Class = NULL;
171#define GraphicsBase GfxBase
225 AMINS_LIB_OPEN(
"application.library", 53, Application,
"application", 2,
false)
233 AMINS_LIB_OPEN(
"datatypes.library", 39, DataTypes,
"main", 1,
true)
239 AMINS_LIB_OPEN(
"intuition.library", 40, Intuition,
"main", 1,
true)
243 AMINS_LIB_OPEN(
"workbench.library", 37, Workbench,
"main", 1,
true)
248 if(GfxBase->LibNode.lib_Version < 54)
278 AMINS_CLASS_OPEN(
"gadgets/fuelgauge.gadget", 41, FuelGauge, FUELGAUGE,
false)
281 AMINS_CLASS_OPEN(
"gadgets/getscreenmode.gadget", 41, GetScreenMode, GETSCREENMODE,
false)
285 AMINS_CLASS_OPEN(
"gadgets/listbrowser.gadget", 41, ListBrowser, LISTBROWSER,
true)
286 AMINS_CLASS_OPEN(
"gadgets/radiobutton.gadget", 41, RadioButton, RADIOBUTTON,
false)
#define AMINS_CLASS_STRUCT(PREFIX)
#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE)
#define AMINS_LIB_STRUCT(PREFIX)
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL)
#define AMINS_LIB_CLOSE(PREFIX)
void ami_libs_close(void)
#define AMINS_CLASS_CLOSE(PREFIX)
Minimal compatibility header for AmigaOS 3.
Interface to a number of general purpose functionality.