Applied patrch #1523242 - support for Open Watcom 1.5.
diff --git a/expat/lib/watcomconfig.h b/expat/lib/watcomconfig.h
new file mode 100644
index 0000000..2f05e3f
--- /dev/null
+++ b/expat/lib/watcomconfig.h
@@ -0,0 +1,47 @@
+/* expat_config.h for use with Open Watcom 1.5 and above.  */
+
+#ifndef WATCOMCONFIG_H
+#define WATCOMCONFIG_H
+
+#ifdef __NT__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#define BYTEORDER 1234
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "expat-bugs@mail.libexpat.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "expat"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "expat 2.0.0"
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.0.0"
+
+/* Define to specify how much context to retain around the current parse
+   point. */
+#define XML_CONTEXT_BYTES 1024
+
+/* Define to make parameter entity parsing functionality available. */
+#define XML_DTD 1
+
+/* Define to make XML Namespaces functionality available. */
+#define XML_NS 1
+
+#endif
+
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index db9c174..184d8f6 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -14,6 +14,8 @@
 #include "macconfig.h"
 #elif defined(__amigaos4__)
 #include "amigaconfig.h"
+#elif defined(__WATCOMC__)
+#include "watcomconfig.h"
 #elif defined(HAVE_EXPAT_CONFIG_H)
 #include <expat_config.h>
 #endif /* ndef COMPILED_FROM_DSP */
diff --git a/expat/lib/xmlrole.c b/expat/lib/xmlrole.c
index 3782f1e..9c5e25b 100644
--- a/expat/lib/xmlrole.c
+++ b/expat/lib/xmlrole.c
@@ -10,6 +10,8 @@
 #include "macconfig.h"
 #elif defined(__amigaos4__)
 #include "amigaconfig.h"
+#elif defined(__WATCOMC__)
+#include "watcomconfig.h"
 #else
 #ifdef HAVE_EXPAT_CONFIG_H
 #include <expat_config.h>
