From 501a5b35252e766743ba0dc65126003015dca159 Mon Sep 17 00:00:00 2001
From: "Fred L. Drake, Jr." <fdrake@users.sourceforge.net>
Date: Mon, 8 Jul 2002 17:06:55 +0000
Subject: [PATCH] Mac OS (classic) support, based on patches from Thomas Wegner
 and Daryle Walker.

---
 expat/lib/Makefile.MPW | 206 +++++++++++++++++++++++++++++++++++++++++
 expat/lib/macconfig.h  | 104 +++++++++++++++++++++
 expat/lib/xmlrole.c    |   2 +
 expat/lib/xmltok.c     |   2 +
 4 files changed, 314 insertions(+)
 create mode 100644 expat/lib/Makefile.MPW
 create mode 100644 expat/lib/macconfig.h

diff --git a/expat/lib/Makefile.MPW b/expat/lib/Makefile.MPW
new file mode 100644
index 00000000..046af005
--- /dev/null
+++ b/expat/lib/Makefile.MPW
@@ -0,0 +1,206 @@
+#   File:       Makefile.MPW
+#   Targets:    All, Dynamic, Static (and Clean, Clean-All)
+#   Created:    Tuesday, July 02, 2002
+#
+#   MPW Makefile for building expat under the "classic" (i.e. pre-X) Mac OS
+#   Copyright © 2002 Daryle Walker
+#   Portions Copyright © 2002 Thomas Wegner
+#   See the COPYING file for distribution information
+#
+#   Description: 
+#   This Makefile lets you build static, dynamic (i.e. shared) and stub 
+#   versions of the expat library as well as the elements.c and outline.c 
+#   examples (built as tools for MPW). This is for PPC only; it should be 
+#   no problem to build a 68K version of the expat library, though.
+#
+# 	Usage: 
+#			       Buildprogram All
+#			 or    Buildprogram Dynamic
+#			 or    Buildprogram Static
+#
+#   Note: You first have to rename this file to "Makefile", or the Buildprogram 
+#         commando will not recognize it.
+#
+
+MAKEFILE        = Makefile
+¥MondoBuild¥    = {MAKEFILE}  # Make blank to avoid rebuilds when makefile is modified
+
+ObjDir          = :
+SrcDir          = :
+HdrDir          = :
+
+ToolDir         = ::examples:
+
+Includes        = -i {HdrDir}
+
+Sym-PPC         = -sym off
+
+Defines         = -d MACOS_CLASSIC
+
+PPCCOptions     = {Includes} {Sym-PPC} -w 35 {Defines}
+
+FragName        = libexpat
+
+
+### Source Files ###
+
+SrcFiles        =  ¶
+				  "{SrcDir}xmlparse.c" ¶
+				  "{SrcDir}xmlrole.c" ¶
+				  "{SrcDir}xmltok.c"
+
+ToolSrcFiles    =  ¶
+				  "{ToolDir}elements.c" ¶
+				  "{ToolDir}outline.c"
+
+
+### Object Files ###
+
+ObjFiles-PPC    =  ¶
+				  "{ObjDir}xmlparse.c.o" ¶
+				  "{ObjDir}xmlrole.c.o" ¶
+				  "{ObjDir}xmltok.c.o"
+
+ElementToolObjFile   =  "{ObjDir}elements.c.o"
+
+OutlineToolObjFile   =  "{ObjDir}outline.c.o"
+
+
+### Libraries ###
+
+StLibFiles-PPC    =  ¶
+				  "{PPCLibraries}StdCRuntime.o" ¶
+				  "{PPCLibraries}PPCCRuntime.o" ¶
+				  "{PPCLibraries}PPCToolLibs.o"
+
+ShLibFiles-PPC    =  ¶
+				  "{SharedLibraries}InterfaceLib" ¶
+				  "{SharedLibraries}StdCLib" ¶
+				  "{SharedLibraries}MathLib"
+
+LibFiles-PPC    =  ¶
+				  {StLibFiles-PPC} ¶
+				  {ShLibFiles-PPC}
+
+
+### Special Files ###
+
+ExportFile      = "{ObjDir}{FragName}.exp"
+
+StLibFile       = "{ObjDir}{FragName}.MrC.o"
+
+ShLibFile       = "{ObjDir}{FragName}"
+
+StubFile        = "{ObjDir}{FragName}.stub"
+
+ElementsTool    = "{ToolDir}elements"
+
+OutlineTool     = "{ToolDir}outline"
+
+
+### Default Rules ###
+
+.c.o  Ä  .c  {¥MondoBuild¥}
+	{PPCC} {depDir}{default}.c -o {targDir}{default}.c.o {PPCCOptions}
+
+
+### Build Rules ###
+
+All  Ä  Dynamic {ElementsTool} {OutlineTool}
+
+Static  Ä  {StLibFile}
+
+Dynamic  Ä  Static {ShLibFile} {StubFile}
+
+{StLibFile}  ÄÄ  {ObjFiles-PPC} {StLibFiles-PPC} {¥MondoBuild¥}
+	PPCLink ¶
+		-o {Targ} ¶
+		{ObjFiles-PPC} ¶
+		{StLibFiles-PPC} ¶
+		{Sym-PPC} ¶
+		-mf -d ¶
+		-t 'XCOF' ¶
+		-c 'MPS ' ¶
+		-xm l
+
+{ShLibFile}  ÄÄ  {StLibFile} {ShLibFiles-PPC} {ExportFile} {¥MondoBuild¥}
+	PPCLink ¶
+		-o {Targ} ¶
+		{StLibFile} ¶
+		{ShLibFiles-PPC} ¶
+		{Sym-PPC} ¶
+		-@export {ExportFile} ¶
+		-fragname {FragName} ¶
+		-mf -d ¶
+		-t 'shlb' ¶
+		-c '????' ¶
+		-xm s
+
+{StubFile}  ÄÄ  {ShLibFile} {¥MondoBuild¥}
+	shlb2stub -o {Targ} {ShLibFile}
+
+{ElementsTool}  ÄÄ  {ElementToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥}
+	PPCLink ¶
+		-o {Targ} ¶
+		{ElementToolObjFile} ¶
+		{StLibFile} ¶
+		{LibFiles-PPC} ¶
+		{Sym-PPC} ¶
+		-mf -d ¶
+		-t 'MPST' ¶
+		-c 'MPS '
+
+{OutlineTool}  ÄÄ  {OutlineToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥}
+	PPCLink ¶
+		-o {Targ} ¶
+		{OutlineToolObjFile} ¶
+		{StLibFile} ¶
+		{LibFiles-PPC} ¶
+		{Sym-PPC} ¶
+		-mf -d ¶
+		-t 'MPST' ¶
+		-c 'MPS '
+
+
+### Special Rules ###
+
+{ExportFile}  ÄÄ  "{HdrDir}expat.h" {¥MondoBuild¥}
+	StreamEdit -d ¶
+		-e "/¥('XMLPARSEAPI('Å') ')Ç0,1È'XML_'([A-Za-z0-9_]+)¨1'('/ Print 'XML_' ¨1" ¶
+		"{HdrDir}expat.h" > {Targ}
+
+
+### Required Dependencies ###
+
+"{ObjDir}xmlparse.c.o"  Ä  "{SrcDir}xmlparse.c"
+"{ObjDir}xmlrole.c.o"  Ä  "{SrcDir}xmlrole.c"
+"{ObjDir}xmltok.c.o"  Ä  "{SrcDir}xmltok.c"
+
+"{ObjDir}elements.c.o"  Ä "{ToolDir}elements.c"
+"{ObjDir}outline.c.o"  Ä "{ToolDir}outline.c"
+
+
+### Optional Dependencies ###
+### Build this target to clean out generated intermediate files. ###
+
+Clean  Ä
+	Delete {ObjFiles-PPC} {ExportFile} {ElementToolObjFile} {OutlineToolObjFile}
+
+### Build this target to clean out all generated files. ###
+
+Clean-All  Ä  Clean
+	Delete {StLibFile} {ShLibFile} {StubFile} {ElementsTool} {OutlineTool}
+
+### Build this target to generate "include file" dependencies. ###
+
+Dependencies  Ä  $OutOfDate
+	MakeDepend ¶
+		-append {MAKEFILE} ¶
+		-ignore "{CIncludes}" ¶
+		-objdir "{ObjDir}" ¶
+		-objext .o ¶
+		{Defines} ¶
+		{Includes} ¶
+		{SrcFiles}
+
+
diff --git a/expat/lib/macconfig.h b/expat/lib/macconfig.h
new file mode 100644
index 00000000..3c5eb541
--- /dev/null
+++ b/expat/lib/macconfig.h
@@ -0,0 +1,104 @@
+/*================================================================
+** Copyright 2000, Clark Cooper
+** All rights reserved.
+**
+** This is free software. You are permitted to copy, distribute, or modify
+** it under the terms of the MIT/X license (contained in the COPYING file
+** with this distribution.)
+**
+*/
+
+#ifndef MACCONFIG_H
+#define MACCONFIG_H
+
+
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#define BYTEORDER  4321
+
+/* Define to 1 if you have the `bcopy' function. */
+#undef HAVE_BCOPY
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS
+
+/* whether byteorder is bigendian */
+#define WORDS_BIGENDIAN
+
+/* Define to specify how much context to retain around the current parse
+   point. */
+#undef XML_CONTEXT_BYTES
+
+/* Define to make parameter entity parsing functionality available. */
+#define XML_DTD
+
+/* Define to make XML Namespaces functionality available. */
+#define XML_NS
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `long' if <sys/types.h> does not define. */
+#define off_t  long
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+
+#endif /* ifndef MACCONFIG_H */
diff --git a/expat/lib/xmlrole.c b/expat/lib/xmlrole.c
index 3e573f4b..30b87fd2 100644
--- a/expat/lib/xmlrole.c
+++ b/expat/lib/xmlrole.c
@@ -4,6 +4,8 @@
 
 #ifdef COMPILED_FROM_DSP
 #include "winconfig.h"
+#elif defined(MACOS_CLASSIC)
+#include "macconfig.h"
 #else
 #include <expat_config.h>
 #endif /* ndef COMPILED_FROM_DSP */
diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c
index c91d605f..63e3503c 100644
--- a/expat/lib/xmltok.c
+++ b/expat/lib/xmltok.c
@@ -4,6 +4,8 @@
 
 #ifdef COMPILED_FROM_DSP
 #include "winconfig.h"
+#elif defined(MACOS_CLASSIC)
+#incldue "macconfig.h"
 #else
 #include <expat_config.h>
 #endif /* ndef COMPILED_FROM_DSP */
-- 
2.40.0