expat/amiga expat_base.h, NONE, 1.1 Makefile, 1.8, 1.9 README.txt, 1.8, 1.9 expat_68k.c, 1.2, 1.3 expat_68k.h, 1.1, 1.2 expat_68k_handler_stubs.c, 1.2, 1.3 expat_lib.c, 1.7, 1.8 launch.c, 1.3, 1.4 stdlib.c, 1.4, NONE
"Steven Solie" <[email protected]> Sat, 08 Aug 2009 03:48:57 +0000
| Newsgroups | gmane.text.xml.expat.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/expat/expat/amiga
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25352/amiga
Modified Files:
Makefile README.txt expat_68k.c expat_68k.h
expat_68k_handler_stubs.c expat_lib.c launch.c
Added Files:
expat_base.h
Removed Files:
stdlib.c
Log Message:
Some AmigaOS related changes.
--- NEW FILE: expat_base.h ---
/*
** 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
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** 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.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef EXPAT_BASE_H
#define EXPAT_BASE_H
#include <exec/libraries.h>
#include <dos/dos.h>
#include <interfaces/exec.h>
#include <interfaces/utility.h>
struct ExpatBase {
struct Library libNode;
uint16 pad;
BPTR SegList;
struct ExecIFace *IExec;
};
#endif
Index: Makefile
===================================================================
RCS file: /cvsroot/expat/expat/amiga/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Makefile 31 Jan 2009 20:57:34 -0000 1.8
+++ Makefile 8 Aug 2009 03:48:55 -0000 1.9
@@ -214,20 +214,19 @@
#############################################################################
-libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o libs/stdlib.o newlib/libexpat.a
- $(CC) -mcrt=newlib -nostartfiles -nostdlib $^ -o $@ newlib/libexpat.a
+libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o newlib/libexpat.a
+ $(CC) -mcrt=newlib -nostartfiles $^ -o $@ newlib/libexpat.a -Wl,--cref,-M,[email protected]
protect $@ -e
+ $(STRIP) $(STRIPFLAGS) $@
-libs/expat_lib.o: expat_lib.c
+libs/expat_lib.o: expat_lib.c expat_base.h
-libs/expat_68k.o: expat_68k.c expat_68k.h
+libs/expat_68k.o: expat_68k.c expat_68k.h expat_base.h
libs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h
libs/expat_vectors.o: expat_vectors.c
-libs/stdlib.o: stdlib.c
-
libs/launch.o: launch.c
#############################################################################
Index: README.txt
===================================================================
RCS file: /cvsroot/expat/expat/amiga/README.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- README.txt 10 Feb 2009 03:47:00 -0000 1.8
+++ README.txt 8 Aug 2009 03:48:55 -0000 1.9
@@ -39,6 +39,14 @@
HISTORY
=======
+53.1 - bumped version to match AmigaOS streaming
+ - modified to remove all global variables (except INewLib)
+ - removed replacements for malloc(), etc. which are now
+ handled by the respective C library
+ - compiled with the latest binutils which bumps the
+ AMIGAOS_DYNVERSION to 2 for the libexpat.so target
+ - now strips the expat.library binary
+
5.2 - fixed XML_Parse 68k stub which enables xmlviewer to work
without crashing
- added some new functions to the 68k jump table available
Index: expat_68k.c
===================================================================
RCS file: /cvsroot/expat/expat/amiga/expat_68k.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- expat_68k.c 10 Feb 2009 03:47:00 -0000 1.2
+++ expat_68k.c 8 Aug 2009 03:48:55 -0000 1.3
@@ -22,7 +22,7 @@
*/
/*
-** This file was originally automatically generated by fdtrans.
+** Note: This file was originally automatically generated by fdtrans.
*/
#ifdef __USE_INLINE__
@@ -35,6 +35,7 @@
#include <proto/exec.h>
#include <interfaces/expat.h>
#include "expat_68k.h"
+#include "expat_base.h"
STATIC ULONG stub_OpenPPC(ULONG *regarray)
@@ -74,12 +75,14 @@
struct Library *Base = (struct Library *) regarray[REG68K_A6/4];
struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);
struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;
+ struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;
M68kXML_Parser p;
p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);
if (p) {
p->p = Self->XML_ParserCreate((const XML_Char *)regarray[8]);
if (p->p) {
+ p->IExec = IExec;
Self->XML_SetUserData(p->p, p);
return p;
}
@@ -94,12 +97,14 @@
struct Library *Base = (struct Library *) regarray[REG68K_A6/4];
struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);
struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;
+ struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;
M68kXML_Parser p;
p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);
if (p) {
p->p = Self->XML_ParserCreateNS((const XML_Char *)regarray[8], (XML_Char)regarray[0]);
if (p->p) {
+ p->IExec = IExec;
Self->XML_SetUserData(p->p, p);
return p;
}
@@ -114,6 +119,7 @@
struct Library *Base = (struct Library *) regarray[REG68K_A6/4];
struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);
struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;
+ struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;
M68kXML_Parser p;
p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);
@@ -122,6 +128,7 @@
(const XML_Memory_Handling_Suite *)regarray[9],
(const XML_Char *)regarray[10]);
if (p->p) {
+ p->IExec = IExec;
Self->XML_SetUserData(p->p, p);
return p;
}
@@ -136,6 +143,7 @@
struct Library *Base = (struct Library *) regarray[REG68K_A6/4];
struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);
struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;
+ struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;
M68kXML_Parser p;
p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);
@@ -143,6 +151,7 @@
p->p = Self->XML_ExternalEntityParserCreate((XML_Parser)regarray[8],
(const XML_Char *)regarray[9], (const XML_Char *)regarray[10]);
if (p->p) {
+ p->IExec = IExec;
Self->XML_SetUserData(p->p, p);
return p;
}
@@ -157,6 +166,7 @@
struct Library *Base = (struct Library *) regarray[REG68K_A6/4];
struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);
struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;
+ struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;
M68kXML_Parser p = (M68kXML_Parser)regarray[8];
if (p) {
Index: expat_68k.h
===================================================================
RCS file: /cvsroot/expat/expat/amiga/expat_68k.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- expat_68k.h 31 Jan 2009 06:21:09 -0000 1.1
+++ expat_68k.h 8 Aug 2009 03:48:55 -0000 1.2
@@ -1,3 +1,26 @@
+/*
+** 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
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** 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.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
#ifndef EXPAT_68K_H
#define EXPAT_68K_H
@@ -7,6 +30,7 @@
typedef struct M68kXML_ParserStruct {
XML_Parser p;
+ struct ExecIFace *IExec;
void *handlerarg;
void *extenthandlerarg;
void *enchandlerarg;
Index: expat_68k_handler_stubs.c
===================================================================
RCS file: /cvsroot/expat/expat/amiga/expat_68k_handler_stubs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- expat_68k_handler_stubs.c 31 Jan 2009 20:57:34 -0000 1.2
+++ expat_68k_handler_stubs.c 8 Aug 2009 03:48:55 -0000 1.3
@@ -21,19 +21,23 @@
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifdef __USE_INLINE__
+#undef __USE_INLINE__
+#endif
+
#include "expat_68k.h"
#include <exec/emulation.h>
#include <proto/exec.h>
#include <stdarg.h>
-static uint32 VARARGS68K call_68k_code (void *code, int num_args, ...) {
+static uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) {
uint32 res = 0;
va_list vargs;
va_startlinear(vargs, num_args);
uint32 *args = va_getlinearva(vargs, uint32 *);
- uint8 *stack = AllocVec(4096, MEMF_SHARED);
+ uint8 *stack = IExec->AllocVec(4096, MEMF_SHARED);
if (stack) {
uint32 *sp = (uint32 *)(stack + 4096);
args += num_args;
@@ -41,8 +45,8 @@
*--sp = *--args;
}
- res = EmulateTags(code, ET_StackPtr, sp, TAG_END);
- FreeVec(stack);
+ res = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END);
+ IExec->FreeVec(stack);
}
va_end(vargs);
@@ -52,47 +56,47 @@
void _68k_startelementhandler(void *userdata, const char *name, const char **attrs) {
M68kXML_Parser p = userdata;
- call_68k_code(p->startelementhandler, 3, p->handlerarg, name, attrs);
+ call_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs);
}
void _68k_endelementhandler(void *userdata, const char *name) {
M68kXML_Parser p = userdata;
- call_68k_code(p->endelementhandler, 2, p->handlerarg, name);
+ call_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name);
}
void _68k_chardatahandler(void *userdata, const char *s, int len) {
M68kXML_Parser p = userdata;
- call_68k_code(p->chardatahandler, 3, p->handlerarg, s, len);
+ call_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len);
}
void _68k_procinsthandler(void *userdata, const char *target, const char *data) {
M68kXML_Parser p = userdata;
- call_68k_code(p->procinsthandler, 3, p->handlerarg, target, data);
+ call_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data);
}
void _68k_commenthandler(void *userdata, const char *data) {
M68kXML_Parser p = userdata;
- call_68k_code(p->commenthandler, 2, p->handlerarg, data);
+ call_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data);
}
void _68k_startcdatahandler(void *userdata) {
M68kXML_Parser p = userdata;
- call_68k_code(p->startcdatahandler, 1, p->handlerarg);
+ call_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg);
}
void _68k_endcdatahandler(void *userdata) {
M68kXML_Parser p = userdata;
- call_68k_code(p->endcdatahandler, 1, p->handlerarg);
+ call_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg);
}
void _68k_defaulthandler(void *userdata, const char *s, int len) {
M68kXML_Parser p = userdata;
- call_68k_code(p->defaulthandler, 3, p->handlerarg, s, len);
+ call_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len);
}
void _68k_defaulthandlerexp(void *userdata, const char *s, int len) {
M68kXML_Parser p = userdata;
- call_68k_code(p->defaulthandlerexp, 3, p->handlerarg, s, len);
+ call_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len);
}
int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base,
@@ -100,51 +104,51 @@
{
M68kXML_Parser p = XML_GetUserData(parser);
void *arg = p->extenthandlerarg;
- return (int)call_68k_code(p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid);
+ return (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid);
}
int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) {
M68kXML_Parser p = enchandlerdata;
- return (int)call_68k_code(p->unknownenchandler, 3, p->enchandlerarg, name, info);
+ return (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info);
}
void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) {
M68kXML_Parser p = userdata;
- call_68k_code(p->startnamespacehandler, 3, p->handlerarg, prefix, uri);
+ call_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri);
}
void _68k_endnamespacehandler(void *userdata, const char *prefix) {
M68kXML_Parser p = userdata;
- call_68k_code(p->endnamespacehandler, 2, p->handlerarg, prefix);
+ call_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix);
}
void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) {
M68kXML_Parser p = userdata;
- call_68k_code(p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone);
+ call_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone);
}
void _68k_startdoctypehandler(void *userdata, const char *doctypename,
const char *sysid, const char *pubid, int has_internal_subset)
{
M68kXML_Parser p = userdata;
- call_68k_code(p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset);
+ call_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset);
}
void _68k_enddoctypehandler(void *userdata) {
M68kXML_Parser p = userdata;
- call_68k_code(p->enddoctypehandler, 1, p->handlerarg);
+ call_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg);
}
void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) {
M68kXML_Parser p = userdata;
- call_68k_code(p->elementdeclhandler, 3, p->handlerarg, name, model);
+ call_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model);
}
void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname,
const char *att_type, const char *dflt, int isrequired)
{
M68kXML_Parser p = userdata;
- call_68k_code(p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired);
+ call_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired);
}
void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity,
@@ -152,7 +156,7 @@
const char *notationname)
{
M68kXML_Parser p = userdata;
- call_68k_code(p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity,
+ call_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity,
value, value_length, base, sysid, pubid, notationname);
}
@@ -160,22 +164,22 @@
const char *sysid, const char *pubid, const char *notationname)
{
M68kXML_Parser p = userdata;
- call_68k_code(p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname);
+ call_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname);
}
void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base,
const char *sysid, const char *pubid)
{
M68kXML_Parser p = userdata;
- call_68k_code(p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid);
+ call_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid);
}
int _68k_notstandalonehandler(void *userdata) {
M68kXML_Parser p = userdata;
- return (int)call_68k_code(p->notstandalonehandler, 1, p->handlerarg);
+ return (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg);
}
void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) {
M68kXML_Parser p = userdata;
- call_68k_code(p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity);
+ call_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity);
}
Index: expat_lib.c
===================================================================
RCS file: /cvsroot/expat/expat/amiga/expat_lib.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- expat_lib.c 10 Feb 2009 03:47:00 -0000 1.7
+++ expat_lib.c 8 Aug 2009 03:48:55 -0000 1.8
@@ -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 5
-#define REVISION 2
-#define VSTRING "expat.library 5.2 (9.2.2009)" /* 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 @@
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[] = {
@@ -112,20 +120,13 @@
};
-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;
@@ -134,29 +135,20 @@
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;
}
@@ -204,29 +196,25 @@
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;
@@ -234,3 +222,26 @@
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);
+ }
+}
Index: launch.c
===================================================================
RCS file: /cvsroot/expat/expat/amiga/launch.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- launch.c 31 Jan 2009 06:21:09 -0000 1.3
+++ launch.c 8 Aug 2009 03:48:55 -0000 1.4
@@ -21,6 +21,10 @@
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifdef __USE_INLINE__
+#undef __USE_INLINE__
+#endif
+
#include <stdlib.h>
#include <proto/exec.h>
@@ -34,20 +38,20 @@
void setup()
{
- ExpatBase = OpenLibrary("expat.library", 5);
- IExpat = (struct ExpatIFace*)GetInterface(ExpatBase, "main", 1, NULL);
+ ExpatBase = IExec->OpenLibrary("expat.library", 53);
+ IExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, "main", 1, NULL);
if ( IExpat == 0 ) {
- DebugPrintF("Can't open expat.library\n");
+ IExec->DebugPrintF("Can't open expat.library\n");
}
}
void cleanup()
{
- DropInterface((struct Interface*)IExpat);
+ IExec->DropInterface((struct Interface*)IExpat);
IExpat = 0;
- CloseLibrary(ExpatBase);
+ IExec->CloseLibrary(ExpatBase);
ExpatBase = 0;
}
--- stdlib.c DELETED ---