@@ -53,12 +55,16 @@
     ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
 static const char KW_IDREFS[] = {
     ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
+#ifdef XML_DTD
 static const char KW_IGNORE[] = {
     ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
+#endif
 static const char KW_IMPLIED[] = {
     ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
+#ifdef XML_DTD
 static const char KW_INCLUDE[] = {
     ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
+#endif
 static const char KW_NDATA[] = {
     ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
 static const char KW_NMTOKEN[] = {
diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c
index 26cee4d..d1810a5 100644
--- a/expat/lib/xmltok.c
+++ b/expat/lib/xmltok.c
@@ -10,6 +10,8 @@
 #include "macconfig.h"
 #elif defined(__amigaos4__)
 #include "amigaconfig.h"
+#elif defined(__WATCOMC__)
+#include "watcomconfig.h"
 #else
 #ifdef HAVE_EXPAT_CONFIG_H
 #include <expat_config.h>
diff --git a/expat/watcom/README.TXT b/expat/watcom/README.TXT
new file mode 100644
index 0000000..c04a2b2
--- /dev/null
+++ b/expat/watcom/README.TXT
@@ -0,0 +1,146 @@
+
+                        Expat, Release 2.0.0
+                 Open Watcom OS/2-eCS and NT/2000/XP
+
+SUMMARY
+=======
+This is the first effort of adding Open Watcom (www.openwatcom.org) build
+capability to the expat project. The included changes and makefiles are
+verified to work with Open Watcom 1.5, however, it might build with
+version 1.4.
+
+HISTORY
+=======
+June 2006 - First successful compile with Open Watcom 1.5
+July 2006 - Submit as patch
+
+BUILDING
+========
+The makefile system is based on a multi-platform system provided by
+Mat Nieuwenhoven. In the watcom directory is the main makefile which
+accepts the following options:
+
+   os2       - OS/2-ECS Release
+   nt        - WinNT/2000/XP Release
+   linux     - Linux Release
+   os2d      - OS/2-ECS Debug
+   ntd       - WinNT/2000/XP Debug
+   linuxd    - Linux Debug
+   full      - all release
+   fulld     - all debug
+   fullall   - all release and debug
+   cleanall  - remove all
+   clean     - remove build keep release
+   xmlts.zip - download test suite and unzip
+
+The options for the OW build of expat are set in watcom\buildopts.inc.
+
+The following expat options are available:
+
+XML_DTD (Note 1)
+    Include support for using and reporting DTD-based content. If this
+    is defined, default attribute values from an external DTD subset are
+    reported and attribute value normalization occurs based on the type of
+    attributes defined in the external subset. Without this, Expat has a
+    smaller memory footprint and can be faster, but will not load external
+    entities or process conditional sections. This does not affect the set
+    of functions available in the API.
+
+XML_NS (Note 1)
+    When defined, support for the Namespaces in XML specification is included.
+
+XML_UNICODE (Note 2)
+    When defined, character data reported to the application is encoded
+    in UTF-16 using wide characters of the type XML_Char. This is implied
+    if XML_UNICODE_WCHAR_T is defined.
+
+XML_UNICODE_WCHAR_T (Note 2)
+    If defined, causes the XML_Char character type to be defined using the
+    wchar_t type; otherwise, unsigned short is used. Defining this implies
+    XML_UNICODE.
+
+XML_LARGE_SIZE (Note 3)
+    (OS/2 and Windows) [optional] If defined, causes the XML_Size and XML_Index
+    integer types to be at least 64 bits in size. This is intended to support
+    processing of very large input streams, where the return values of
+    XML_GetCurrentByteIndex, XML_GetCurrentLineNumber and
+    XML_GetCurrentColumnNumber could overflow. It may not be supported by all
+    compilers, and is turned off by default.
+
+XML_CONTEXT_BYTES (Note 1)
+    The number of input bytes of markup context which the parser will ensure are
+    available for reporting via XML_GetInputContext. This is normally set to 1024,
+    and must be set to a positive interger. If this is not defined, the input
+    context will not be available and XML_GetInputContext will always report NULL.
+    Without this, Expat has a smaller memory footprint and can be faster.
+
+XML_MIN_SIZE (Note 3)
+    (OS/2 and Windows) [optional] Makes a parser that's smaller but that,
+    in general, will run slower.
+
+Note 1: Define by default in watcomconfig.h - XML_CONTEXT_BYTES define as 1024.
+
+Note 2: Not yet supported
+
+Note 3: Not defined by default, but supported by Open Watcom
+
+
+XML_TEST_SUITE
+==============
+While you are welcome to run the tests, however, it will require downloading and
+setting up additional unix type utilitiy/tools on OS/2-ECS and Windows platforms.
+
+I have added the target xmlts.zip to the makefile which will use wget to dowload
+and unzip to setup the test files. The tests/xmltest.sh file will have to be
+modified, changing XMLWF= to the location of the xmlwwf.exe file.
+
+The ouput from both OS2-ECS and WinNT/2000/XP builds is listed below. I have
+built expat 2.0.0 on a Linux gcc system and verified that the output is the same
+result for OS/2-ECS and Windows platforms. So, I feel confident that the Open Watcom
+build is working as well as the other compiler builds.
+
+The test results should be:
+
+  Output differs: ibm/valid/P02/ibm02v01.xml
+  Output differs: ibm/valid/P28/ibm28v02.xml
+  Output differs: ibm/valid/P29/ibm29v01.xml
+  Output differs: ibm/valid/P29/ibm29v02.xml
+  Output differs: ibm/valid/P54/ibm54v01.xml
+  Output differs: ibm/valid/P56/ibm56v08.xml
+  Output differs: ibm/valid/P57/ibm57v01.xml
+  Output differs: ibm/valid/P58/ibm58v01.xml
+  Output differs: ibm/valid/P58/ibm58v02.xml
+  Output differs: ibm/valid/P70/ibm70v01.xml
+  Output differs: ibm/valid/P82/ibm82v01.xml
+  E:/expat-2.0.0/tests/XML-Test-Suite/out/ibm/invalid/P29//*.xml: No such file or directory
+  ibm49i02.dtd: No such file or directory
+  In ibm/invalid/P49/: ibm49i02.xml:4:1: error in processing external entity reference
+  Output differs: ibm/invalid/P58/ibm58i01.xml
+  Output differs: ibm/invalid/P58/ibm58i02.xml
+  Output differs: xmltest/valid/sa/069.xml
+  Output differs: xmltest/valid/sa/076.xml
+  Output differs: xmltest/valid/sa/090.xml
+  Output differs: xmltest/valid/sa/091.xml
+  Output differs: sun/valid/not-sa01.xml
+  Output differs: sun/valid/not-sa02.xml
+  Output differs: sun/valid/not-sa03.xml
+  Output differs: sun/valid/not-sa04.xml
+  Output differs: sun/valid/notation01.xml
+  Output differs: sun/valid/sa02.xml
+  Output differs: sun/valid/sa03.xml
+  Output differs: sun/valid/sa04.xml
+  Output differs: sun/valid/sa05.xml
+  Expected well-formed: ibm/not-wf/misc/432gewf.xml
+  Expected well-formed: xmltest/not-wf/not-sa/005.xml
+  Expected well-formed: sun/not-wf/uri01.xml
+  Expected well-formed: oasis/p06fail1.xml
+  Expected well-formed: oasis/p08fail1.xml
+  Expected well-formed: oasis/p08fail2.xml
+  Passed: 1776
+  Failed: 34
+
+
+
+
+
+
diff --git a/expat/watcom/buildopts.inc b/expat/watcom/buildopts.inc
new file mode 100644
index 0000000..7a332d6
--- /dev/null
+++ b/expat/watcom/buildopts.inc
@@ -0,0 +1,82 @@
+######################################################################
+#
+# Open Watcom 1.5 multiplatform target options file.
+#
+# Author        : Michael Greene, July 2006
+#
+######################################################################
+
+STATICLIB  = libexpat.lib
+
+# only for OS/2 and NT builds
+DLLNAME    = expat.dll
+IMPORTLIB  = iexpat.lib
+
+# path to wget if not in path - only needed for test suite download
+
+#WGET = D:\BLDTOOLS\
+
+# Uncomment to compile multi-thread
+
+MULTITHREAD = 1
+
+# Uncomment to compile using runtime library - default static
+
+#CLIBLNK = 1
+
+# valid defines:
+#   XML_LARGE_SIZE      (supported - see main EXPAT readme for info)
+#   XML_UNICODE_WCHAR_T (not supported)
+#   XML_UNICODE         (not supported)
+#   XML_MIN_SIZE        (compiles with but not tested)
+#   XML_DTD - XML_NS    (enabled always - see watcomconfig.h)
+
+#DEFS = -DXML_LARGE_SIZE
+
+#                              [Processor options]
+# -3r 386 register calling conventions  -5r Pentium register calling conv.
+# -3s 386 stack calling conventions     -5s Pentium stack calling conventions
+# -4r 486 register calling conventions  -6r Pentium Pro register call conven.
+# -4s 486 stack calling conventions     -6s Pentium Pro stack call conven.
+#                      [Floating-point processor options]
+# -fpc calls to floating-point library  -fp2 generate 287 floating-point code
+# -fpd enable Pentium FDIV check        -fp3 generate 387 floating-point code
+# -fpi   inline 80x87 with emulation    -fp5 optimize f-p for Pentium
+# -fpi87 inline 80x87                   -fp6 optimize f-p for Pentium Pro
+# -fpr use old floating-point conventions
+
+MACHINE = -6s -fp6
+
+#                            [Optimization options]
+# -oa relax alias checking              -ol+ ol with loop unrolling
+# -ob branch prediction                 -om generate inline math functions
+# -oc disable call/ret optimization     -on numerically unstable floating-point
+# -od disable optimizations             -oo continue compile when low on memory
+# -oe[=num] expand functions inline     -op improve floating-point consistency
+# Press any key to continue:
+# -of[+] generate traceable stack frames-or re-order instructions to avoid stalls
+# -oh enable repeated optimizations     -os optimize for space
+# -oi inline intrinsic functions        -ot optimize for time
+# -oi+ (C++) oi with max inlining depth -ou ensure unique addresses for functions
+# -ok control flow entry/exit seq.      -ox maximum optimization (-obmiler -s)
+# -ol perform loop optimizations
+
+OPTIMIZATION = -otexan
+
+#                              [Debugging options]
+# -d0 no debugging information          -d2t (C++) d2 but without type names
+# -d1{+} line number debugging info.    -d3 debug info with unref'd type names
+# -d2 full symbolic debugging info.     -d3i (C++) d3 + inlines as COMDATs
+# -d2i (C++) d2 + inlines as COMDATs    -d3s (C++) d3 + inlines as statics
+# -d2s (C++) d2 + inlines as statics
+
+DEBUGOPTS = -d3
+
+# I used this for testing. If LINKLIB is expat.lib (default) then
+# all executables are linked static. If LINKLIB is iexpat.lib then
+# executables will use the expat dll.
+
+#TARGLIB = $(IMPORTLIB)
+
+TARGLIB = $(STATICLIB)
+
diff --git a/expat/watcom/expat.lnk b/expat/watcom/expat.lnk
new file mode 100644
index 0000000..e3b4a61
--- /dev/null
+++ b/expat/watcom/expat.lnk
@@ -0,0 +1,71 @@
+# EXPORTs for making dll with Open Watcom under OS/2
+SYSTEM os2v2_dll initinstance terminstance
+OPTION manyautodata
+OPTION DESCRIPTION 'Expat (DLL) Implements an XML parser'
+
+EXPORT XML_DefaultCurrent
+EXPORT XML_ErrorString
+EXPORT XML_ExpatVersion
+EXPORT XML_ExpatVersionInfo
+EXPORT XML_ExternalEntityParserCreate
+EXPORT XML_GetBase
+EXPORT XML_GetBuffer
+EXPORT XML_GetCurrentByteCount
+EXPORT XML_GetCurrentByteIndex
+EXPORT XML_GetCurrentColumnNumber
+EXPORT XML_GetCurrentLineNumber
+EXPORT XML_GetErrorCode
+EXPORT XML_GetIdAttributeIndex
+EXPORT XML_GetInputContext
+EXPORT XML_GetSpecifiedAttributeCount
+EXPORT XML_Parse
+EXPORT XML_ParseBuffer
+EXPORT XML_ParserCreate
+EXPORT XML_ParserCreateNS
+EXPORT XML_ParserCreate_MM
+EXPORT XML_ParserFree
+EXPORT XML_SetAttlistDeclHandler
+EXPORT XML_SetBase
+EXPORT XML_SetCdataSectionHandler
+EXPORT XML_SetCharacterDataHandler
+EXPORT XML_SetCommentHandler
+EXPORT XML_SetDefaultHandler
+EXPORT XML_SetDefaultHandlerExpand
+EXPORT XML_SetDoctypeDeclHandler
+EXPORT XML_SetElementDeclHandler
+EXPORT XML_SetElementHandler
+EXPORT XML_SetEncoding
+EXPORT XML_SetEndCdataSectionHandler
+EXPORT XML_SetEndDoctypeDeclHandler
+EXPORT XML_SetEndElementHandler
+EXPORT XML_SetEndNamespaceDeclHandler
+EXPORT XML_SetEntityDeclHandler
+EXPORT XML_SetExternalEntityRefHandler
+EXPORT XML_SetExternalEntityRefHandlerArg
+EXPORT XML_SetNamespaceDeclHandler
+EXPORT XML_SetNotStandaloneHandler
+EXPORT XML_SetNotationDeclHandler
+EXPORT XML_SetParamEntityParsing
+EXPORT XML_SetProcessingInstructionHandler
+EXPORT XML_SetReturnNSTriplet
+EXPORT XML_SetStartCdataSectionHandler
+EXPORT XML_SetStartDoctypeDeclHandler
+EXPORT XML_SetStartElementHandler
+EXPORT XML_SetStartNamespaceDeclHandler
+EXPORT XML_SetUnknownEncodingHandler
+EXPORT XML_SetUnparsedEntityDeclHandler
+EXPORT XML_SetUserData
+EXPORT XML_SetXmlDeclHandler
+EXPORT XML_UseParserAsHandlerArg
+EXPORT XML_ParserReset
+EXPORT XML_SetSkippedEntityHandler
+EXPORT XML_GetFeatureList
+EXPORT XML_UseForeignDTD
+EXPORT XML_FreeContentModel
+EXPORT XML_MemMalloc
+EXPORT XML_MemRealloc
+EXPORT XML_MemFree
+EXPORT XML_StopParser
+EXPORT XML_ResumeParser
+EXPORT XML_GetParsingStatus
+
diff --git a/expat/watcom/makefile b/expat/watcom/makefile
new file mode 100644
index 0000000..0b37e0c
--- /dev/null
+++ b/expat/watcom/makefile
@@ -0,0 +1,85 @@
+#########################################################################
+#
+#           Open Watcom 1.5 EXPAT XML Parser Main Makefile
+#
+# Open Watcom 1.5 and newer multi-platform makefile for EXPAT XML Parser.
+# Currently will build targets for OS/2-ECS, NT/Win2000/XP, and Linux.
+# This makefile will call, based on comand line target, watmake.mif
+# to build target release or debug.
+#
+# Author        : Michael Greene, July 2006
+#
+# User selectable project options are set in buildopts.inc
+#
+#########################################################################
+
+
+all: .SYMBOLIC
+  @echo ***********************************************
+  @echo Valid options:
+  @echo   "wmake <platform build>"
+  @echo      os2       - OS/2-ECS Release
+  @echo      nt        - NT/Win2000/XP
+  @echo      linux     - Linux Release
+  @echo      os2d      - OS/2-ECS Debug
+  @echo      ntd       - NT/Win2000/XP Debug
+  @echo      linuxd    - Linux Debug
+  @echo      full      - all release
+  @echo      fulld     - all debug
+  @echo      fullall   - all release and debug
+  @echo      cleanall  - remove all
+  @echo      clean     - remove build keep release
+  @echo      xmlts.zip - download test suite and unzip
+
+full: os2 nt linux .SYMBOLIC
+
+fulld: os2d ntd linuxd .SYMBOLIC
+
+fullall: os2 nt linux os2d ntd linuxd .SYMBOLIC
+
+os2: .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = os2
+  @%make buildproc
+
+os2d: .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = os2
+  @%append watopts.tmp DEBUG = 1
+  @%make buildproc
+
+nt:  .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = nt
+  @%make buildproc
+
+ntd:  .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = nt
+  @%append watopts.tmp DEBUG = 1
+  @%make buildproc
+
+linux: .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = linux
+  @%make buildproc
+
+linuxd: .SYMBOLIC
+  @%write  watopts.tmp SYSPLATFORM = linux
+  @%append watopts.tmp DEBUG = 1
+  @%make buildproc
+
+clean: .SYMBOLIC
+  @%write  watopts.tmp CLEAN = 1
+  @wmake -h -f watmake.mif clean
+
+cleanall: .SYMBOLIC
+  @%write  watopts.tmp CLEAN = 1
+  @wmake -h -f watmake.mif cleanall
+
+xmlts.zip: .SYMBOLIC
+  @%write  watopts.tmp DUMMY = 1
+  @wmake -h -f watmake.mif xmlts.zip
+
+buildproc: .procedure
+!ifdef DEBUG
+  @%append  watopts.tmp DEBUG   = 1
+!endif
+  @wmake -a -h -f watmake.mif
+
+
diff --git a/expat/watcom/watclean.mif b/expat/watcom/watclean.mif
new file mode 100644
index 0000000..2226623
--- /dev/null
+++ b/expat/watcom/watclean.mif
@@ -0,0 +1,57 @@
+#############################################################
+#
+#  ***** Project make release directories procedures *****
+#
+#############################################################
+
+!include watclean.tmp
+
+os2: .SYMBOLIC
+  @set CLEANDIR = $(RELDIR)\os2
+  @%make rmtargdir
+
+os2d: .SYMBOLIC
+  @set CLEANDIR = $(DEBDIR)\os2
+  @%make rmtargdir
+
+nt: .SYMBOLIC
+  @set CLEANDIR = $(RELDIR)\nt
+  @%make rmtargdir
+
+ntd: .SYMBOLIC
+  @set CLEANDIR = $(DEBDIR)\nt
+  @%make rmtargdir
+
+linux: .SYMBOLIC
+  @set CLEANDIR = $(RELDIR)\linux
+  @%make rmtargdir
+
+linuxd: .SYMBOLIC
+  @set CLEANDIR = $(DEBDIR)\linux
+  @%make rmtargdir
+
+rmtargdir: .PROCEDURE
+  -@rm $(%CLEANDIR)\lib\*.lib
+  -@rd $(%CLEANDIR)\lib
+  -@rm $(%CLEANDIR)\include\*.h
+  -@rd $(%CLEANDIR)\include
+  @if EXIST $(%CLEANDIR)\dll -@rm $(%CLEANDIR)\dll\*.dll
+  @if EXIST $(%CLEANDIR)\dll -@rd $(%CLEANDIR)\dll
+  @if EXIST $(%CLEANDIR)\bin\xmlwf @%make cleanl
+  @if EXIST $(%CLEANDIR)\bin\xmlwf.exe @%make cleano
+  -@rd $(%CLEANDIR)\bin
+  -@rd $(%CLEANDIR)
+
+# cleanup build files
+clean: .SYMBOLIC
+CLEANEXTS   = obj exe err lst map sym lib dll
+  @for %a in ($(CLEANEXTS)) do -@rm *.%a
+  @if EXIST xmlwf @%make cleanl
+
+cleanl: .PROCEDURE
+CLEANLINUX  = xmlwf runtests elements outline benchmark
+  @for %a in ($(CLEANLINUX))  do -@rm $(%CLEANDIR)\bin\%a
+
+cleano: .PROCEDURE
+  -@rm $(%CLEANDIR)\bin\*.exe
+
diff --git a/expat/watcom/watmake.mif b/expat/watcom/watmake.mif
new file mode 100644
index 0000000..2979698
--- /dev/null
+++ b/expat/watcom/watmake.mif
@@ -0,0 +1,223 @@
+######################################################################
+#
+# Open Watcom 1.5 multiplatform target makefile. This file is called
+# by main makefile.
+#
+# Author        : Michael Greene, July 2006
+#
+# User selectable project options are set in buildopts.inc
+#
+######################################################################
+
+# include options set by main makefile
+!include watopts.tmp
+
+# include user selectable option
+!include buildopts.inc
+
+# project directories
+PROJ   = $+ $(%cwd) $-
+RELDIR = $(PROJ)\release
+DEBDIR = $(PROJ)\debug
+SRCDIR = $(PROJ)\..\lib
+TSTDIR = $(PROJ)\..\tests
+XMLDIR = $(PROJ)\..\xmlwf
+
+CC  = wcl386
+LD  = wlink
+LB  = wlib
+
+
+########################################
+#
+# ***** platform specific options *****
+#
+!ifeqi SYSPLATFORM os2
+SYSCOMP    = os2
+SYSLINK    = os2v2
+LINKFILE   = expat.lnk
+COMINC     = $(%watcom)\h;$(%watcom)\h\os2
+EXPATDLL   = $(DLLNAME)
+EXT        = .exe
+!else ifeqi SYSPLATFORM nt
+SYSCOMP    = nt
+SYSLINK    = nt
+LINKFILE   = wexpat.lnk
+COMINC     = $(%watcom)\h;$(%watcom)\h\nt
+EXPATDLL   = $(DLLNAME)
+EXT        = .exe
+NTLIB      = LIB $(%watcom)\lib386\nt\kernel32.lib
+!else ifeqi SYSPLATFORM linux
+SYSCOMP    = linux
+SYSLINK    = linux
+COMINC     = $(%watcom)\lh
+LINUXEXT   = op noext
+#EXT = .elf
+!endif
+# ***** END platform specific options *****
+
+
+########################################
+#
+#  ***** Release/Debug options *****
+#
+!ifndef DEBUG
+LD_OPTS   = op el
+# -wcd to quiet warning 201 - might need to check
+C_COMMON  = -d0 -wcd=201
+OPT       = $(OPTIMIZATION)
+TARGDIR   = $(RELDIR)
+!else
+LD_OPTS   = d all op map,symf
+C_COMMON  = $(DEBUGOPTS) -of
+# overrides optimization options set in buildopts.inc
+OPT       = -od
+TARGDIR   = $(DEBDIR)
+!endif
+#  ***** END Release/Debug options *****
+
+
+# MULTITHREAD set in buildopts.inc
+!ifdef MULTITHREAD
+MT = -bm
+!endif
+
+# CLIBLNK set in buildopts.inc
+!ifdef CLIBLNK
+CLIBOPT = -br
+!endif
+
+INCLUDE   = $(SRCDIR);$(TSTDIR);$(COMINC)
+
+EXTRA_C   = $(C_COMMON) $(OPT) $(MT) $(CLIBOPT) $(MACHINE)
+COMMONC   = -w4 -e25 -zq -bt=$(SYSCOMP) -mf
+
+CFLAGS    = -i=$(INCLUDE) $(DEFS) $(COMMONC) $(EXTRA_C)
+LDFLAGS   = $(LD_OPTS) op maxe=25
+LIBFLAGS  = -b -c -n -p=512
+
+SRCS = $(SRCDIR)\xmlparse.c $(SRCDIR)\xmlrole.c $(SRCDIR)\xmltok.c
+OBJS = xmlparse.obj xmlrole.obj xmltok.obj
+
+XMLWFS = $(XMLDIR)\xmlwf.c $(XMLDIR)\xmlfile.c $(XMLDIR)\codepage.c &
+         $(XMLDIR)\readfilemap.c
+XMLWFO = xmlwf.obj xmlfile.obj codepage.obj readfilemap.obj
+
+TESTSRC = ..\tests\chardata.c ..\tests\minicheck.c ..\tests\runtests.c
+TESTOBJ = chardata.obj minicheck.obj runtests.obj
+
+
+#############################################################
+#
+#       ***** Project target build procedures *****
+#
+#############################################################
+
+all: clean $(EXPATDLL) $(TARGLIB) xmlwf$(EXT) tests release .SYMBOLIC
+
+# dll is built only for OS/2-ECS and LINUX platforms
+#expat.dll: .ALWAYS
+$(DLLNAME): .ALWAYS
+  $(CC) -c $(CFLAGS) -bd $(SRCS)
+!ifeqi SYSPLATFORM os2
+  $(LD) NAME $* @expat.lnk $(LDFLAGS) FILE {$(OBJS)}
+!else
+  $(LD) NAME $* @wexpat.lnk $(LDFLAGS) FILE {$(OBJS)}
+!endif
+  $(LB) $(IMPORTLIB) +$*.dll
+
+# build static lib for platform
+$(TARGLIB): .ALWAYS
+  $(CC) -c $(CFLAGS) $(CLIBOPT) $(SRCS)
+  $(LB) $(LIBFLAGS) $*.lib $(OBJS)
+
+# build standalone XML parser
+xmlwf$(EXT):
+  $(CC) -c $(CFLAGS) $(CLIBOPT) $(XMLWFS)
+  $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) $(NTLIB) FILE {$(XMLWFO)}
+
+# The following builds EXPAT test and example programs
+tests: runtests$(EXT) elements$(EXT) outline$(EXT) benchmark$(EXT) .SYMBOLIC
+
+runtests$(EXT): $(LINKLIB)
+  $(CC) -c $(CFLAGS) $(CLIBOPT) $(TESTSRC)
+  $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE {$(TESTOBJ)}
+
+elements$(EXT): $(LINKLIB)
+  $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\elements.c
+  $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
+
+outline$(EXT): $(LINKLIB)
+  $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\outline.c
+  $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
+
+benchmark$(EXT): $(LINKLIB)
+  $(CC) -c $(CFLAGS) $(CLIBOPT) ..\tests\benchmark\benchmark.c
+  $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
+
+# requires wget to download and unzip XML_TEST_SUITE
+xmlts.zip:  .SYMBOLIC
+  $(WGET)wget --output-document=..\tests\xmlts.zip &
+                       http://www.w3.org/XML/Test/xmlts20020606.zip
+  unzip -q ..\tests\xmlts.zip -d ..\tests
+
+
+#############################################################
+#
+#  ***** Project make release directories procedures *****
+#
+#############################################################
+
+release: .SYMBOLIC
+TARGEXE = xmlwf$(EXT) runtests$(EXT) elements$(EXT) outline$(EXT) benchmark$(EXT)
+  @if not EXIST $(TARGDIR) -@mkdir $(TARGDIR)
+  @if not EXIST $(TARGDIR)\$(SYSPLATFORM) @%make mktargdir
+!ifneqi SYSPLATFORM linux
+  -@copy  .\$(EXPATDLL) $(TARGDIR)\$(SYSPLATFORM)\dll
+!endif
+  @for %a in ($(TARGEXE)) do -@copy .\%a $(TARGDIR)\$(SYSPLATFORM)\bin
+  -@copy  .\*.lib $(TARGDIR)\$(SYSPLATFORM)\lib
+  -@copy  ..\lib\expat.h $(TARGDIR)\$(SYSPLATFORM)\include
+  -@copy  ..\lib\expat_external.h $(TARGDIR)\$(SYSPLATFORM)\include
+
+mktargdir: .PROCEDURE
+  -@mkdir $(TARGDIR)\$(SYSPLATFORM)
+  -@mkdir $(TARGDIR)\$(SYSPLATFORM)\bin
+  -@mkdir $(TARGDIR)\$(SYSPLATFORM)\lib
+  -@mkdir $(TARGDIR)\$(SYSPLATFORM)\include
+!ifneqi SYSPLATFORM linux
+  -@mkdir $(TARGDIR)\$(SYSPLATFORM)\dll
+!endif
+
+#############################################################
+#
+#           ***** Project clean procedures *****
+#
+#############################################################
+
+# cleanup build files
+clean: .SYMBOLIC
+CLEANEXTS   = obj exe err lst map sym lib dll
+CLEANLINUX  = xmlwf runtests elements outline benchmark
+  @for %a in ($(CLEANEXTS))  do -@rm *.%a
+  @for %a in ($(CLEANLINUX)) do -@rm %a*
+
+cleanall: clean .SYMBOLIC
+  @%write  watclean.tmp RELDIR=$(RELDIR)
+  @%append watclean.tmp DEBDIR=$(DEBDIR)
+  @if EXIST $(RELDIR)\os2   @wmake -h -f watclean.mif os2
+  @if EXIST $(DEBDIR)\os2   @wmake -h -f watclean.mif os2d
+  @if EXIST $(RELDIR)\nt    @wmake -h -f watclean.mif nt
+  @if EXIST $(DEBDIR)\nt    @wmake -h -f watclean.mif ntd
+  @if EXIST $(RELDIR)\linux @wmake -h -f watclean.mif linux
+  @if EXIST $(DEBDIR)\linux @wmake -h -f watclean.mif linuxd
+  @if EXIST $(RELDIR) -@rd $(RELDIR)
+  @if EXIST $(DEBDIR) -@rd $(DEBDIR)
+  @if EXIST watclean.tmp -@rm watclean.tmp
+  @if EXIST watopts.tmp -@rm watopts.tmp
+  @cd ..\tests
+  @if EXIST xmlts.zip -@rm xmlts.zip
+  @echo Clean complete.
+
+
+
diff --git a/expat/watcom/wexpat.lnk b/expat/watcom/wexpat.lnk
new file mode 100644
index 0000000..7adcca6
--- /dev/null
+++ b/expat/watcom/wexpat.lnk
@@ -0,0 +1,70 @@
+# EXPORTs for making dll with Open Watcom under NT/2000/XP
+SYSTEM nt_dll initinstance terminstance
+OPTION DESCRIPTION 'Expat (DLL) Implements an XML parser'
+
+EXPORT XML_DefaultCurrent
+EXPORT XML_ErrorString
+EXPORT XML_ExpatVersion
+EXPORT XML_ExpatVersionInfo
+EXPORT XML_ExternalEntityParserCreate
+EXPORT XML_GetBase
+EXPORT XML_GetBuffer
+EXPORT XML_GetCurrentByteCount
+EXPORT XML_GetCurrentByteIndex
+EXPORT XML_GetCurrentColumnNumber
+EXPORT XML_GetCurrentLineNumber
+EXPORT XML_GetErrorCode
+EXPORT XML_GetIdAttributeIndex
+EXPORT XML_GetInputContext
+EXPORT XML_GetSpecifiedAttributeCount
+EXPORT XML_Parse
+EXPORT XML_ParseBuffer
+EXPORT XML_ParserCreate
+EXPORT XML_ParserCreateNS
+EXPORT XML_ParserCreate_MM
+EXPORT XML_ParserFree
+EXPORT XML_SetAttlistDeclHandler
+EXPORT XML_SetBase
+EXPORT XML_SetCdataSectionHandler
+EXPORT XML_SetCharacterDataHandler
+EXPORT XML_SetCommentHandler
+EXPORT XML_SetDefaultHandler
+EXPORT XML_SetDefaultHandlerExpand
+EXPORT XML_SetDoctypeDeclHandler
+EXPORT XML_SetElementDeclHandler
+EXPORT XML_SetElementHandler
+EXPORT XML_SetEncoding
+EXPORT XML_SetEndCdataSectionHandler
+EXPORT XML_SetEndDoctypeDeclHandler
+EXPORT XML_SetEndElementHandler
+EXPORT XML_SetEndNamespaceDeclHandler
+EXPORT XML_SetEntityDeclHandler
+EXPORT XML_SetExternalEntityRefHandler
+EXPORT XML_SetExternalEntityRefHandlerArg
+EXPORT XML_SetNamespaceDeclHandler
+EXPORT XML_SetNotStandaloneHandler
+EXPORT XML_SetNotationDeclHandler
+EXPORT XML_SetParamEntityParsing
+EXPORT XML_SetProcessingInstructionHandler
+EXPORT XML_SetReturnNSTriplet
+EXPORT XML_SetStartCdataSectionHandler
+EXPORT XML_SetStartDoctypeDeclHandler
+EXPORT XML_SetStartElementHandler
+EXPORT XML_SetStartNamespaceDeclHandler
+EXPORT XML_SetUnknownEncodingHandler
+EXPORT XML_SetUnparsedEntityDeclHandler
+EXPORT XML_SetUserData
+EXPORT XML_SetXmlDeclHandler
+EXPORT XML_UseParserAsHandlerArg
+EXPORT XML_ParserReset
+EXPORT XML_SetSkippedEntityHandler
+EXPORT XML_GetFeatureList
+EXPORT XML_UseForeignDTD
+EXPORT XML_FreeContentModel
+EXPORT XML_MemMalloc
+EXPORT XML_MemRealloc
+EXPORT XML_MemFree
+EXPORT XML_StopParser
+EXPORT XML_ResumeParser
+EXPORT XML_GetParsingStatus
+
diff --git a/expat/xmlwf/codepage.c b/expat/xmlwf/codepage.c
index e610c7c..57e48ff 100755
--- a/expat/xmlwf/codepage.c
+++ b/expat/xmlwf/codepage.c
@@ -4,7 +4,7 @@
 
 #include "codepage.h"
 
-#ifdef WIN32
+#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))
 #define STRICT 1
 #define WIN32_LEAN_AND_MEAN 1
 
diff --git a/expat/xmlwf/readfilemap.c b/expat/xmlwf/readfilemap.c
index 0a91f08..170031e 100755
--- a/expat/xmlwf/readfilemap.c
+++ b/expat/xmlwf/readfilemap.c
@@ -8,6 +8,14 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#ifdef __WATCOMC__
+#ifndef __linux__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+#endif
+
 #ifdef __BEOS__
 #include <unistd.h>
 #endif
diff --git a/expat/xmlwf/xmlfile.c b/expat/xmlwf/xmlfile.c
index ceb00e8..5429491 100755
--- a/expat/xmlwf/xmlfile.c
+++ b/expat/xmlwf/xmlfile.c
@@ -14,6 +14,8 @@
 #include "macconfig.h"
 #elif defined(__amigaos4__)
 #include "amigaconfig.h"
+#elif defined(__WATCOMC__)
+#include "watcomconfig.h"
 #elif defined(HAVE_EXPAT_CONFIG_H)
 #include <expat_config.h>
 #endif /* ndef COMPILED_FROM_DSP */
@@ -23,9 +25,11 @@
 #include "xmltchar.h"
 #include "filemap.h"
 
-#ifdef _MSC_VER
+#if (defined(_MSC_VER) || defined(__WATCOMC__))
+#ifndef __linux__
 #include <io.h>
 #endif
+#endif
 
 #ifdef AMIGA_SHARED_LIB
 #include <proto/expat.h>
@@ -85,7 +89,7 @@
     *retPtr = 1;
 }
 
-#ifdef WIN32
+#if (defined(WIN32) || defined(__WATCOMC__))
 
 static int
 isAsciiLetter(XML_Char c)
@@ -103,7 +107,7 @@
   *toFree = 0;
   if (!base
       || *systemId == T('/')
-#ifdef WIN32
+#if (defined(WIN32) || defined(__WATCOMC__))
       || *systemId == T('\\')
       || (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))
 #endif
@@ -117,7 +121,7 @@
   s = *toFree;
   if (tcsrchr(s, T('/')))
     s = tcsrchr(s, T('/')) + 1;
-#ifdef WIN32
+#if (defined(WIN32) || defined(__WATCOMC__))
   if (tcsrchr(s, T('\\')))
     s = tcsrchr(s, T('\\')) + 1;
 #endif
diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 1659b7b..4b455d1 100755
--- a/expat/xmlwf/xmlwf.c
+++ b/expat/xmlwf/xmlwf.c
@@ -607,7 +607,7 @@
   const XML_Feature *features = XML_GetFeatureList();
   while ((ch = *s) != 0) {
     if (ch == '/'
-#ifdef WIN32
+#if (defined(WIN32) || defined(__WATCOMC__))
         || ch == '\\'
 #endif
         )
@@ -780,7 +780,7 @@
       const XML_Char *file = useStdin ? T("STDIN") : argv[i];
       if (tcsrchr(file, T('/')))
         file = tcsrchr(file, T('/')) + 1;
-#ifdef WIN32
+#if (defined(WIN32) || defined(__WATCOMC__))
       if (tcsrchr(file, T('\\')))
         file = tcsrchr(file, T('\\')) + 1;
 #endif