Diff for /embedaddon/expat/amiga/expat_lib.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:00:54 version 1.1.1.2, 2014/06/15 16:09:43
Line 1 Line 1
 /*  /*
** Copyright (c) 2001-2007 Expat maintainers.** Copyright (c) 2001-2009 Expat maintainers.
 **  **
 ** Permission is hereby granted, free of charge, to any person obtaining  ** Permission is hereby granted, free of charge, to any person obtaining
 ** a copy of this software and associated documentation files (the  ** a copy of this software and associated documentation files (the
Line 8 Line 8
 ** distribute, sublicense, and/or sell copies of the Software, and to  ** distribute, sublicense, and/or sell copies of the Software, and to
 ** permit persons to whom the Software is furnished to do so, subject to  ** permit persons to whom the Software is furnished to do so, subject to
 ** the following conditions:  ** the following conditions:
** **
 ** The above copyright notice and this permission notice shall be included  ** The above copyright notice and this permission notice shall be included
 ** in all copies or substantial portions of the Software.  ** in all copies or substantial portions of the Software.
** **
 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Line 21 Line 21
 ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ** 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 <dos/dos.h>
 #include <proto/exec.h>  #include <proto/exec.h>
   
   #include "expat_base.h"
   
   
 #define LIBNAME         "expat.library"  #define LIBNAME         "expat.library"
 #define LIBPRI          0  #define LIBPRI          0
#define VERSION         4#define VERSION         53
#define REVISION        2#define REVISION        1
#define VSTRING         "expat.library 4.2 (2.6.2007)"  /* dd.mm.yyyy */#define VSTRING         "expat.library 53.1 (7.8.2009)"  /* dd.mm.yyyy */
   
   
 static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING;  static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING;
   
   
struct ExpatBase {struct Interface *INewlib = 0;
        struct Library libNode; 
        uint16 pad; 
        BPTR SegList; 
}; 
   
   
 struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys);  struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys);
Line 47  uint32 libRelease (struct LibraryManagerInterface *Sel Line 53  uint32 libRelease (struct LibraryManagerInterface *Sel
 struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version);  struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version);
 BPTR libClose (struct LibraryManagerInterface *Self);  BPTR libClose (struct LibraryManagerInterface *Self);
 BPTR libExpunge (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[] = {  static APTR lib_manager_vectors[] = {
Line 87  static APTR libInterfaces[] = { Line 95  static APTR libInterfaces[] = {
 };  };
   
   
   extern void *VecTable68K[];
   
 static struct TagItem libCreateTags[] = {  static struct TagItem libCreateTags[] = {
         { CLT_DataSize, sizeof(struct ExpatBase) },          { CLT_DataSize, sizeof(struct ExpatBase) },
         { CLT_InitFunc, (uint32)libInit },          { CLT_InitFunc, (uint32)libInit },
         { CLT_Interfaces, (uint32)libInterfaces },          { CLT_Interfaces, (uint32)libInterfaces },
           { CLT_Vector68K, (uint32)VecTable68K },
         { TAG_END, 0 }          { TAG_END, 0 }
 };  };
   
Line 109  static struct Resident __attribute__((used)) lib_res = Line 120  static struct Resident __attribute__((used)) lib_res =
 };  };
   
   
struct Library *DOSLib = 0;int32 _start()
struct Library *UtilityBase = 0; 
 
struct ExecIFace *IExec = 0; 
struct DOSIFace *IDOS = 0; 
struct UtilityIFace *IUtility = 0; 
 
 
void _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_Type = NT_LIBRARY;
         libBase->libNode.lib_Node.ln_Pri = LIBPRI;          libBase->libNode.lib_Node.ln_Pri = LIBPRI;
Line 131  struct ExpatBase *libInit(struct ExpatBase *libBase, B Line 135  struct ExpatBase *libInit(struct ExpatBase *libBase, B
         libBase->libNode.lib_Version = VERSION;          libBase->libNode.lib_Version = VERSION;
         libBase->libNode.lib_Revision = REVISION;          libBase->libNode.lib_Revision = REVISION;
         libBase->libNode.lib_IdString = VSTRING;          libBase->libNode.lib_IdString = VSTRING;
   
         libBase->SegList = seglist;          libBase->SegList = seglist;
   
        IExec = ISys;        libBase->IExec = iexec;
         INewlib        = openInterface(iexec, "newlib.library", 0);
   
        DOSLib = OpenLibrary("dos.library", 51);        if ( INewlib != 0 )  {
        if ( DOSLib != 0 )  {                return libBase;
                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; 
                                } 
   
                                CloseLibrary(UtilityBase);        closeInterface(iexec, INewlib);
                        }        INewlib = 0;
   
                        DropInterface((struct Interface *)IDOS);        iexec->DeleteLibrary(&libBase->libNode);
                } 
   
                 CloseLibrary(DOSLib);  
         }  
   
         return NULL;          return NULL;
 }  }
   
Line 201  BPTR libClose( struct LibraryManagerInterface *Self ) Line 196  BPTR libClose( struct LibraryManagerInterface *Self )
                 return (BPTR)Self->LibExpunge();                  return (BPTR)Self->LibExpunge();
         }          }
         else {          else {
                return 0;                return ZERO;
         }          }
 }  }
   
   
 BPTR libExpunge( struct LibraryManagerInterface *Self )  BPTR libExpunge( struct LibraryManagerInterface *Self )
 {  {
        struct ExpatBase *libBase;        struct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase;
        BPTR result = 0;        BPTR result = ZERO;
   
         libBase = (struct ExpatBase *)Self->Data.LibBase;  
   
         if (libBase->libNode.lib_OpenCnt == 0) {          if (libBase->libNode.lib_OpenCnt == 0) {
                Remove(&libBase->libNode.lib_Node);                libBase->IExec->Remove(&libBase->libNode.lib_Node);
   
                 result = libBase->SegList;                  result = libBase->SegList;
   
                DropInterface((struct Interface *)IUtility);                closeInterface(libBase->IExec, INewlib);
                CloseLibrary(UtilityBase);                INewlib = 0;
                DropInterface((struct Interface *)IDOS); 
                CloseLibrary(DOSLib); 
   
                DeleteLibrary(&libBase->libNode);                libBase->IExec->DeleteLibrary(&libBase->libNode);
         }          }
         else {          else {
                 libBase->libNode.lib_Flags |= LIBF_DELEXP;                  libBase->libNode.lib_Flags |= LIBF_DELEXP;
         }          }
   
         return result;          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);
           }
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>