diff options
Diffstat (limited to 'lib/expat/amiga')
-rw-r--r-- | lib/expat/amiga/Makefile | 184 | ||||
-rw-r--r-- | lib/expat/amiga/README.txt | 56 | ||||
-rw-r--r-- | lib/expat/amiga/expat.xml | 264 | ||||
-rw-r--r-- | lib/expat/amiga/expat_lib.c | 233 | ||||
-rw-r--r-- | lib/expat/amiga/expat_vectors.c | 505 | ||||
-rw-r--r-- | lib/expat/amiga/include/inline4/expat.h | 94 | ||||
-rw-r--r-- | lib/expat/amiga/include/interfaces/expat.h | 98 | ||||
-rw-r--r-- | lib/expat/amiga/include/libraries/expat.h | 564 | ||||
-rw-r--r-- | lib/expat/amiga/include/proto/expat.h | 62 | ||||
-rw-r--r-- | lib/expat/amiga/launch.c | 66 | ||||
-rw-r--r-- | lib/expat/amiga/stdlib.c | 109 |
11 files changed, 2235 insertions, 0 deletions
diff --git a/lib/expat/amiga/Makefile b/lib/expat/amiga/Makefile new file mode 100644 index 000000000..37e1f1520 --- /dev/null +++ b/lib/expat/amiga/Makefile @@ -0,0 +1,184 @@ +# +# Makefile for AmigaOS +# + +.PHONY: help all staticlib sharedlib check clean install + +vpath %.c ../lib ../examples ../xmlwf ../tests +vpath %.h ../lib ../tests + + +# +# Set these for SDK installation. +# +tooldir = SDK:Local/C +staticlibdir = SDK:Local/clib2/lib +staticincludedir = SDK:Local/clib2/include +sharedlibdir = LIBS: +sharedincludedir = SDK:Local/common/include + + +ifeq ($(MAKECMDGOALS), staticlib) + DESTDIR = lib +else + DESTDIR = libs +endif + +STATICLIB = $(DESTDIR)/libexpat.a +SHAREDLIB = $(DESTDIR)/expat.library + +XMLWF = $(DESTDIR)/xmlwf +ELEMENTS = $(DESTDIR)/elements +OUTLINE = $(DESTDIR)/outline +RUNTESTS = $(DESTDIR)/runtests +BENCHMARK = $(DESTDIR)/benchmark + + +help: + @echo "Requires:" + @echo " AmigaOS 4.0" + @echo " SDK 51.15" + @echo " clib2 1.198" + @echo "" + @echo "Targets:" + @echo " all - make expat libraries, xmlwf, examples and run test suite" + @echo " install - install expat libraries and tools into SDK" + +all: + -makedir lib libs + $(MAKE) staticlib + $(MAKE) sharedlib + +staticlib: $(STATICLIB) $(XMLWF) $(ELEMENTS) $(OUTLINE) $(RUNTESTS) $(BENCHMARK) check + @echo done + +sharedlib: $(SHAREDLIB) $(XMLWF) $(ELEMENTS) $(OUTLINE) $(RUNTESTS) $(BENCHMARK) check + @echo done + +check: + $(RUNTESTS) + +clean: + -delete lib/#?.o quiet + -delete libs/#?.o quiet + +install: + copy lib/xmlwf $(tooldir) quiet + copy /lib/expat.h /lib/expat_external.h $(staticincludedir) quiet + copy lib/libexpat.a $(staticlibdir) quiet + copy libs/expat.library $(sharedlibdir) quiet + copy include $(sharedincludedir) quiet all + + +CC = gcc +LIBTOOL = ar +STRIP = strip + +LDFLAGS = +LIBS = +CFLAGS = -DNDEBUG -O2 +LTFLAGS = -crs +STRIPFLAGS = -R.comment +LAUNCH = + +ifeq ($(MAKECMDGOALS), staticlib) + LIBS += $(STATICLIB) + INCLUDES = -I../lib +endif + +ifeq ($(MAKECMDGOALS), sharedlib) + CFLAGS += -DAMIGA_SHARED_LIB -D__USE_INLINE__ + INCLUDES = -I. -Iinclude -Iinclude/libraries -I../lib + LAUNCH = $(DESTDIR)/launch.o +endif + + +COMPILE = $(CC) $(CFLAGS) $(INCLUDES) -c + +LINK = $(CC) $(LDFLAGS) -o $@ + + +$(STATICLIB): $(DESTDIR)/xmlparse.o $(DESTDIR)/xmltok.o $(DESTDIR)/xmlrole.o + $(LIBTOOL) $(LTFLAGS) $@ $^ + +$(DESTDIR)/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ + expat_external.h internal.h amigaconfig.h + $(COMPILE) $< -o $@ + +$(DESTDIR)/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ + internal.h amigaconfig.h + $(COMPILE) $< -o $@ + +$(DESTDIR)/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ + iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ + expat_external.h internal.h amigaconfig.h + $(COMPILE) $< -o $@ + + +$(SHAREDLIB): $(DESTDIR)/expat_lib.o $(DESTDIR)/expat_vectors.o $(DESTDIR)/stdlib.o lib/libexpat.a + $(LINK) -nostartfiles -nostdlib -o $@ $^ + +$(DESTDIR)/expat_lib.o: expat_lib.c + $(COMPILE) $< -o $@ + +$(DESTDIR)/expat_vectors.o: expat_vectors.c + $(COMPILE) $< -o $@ + +$(DESTDIR)/stdlib.o: stdlib.c + $(COMPILE) $< -o $@ + +$(LAUNCH): launch.c + $(COMPILE) $< -o $@ + + +$(XMLWF): $(DESTDIR)/xmlwf.o $(DESTDIR)/xmlfile.o $(DESTDIR)/codepage.o $(DESTDIR)/readfilemap.o $(LAUNCH) + $(LINK) $^ $(LIBS) + $(STRIP) $(STRIPFLAGS) $@ + +$(DESTDIR)/xmlwf.o: xmlwf.c + $(COMPILE) $< -o $@ + +$(DESTDIR)/xmlfile.o: xmlfile.c + $(COMPILE) $< -o $@ + +$(DESTDIR)/codepage.o: codepage.c + $(COMPILE) $< -o $@ + +$(DESTDIR)/readfilemap.o: readfilemap.c + $(COMPILE) $< -o $@ + + +$(ELEMENTS): $(DESTDIR)/elements.o $(LAUNCH) + $(LINK) $^ $(LIBS) + $(STRIP) $(STRIPFLAGS) $@ + +$(DESTDIR)/elements.o: elements.c + $(COMPILE) $< -o $@ + + +$(OUTLINE): $(DESTDIR)/outline.o $(LAUNCH) + $(LINK) $^ $(LIBS) + $(STRIP) $(STRIPFLAGS) $@ + +$(DESTDIR)/outline.o: outline.c + $(COMPILE) $< -o $@ + + +$(RUNTESTS): $(DESTDIR)/runtests.o $(DESTDIR)/chardata.o $(DESTDIR)/minicheck.o $(LAUNCH) + $(LINK) $^ $(LIBS) + +$(DESTDIR)/chardata.o: chardata.c chardata.h + $(COMPILE) $< -o $@ + +$(DESTDIR)/minicheck.o: minicheck.c minicheck.h + $(COMPILE) $< -o $@ + +$(DESTDIR)/runtests.o: runtests.c chardata.h + $(COMPILE) $< -o $@ + + +$(BENCHMARK): $(DESTDIR)/benchmark.o $(LAUNCH) + $(LINK) $^ $(LIBS) -lm + +$(DESTDIR)/benchmark.o: benchmark/benchmark.c + $(COMPILE) $< -o $@ diff --git a/lib/expat/amiga/README.txt b/lib/expat/amiga/README.txt new file mode 100644 index 000000000..ca742228c --- /dev/null +++ b/lib/expat/amiga/README.txt @@ -0,0 +1,56 @@ +SUMMARY +======= +This is a port of expat for AmigaOS 4.0 which includes the +SDK, some XML tools and the libraries. + +Both static and shared library versions are supported. + +The static library version is limited to clib2 although it should +be possible to use newlib with the appopriate compile options. + +The shared library version is based on the work of Fredrik Wikstrom +and is currently limited to PPC only. + + +HISTORY +======= +4.0 - updated for corresponding Expat 2.0 release + - some minor CVS related changes + +3.1 - removed obsolete sfd file + - added library description xml file + - refactored Makefile + - removed extraneous VARARGS68K keywords + - reworked default memory handling functions in shared lib + - updated amigaconfig.h + +3.0 - initial release + - based on expat 1.95.8 + + +BUILDING +======== +To build expat.library, xmlwf tool, examples and run the test suite, +simply type 'make all' in the amiga subdirectory. + +The test suite will compile and run for both the static and shared +library versions. + + +INSTALLATION +============ +To install both static and shared versions of expat into the +AmigaOS SDK type 'make install' in the amiga subdirectory. + + +CONFIGURATION +============= +You may want to edit the lib/amigaconfig.h file to remove +DTD and/or XML namespace support if they are not required by your +specific application for a smaller and faster implementation. + + +TO DO +===== +- wide character support (UTF-16) +- provide 68k backwards compatibility diff --git a/lib/expat/amiga/expat.xml b/lib/expat/amiga/expat.xml new file mode 100644 index 000000000..d6aeae2e3 --- /dev/null +++ b/lib/expat/amiga/expat.xml @@ -0,0 +1,264 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE library SYSTEM "library.dtd"> +<!-- autogenerated by fdtrans v51.16 --> +<library name="expat" basename="ExpatBase" basetype="Library" openname="expat.library"> + <include>libraries/expat.h</include> + <interface name="main" version="1.0" struct="ExpatIFace" prefix="_Expat_" asmprefix="IExpat" global="IExpat"> + <method name="Obtain" result="uint32"/> + <method name="Release" result="uint32"/> + <method name="Expunge" result="void" status="unimplemented"/> + <method name="Clone" result="struct Interface *" status="unimplemented"/> + <method name="XML_ParserCreate" result="XML_Parser"> + <arg name="encodingName" type="const XML_Char *"/> + </method> + <method name="XML_ParserCreateNS" result="XML_Parser"> + <arg name="encodingName" type="const XML_Char *"/> + <arg name="nsSep" type="XML_Char"/> + </method> + <method name="XML_ParserCreate_MM" result="XML_Parser"> + <arg name="encoding" type="const XML_Char *"/> + <arg name="memsuite" type="const XML_Memory_Handling_Suite *"/> + <arg name="namespaceSeparator" type="const XML_Char *"/> + </method> + <method name="XML_ExternalEntityParserCreate" result="XML_Parser"> + <arg name="parser" type="XML_Parser"/> + <arg name="context" type="const XML_Char *"/> + <arg name="encoding" type="const XML_Char *"/> + </method> + <method name="XML_ParserFree" result="void"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_Parse" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + <arg name="s" type="const char *"/> + <arg name="len" type="int"/> + <arg name="isFinal" type="int"/> + </method> + <method name="XML_ParseBuffer" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + <arg name="len" type="int"/> + <arg name="isFinal" type="int"/> + </method> + <method name="XML_GetBuffer" result="void *"> + <arg name="parser" type="XML_Parser"/> + <arg name="len" type="int"/> + </method> + <method name="XML_SetStartElementHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartElementHandler"/> + </method> + <method name="XML_SetEndElementHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="end" type="XML_EndElementHandler"/> + </method> + <method name="XML_SetElementHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartElementHandler"/> + <arg name="end" type="XML_EndElementHandler"/> + </method> + <method name="XML_SetCharacterDataHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_CharacterDataHandler"/> + </method> + <method name="XML_SetProcessingInstructionHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_ProcessingInstructionHandler"/> + </method> + <method name="XML_SetCommentHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_CommentHandler"/> + </method> + <method name="XML_SetStartCdataSectionHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartCdataSectionHandler"/> + </method> + <method name="XML_SetEndCdataSectionHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="end" type="XML_EndCdataSectionHandler"/> + </method> + <method name="XML_SetCdataSectionHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartCdataSectionHandler"/> + <arg name="end" type="XML_EndCdataSectionHandler"/> + </method> + <method name="XML_SetDefaultHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_DefaultHandler"/> + </method> + <method name="XML_SetDefaultHandlerExpand" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_DefaultHandler"/> + </method> + <method name="XML_SetExternalEntityRefHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_ExternalEntityRefHandler"/> + </method> + <method name="XML_SetExternalEntityRefHandlerArg" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="arg" type="void *"/> + </method> + <method name="XML_SetUnknownEncodingHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_UnknownEncodingHandler"/> + <arg name="data" type="void *"/> + </method> + <method name="XML_SetStartNamespaceDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartNamespaceDeclHandler"/> + </method> + <method name="XML_SetEndNamespaceDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="end" type="XML_EndNamespaceDeclHandler"/> + </method> + <method name="XML_SetNamespaceDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartNamespaceDeclHandler"/> + <arg name="end" type="XML_EndNamespaceDeclHandler"/> + </method> + <method name="XML_SetXmlDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_XmlDeclHandler"/> + </method> + <method name="XML_SetStartDoctypeDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartDoctypeDeclHandler"/> + </method> + <method name="XML_SetEndDoctypeDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="end" type="XML_EndDoctypeDeclHandler"/> + </method> + <method name="XML_SetDoctypeDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="start" type="XML_StartDoctypeDeclHandler"/> + <arg name="end" type="XML_EndDoctypeDeclHandler"/> + </method> + <method name="XML_SetElementDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="eldecl" type="XML_ElementDeclHandler"/> + </method> + <method name="XML_SetAttlistDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="attdecl" type="XML_AttlistDeclHandler"/> + </method> + <method name="XML_SetEntityDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_EntityDeclHandler"/> + </method> + <method name="XML_SetUnparsedEntityDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_UnparsedEntityDeclHandler"/> + </method> + <method name="XML_SetNotationDeclHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_NotationDeclHandler"/> + </method> + <method name="XML_SetNotStandaloneHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_NotStandaloneHandler"/> + </method> + <method name="XML_GetErrorCode" result="enum XML_Error"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_ErrorString" result="const XML_LChar *"> + <arg name="code" type="enum XML_Error"/> + </method> + <method name="XML_GetCurrentByteIndex" result="long"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetCurrentLineNumber" result="int"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetCurrentColumnNumber" result="int"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetCurrentByteCount" result="int"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetInputContext" result="const char *"> + <arg name="parser" type="XML_Parser"/> + <arg name="offset" type="int *"/> + <arg name="size" type="int *"/> + </method> + <method name="XML_SetUserData" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="userData" type="void *"/> + </method> + <method name="XML_DefaultCurrent" result="void"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_UseParserAsHandlerArg" result="void"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_SetBase" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + <arg name="base" type="const XML_Char *"/> + </method> + <method name="XML_GetBase" result="const XML_Char *"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetSpecifiedAttributeCount" result="int"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetIdAttributeIndex" result="int"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_SetEncoding" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + <arg name="encoding" type="const XML_Char *"/> + </method> + <method name="XML_SetParamEntityParsing" result="int"> + <arg name="parser" type="XML_Parser"/> + <arg name="parsing" type="enum XML_ParamEntityParsing"/> + </method> + <method name="XML_SetReturnNSTriplet" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="do_nst" type="int"/> + </method> + <method name="XML_ExpatVersion" result="const XML_LChar *"> + </method> + <method name="XML_ExpatVersionInfo" result="XML_Expat_Version"> + </method> + <method name="XML_ParserReset" result="XML_Bool"> + <arg name="parser" type="XML_Parser"/> + <arg name="encoding" type="const XML_Char *"/> + </method> + <method name="XML_SetSkippedEntityHandler" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="handler" type="XML_SkippedEntityHandler"/> + </method> + <method name="XML_UseForeignDTD" result="enum XML_Error"> + <arg name="parser" type="XML_Parser"/> + <arg name="useDTD" type="XML_Bool"/> + </method> + <method name="XML_GetFeatureList" result="const XML_Feature *"> + </method> + <method name="XML_StopParser" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + <arg name="resumable" type="XML_Bool"/> + </method> + <method name="XML_ResumeParser" result="enum XML_Status"> + <arg name="parser" type="XML_Parser"/> + </method> + <method name="XML_GetParsingStatus" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="status" type="XML_ParsingStatus *"/> + </method> + <method name="XML_FreeContentModel" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="model" type="XML_Content *"/> + </method> + <method name="XML_MemMalloc" result="void *"> + <arg name="parser" type="XML_Parser"/> + <arg name="size" type="size_t"/> + </method> + <method name="XML_MemRealloc" result="void *"> + <arg name="parser" type="XML_Parser"/> + <arg name="ptr" type="void *"/> + <arg name="size" type="size_t"/> + </method> + <method name="XML_MemFree" result="void"> + <arg name="parser" type="XML_Parser"/> + <arg name="ptr" type="void *"/> + </method> + </interface> +</library> diff --git a/lib/expat/amiga/expat_lib.c b/lib/expat/amiga/expat_lib.c new file mode 100644 index 000000000..70f90748d --- /dev/null +++ b/lib/expat/amiga/expat_lib.c @@ -0,0 +1,233 @@ +/* +** Copyright (c) 2001-2005 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. +*/ + +#include <dos/dos.h> +#include <proto/exec.h> + +#define LIBNAME "expat.library" +#define LIBPRI 0 +#define VERSION 4 +#define REVISION 0 +#define VSTRING "expat.library 4.0 (27.12.2005)" /* dd.mm.yyyy */ + + +static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING; + + +struct ExpatBase { + struct Library libNode; + uint16 pad; + BPTR SegList; +}; + + +struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys); +uint32 libObtain (struct LibraryManagerInterface *Self); +uint32 libRelease (struct LibraryManagerInterface *Self); +struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version); +BPTR libClose (struct LibraryManagerInterface *Self); +BPTR libExpunge (struct LibraryManagerInterface *Self); + + +static APTR lib_manager_vectors[] = { + libObtain, + libRelease, + NULL, + NULL, + libOpen, + libClose, + libExpunge, + NULL, + (APTR)-1, +}; + + +static struct TagItem lib_managerTags[] = { + { MIT_Name, (uint32)"__library" }, + { MIT_VectorTable, (uint32)lib_manager_vectors }, + { MIT_Version, 1 }, + { TAG_END, 0 } +}; + + +extern void *main_vectors[]; + +static struct TagItem lib_mainTags[] = { + { MIT_Name, (uint32)"main" }, + { MIT_VectorTable, (uint32)main_vectors }, + { MIT_Version, 1 }, + { TAG_END, 0 } +}; + + +static APTR libInterfaces[] = { + lib_managerTags, + lib_mainTags, + NULL +}; + + +static struct TagItem libCreateTags[] = { + { CLT_DataSize, sizeof(struct ExpatBase) }, + { CLT_InitFunc, (uint32)libInit }, + { CLT_Interfaces, (uint32)libInterfaces }, + { TAG_END, 0 } +}; + + +static struct Resident __attribute__((used)) lib_res = { + RTC_MATCHWORD, // rt_MatchWord + &lib_res, // rt_MatchTag + &lib_res+1, // rt_EndSkip + RTF_NATIVE | RTF_AUTOINIT, // rt_Flags + VERSION, // rt_Version + NT_LIBRARY, // rt_Type + LIBPRI, // rt_Pri + LIBNAME, // rt_Name + VSTRING, // rt_IdString + libCreateTags // rt_Init +}; + + +struct Library *DOSLib = 0; +struct Library *UtilityBase = 0; + +struct ExecIFace *IExec = 0; +struct DOSIFace *IDOS = 0; +struct UtilityIFace *IUtility = 0; + + +void _start() +{ +} + + +struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys) +{ + libBase->libNode.lib_Node.ln_Type = NT_LIBRARY; + libBase->libNode.lib_Node.ln_Pri = LIBPRI; + libBase->libNode.lib_Node.ln_Name = LIBNAME; + libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED; + libBase->libNode.lib_Version = VERSION; + libBase->libNode.lib_Revision = REVISION; + libBase->libNode.lib_IdString = VSTRING; + libBase->SegList = seglist; + + IExec = ISys; + + 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; + } + + CloseLibrary(UtilityBase); + } + + DropInterface((struct Interface *)IDOS); + } + + CloseLibrary(DOSLib); + } + + return NULL; +} + + +uint32 libObtain( struct LibraryManagerInterface *Self ) +{ + ++Self->Data.RefCount; + return Self->Data.RefCount; +} + + +uint32 libRelease( struct LibraryManagerInterface *Self ) +{ + --Self->Data.RefCount; + return Self->Data.RefCount; +} + + +struct ExpatBase *libOpen( struct LibraryManagerInterface *Self, uint32 version ) +{ + struct ExpatBase *libBase; + + libBase = (struct ExpatBase *)Self->Data.LibBase; + + ++libBase->libNode.lib_OpenCnt; + libBase->libNode.lib_Flags &= ~LIBF_DELEXP; + + return libBase; +} + + +BPTR libClose( struct LibraryManagerInterface *Self ) +{ + struct ExpatBase *libBase; + + libBase = (struct ExpatBase *)Self->Data.LibBase; + + --libBase->libNode.lib_OpenCnt; + if ( libBase->libNode.lib_OpenCnt ) { + return 0; + } + + if ( libBase->libNode.lib_Flags & LIBF_DELEXP ) { + return (BPTR)Self->LibExpunge(); + } + else { + return 0; + } +} + + +BPTR libExpunge( struct LibraryManagerInterface *Self ) +{ + struct ExpatBase *libBase; + BPTR result = 0; + + libBase = (struct ExpatBase *)Self->Data.LibBase; + + if (libBase->libNode.lib_OpenCnt == 0) { + Remove(&libBase->libNode.lib_Node); + + result = libBase->SegList; + + DropInterface((struct Interface *)IUtility); + CloseLibrary(UtilityBase); + DropInterface((struct Interface *)IDOS); + CloseLibrary(DOSLib); + + DeleteLibrary(&libBase->libNode); + } + else { + libBase->libNode.lib_Flags |= LIBF_DELEXP; + } + + return result; +} diff --git a/lib/expat/amiga/expat_vectors.c b/lib/expat/amiga/expat_vectors.c new file mode 100644 index 000000000..11163131d --- /dev/null +++ b/lib/expat/amiga/expat_vectors.c @@ -0,0 +1,505 @@ +/* +** Copyright (c) 2001-2005 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. +*/ + +#include <exec/types.h> +#include <exec/exec.h> +#include <exec/interfaces.h> +#include <interfaces/expat.h> + +extern uint32 _Expat_Obtain(struct ExpatIFace *); +extern uint32 _Expat_Release(struct ExpatIFace *); +extern XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace *, const XML_Char * encodingName); +extern XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace *, const XML_Char * encodingName, XML_Char nsSep); +extern XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace *, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); +extern XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace *, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); +extern void _Expat_XML_ParserFree(struct ExpatIFace *, XML_Parser parser); +extern enum XML_Status _Expat_XML_Parse(struct ExpatIFace *, XML_Parser parser, const char * s, int len, int isFinal); +extern enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace *, XML_Parser parser, int len, int isFinal); +extern void * _Expat_XML_GetBuffer(struct ExpatIFace *, XML_Parser parser, int len); +extern void _Expat_XML_SetStartElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start); +extern void _Expat_XML_SetEndElementHandler(struct ExpatIFace *, XML_Parser parser, XML_EndElementHandler end); +extern void _Expat_XML_SetElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); +extern void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace *, XML_Parser parser, XML_CharacterDataHandler handler); +extern void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace *, XML_Parser parser, XML_ProcessingInstructionHandler handler); +extern void _Expat_XML_SetCommentHandler(struct ExpatIFace *, XML_Parser parser, XML_CommentHandler handler); +extern void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start); +extern void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_EndCdataSectionHandler end); +extern void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); +extern void _Expat_XML_SetDefaultHandler(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); +extern void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); +extern void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace *, XML_Parser parser, XML_ExternalEntityRefHandler handler); +extern void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace *, XML_Parser parser, void * arg); +extern void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace *, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); +extern void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start); +extern void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndNamespaceDeclHandler end); +extern void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); +extern void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_XmlDeclHandler handler); +extern void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start); +extern void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndDoctypeDeclHandler end); +extern void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); +extern void _Expat_XML_SetElementDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_ElementDeclHandler eldecl); +extern void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_AttlistDeclHandler attdecl); +extern void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EntityDeclHandler handler); +extern void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); +extern void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_NotationDeclHandler handler); +extern void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace *, XML_Parser parser, XML_NotStandaloneHandler handler); +extern enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace *, XML_Parser parser); +extern const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace *, enum XML_Error code); +extern long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace *, XML_Parser parser); +extern int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace *, XML_Parser parser); +extern int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace *, XML_Parser parser); +extern int _Expat_XML_GetCurrentByteCount(struct ExpatIFace *, XML_Parser parser); +extern const char * _Expat_XML_GetInputContext(struct ExpatIFace *, XML_Parser parser, int * offset, int * size); +extern void _Expat_XML_SetUserData(struct ExpatIFace *, XML_Parser parser, void * userData); +extern void _Expat_XML_DefaultCurrent(struct ExpatIFace *, XML_Parser parser); +extern void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace *, XML_Parser parser); +extern enum XML_Status _Expat_XML_SetBase(struct ExpatIFace *, XML_Parser parser, const XML_Char * base); +extern const XML_Char * _Expat_XML_GetBase(struct ExpatIFace *, XML_Parser parser); +extern int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace *, XML_Parser parser); +extern int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace *, XML_Parser parser); +extern enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); +extern int _Expat_XML_SetParamEntityParsing(struct ExpatIFace *, XML_Parser parser, enum XML_ParamEntityParsing parsing); +extern void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace *, XML_Parser parser, int do_nst); +extern const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace *); +extern XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace *); +extern XML_Bool _Expat_XML_ParserReset(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); +extern void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace *, XML_Parser parser, XML_SkippedEntityHandler handler); +extern enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace *, XML_Parser parser, XML_Bool useDTD); +extern const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace *); +extern enum XML_Status _Expat_XML_StopParser(struct ExpatIFace *, XML_Parser parser, XML_Bool resumable); +extern enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace *, XML_Parser parser); +extern void _Expat_XML_GetParsingStatus(struct ExpatIFace *, XML_Parser parser, XML_ParsingStatus * status); +extern void _Expat_XML_FreeContentModel(struct ExpatIFace *, XML_Parser parser, XML_Content * model); +extern void * _Expat_XML_MemMalloc(struct ExpatIFace *, XML_Parser parser, size_t size); +extern void * _Expat_XML_MemRealloc(struct ExpatIFace *, XML_Parser parser, void * ptr, size_t size); +extern void _Expat_XML_MemFree(struct ExpatIFace *, XML_Parser parser, void * ptr); + + +CONST APTR main_vectors[] = +{ + _Expat_Obtain, + _Expat_Release, + NULL, + NULL, + _Expat_XML_ParserCreate, + _Expat_XML_ParserCreateNS, + _Expat_XML_ParserCreate_MM, + _Expat_XML_ExternalEntityParserCreate, + _Expat_XML_ParserFree, + _Expat_XML_Parse, + _Expat_XML_ParseBuffer, + _Expat_XML_GetBuffer, + _Expat_XML_SetStartElementHandler, + _Expat_XML_SetEndElementHandler, + _Expat_XML_SetElementHandler, + _Expat_XML_SetCharacterDataHandler, + _Expat_XML_SetProcessingInstructionHandler, + _Expat_XML_SetCommentHandler, + _Expat_XML_SetStartCdataSectionHandler, + _Expat_XML_SetEndCdataSectionHandler, + _Expat_XML_SetCdataSectionHandler, + _Expat_XML_SetDefaultHandler, + _Expat_XML_SetDefaultHandlerExpand, + _Expat_XML_SetExternalEntityRefHandler, + _Expat_XML_SetExternalEntityRefHandlerArg, + _Expat_XML_SetUnknownEncodingHandler, + _Expat_XML_SetStartNamespaceDeclHandler, + _Expat_XML_SetEndNamespaceDeclHandler, + _Expat_XML_SetNamespaceDeclHandler, + _Expat_XML_SetXmlDeclHandler, + _Expat_XML_SetStartDoctypeDeclHandler, + _Expat_XML_SetEndDoctypeDeclHandler, + _Expat_XML_SetDoctypeDeclHandler, + _Expat_XML_SetElementDeclHandler, + _Expat_XML_SetAttlistDeclHandler, + _Expat_XML_SetEntityDeclHandler, + _Expat_XML_SetUnparsedEntityDeclHandler, + _Expat_XML_SetNotationDeclHandler, + _Expat_XML_SetNotStandaloneHandler, + _Expat_XML_GetErrorCode, + _Expat_XML_ErrorString, + _Expat_XML_GetCurrentByteIndex, + _Expat_XML_GetCurrentLineNumber, + _Expat_XML_GetCurrentColumnNumber, + _Expat_XML_GetCurrentByteCount, + _Expat_XML_GetInputContext, + _Expat_XML_SetUserData, + _Expat_XML_DefaultCurrent, + _Expat_XML_UseParserAsHandlerArg, + _Expat_XML_SetBase, + _Expat_XML_GetBase, + _Expat_XML_GetSpecifiedAttributeCount, + _Expat_XML_GetIdAttributeIndex, + _Expat_XML_SetEncoding, + _Expat_XML_SetParamEntityParsing, + _Expat_XML_SetReturnNSTriplet, + _Expat_XML_ExpatVersion, + _Expat_XML_ExpatVersionInfo, + _Expat_XML_ParserReset, + _Expat_XML_SetSkippedEntityHandler, + _Expat_XML_UseForeignDTD, + _Expat_XML_GetFeatureList, + _Expat_XML_StopParser, + _Expat_XML_ResumeParser, + _Expat_XML_GetParsingStatus, + _Expat_XML_FreeContentModel, + _Expat_XML_MemMalloc, + _Expat_XML_MemRealloc, + _Expat_XML_MemFree, + (APTR)-1 +}; + +uint32 _Expat_Obtain(struct ExpatIFace *Self) +{ + return ++Self->Data.RefCount; +} + +uint32 _Expat_Release(struct ExpatIFace *Self) +{ + return --Self->Data.RefCount; +} + +XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace * Self, const XML_Char *encoding) +{ + return XML_ParserCreate(encoding); +} + +XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace * Self, const XML_Char *encoding, XML_Char nsSep) +{ + return XML_ParserCreateNS(encoding, nsSep); +} + +XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace * Self, const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator) +{ + return XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator); +} + +XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *context, const XML_Char *encoding) +{ + return XML_ExternalEntityParserCreate(parser, context, encoding); +} + +void _Expat_XML_ParserFree(struct ExpatIFace *Self, XML_Parser parser) +{ + XML_ParserFree(parser); +} + +enum XML_Status _Expat_XML_Parse(struct ExpatIFace * Self, XML_Parser parser, const char * s, int len, int isFinal) +{ + return XML_Parse(parser, s, len, isFinal); +} + +enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace * Self, XML_Parser parser, int len, int isFinal) +{ + return XML_ParseBuffer(parser, len, isFinal); +} + +void * _Expat_XML_GetBuffer(struct ExpatIFace * Self, XML_Parser parser, int len) +{ + return XML_GetBuffer(parser, len); +} + +void _Expat_XML_SetStartElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start) +{ + XML_SetStartElementHandler(parser, start); +} + +void _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end) +{ + XML_SetEndElementHandler(parser, end); +} + +void _Expat_XML_SetElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) +{ + XML_SetElementHandler(parser, start, end); +} + +void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CharacterDataHandler handler) +{ + XML_SetCharacterDataHandler(parser, handler); +} + +void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ProcessingInstructionHandler handler) +{ + XML_SetProcessingInstructionHandler(parser, handler); +} + +void _Expat_XML_SetCommentHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CommentHandler handler) +{ + XML_SetCommentHandler(parser, handler); +} + +void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start) +{ + XML_SetStartCdataSectionHandler(parser, start); +} + +void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndCdataSectionHandler end) +{ + XML_SetEndCdataSectionHandler(parser, end); +} + +void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) +{ + XML_SetCdataSectionHandler(parser, start, end); +} + +void _Expat_XML_SetDefaultHandler(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) +{ + XML_SetDefaultHandler(parser, handler); +} + +void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) +{ + XML_SetDefaultHandlerExpand(parser, handler); +} + +void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ExternalEntityRefHandler handler) +{ + XML_SetExternalEntityRefHandler(parser, handler); +} + +void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace * Self, XML_Parser parser, void * arg) +{ + XML_SetExternalEntityRefHandlerArg(parser, arg); +} + +void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data) +{ + XML_SetUnknownEncodingHandler(parser, handler, data); +} + +void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start) +{ + XML_SetStartNamespaceDeclHandler(parser, start); +} + +void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndNamespaceDeclHandler end) +{ + XML_SetEndNamespaceDeclHandler(parser, end); +} + +void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) +{ + XML_SetNamespaceDeclHandler(parser, start, end); +} + +void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_XmlDeclHandler handler) +{ + XML_SetXmlDeclHandler(parser, handler); +} + +void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start) +{ + XML_SetStartDoctypeDeclHandler(parser, start); +} + +void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndDoctypeDeclHandler end) +{ + XML_SetEndDoctypeDeclHandler(parser, end); +} + +void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) +{ + XML_SetDoctypeDeclHandler(parser, start, end); +} + +void _Expat_XML_SetElementDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ElementDeclHandler eldecl) +{ + XML_SetElementDeclHandler(parser, eldecl); +} + +void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_AttlistDeclHandler attdecl) +{ + XML_SetAttlistDeclHandler(parser, attdecl); +} + +void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EntityDeclHandler handler) +{ + XML_SetEntityDeclHandler(parser, handler); +} + +void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler) +{ + XML_SetUnparsedEntityDeclHandler(parser, handler); +} + +void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotationDeclHandler handler) +{ + XML_SetNotationDeclHandler(parser, handler); +} + +void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotStandaloneHandler handler) +{ + XML_SetNotStandaloneHandler(parser, handler); +} + +enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetErrorCode(parser); +} + +const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace * Self, enum XML_Error code) +{ + return XML_ErrorString(code); +} + +long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetCurrentByteIndex(parser); +} + +int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetCurrentLineNumber(parser); +} + +int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetCurrentColumnNumber(parser); +} + +int _Expat_XML_GetCurrentByteCount(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetCurrentByteCount(parser); +} + +const char * _Expat_XML_GetInputContext(struct ExpatIFace * Self, XML_Parser parser, int * offset, int * size) +{ + return XML_GetInputContext(parser, offset, size); +} + +void _Expat_XML_SetUserData(struct ExpatIFace * Self, XML_Parser parser, void * userData) +{ + XML_SetUserData(parser, userData); +} + +void _Expat_XML_DefaultCurrent(struct ExpatIFace * Self, XML_Parser parser) +{ + XML_DefaultCurrent(parser); +} + +void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace * Self, XML_Parser parser) +{ + XML_UseParserAsHandlerArg(parser); +} + +enum XML_Status _Expat_XML_SetBase(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *p) +{ + return XML_SetBase(parser, p); +} + +const XML_Char * _Expat_XML_GetBase(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetBase(parser); +} + +int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetSpecifiedAttributeCount(parser); +} + +int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_GetIdAttributeIndex(parser); +} + +enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) +{ + return XML_SetEncoding(parser, encoding); +} + +int _Expat_XML_SetParamEntityParsing(struct ExpatIFace * Self, XML_Parser parser, enum XML_ParamEntityParsing parsing) +{ + return XML_SetParamEntityParsing(parser, parsing); +} + +void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace * Self, XML_Parser parser, int do_nst) +{ + XML_SetReturnNSTriplet(parser, do_nst); +} + +const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace * Self) +{ + return XML_ExpatVersion(); +} + +XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace * Self) +{ + return XML_ExpatVersionInfo(); +} + +XML_Bool _Expat_XML_ParserReset(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) +{ + return XML_ParserReset(parser, encoding); +} + +void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace * Self, XML_Parser parser, XML_SkippedEntityHandler handler) +{ + XML_SetSkippedEntityHandler(parser, handler); +} + +enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace * Self, XML_Parser parser, XML_Bool useDTD) +{ + return XML_UseForeignDTD(parser, useDTD); +} + +const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace * Self) +{ + return XML_GetFeatureList(); +} + +enum XML_Status _Expat_XML_StopParser(struct ExpatIFace * Self, XML_Parser parser, XML_Bool resumable) +{ + return XML_StopParser(parser, resumable); +} + +enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace * Self, XML_Parser parser) +{ + return XML_ResumeParser(parser); +} + +void _Expat_XML_GetParsingStatus(struct ExpatIFace * Self, XML_Parser parser, XML_ParsingStatus * status) +{ + XML_GetParsingStatus(parser, status); +} + +void _Expat_XML_FreeContentModel(struct ExpatIFace * Self, XML_Parser parser, XML_Content * model) +{ + XML_FreeContentModel(parser, model); +} + +void * _Expat_XML_MemMalloc(struct ExpatIFace * Self, XML_Parser parser, size_t size) +{ + return XML_MemMalloc(parser, size); +} + +void * _Expat_XML_MemRealloc(struct ExpatIFace * Self, XML_Parser parser, void * ptr, size_t size) +{ + XML_MemRealloc(parser, ptr, size); +} + +void _Expat_XML_MemFree(struct ExpatIFace * Self, XML_Parser parser, void * ptr) +{ + XML_MemFree(parser, ptr); +} diff --git a/lib/expat/amiga/include/inline4/expat.h b/lib/expat/amiga/include/inline4/expat.h new file mode 100644 index 000000000..1e3105d94 --- /dev/null +++ b/lib/expat/amiga/include/inline4/expat.h @@ -0,0 +1,94 @@ +#ifndef INLINE4_EXPAT_H +#define INLINE4_EXPAT_H + +/* +** This file was auto generated by idltool 51.6. +** +** It provides compatibility to OS3 style library +** calls by substituting functions. +** +** Do not edit manually. +*/ + +#ifndef EXEC_TYPES_H +#include <exec/types.h> +#endif +#ifndef EXEC_EXEC_H +#include <exec/exec.h> +#endif +#ifndef EXEC_INTERFACES_H +#include <exec/interfaces.h> +#endif + +#ifndef LIBRARIES_EXPAT_H +#include <libraries/expat.h> +#endif + +/* Inline macros for Interface "main" */ +#define XML_ParserCreate(encodingName) IExpat->XML_ParserCreate(encodingName) +#define XML_ParserCreateNS(encodingName, nsSep) IExpat->XML_ParserCreateNS(encodingName, nsSep) +#define XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) IExpat->XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) +#define XML_ExternalEntityParserCreate(parser, context, encoding) IExpat->XML_ExternalEntityParserCreate(parser, context, encoding) +#define XML_ParserFree(parser) IExpat->XML_ParserFree(parser) +#define XML_Parse(parser, s, len, isFinal) IExpat->XML_Parse(parser, s, len, isFinal) +#define XML_ParseBuffer(parser, len, isFinal) IExpat->XML_ParseBuffer(parser, len, isFinal) +#define XML_GetBuffer(parser, len) IExpat->XML_GetBuffer(parser, len) +#define XML_SetStartElementHandler(parser, start) IExpat->XML_SetStartElementHandler(parser, start) +#define XML_SetEndElementHandler(parser, end) IExpat->XML_SetEndElementHandler(parser, end) +#define XML_SetElementHandler(parser, start, end) IExpat->XML_SetElementHandler(parser, start, end) +#define XML_SetCharacterDataHandler(parser, handler) IExpat->XML_SetCharacterDataHandler(parser, handler) +#define XML_SetProcessingInstructionHandler(parser, handler) IExpat->XML_SetProcessingInstructionHandler(parser, handler) +#define XML_SetCommentHandler(parser, handler) IExpat->XML_SetCommentHandler(parser, handler) +#define XML_SetStartCdataSectionHandler(parser, start) IExpat->XML_SetStartCdataSectionHandler(parser, start) +#define XML_SetEndCdataSectionHandler(parser, end) IExpat->XML_SetEndCdataSectionHandler(parser, end) +#define XML_SetCdataSectionHandler(parser, start, end) IExpat->XML_SetCdataSectionHandler(parser, start, end) +#define XML_SetDefaultHandler(parser, handler) IExpat->XML_SetDefaultHandler(parser, handler) +#define XML_SetDefaultHandlerExpand(parser, handler) IExpat->XML_SetDefaultHandlerExpand(parser, handler) +#define XML_SetExternalEntityRefHandler(parser, handler) IExpat->XML_SetExternalEntityRefHandler(parser, handler) +#define XML_SetExternalEntityRefHandlerArg(parser, arg) IExpat->XML_SetExternalEntityRefHandlerArg(parser, arg) +#define XML_SetUnknownEncodingHandler(parser, handler, data) IExpat->XML_SetUnknownEncodingHandler(parser, handler, data) +#define XML_SetStartNamespaceDeclHandler(parser, start) IExpat->XML_SetStartNamespaceDeclHandler(parser, start) +#define XML_SetEndNamespaceDeclHandler(parser, end) IExpat->XML_SetEndNamespaceDeclHandler(parser, end) +#define XML_SetNamespaceDeclHandler(parser, start, end) IExpat->XML_SetNamespaceDeclHandler(parser, start, end) +#define XML_SetXmlDeclHandler(parser, handler) IExpat->XML_SetXmlDeclHandler(parser, handler) +#define XML_SetStartDoctypeDeclHandler(parser, start) IExpat->XML_SetStartDoctypeDeclHandler(parser, start) +#define XML_SetEndDoctypeDeclHandler(parser, end) IExpat->XML_SetEndDoctypeDeclHandler(parser, end) +#define XML_SetDoctypeDeclHandler(parser, start, end) IExpat->XML_SetDoctypeDeclHandler(parser, start, end) +#define XML_SetElementDeclHandler(parser, eldecl) IExpat->XML_SetElementDeclHandler(parser, eldecl) +#define XML_SetAttlistDeclHandler(parser, attdecl) IExpat->XML_SetAttlistDeclHandler(parser, attdecl) +#define XML_SetEntityDeclHandler(parser, handler) IExpat->XML_SetEntityDeclHandler(parser, handler) +#define XML_SetUnparsedEntityDeclHandler(parser, handler) IExpat->XML_SetUnparsedEntityDeclHandler(parser, handler) +#define XML_SetNotationDeclHandler(parser, handler) IExpat->XML_SetNotationDeclHandler(parser, handler) +#define XML_SetNotStandaloneHandler(parser, handler) IExpat->XML_SetNotStandaloneHandler(parser, handler) +#define XML_GetErrorCode(parser) IExpat->XML_GetErrorCode(parser) +#define XML_ErrorString(code) IExpat->XML_ErrorString(code) +#define XML_GetCurrentByteIndex(parser) IExpat->XML_GetCurrentByteIndex(parser) +#define XML_GetCurrentLineNumber(parser) IExpat->XML_GetCurrentLineNumber(parser) +#define XML_GetCurrentColumnNumber(parser) IExpat->XML_GetCurrentColumnNumber(parser) +#define XML_GetCurrentByteCount(parser) IExpat->XML_GetCurrentByteCount(parser) +#define XML_GetInputContext(parser, offset, size) IExpat->XML_GetInputContext(parser, offset, size) +#define XML_SetUserData(parser, userData) IExpat->XML_SetUserData(parser, userData) +#define XML_DefaultCurrent(parser) IExpat->XML_DefaultCurrent(parser) +#define XML_UseParserAsHandlerArg(parser) IExpat->XML_UseParserAsHandlerArg(parser) +#define XML_SetBase(parser, base) IExpat->XML_SetBase(parser, base) +#define XML_GetBase(parser) IExpat->XML_GetBase(parser) +#define XML_GetSpecifiedAttributeCount(parser) IExpat->XML_GetSpecifiedAttributeCount(parser) +#define XML_GetIdAttributeIndex(parser) IExpat->XML_GetIdAttributeIndex(parser) +#define XML_SetEncoding(parser, encoding) IExpat->XML_SetEncoding(parser, encoding) +#define XML_SetParamEntityParsing(parser, parsing) IExpat->XML_SetParamEntityParsing(parser, parsing) +#define XML_SetReturnNSTriplet(parser, do_nst) IExpat->XML_SetReturnNSTriplet(parser, do_nst) +#define XML_ExpatVersion() IExpat->XML_ExpatVersion() +#define XML_ExpatVersionInfo() IExpat->XML_ExpatVersionInfo() +#define XML_ParserReset(parser, encoding) IExpat->XML_ParserReset(parser, encoding) +#define XML_SetSkippedEntityHandler(parser, handler) IExpat->XML_SetSkippedEntityHandler(parser, handler) +#define XML_UseForeignDTD(parser, useDTD) IExpat->XML_UseForeignDTD(parser, useDTD) +#define XML_GetFeatureList() IExpat->XML_GetFeatureList() +#define XML_StopParser(parser, resumable) IExpat->XML_StopParser(parser, resumable) +#define XML_ResumeParser(parser) IExpat->XML_ResumeParser(parser) +#define XML_GetParsingStatus(parser, status) IExpat->XML_GetParsingStatus(parser, status) +#define XML_FreeContentModel(parser, model) IExpat->XML_FreeContentModel(parser, model) +#define XML_MemMalloc(parser, size) IExpat->XML_MemMalloc(parser, size) +#define XML_MemRealloc(parser, ptr, size) IExpat->XML_MemRealloc(parser, ptr, size) +#define XML_MemFree(parser, ptr) IExpat->XML_MemFree(parser, ptr) + +#endif /* INLINE4_EXPAT_H */ diff --git a/lib/expat/amiga/include/interfaces/expat.h b/lib/expat/amiga/include/interfaces/expat.h new file mode 100644 index 000000000..e9bdf4aa1 --- /dev/null +++ b/lib/expat/amiga/include/interfaces/expat.h @@ -0,0 +1,98 @@ +#ifndef EXPAT_INTERFACE_DEF_H +#define EXPAT_INTERFACE_DEF_H + +/* +** This file was machine generated by idltool 51.6. +** Do not edit +*/ + +#ifndef EXEC_TYPES_H +#include <exec/types.h> +#endif +#ifndef EXEC_EXEC_H +#include <exec/exec.h> +#endif +#ifndef EXEC_INTERFACES_H +#include <exec/interfaces.h> +#endif + +#ifndef LIBRARIES_EXPAT_H +#include <libraries/expat.h> +#endif + +struct ExpatIFace +{ + struct InterfaceData Data; + + uint32 APICALL (*Obtain)(struct ExpatIFace *Self); + uint32 APICALL (*Release)(struct ExpatIFace *Self); + void APICALL (*Expunge)(struct ExpatIFace *Self); + struct Interface * APICALL (*Clone)(struct ExpatIFace *Self); + XML_Parser APICALL (*XML_ParserCreate)(struct ExpatIFace *Self, const XML_Char * encodingName); + XML_Parser APICALL (*XML_ParserCreateNS)(struct ExpatIFace *Self, const XML_Char * encodingName, XML_Char nsSep); + XML_Parser APICALL (*XML_ParserCreate_MM)(struct ExpatIFace *Self, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); + XML_Parser APICALL (*XML_ExternalEntityParserCreate)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); + void APICALL (*XML_ParserFree)(struct ExpatIFace *Self, XML_Parser parser); + enum XML_Status APICALL (*XML_Parse)(struct ExpatIFace *Self, XML_Parser parser, const char * s, int len, int isFinal); + enum XML_Status APICALL (*XML_ParseBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len, int isFinal); + void * APICALL (*XML_GetBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len); + void APICALL (*XML_SetStartElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start); + void APICALL (*XML_SetEndElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndElementHandler end); + void APICALL (*XML_SetElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); + void APICALL (*XML_SetCharacterDataHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CharacterDataHandler handler); + void APICALL (*XML_SetProcessingInstructionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ProcessingInstructionHandler handler); + void APICALL (*XML_SetCommentHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CommentHandler handler); + void APICALL (*XML_SetStartCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start); + void APICALL (*XML_SetEndCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndCdataSectionHandler end); + void APICALL (*XML_SetCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); + void APICALL (*XML_SetDefaultHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); + void APICALL (*XML_SetDefaultHandlerExpand)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); + void APICALL (*XML_SetExternalEntityRefHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ExternalEntityRefHandler handler); + void APICALL (*XML_SetExternalEntityRefHandlerArg)(struct ExpatIFace *Self, XML_Parser parser, void * arg); + void APICALL (*XML_SetUnknownEncodingHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); + void APICALL (*XML_SetStartNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start); + void APICALL (*XML_SetEndNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndNamespaceDeclHandler end); + void APICALL (*XML_SetNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); + void APICALL (*XML_SetXmlDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_XmlDeclHandler handler); + void APICALL (*XML_SetStartDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start); + void APICALL (*XML_SetEndDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndDoctypeDeclHandler end); + void APICALL (*XML_SetDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); + void APICALL (*XML_SetElementDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ElementDeclHandler eldecl); + void APICALL (*XML_SetAttlistDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_AttlistDeclHandler attdecl); + void APICALL (*XML_SetEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EntityDeclHandler handler); + void APICALL (*XML_SetUnparsedEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); + void APICALL (*XML_SetNotationDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotationDeclHandler handler); + void APICALL (*XML_SetNotStandaloneHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotStandaloneHandler handler); + enum XML_Error APICALL (*XML_GetErrorCode)(struct ExpatIFace *Self, XML_Parser parser); + const XML_LChar * APICALL (*XML_ErrorString)(struct ExpatIFace *Self, enum XML_Error code); + long APICALL (*XML_GetCurrentByteIndex)(struct ExpatIFace *Self, XML_Parser parser); + int APICALL (*XML_GetCurrentLineNumber)(struct ExpatIFace *Self, XML_Parser parser); + int APICALL (*XML_GetCurrentColumnNumber)(struct ExpatIFace *Self, XML_Parser parser); + int APICALL (*XML_GetCurrentByteCount)(struct ExpatIFace *Self, XML_Parser parser); + const char * APICALL (*XML_GetInputContext)(struct ExpatIFace *Self, XML_Parser parser, int * offset, int * size); + void APICALL (*XML_SetUserData)(struct ExpatIFace *Self, XML_Parser parser, void * userData); + void APICALL (*XML_DefaultCurrent)(struct ExpatIFace *Self, XML_Parser parser); + void APICALL (*XML_UseParserAsHandlerArg)(struct ExpatIFace *Self, XML_Parser parser); + enum XML_Status APICALL (*XML_SetBase)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * base); + const XML_Char * APICALL (*XML_GetBase)(struct ExpatIFace *Self, XML_Parser parser); + int APICALL (*XML_GetSpecifiedAttributeCount)(struct ExpatIFace *Self, XML_Parser parser); + int APICALL (*XML_GetIdAttributeIndex)(struct ExpatIFace *Self, XML_Parser parser); + enum XML_Status APICALL (*XML_SetEncoding)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); + int APICALL (*XML_SetParamEntityParsing)(struct ExpatIFace *Self, XML_Parser parser, enum XML_ParamEntityParsing parsing); + void APICALL (*XML_SetReturnNSTriplet)(struct ExpatIFace *Self, XML_Parser parser, int do_nst); + const XML_LChar * APICALL (*XML_ExpatVersion)(struct ExpatIFace *Self); + XML_Expat_Version APICALL (*XML_ExpatVersionInfo)(struct ExpatIFace *Self); + XML_Bool APICALL (*XML_ParserReset)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); + void APICALL (*XML_SetSkippedEntityHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_SkippedEntityHandler handler); + enum XML_Error APICALL (*XML_UseForeignDTD)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool useDTD); + const XML_Feature * APICALL (*XML_GetFeatureList)(struct ExpatIFace *Self); + enum XML_Status APICALL (*XML_StopParser)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool resumable); + enum XML_Status APICALL (*XML_ResumeParser)(struct ExpatIFace *Self, XML_Parser parser); + void APICALL (*XML_GetParsingStatus)(struct ExpatIFace *Self, XML_Parser parser, XML_ParsingStatus * status); + void APICALL (*XML_FreeContentModel)(struct ExpatIFace *Self, XML_Parser parser, XML_Content * model); + void * APICALL (*XML_MemMalloc)(struct ExpatIFace *Self, XML_Parser parser, size_t size); + void * APICALL (*XML_MemRealloc)(struct ExpatIFace *Self, XML_Parser parser, void * ptr, size_t size); + void APICALL (*XML_MemFree)(struct ExpatIFace *Self, XML_Parser parser, void * ptr); +}; + +#endif /* EXPAT_INTERFACE_DEF_H */ diff --git a/lib/expat/amiga/include/libraries/expat.h b/lib/expat/amiga/include/libraries/expat.h new file mode 100644 index 000000000..cdd211e13 --- /dev/null +++ b/lib/expat/amiga/include/libraries/expat.h @@ -0,0 +1,564 @@ +#ifndef LIBRARIES_EXPAT_H +#define LIBRARIES_EXPAT_H + +/* +** Copyright (c) 2001-2005 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. +*/ + + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + + +#include <stdlib.h> + +#ifndef XMLCALL +#define XMLCALL +#endif + +typedef char XML_Char; +typedef char XML_LChar; +typedef long XML_Index; +typedef unsigned long XML_Size; + +struct XML_ParserStruct; +typedef struct XML_ParserStruct *XML_Parser; + +typedef unsigned char XML_Bool; +#define XML_TRUE ((XML_Bool) 1) +#define XML_FALSE ((XML_Bool) 0) + +enum XML_Status { + XML_STATUS_ERROR = 0, +#define XML_STATUS_ERROR XML_STATUS_ERROR + XML_STATUS_OK = 1, +#define XML_STATUS_OK XML_STATUS_OK + XML_STATUS_SUSPENDED = 2, +#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED +}; + +enum XML_Error { + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + XML_ERROR_NOT_STANDALONE, + XML_ERROR_UNEXPECTED_STATE, + XML_ERROR_ENTITY_DECLARED_IN_PE, + XML_ERROR_FEATURE_REQUIRES_XML_DTD, + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, + XML_ERROR_UNBOUND_PREFIX, + XML_ERROR_UNDECLARING_PREFIX, + XML_ERROR_INCOMPLETE_PE, + XML_ERROR_XML_DECL, + XML_ERROR_TEXT_DECL, + XML_ERROR_PUBLICID, + XML_ERROR_SUSPENDED, + XML_ERROR_NOT_SUSPENDED, + XML_ERROR_ABORTED, + XML_ERROR_FINISHED, + XML_ERROR_SUSPEND_PE, + XML_ERROR_RESERVED_PREFIX_XML, + XML_ERROR_RESERVED_PREFIX_XMLNS, + XML_ERROR_RESERVED_NAMESPACE_URI +}; + +enum XML_Content_Type { + XML_CTYPE_EMPTY = 1, + XML_CTYPE_ANY, + XML_CTYPE_MIXED, + XML_CTYPE_NAME, + XML_CTYPE_CHOICE, + XML_CTYPE_SEQ +}; + +enum XML_Content_Quant { + XML_CQUANT_NONE, + XML_CQUANT_OPT, + XML_CQUANT_REP, + XML_CQUANT_PLUS +}; + +typedef struct XML_cp XML_Content; + +struct XML_cp { + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char * name; + unsigned int numchildren; + XML_Content * children; +}; + + +typedef void (*XML_ElementDeclHandler) (void *userData, + const XML_Char *name, + XML_Content *model); + +void +XML_SetElementDeclHandler(XML_Parser parser, + XML_ElementDeclHandler eldecl); + +typedef void (*XML_AttlistDeclHandler) ( + void *userData, + const XML_Char *elname, + const XML_Char *attname, + const XML_Char *att_type, + const XML_Char *dflt, + int isrequired); + +void +XML_SetAttlistDeclHandler(XML_Parser parser, + XML_AttlistDeclHandler attdecl); + +typedef void (*XML_XmlDeclHandler) (void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); + +void +XML_SetXmlDeclHandler(XML_Parser parser, + XML_XmlDeclHandler xmldecl); + + +typedef struct { + void *(*malloc_fcn)(size_t size); + void *(*realloc_fcn)(void *ptr, size_t size); + void (*free_fcn)(void *ptr); +} XML_Memory_Handling_Suite; + +XML_Parser +XML_ParserCreate(const XML_Char *encoding); + +XML_Parser +XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); + + +XML_Parser +XML_ParserCreate_MM(const XML_Char *encoding, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); + +XML_Bool +XML_ParserReset(XML_Parser parser, const XML_Char *encoding); + +typedef void (*XML_StartElementHandler) (void *userData, + const XML_Char *name, + const XML_Char **atts); + +typedef void (*XML_EndElementHandler) (void *userData, + const XML_Char *name); + + +typedef void (*XML_CharacterDataHandler) (void *userData, + const XML_Char *s, + int len); + +typedef void (*XML_ProcessingInstructionHandler) ( + void *userData, + const XML_Char *target, + const XML_Char *data); + +typedef void (*XML_CommentHandler) (void *userData, + const XML_Char *data); + +typedef void (*XML_StartCdataSectionHandler) (void *userData); +typedef void (*XML_EndCdataSectionHandler) (void *userData); + +typedef void (*XML_DefaultHandler) (void *userData, + const XML_Char *s, + int len); + +typedef void (*XML_StartDoctypeDeclHandler) ( + void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); + +typedef void (*XML_EndDoctypeDeclHandler)(void *userData); + +typedef void (*XML_EntityDeclHandler) ( + void *userData, + const XML_Char *entityName, + int is_parameter_entity, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +void +XML_SetEntityDeclHandler(XML_Parser parser, + XML_EntityDeclHandler handler); + +typedef void (*XML_UnparsedEntityDeclHandler) ( + void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +typedef void (*XML_NotationDeclHandler) ( + void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +typedef void (*XML_StartNamespaceDeclHandler) ( + void *userData, + const XML_Char *prefix, + const XML_Char *uri); + +typedef void (*XML_EndNamespaceDeclHandler) ( + void *userData, + const XML_Char *prefix); + +typedef int (*XML_NotStandaloneHandler) (void *userData); + +typedef int (*XML_ExternalEntityRefHandler) ( + XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +typedef void (*XML_SkippedEntityHandler) ( + void *userData, + const XML_Char *entityName, + int is_parameter_entity); + +typedef struct { + int map[256]; + void *data; + int (*convert)(void *data, const char *s); + void (*release)(void *data); +} XML_Encoding; + +typedef int (*XML_UnknownEncodingHandler) ( + void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); + +void +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + +void +XML_SetStartElementHandler(XML_Parser parser, + XML_StartElementHandler handler); + +void +XML_SetEndElementHandler(XML_Parser parser, + XML_EndElementHandler handler); + +void +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler); + +void +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler); +void +XML_SetCommentHandler(XML_Parser parser, + XML_CommentHandler handler); + +void +XML_SetCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end); + +void +XML_SetStartCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start); + +void +XML_SetEndCdataSectionHandler(XML_Parser parser, + XML_EndCdataSectionHandler end); + +void +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler); + +void +XML_SetDefaultHandlerExpand(XML_Parser parser, + XML_DefaultHandler handler); + +void +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + +void +XML_SetStartDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start); + +void +XML_SetEndDoctypeDeclHandler(XML_Parser parser, + XML_EndDoctypeDeclHandler end); + +void +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler); + +void +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler); + +void +XML_SetNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + +void +XML_SetStartNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start); + +void +XML_SetEndNamespaceDeclHandler(XML_Parser parser, + XML_EndNamespaceDeclHandler end); + +void +XML_SetNotStandaloneHandler(XML_Parser parser, + XML_NotStandaloneHandler handler); + +void +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler); + +void +XML_SetExternalEntityRefHandlerArg(XML_Parser parser, + void *arg); + +void +XML_SetSkippedEntityHandler(XML_Parser parser, + XML_SkippedEntityHandler handler); + +void +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + +void +XML_DefaultCurrent(XML_Parser parser); + +void +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); + +void +XML_SetUserData(XML_Parser parser, void *userData); + +#define XML_GetUserData(parser) (*(void **)(parser)) + +enum XML_Status +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); + +void +XML_UseParserAsHandlerArg(XML_Parser parser); + +enum XML_Error +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); + + +enum XML_Status +XML_SetBase(XML_Parser parser, const XML_Char *base); + +const XML_Char * +XML_GetBase(XML_Parser parser); + +int +XML_GetSpecifiedAttributeCount(XML_Parser parser); + +int +XML_GetIdAttributeIndex(XML_Parser parser); + +enum XML_Status +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); + +void * +XML_GetBuffer(XML_Parser parser, int len); + +enum XML_Status +XML_ParseBuffer(XML_Parser parser, int len, int isFinal); + +enum XML_Status +XML_StopParser(XML_Parser parser, XML_Bool resumable); + +enum XML_Status +XML_ResumeParser(XML_Parser parser); + +enum XML_Parsing { + XML_INITIALIZED, + XML_PARSING, + XML_FINISHED, + XML_SUSPENDED +}; + +typedef struct { + enum XML_Parsing parsing; + XML_Bool finalBuffer; +} XML_ParsingStatus; + +void +XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); + +XML_Parser +XML_ExternalEntityParserCreate(XML_Parser parser, + const XML_Char *context, + const XML_Char *encoding); + +enum XML_ParamEntityParsing { + XML_PARAM_ENTITY_PARSING_NEVER, + XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, + XML_PARAM_ENTITY_PARSING_ALWAYS +}; + +int +XML_SetParamEntityParsing(XML_Parser parser, + enum XML_ParamEntityParsing parsing); + +enum XML_Error +XML_GetErrorCode(XML_Parser parser); + +int XML_GetCurrentLineNumber(XML_Parser parser); +int XML_GetCurrentColumnNumber(XML_Parser parser); +long XML_GetCurrentByteIndex(XML_Parser parser); + +int +XML_GetCurrentByteCount(XML_Parser parser); + +const char * +XML_GetInputContext(XML_Parser parser, + int *offset, + int *size); + +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex + +void +XML_FreeContentModel(XML_Parser parser, XML_Content *model); + +void * +XML_MemMalloc(XML_Parser parser, size_t size); + +void * +XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); + +void +XML_MemFree(XML_Parser parser, void *ptr); + +void +XML_ParserFree(XML_Parser parser); + +const XML_LChar * +XML_ErrorString(enum XML_Error code); + +const XML_LChar * +XML_ExpatVersion(void); + +typedef struct { + int major; + int minor; + int micro; +} XML_Expat_Version; + +XML_Expat_Version +XML_ExpatVersionInfo(void); + +enum XML_FeatureEnum { + XML_FEATURE_END = 0, + XML_FEATURE_UNICODE, + XML_FEATURE_UNICODE_WCHAR_T, + XML_FEATURE_DTD, + XML_FEATURE_CONTEXT_BYTES, + XML_FEATURE_MIN_SIZE, + XML_FEATURE_SIZEOF_XML_CHAR, + XML_FEATURE_SIZEOF_XML_LCHAR +}; + +typedef struct { + enum XML_FeatureEnum feature; + const XML_LChar *name; + long int value; +} XML_Feature; + +const XML_Feature * +XML_GetFeatureList(void); + + +#define XML_MAJOR_VERSION 2 +#define XML_MINOR_VERSION 0 +#define XML_MICRO_VERSION 0 + + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +#ifdef __cplusplus +} +#endif + +/****************************************************************************/ + +#endif /* EXPAT_EXPAT_H */ diff --git a/lib/expat/amiga/include/proto/expat.h b/lib/expat/amiga/include/proto/expat.h new file mode 100644 index 000000000..02df6c39f --- /dev/null +++ b/lib/expat/amiga/include/proto/expat.h @@ -0,0 +1,62 @@ +#ifndef PROTO_EXPAT_H +#define PROTO_EXPAT_H + +/* +** $Id: expat.h,v 1.1 2006/11/25 18:35:43 matthieu Exp $ +** Includes Release 50.1 +** +** Prototype/inline/pragma header file combo +** +** (C) Copyright 2003-2005 Amiga, Inc. +** All Rights Reserved +*/ + +#ifndef LIBRARIES_EXPAT_H +#include <libraries/expat.h> +#endif + +/****************************************************************************/ + +#ifndef __NOLIBBASE__ + #ifndef __USE_BASETYPE__ + extern struct Library * ExpatBase; + #else + extern struct Library * ExpatBase; + #endif /* __USE_BASETYPE__ */ +#endif /* __NOLIBBASE__ */ + +/****************************************************************************/ + +#ifdef __amigaos4__ + #include <interfaces/expat.h> + #ifdef __USE_INLINE__ + #include <inline4/expat.h> + #endif /* __USE_INLINE__ */ + #ifndef CLIB_EXPAT_PROTOS_H + #define CLIB_EXPAT_PROTOS_H 1 + #endif /* CLIB_EXPAT_PROTOS_H */ + #ifndef __NOGLOBALIFACE__ + extern struct ExpatIFace *IExpat; + #endif /* __NOGLOBALIFACE__ */ +#else /* __amigaos4__ */ + #ifndef CLIB_EXPAT_PROTOS_H + #include <clib/expat_protos.h> + #endif /* CLIB_EXPAT_PROTOS_H */ + #if defined(__GNUC__) + #ifndef __PPC__ + #include <inline/expat.h> + #else + #include <ppcinline/expat.h> + #endif /* __PPC__ */ + #elif defined(__VBCC__) + #ifndef __PPC__ + #include <inline/expat_protos.h> + #endif /* __PPC__ */ + #else + #include <pragmas/expat_pragmas.h> + #endif /* __GNUC__ */ +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#endif /* PROTO_EXPAT_H */ diff --git a/lib/expat/amiga/launch.c b/lib/expat/amiga/launch.c new file mode 100644 index 000000000..11bbf1c22 --- /dev/null +++ b/lib/expat/amiga/launch.c @@ -0,0 +1,66 @@ +/* +** Copyright (c) 2001-2005 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. +*/ + +#include <stdlib.h> +#include <proto/exec.h> + +struct Library* ExpatBase = 0; +struct ExpatIFace* IExpat = 0; + + +int amiga_main(int argc, char** argv); +void cleanup(); + + +int main(int argc, char** argv) +{ + int result = -1; + + atexit(cleanup); + + ExpatBase = OpenLibrary("expat.library", 2); + if ( ExpatBase != 0 ) { + IExpat = (struct ExpatIFace*)GetInterface(ExpatBase, "main", 1, NULL); + if ( IExpat != 0 ) { + result = amiga_main(argc, argv); + } + } + + cleanup(); + + return result; +} + + +void cleanup() +{ + if ( IExpat != 0 ) { + DropInterface((struct Interface*)IExpat); + IExpat = 0; + } + + if ( ExpatBase != 0 ) { + CloseLibrary(ExpatBase); + ExpatBase = 0; + } +} diff --git a/lib/expat/amiga/stdlib.c b/lib/expat/amiga/stdlib.c new file mode 100644 index 000000000..4a7ca713c --- /dev/null +++ b/lib/expat/amiga/stdlib.c @@ -0,0 +1,109 @@ +/* +** Copyright (c) 2001-2005 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. +*/ + +#include <stdlib.h> +#include <exec/memory.h> +#include <proto/exec.h> +#include <proto/utility.h> + +void * malloc (size_t len) +{ + uint32 size = sizeof(uint32) + len; + + uint32 *mem = AllocMem(size, MEMF_ANY); + if ( mem != 0 ) { + *mem = size; + ++mem; + } + + return mem; +} + + +void * realloc (void * mem, size_t len2) +{ + if ( mem == 0 ) { + return malloc(len2); + } + + if ( len2 == 0 ) { + free(mem); + return 0; + } + + void * new_mem = malloc(len2); + if ( new_mem == 0 ) { + return 0; + } + + uint32 mem_size = *(((uint32*)mem) - 1); + CopyMem(mem, new_mem, mem_size); + free(mem); + + return new_mem; +} + + +void free (void * mem) +{ + if ( mem != 0 ) { + uint32 size = *(((uint32*)mem) - 1); + FreeMem(mem, size); + } +} + + +int memcmp (const void * a, const void * b, size_t len) +{ + size_t i; + int diff; + + for ( i = 0; i < len; ++i ) { + diff = *((uint8 *)a++) - *((uint8 *)b++); + if ( diff ) { + return diff; + } + } + + return 0; +} + + +void * memcpy (void * t, const void * a, size_t len) +{ + CopyMem((APTR)a, t, len); + return t; +} + + +void * memmove (void * t1, const void * t2, size_t len) +{ + MoveMem((APTR)t2, t1, len); + return t1; +} + + +void * memset (void * t, int c, size_t len) +{ + return SetMem(t, c, len); +} |