1 /***************************************************************************
3 openurl.library - universal URL display and browser launcher library
4 Copyright (C) 1998-2005 by Troels Walsted Hansen, et al.
5 Copyright (C) 2005-2009 by openurl.library Open Source Team
7 This library is free software; it has been placed in the public domain
8 and you can freely redistribute it and/or modify it. Please note, however,
9 that some components may be under the LGPL or GPL license.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 openurl.library project: http://sourceforge.net/projects/openurllib/
19 ***************************************************************************/
25 #if defined(__amigaos4__)
26 struct Library
*DOSBase
= NULL
;
27 struct Library
*UtilityBase
= NULL
;
28 struct Library
*RexxSysBase
= NULL
;
29 struct Library
*IFFParseBase
= NULL
;
31 struct DOSIFace
* IDOS
= NULL
;
32 struct UtilityIFace
* IUtility
= NULL
;
33 struct RexxSysIFace
* IRexxSys
= NULL
;
34 struct IFFParseIFace
* IIFFParse
= NULL
;
36 #if !defined(__NEWLIB__)
37 extern struct Library
*__UtilityBase
;
38 extern struct UtilityIFace
* __IUtility
;
42 struct DosLibrary
*DOSBase
= NULL
;
44 struct UtilityBase
*UtilityBase
= NULL
;
46 struct Library
*UtilityBase
= NULL
;
47 struct Library
*__UtilityBase
= NULL
; // required by clib2 & libnix
49 #if defined(__MORPHOS__)
50 struct Library
*RexxSysBase
= NULL
;
52 struct RxsLib
*RexxSysBase
= NULL
;
54 struct Library
*IFFParseBase
= NULL
;
57 /***********************************************************************/
60 freeBase(struct LibraryHeader
*lib
)
64 D(DBF_STARTUP
, "freeing all resources of openurl.library");
66 if(lib
->prefs
!= NULL
)
68 URL_FreePrefsA(lib
->prefs
,NULL
);
74 DROPINTERFACE(IRexxSys
);
75 CloseLibrary((struct Library
*)RexxSysBase
);
81 DROPINTERFACE(IIFFParse
);
82 CloseLibrary(IFFParseBase
);
86 // delete our private memory pool
89 #if defined(__amigaos4__)
90 FreeSysObject(ASOT_MEMPOOL
, lib
->pool
);
92 DeletePool(lib
->pool
);
99 DROPINTERFACE(IUtility
);
100 CloseLibrary((struct Library
*)UtilityBase
);
107 CloseLibrary((struct Library
*)DOSBase
);
111 CLEAR_FLAG(lib
->flags
, BASEFLG_Init
);
117 /***********************************************************************/
120 initBase(struct LibraryHeader
*lib
)
124 if((DOSBase
= (APTR
)OpenLibrary("dos.library", 37)) &&
125 GETINTERFACE(IDOS
, DOSBase
))
127 if((UtilityBase
= (APTR
)OpenLibrary("utility.library", 37)) &&
128 GETINTERFACE(IUtility
, UtilityBase
))
130 // we have to please the internal utilitybase
131 // pointers of libnix and clib2
132 #if !defined(__NEWLIB__) && !defined(__AROS__)
133 __UtilityBase
= (APTR
)UtilityBase
;
134 #if defined(__amigaos4__)
135 __IUtility
= IUtility
;
139 // setup the debugging stuff
144 if((IFFParseBase
= OpenLibrary("iffparse.library", 37)) &&
145 GETINTERFACE(IIFFParse
, IFFParseBase
))
146 if((RexxSysBase
= (APTR
)OpenLibrary("rexxsyslib.library", 36)) &&
147 GETINTERFACE(IRexxSys
, RexxSysBase
))
149 #if defined(__amigaos4__)
150 lib
->pool
= AllocSysObjectTags(ASOT_MEMPOOL
, ASOPOOL_MFlags
, MEMF_SHARED
|MEMF_CLEAR
,
151 ASOPOOL_Puddle
, 4096,
152 ASOPOOL_Threshold
, 512,
153 ASOPOOL_Name
, "openurl.library pool",
154 ASOPOOL_LockMem
, FALSE
,
157 lib
->pool
= CreatePool(MEMF_CLEAR
, 4096, 512);
159 if(lib
->pool
!= NULL
)
161 lib
->prefs
= loadPrefsNotFail();
163 if(lib
->prefs
!= NULL
)
165 SET_FLAG(lib
->flags
, BASEFLG_Init
);
181 /***********************************************************************/