summaryrefslogtreecommitdiff
path: root/expat/amiga/expat_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'expat/amiga/expat_lib.c')
-rw-r--r--expat/amiga/expat_lib.c114
1 files changed, 64 insertions, 50 deletions
diff --git a/expat/amiga/expat_lib.c b/expat/amiga/expat_lib.c
index 039c48d21..70e91b101 100644
--- a/expat/amiga/expat_lib.c
+++ b/expat/amiga/expat_lib.c
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 2001-2007 Expat maintainers.
+** Copyright (c) 2001-2009 Expat maintainers.
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
@@ -8,10 +8,10 @@
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
-**
+**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
-**
+**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -21,24 +21,30 @@
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifdef __USE_INLINE__
+#undef __USE_INLINE__
+#endif
+
+#define __NOLIBBASE__
+#define __NOGLOBALIFACE__
+
#include <dos/dos.h>
#include <proto/exec.h>
+#include "expat_base.h"
+
+
#define LIBNAME "expat.library"
#define LIBPRI 0
-#define VERSION 4
-#define REVISION 2
-#define VSTRING "expat.library 4.2 (2.6.2007)" /* dd.mm.yyyy */
+#define VERSION 53
+#define REVISION 1
+#define VSTRING "expat.library 53.1 (7.8.2009)" /* dd.mm.yyyy */
static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING;
-struct ExpatBase {
- struct Library libNode;
- uint16 pad;
- BPTR SegList;
-};
+struct Interface *INewlib = 0;
struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys);
@@ -47,6 +53,8 @@ uint32 libRelease (struct LibraryManagerInterface *Self);
struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version);
BPTR libClose (struct LibraryManagerInterface *Self);
BPTR libExpunge (struct LibraryManagerInterface *Self);
+struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer);
+void closeInterface(struct ExecIFace *IExec, struct Interface *iface);
static APTR lib_manager_vectors[] = {
@@ -87,10 +95,13 @@ static APTR libInterfaces[] = {
};
+extern void *VecTable68K[];
+
static struct TagItem libCreateTags[] = {
{ CLT_DataSize, sizeof(struct ExpatBase) },
{ CLT_InitFunc, (uint32)libInit },
{ CLT_Interfaces, (uint32)libInterfaces },
+ { CLT_Vector68K, (uint32)VecTable68K },
{ TAG_END, 0 }
};
@@ -109,20 +120,13 @@ static struct Resident __attribute__((used)) lib_res = {
};
-struct Library *DOSLib = 0;
-struct Library *UtilityBase = 0;
-
-struct ExecIFace *IExec = 0;
-struct DOSIFace *IDOS = 0;
-struct UtilityIFace *IUtility = 0;
-
-
-void _start()
+int32 _start()
{
+ return RETURN_FAIL;
}
-struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys)
+struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *iexec)
{
libBase->libNode.lib_Node.ln_Type = NT_LIBRARY;
libBase->libNode.lib_Node.ln_Pri = LIBPRI;
@@ -131,29 +135,20 @@ struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIF
libBase->libNode.lib_Version = VERSION;
libBase->libNode.lib_Revision = REVISION;
libBase->libNode.lib_IdString = VSTRING;
- libBase->SegList = seglist;
- IExec = ISys;
+ libBase->SegList = seglist;
- DOSLib = OpenLibrary("dos.library", 51);
- if ( DOSLib != 0 ) {
- IDOS = (struct DOSIFace *)GetInterface(DOSLib, "main", 1, NULL);
- if ( IDOS != 0 ) {
- UtilityBase = OpenLibrary("utility.library", 51);
- if ( UtilityBase != 0 ) {
- IUtility = (struct UtilityIFace*)GetInterface(UtilityBase, "main", 1, NULL);
- if ( IUtility != 0 ) {
- return libBase;
- }
+ libBase->IExec = iexec;
+ INewlib = openInterface(iexec, "newlib.library", 0);
- CloseLibrary(UtilityBase);
- }
+ if ( INewlib != 0 ) {
+ return libBase;
+ }
- DropInterface((struct Interface *)IDOS);
- }
+ closeInterface(iexec, INewlib);
+ INewlib = 0;
- CloseLibrary(DOSLib);
- }
+ iexec->DeleteLibrary(&libBase->libNode);
return NULL;
}
@@ -201,29 +196,25 @@ BPTR libClose( struct LibraryManagerInterface *Self )
return (BPTR)Self->LibExpunge();
}
else {
- return 0;
+ return ZERO;
}
}
BPTR libExpunge( struct LibraryManagerInterface *Self )
{
- struct ExpatBase *libBase;
- BPTR result = 0;
-
- libBase = (struct ExpatBase *)Self->Data.LibBase;
+ struct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase;
+ BPTR result = ZERO;
if (libBase->libNode.lib_OpenCnt == 0) {
- Remove(&libBase->libNode.lib_Node);
+ libBase->IExec->Remove(&libBase->libNode.lib_Node);
result = libBase->SegList;
- DropInterface((struct Interface *)IUtility);
- CloseLibrary(UtilityBase);
- DropInterface((struct Interface *)IDOS);
- CloseLibrary(DOSLib);
+ closeInterface(libBase->IExec, INewlib);
+ INewlib = 0;
- DeleteLibrary(&libBase->libNode);
+ libBase->IExec->DeleteLibrary(&libBase->libNode);
}
else {
libBase->libNode.lib_Flags |= LIBF_DELEXP;
@@ -231,3 +222,26 @@ BPTR libExpunge( struct LibraryManagerInterface *Self )
return result;
}
+
+
+struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer)
+{
+ struct Library *base = IExec->OpenLibrary(libName, libVer);
+ struct Interface *iface = IExec->GetInterface(base, "main", 1, 0);
+ if (iface == 0) {
+ IExec->CloseLibrary(base);
+ }
+
+ return iface;
+}
+
+
+void closeInterface(struct ExecIFace *IExec, struct Interface *iface)
+{
+ if (iface != 0)
+ {
+ struct Library *base = iface->Data.LibBase;
+ IExec->DropInterface(iface);
+ IExec->CloseLibrary(base);
+ }
+}