From 658f6f72da1f979bdbe0b95b133a5850b40c627d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Tue, 28 Jun 2016 09:29:39 +0200
Subject: [PATCH] Restore compatibility with old header files naming

---
 CMakeLists.txt              |   4 +-
 README/README.md            |   4 +-
 console/test71.cxx          |   2 +-
 experimental/TidyNodeIter.c |   2 +-
 include/tidy.h              |   6 +-
 include/tidy/buffio.h       | 112 ++++++
 include/tidy/enum.h         | 855 ++++++++++++++++++++++++++++++++++++++++++++
 include/tidy/platform.h     | 635 ++++++++++++++++++++++++++++++++
 include/tidybuffio.h        | 112 ------
 include/tidyenum.h          | 855 --------------------------------------------
 include/tidyplatform.h      | 635 --------------------------------
 src/buffio.c                |   2 +-
 src/fileio.h                |   2 +-
 src/forward.h               |   2 +-
 src/language.h              |   2 +-
 src/sprtf.h                 |   2 +-
 src/streamio.h              |   2 +-
 src/tmbstr.h                |   2 +-
 src/utf8.h                  |   4 +-
 20 files changed, 1621 insertions(+), 1621 deletions(-)
 create mode 100644 include/tidy/buffio.h
 create mode 100644 include/tidy/enum.h
 create mode 100644 include/tidy/platform.h
 delete mode 100644 include/tidybuffio.h
 delete mode 100644 include/tidyenum.h
 delete mode 100644 include/tidyplatform.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8d18dc..17a2850 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,8 +138,8 @@ set ( CFILES
         ${SRCDIR}/tidylib.c      ${SRCDIR}/mappedio.c     ${SRCDIR}/gdoc.c
         ${SRCDIR}/language.c  )
 set ( HFILES
-        ${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h         ${INCDIR}/tidyenum.h
-        ${INCDIR}/tidybuffio.h )
+        ${INCDIR}/tidy.h         ${INCDIR}/tidy/enum.h    ${INCDIR}/tidy/platform.h
+        ${INCDIR}/tidy/buffio.h )
 set ( LIBHFILES
         ${SRCDIR}/access.h       ${SRCDIR}/attrs.h        ${SRCDIR}/attrdict.h ${SRCDIR}/charsets.h
         ${SRCDIR}/clean.h        ${SRCDIR}/config.h       ${SRCDIR}/entities.h
diff --git a/README/README.md b/README/README.md
index 5fa3f36..2765b1f 100644
--- a/README/README.md
+++ b/README/README.md
@@ -38,11 +38,11 @@ If you do **not** need the tidy library built as a 'shared' (DLL) library, then
 
 ## Build PHP with the tidy-html5 library
 
-Due to API changes in the PHP source, "buffio.h" needs to be changed to "tidybuffio.h" in the file ext/tidy/tidy.c.
+Due to API changes in the PHP source, "buffio.h" needs to be changed to "tidy/buffio.h" in the file ext/tidy/tidy.c.
 
 That is - prior to configuring php run this in the php source directory:
 ```
-sed -i 's/buffio.h/tidybuffio.h/' ext/tidy/*.c
+sed -i 's,buffio.h,tidy/buffio.h,' ext/tidy/*.c
 ```
 
 And then continue with (just an example here, use your own php config options):
diff --git a/console/test71.cxx b/console/test71.cxx
index 4e8adf8..da6ce62 100644
--- a/console/test71.cxx
+++ b/console/test71.cxx
@@ -9,7 +9,7 @@
 \*/
 
 #include <stdio.h>
-#include "tidybuffio.h"
+#include "tidy/buffio.h"
 #include "tidy.h"
 
 static const char *sample =
diff --git a/experimental/TidyNodeIter.c b/experimental/TidyNodeIter.c
index db78e47..62483da 100644
--- a/experimental/TidyNodeIter.c
+++ b/experimental/TidyNodeIter.c
@@ -1,4 +1,4 @@
-#include "tidyplatform.h"
+#include "tidy/platform.h"
 #include "tidy-int.h"
 
 #include "TidyNodeIter.h"
diff --git a/include/tidy.h b/include/tidy.h
index 0eeabca..2364927 100755
--- a/include/tidy.h
+++ b/include/tidy.h
@@ -62,8 +62,8 @@
 
 */
 
-#include "tidyplatform.h"
-#include "tidyenum.h"
+#include "tidy/platform.h"
+#include "tidy/enum.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -263,7 +263,7 @@ The following is a short example program.
 
 <pre>
 \#include &lt;tidy.h&gt;
-\#include &lt;tidybuffio.h&gt;
+\#include &lt;tidy/buffio.h&gt;
 \#include &lt;stdio.h&gt;
 \#include &lt;errno.h&gt;
 
diff --git a/include/tidy/buffio.h b/include/tidy/buffio.h
new file mode 100644
index 0000000..400ae14
--- /dev/null
+++ b/include/tidy/buffio.h
@@ -0,0 +1,112 @@
+#ifndef __TIDY_BUFFIO_H__
+#define __TIDY_BUFFIO_H__
+
+/** @file tidy/buffio.h - Treat buffer as an I/O stream.
+
+  (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
+  See tidy.h for the copyright notice.
+
+  Requires buffer to automatically grow as bytes are added.
+  Must keep track of current read and write points.
+
+*/
+
+#include "tidy/platform.h"
+#include "tidy.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** TidyBuffer - A chunk of memory */
+TIDY_STRUCT
+struct _TidyBuffer 
+{
+    TidyAllocator* allocator;  /**< Memory allocator */
+    byte* bp;           /**< Pointer to bytes */
+    uint  size;         /**< # bytes currently in use */
+    uint  allocated;    /**< # bytes allocated */ 
+    uint  next;         /**< Offset of current input position */
+};
+
+/** Initialize data structure using the default allocator */
+TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf );
+
+/** Initialize data structure using the given custom allocator */
+TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator );
+
+/** Free current buffer, allocate given amount, reset input pointer,
+    use the default allocator */
+TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize );
+
+/** Free current buffer, allocate given amount, reset input pointer,
+    use the given custom allocator */
+TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf,
+                                                      TidyAllocator* allocator,
+                                                      uint allocSize );
+
+/** Expand buffer to given size. 
+**  Chunk size is minimum growth. Pass 0 for default of 256 bytes.
+*/
+TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf,
+                                              uint allocSize, uint chunkSize );
+
+/** Free current contents and zero out */
+TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf );
+
+/** Set buffer bytes to 0 */
+TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf );
+
+/** Attach to existing buffer */
+TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size );
+
+/** Detach from buffer.  Caller must free. */
+TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf );
+
+
+/** Append bytes to buffer.  Expand if necessary. */
+TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size );
+
+/** Append one byte to buffer.  Expand if necessary. */
+TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv );
+
+/** Get byte from end of buffer */
+TIDY_EXPORT int TIDY_CALL  tidyBufPopByte( TidyBuffer* buf );
+
+
+/** Get byte from front of buffer.  Increment input offset. */
+TIDY_EXPORT int TIDY_CALL  tidyBufGetByte( TidyBuffer* buf );
+
+/** At end of buffer? */
+TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf );
+
+/** Put a byte back into the buffer.  Decrement input offset. */
+TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv );
+
+
+/**************
+   TIDY
+**************/
+
+/* Forward declarations
+*/
+
+/** Initialize a buffer input source */
+TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf );
+
+/** Initialize a buffer output sink */
+TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TIDY_BUFFIO_H__ */
+
+/*
+ * local variables:
+ * mode: c
+ * indent-tabs-mode: nil
+ * c-basic-offset: 4
+ * eval: (c-set-offset 'substatement-open 0)
+ * end:
+ */
diff --git a/include/tidy/enum.h b/include/tidy/enum.h
new file mode 100644
index 0000000..f8a588e
--- /dev/null
+++ b/include/tidy/enum.h
@@ -0,0 +1,855 @@
+#ifndef __TIDYENUM_H__
+#define __TIDYENUM_H__
+
+/* @file tidy/enum.h -- Split public enums into separate header
+
+  Simplifies enum re-use in various wrappers.  e.g. SWIG
+  generated wrappers and COM IDL files.
+
+  Copyright (c) 1998-2008 World Wide Web Consortium
+  (Massachusetts Institute of Technology, European Research
+  Consortium for Informatics and Mathematics, Keio University).
+  All Rights Reserved.
+
+  Contributing Author(s):
+
+     Dave Raggett <dsr@w3.org>
+
+  The contributing author(s) would like to thank all those who
+  helped with testing, bug fixes and suggestions for improvements.
+  This wouldn't have been possible without your help.
+
+  COPYRIGHT NOTICE:
+
+  This software and documentation is provided "as is," and
+  the copyright holders and contributing author(s) make no
+  representations or warranties, express or implied, including
+  but not limited to, warranties of merchantability or fitness
+  for any particular purpose or that the use of the software or
+  documentation will not infringe any third party patents,
+  copyrights, trademarks or other rights.
+
+  The copyright holders and contributing author(s) will not be held
+  liable for any direct, indirect, special or consequential damages
+  arising out of any use of the software or documentation, even if
+  advised of the possibility of such damage.
+
+  Permission is hereby granted to use, copy, modify, and distribute
+  this source code, or portions hereof, documentation and executables,
+  for any purpose, without fee, subject to the following restrictions:
+
+  1. The origin of this source code must not be misrepresented.
+  2. Altered versions must be plainly marked as such and must
+     not be misrepresented as being the original source.
+  3. This Copyright notice may not be removed or altered from any
+     source or altered source distribution.
+
+  The copyright holders and contributing author(s) specifically
+  permit, without fee, and encourage the use of this source code
+  as a component for supporting the Hypertext Markup Language in
+  commercial products. If you use this source code in a product,
+  acknowledgment is not required but would be appreciated.
+
+
+  Created 2001-05-20 by Charles Reitzel
+  Updated 2002-07-01 by Charles Reitzel - 1st Implementation
+
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Enumerate configuration options
+*/
+
+/** Categories of Tidy configuration options
+*/
+typedef enum
+{
+  TidyMarkup,          /**< Markup options: (X)HTML version, etc */
+  TidyDiagnostics,     /**< Diagnostics */
+  TidyPrettyPrint,     /**< Output layout */
+  TidyEncoding,        /**< Character encodings */
+  TidyMiscellaneous    /**< File handling, message format, etc. */
+} TidyConfigCategory;
+
+
+/** Option IDs Used to get/set option values.
+
+    These TidyOptionId are used throughout libtidy, and also
+    have associated localized strings to describe them.
+ 
+    Note this enum MUST start at zero due to historical design-time
+    decisions that make assumptions about this starting value.
+*/
+typedef enum
+{
+  TidyUnknownOption,   /**< Unknown option! */
+  TidyIndentSpaces,    /**< Indentation n spaces/tabs */
+  TidyWrapLen,         /**< Wrap margin */
+  TidyTabSize,         /**< Expand tabs to n spaces */
+
+  TidyCharEncoding,    /**< In/out character encoding */
+  TidyInCharEncoding,  /**< Input character encoding (if different) */
+  TidyOutCharEncoding, /**< Output character encoding (if different) */
+  TidyNewline,         /**< Output line ending (default to platform) */
+
+  TidyDoctypeMode,     /**< See doctype property */
+  TidyDoctype,         /**< User specified doctype */
+
+  TidyDuplicateAttrs,  /**< Keep first or last duplicate attribute */
+  TidyAltText,         /**< Default text for alt attribute */
+
+  /* obsolete */
+  TidySlideStyle,      /**< Style sheet for slides: not used for anything yet */
+
+  TidyErrFile,         /**< File name to write errors to */
+  TidyOutFile,         /**< File name to write markup to */
+  TidyWriteBack,       /**< If true then output tidied markup */
+  TidyShowMarkup,      /**< If false, normal output is suppressed */
+  TidyShowInfo,        /**< If true, info-level messages are shown */
+  TidyShowWarnings,    /**< However errors are always shown */
+  TidyQuiet,           /**< No 'Parsing X', guessed DTD or summary */
+  TidyIndentContent,   /**< Indent content of appropriate tags */
+                       /**< "auto" does text/block level content indentation */
+  TidyCoerceEndTags,   /**< Coerce end tags from start tags where probably intended */
+  TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */
+  TidyHideEndTags,     /**< Legacy name for TidyOmitOptionalTags */
+  TidyXmlTags,         /**< Treat input as XML */
+  TidyXmlOut,          /**< Create output as XML */
+  TidyXhtmlOut,        /**< Output extensible HTML */
+  TidyHtmlOut,         /**< Output plain HTML, even for XHTML input.
+                           Yes means set explicitly. */
+  TidyXmlDecl,         /**< Add <?xml?> for XML docs */
+  TidyUpperCaseTags,   /**< Output tags in upper not lower case */
+  TidyUpperCaseAttrs,  /**< Output attributes in upper not lower case */
+  TidyMakeBare,        /**< Make bare HTML: remove Microsoft cruft */
+  TidyMakeClean,       /**< Replace presentational clutter by style rules */
+  TidyGDocClean,       /**< Clean up HTML exported from Google Docs */
+  TidyLogicalEmphasis, /**< Replace i by em and b by strong */
+  TidyDropPropAttrs,   /**< Discard proprietary attributes */
+  TidyDropFontTags,    /**< Discard presentation tags */
+  TidyDropEmptyElems,  /**< Discard empty elements */
+  TidyDropEmptyParas,  /**< Discard empty p elements */
+  TidyFixComments,     /**< Fix comments with adjacent hyphens */
+  TidyBreakBeforeBR,   /**< Output newline before <br> or not? */
+
+  /* obsolete */
+  TidyBurstSlides,     /**< Create slides on each h2 element */
+
+  TidyNumEntities,     /**< Use numeric entities */
+  TidyQuoteMarks,      /**< Output " marks as &quot; */
+  TidyQuoteNbsp,       /**< Output non-breaking space as entity */
+  TidyQuoteAmpersand,  /**< Output naked ampersand as &amp; */
+  TidyWrapAttVals,     /**< Wrap within attribute values */
+  TidyWrapScriptlets,  /**< Wrap within JavaScript string literals */
+  TidyWrapSection,     /**< Wrap within <![ ... ]> section tags */
+  TidyWrapAsp,         /**< Wrap within ASP pseudo elements */
+  TidyWrapJste,        /**< Wrap within JSTE pseudo elements */
+  TidyWrapPhp,         /**< Wrap within PHP pseudo elements */
+  TidyFixBackslash,    /**< Fix URLs by replacing \ with / */
+  TidyIndentAttributes,/**< Newline+indent before each attribute */
+  TidyXmlPIs,          /**< If set to yes PIs must end with ?> */
+  TidyXmlSpace,        /**< If set to yes adds xml:space attr as needed */
+  TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
+  TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */
+  TidyKeepFileTimes,   /**< If yes last modied time is preserved */
+  TidyWord2000,        /**< Draconian cleaning for Word2000 */
+  TidyMark,            /**< Add meta element indicating tidied doc */
+  TidyEmacs,           /**< If true format error output for GNU Emacs */
+  TidyEmacsFile,       /**< Name of current Emacs file */
+  TidyLiteralAttribs,  /**< If true attributes may use newlines */
+  TidyBodyOnly,        /**< Output BODY content only */
+  TidyFixUri,          /**< Applies URI encoding if necessary */
+  TidyLowerLiterals,   /**< Folds known attribute values to lower case */
+  TidyHideComments,    /**< Hides all (real) comments in output */
+  TidyIndentCdata,     /**< Indent <!CDATA[ ... ]]> section */
+  TidyForceOutput,     /**< Output document even if errors were found */
+  TidyShowErrors,      /**< Number of errors to put out */
+  TidyAsciiChars,      /**< Convert quotes and dashes to nearest ASCII char */
+  TidyJoinClasses,     /**< Join multiple class attributes */
+  TidyJoinStyles,      /**< Join multiple style attributes */
+  TidyEscapeCdata,     /**< Replace <![CDATA[]]> sections with escaped text */
+
+#if SUPPORT_ASIAN_ENCODINGS
+  TidyLanguage,        /**< Language property: not used for anything yet */
+  TidyNCR,             /**< Allow numeric character references */
+#else
+  TidyLanguageNotUsed,
+  TidyNCRNotUsed,
+#endif
+#if SUPPORT_UTF16_ENCODINGS
+  TidyOutputBOM,      /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */
+                      /**< auto: if input stream has BOM, we output a BOM */
+#else
+  TidyOutputBOMNotUsed,
+#endif
+
+  TidyReplaceColor,    /**< Replace hex color attribute values with names */
+  TidyCSSPrefix,       /**< CSS class naming for -clean option */
+
+  TidyInlineTags,      /**< Declared inline tags */
+  TidyBlockTags,       /**< Declared block tags */
+  TidyEmptyTags,       /**< Declared empty tags */
+  TidyPreTags,         /**< Declared pre tags */
+
+  TidyAccessibilityCheckLevel, /**< Accessibility check level
+                                   0 (old style), or 1, 2, 3 */
+
+  TidyVertSpace,       /**< degree to which markup is spread out vertically */
+#if SUPPORT_ASIAN_ENCODINGS
+  TidyPunctWrap,       /**< consider punctuation and breaking spaces for wrapping */
+#else
+  TidyPunctWrapNotUsed,
+#endif
+  TidyMergeEmphasis,       /**< Merge nested B and I elements */
+  TidyMergeDivs,           /**< Merge multiple DIVs */
+  TidyDecorateInferredUL,  /**< Mark inferred UL elements with no indent CSS */
+  TidyPreserveEntities,    /**< Preserve entities */
+  TidySortAttributes,      /**< Sort attributes */
+  TidyMergeSpans,          /**< Merge multiple SPANs */
+  TidyAnchorAsName,        /**< Define anchors as name attributes */
+  TidyPPrintTabs,          /**< Indent using tabs istead of spaces */
+  TidySkipNested,          /**< Skip nested tags in script and style CDATA */
+  TidyStrictTagsAttr,      /**< Ensure tags and attributes match output HTML version */
+  TidyEscapeScripts,       /**< Escape items that look like closing tags in script tags */
+  N_TIDY_OPTIONS           /**< Must be last */
+} TidyOptionId;
+
+    
+/** Option data types
+*/
+typedef enum
+{
+  TidyString,          /**< String */
+  TidyInteger,         /**< Integer or enumeration */
+  TidyBoolean          /**< Boolean flag */
+} TidyOptionType;
+
+
+/** AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM
+*/
+typedef enum
+{
+   TidyNoState,     /**< maps to 'no' */
+   TidyYesState,    /**< maps to 'yes' */
+   TidyAutoState    /**< Automatic */
+} TidyTriState;
+
+/** TidyNewline option values to control output line endings.
+*/
+typedef enum
+{
+    TidyLF,         /**< Use Unix style: LF */
+    TidyCRLF,       /**< Use DOS/Windows style: CR+LF */
+    TidyCR          /**< Use Macintosh style: CR */
+} TidyLineEnding;
+
+
+/** Mode controlling treatment of doctype
+*/
+typedef enum
+{
+    TidyDoctypeHtml5,   /**< <!DOCTYPE html> */
+    TidyDoctypeOmit,    /**< Omit DOCTYPE altogether */
+    TidyDoctypeAuto,    /**< Keep DOCTYPE in input.  Set version to content */
+    TidyDoctypeStrict,  /**< Convert document to HTML 4 strict content model */
+    TidyDoctypeLoose,   /**< Convert document to HTML 4 transitional
+                             content model */
+    TidyDoctypeUser     /**< Set DOCTYPE FPI explicitly */
+} TidyDoctypeModes;
+
+/** Mode controlling treatment of duplicate Attributes
+*/
+typedef enum
+{
+    TidyKeepFirst,
+    TidyKeepLast
+} TidyDupAttrModes;
+
+/** Mode controlling treatment of sorting attributes
+*/
+typedef enum
+{
+    TidySortAttrNone,
+    TidySortAttrAlpha
+} TidyAttrSortStrategy;
+
+
+/* I/O and Message handling interface
+**
+** By default, Tidy will define, create and use
+** instances of input and output handlers for
+** standard C buffered I/O (i.e. FILE* stdin,
+** FILE* stdout and FILE* stderr for content
+** input, content output and diagnostic output,
+** respectively.  A FILE* cfgFile input handler
+** will be used for config files.  Command line
+** options will just be set directly.
+*/
+
+/** Message severity level
+ *  These TidyReportLevel are used throughout libtidy, but don't
+ *  have associated localized strings to describe them because
+ *  TidyReportLevel is externally-facing, and changing the enum
+ *  starting int can break existing API's for poorly-written
+ *  applications using libtidy. See enum `TidyReportLevelKeys`.
+*/
+typedef enum
+{
+  TidyInfo,             /**< Information about markup usage */
+  TidyWarning,          /**< Warning message */
+  TidyConfig,           /**< Configuration error */
+  TidyAccess,           /**< Accessibility message */
+  TidyError,            /**< Error message - output suppressed */
+  TidyBadDocument,      /**< I/O or file system error */
+  TidyFatal             /**< Crash! */
+} TidyReportLevel;
+
+/** Message severity level - string lookup keys
+ *  These TidyReportLevelKeys are used throughout libtidy, and
+ *  have associated localized strings to describe them. They
+ *  correspond to enum `TidyReportLevel`.
+*/
+typedef enum
+{
+  TidyInfoString = 600,
+  TidyWarningString,
+  TidyConfigString,
+  TidyAccessString,
+  TidyErrorString,
+  TidyBadDocumentString,
+  TidyFatalString
+} TidyReportLevelKeys;
+
+
+/* Document tree traversal functions
+*/
+
+/** Node types
+*/
+typedef enum
+{
+  TidyNode_Root,        /**< Root */
+  TidyNode_DocType,     /**< DOCTYPE */
+  TidyNode_Comment,     /**< Comment */
+  TidyNode_ProcIns,     /**< Processing Instruction */
+  TidyNode_Text,        /**< Text */
+  TidyNode_Start,       /**< Start Tag */
+  TidyNode_End,         /**< End Tag */
+  TidyNode_StartEnd,    /**< Start/End (empty) Tag */
+  TidyNode_CDATA,       /**< Unparsed Text */
+  TidyNode_Section,     /**< XML Section */
+  TidyNode_Asp,         /**< ASP Source */
+  TidyNode_Jste,        /**< JSTE Source */
+  TidyNode_Php,         /**< PHP Source */
+  TidyNode_XmlDecl      /**< XML Declaration */
+} TidyNodeType;
+
+
+/** Known HTML element types
+*/
+typedef enum
+{
+  TidyTag_UNKNOWN,  /**< Unknown tag! */
+  TidyTag_A,        /**< A */
+  TidyTag_ABBR,     /**< ABBR */
+  TidyTag_ACRONYM,  /**< ACRONYM */
+  TidyTag_ADDRESS,  /**< ADDRESS */
+  TidyTag_ALIGN,    /**< ALIGN */
+  TidyTag_APPLET,   /**< APPLET */
+  TidyTag_AREA,     /**< AREA */
+  TidyTag_B,        /**< B */
+  TidyTag_BASE,     /**< BASE */
+  TidyTag_BASEFONT, /**< BASEFONT */
+  TidyTag_BDO,      /**< BDO */
+  TidyTag_BGSOUND,  /**< BGSOUND */
+  TidyTag_BIG,      /**< BIG */
+  TidyTag_BLINK,    /**< BLINK */
+  TidyTag_BLOCKQUOTE,   /**< BLOCKQUOTE */
+  TidyTag_BODY,     /**< BODY */
+  TidyTag_BR,       /**< BR */
+  TidyTag_BUTTON,   /**< BUTTON */
+  TidyTag_CAPTION,  /**< CAPTION */
+  TidyTag_CENTER,   /**< CENTER */
+  TidyTag_CITE,     /**< CITE */
+  TidyTag_CODE,     /**< CODE */
+  TidyTag_COL,      /**< COL */
+  TidyTag_COLGROUP, /**< COLGROUP */
+  TidyTag_COMMENT,  /**< COMMENT */
+  TidyTag_DD,       /**< DD */
+  TidyTag_DEL,      /**< DEL */
+  TidyTag_DFN,      /**< DFN */
+  TidyTag_DIR,      /**< DIR */
+  TidyTag_DIV,      /**< DIF */
+  TidyTag_DL,       /**< DL */
+  TidyTag_DT,       /**< DT */
+  TidyTag_EM,       /**< EM */
+  TidyTag_EMBED,    /**< EMBED */
+  TidyTag_FIELDSET, /**< FIELDSET */
+  TidyTag_FONT,     /**< FONT */
+  TidyTag_FORM,     /**< FORM */
+  TidyTag_FRAME,    /**< FRAME */
+  TidyTag_FRAMESET, /**< FRAMESET */
+  TidyTag_H1,       /**< H1 */
+  TidyTag_H2,       /**< H2 */
+  TidyTag_H3,       /**< H3 */
+  TidyTag_H4,       /**< H4 */
+  TidyTag_H5,       /**< H5 */
+  TidyTag_H6,       /**< H6 */
+  TidyTag_HEAD,     /**< HEAD */
+  TidyTag_HR,       /**< HR */
+  TidyTag_HTML,     /**< HTML */
+  TidyTag_I,        /**< I */
+  TidyTag_IFRAME,   /**< IFRAME */
+  TidyTag_ILAYER,   /**< ILAYER */
+  TidyTag_IMG,      /**< IMG */
+  TidyTag_INPUT,    /**< INPUT */
+  TidyTag_INS,      /**< INS */
+  TidyTag_ISINDEX,  /**< ISINDEX */
+  TidyTag_KBD,      /**< KBD */
+  TidyTag_KEYGEN,   /**< KEYGEN */
+  TidyTag_LABEL,    /**< LABEL */
+  TidyTag_LAYER,    /**< LAYER */
+  TidyTag_LEGEND,   /**< LEGEND */
+  TidyTag_LI,       /**< LI */
+  TidyTag_LINK,     /**< LINK */
+  TidyTag_LISTING,  /**< LISTING */
+  TidyTag_MAP,      /**< MAP */
+  TidyTag_MATHML,   /**< MATH  (HTML5) [i_a]2 MathML embedded in [X]HTML */
+  TidyTag_MARQUEE,  /**< MARQUEE */
+  TidyTag_MENU,     /**< MENU */
+  TidyTag_META,     /**< META */
+  TidyTag_MULTICOL, /**< MULTICOL */
+  TidyTag_NOBR,     /**< NOBR */
+  TidyTag_NOEMBED,  /**< NOEMBED */
+  TidyTag_NOFRAMES, /**< NOFRAMES */
+  TidyTag_NOLAYER,  /**< NOLAYER */
+  TidyTag_NOSAVE,   /**< NOSAVE */
+  TidyTag_NOSCRIPT, /**< NOSCRIPT */
+  TidyTag_OBJECT,   /**< OBJECT */
+  TidyTag_OL,       /**< OL */
+  TidyTag_OPTGROUP, /**< OPTGROUP */
+  TidyTag_OPTION,   /**< OPTION */
+  TidyTag_P,        /**< P */
+  TidyTag_PARAM,    /**< PARAM */
+  TidyTag_PICTURE,  /**< PICTURE (HTML5) */
+  TidyTag_PLAINTEXT,/**< PLAINTEXT */
+  TidyTag_PRE,      /**< PRE */
+  TidyTag_Q,        /**< Q */
+  TidyTag_RB,       /**< RB */
+  TidyTag_RBC,      /**< RBC */
+  TidyTag_RP,       /**< RP */
+  TidyTag_RT,       /**< RT */
+  TidyTag_RTC,      /**< RTC */
+  TidyTag_RUBY,     /**< RUBY */
+  TidyTag_S,        /**< S */
+  TidyTag_SAMP,     /**< SAMP */
+  TidyTag_SCRIPT,   /**< SCRIPT */
+  TidyTag_SELECT,   /**< SELECT */
+  TidyTag_SERVER,   /**< SERVER */
+  TidyTag_SERVLET,  /**< SERVLET */
+  TidyTag_SMALL,    /**< SMALL */
+  TidyTag_SPACER,   /**< SPACER */
+  TidyTag_SPAN,     /**< SPAN */
+  TidyTag_STRIKE,   /**< STRIKE */
+  TidyTag_STRONG,   /**< STRONG */
+  TidyTag_STYLE,    /**< STYLE */
+  TidyTag_SUB,      /**< SUB */
+  TidyTag_SUP,      /**< SUP */
+  TidyTag_SVG,      /**< SVG  (HTML5) */
+  TidyTag_TABLE,    /**< TABLE */
+  TidyTag_TBODY,    /**< TBODY */
+  TidyTag_TD,       /**< TD */
+  TidyTag_TEXTAREA, /**< TEXTAREA */
+  TidyTag_TFOOT,    /**< TFOOT */
+  TidyTag_TH,       /**< TH */
+  TidyTag_THEAD,    /**< THEAD */
+  TidyTag_TITLE,    /**< TITLE */
+  TidyTag_TR,       /**< TR */
+  TidyTag_TT,       /**< TT */
+  TidyTag_U,        /**< U */
+  TidyTag_UL,       /**< UL */
+  TidyTag_VAR,      /**< VAR */
+  TidyTag_WBR,      /**< WBR */
+  TidyTag_XMP,      /**< XMP */
+  TidyTag_NEXTID,   /**< NEXTID */
+
+  TidyTag_ARTICLE,
+  TidyTag_ASIDE,
+  TidyTag_AUDIO,
+  TidyTag_BDI,
+  TidyTag_CANVAS,
+  TidyTag_COMMAND,
+  TidyTag_DATALIST,
+  TidyTag_DETAILS,
+  TidyTag_DIALOG,
+  TidyTag_FIGCAPTION,
+  TidyTag_FIGURE,
+  TidyTag_FOOTER,
+  TidyTag_HEADER,
+  TidyTag_HGROUP,
+  TidyTag_MAIN,
+  TidyTag_MARK,
+  TidyTag_MENUITEM,
+  TidyTag_METER,
+  TidyTag_NAV,
+  TidyTag_OUTPUT,
+  TidyTag_PROGRESS,
+  TidyTag_SECTION,
+  TidyTag_SOURCE,
+  TidyTag_SUMMARY,
+  TidyTag_TEMPLATE,
+  TidyTag_TIME,
+  TidyTag_TRACK,
+  TidyTag_VIDEO,
+
+  N_TIDY_TAGS       /**< Must be last */
+} TidyTagId;
+
+/* Attribute interrogation
+*/
+
+/** Known HTML attributes
+*/
+typedef enum
+{
+  TidyAttr_UNKNOWN,           /**< UNKNOWN= */
+  TidyAttr_ABBR,              /**< ABBR= */
+  TidyAttr_ACCEPT,            /**< ACCEPT= */
+  TidyAttr_ACCEPT_CHARSET,    /**< ACCEPT_CHARSET= */
+  TidyAttr_ACCESSKEY,         /**< ACCESSKEY= */
+  TidyAttr_ACTION,            /**< ACTION= */
+  TidyAttr_ADD_DATE,          /**< ADD_DATE= */
+  TidyAttr_ALIGN,             /**< ALIGN= */
+  TidyAttr_ALINK,             /**< ALINK= */
+  TidyAttr_ALLOWFULLSCREEN,   /**< ALLOWFULLSCREEN= */
+  TidyAttr_ALT,               /**< ALT= */
+  TidyAttr_ARCHIVE,           /**< ARCHIVE= */
+  TidyAttr_AXIS,              /**< AXIS= */
+  TidyAttr_BACKGROUND,        /**< BACKGROUND= */
+  TidyAttr_BGCOLOR,           /**< BGCOLOR= */
+  TidyAttr_BGPROPERTIES,      /**< BGPROPERTIES= */
+  TidyAttr_BORDER,            /**< BORDER= */
+  TidyAttr_BORDERCOLOR,       /**< BORDERCOLOR= */
+  TidyAttr_BOTTOMMARGIN,      /**< BOTTOMMARGIN= */
+  TidyAttr_CELLPADDING,       /**< CELLPADDING= */
+  TidyAttr_CELLSPACING,       /**< CELLSPACING= */
+  TidyAttr_CHAR,              /**< CHAR= */
+  TidyAttr_CHAROFF,           /**< CHAROFF= */
+  TidyAttr_CHARSET,           /**< CHARSET= */
+  TidyAttr_CHECKED,           /**< CHECKED= */
+  TidyAttr_CITE,              /**< CITE= */
+  TidyAttr_CLASS,             /**< CLASS= */
+  TidyAttr_CLASSID,           /**< CLASSID= */
+  TidyAttr_CLEAR,             /**< CLEAR= */
+  TidyAttr_CODE,              /**< CODE= */
+  TidyAttr_CODEBASE,          /**< CODEBASE= */
+  TidyAttr_CODETYPE,          /**< CODETYPE= */
+  TidyAttr_COLOR,             /**< COLOR= */
+  TidyAttr_COLS,              /**< COLS= */
+  TidyAttr_COLSPAN,           /**< COLSPAN= */
+  TidyAttr_COMPACT,           /**< COMPACT= */
+  TidyAttr_CONTENT,           /**< CONTENT= */
+  TidyAttr_COORDS,            /**< COORDS= */
+  TidyAttr_DATA,              /**< DATA= */
+  TidyAttr_DATAFLD,           /**< DATAFLD= */
+  TidyAttr_DATAFORMATAS,      /**< DATAFORMATAS= */
+  TidyAttr_DATAPAGESIZE,      /**< DATAPAGESIZE= */
+  TidyAttr_DATASRC,           /**< DATASRC= */
+  TidyAttr_DATETIME,          /**< DATETIME= */
+  TidyAttr_DECLARE,           /**< DECLARE= */
+  TidyAttr_DEFER,             /**< DEFER= */
+  TidyAttr_DIR,               /**< DIR= */
+  TidyAttr_DISABLED,          /**< DISABLED= */
+  TidyAttr_ENCODING,          /**< ENCODING= */
+  TidyAttr_ENCTYPE,           /**< ENCTYPE= */
+  TidyAttr_FACE,              /**< FACE= */
+  TidyAttr_FOR,               /**< FOR= */
+  TidyAttr_FRAME,             /**< FRAME= */
+  TidyAttr_FRAMEBORDER,       /**< FRAMEBORDER= */
+  TidyAttr_FRAMESPACING,      /**< FRAMESPACING= */
+  TidyAttr_GRIDX,             /**< GRIDX= */
+  TidyAttr_GRIDY,             /**< GRIDY= */
+  TidyAttr_HEADERS,           /**< HEADERS= */
+  TidyAttr_HEIGHT,            /**< HEIGHT= */
+  TidyAttr_HREF,              /**< HREF= */
+  TidyAttr_HREFLANG,          /**< HREFLANG= */
+  TidyAttr_HSPACE,            /**< HSPACE= */
+  TidyAttr_HTTP_EQUIV,        /**< HTTP_EQUIV= */
+  TidyAttr_ID,                /**< ID= */
+  TidyAttr_ISMAP,             /**< ISMAP= */
+  TidyAttr_ITEMID,            /**< ITEMID= */
+  TidyAttr_ITEMPROP,          /**< ITEMPROP= */
+  TidyAttr_ITEMREF,           /**< ITEMREF= */
+  TidyAttr_ITEMSCOPE,         /**< ITEMSCOPE= */
+  TidyAttr_ITEMTYPE,          /**< ITEMTYPE= */
+  TidyAttr_LABEL,             /**< LABEL= */
+  TidyAttr_LANG,              /**< LANG= */
+  TidyAttr_LANGUAGE,          /**< LANGUAGE= */
+  TidyAttr_LAST_MODIFIED,     /**< LAST_MODIFIED= */
+  TidyAttr_LAST_VISIT,        /**< LAST_VISIT= */
+  TidyAttr_LEFTMARGIN,        /**< LEFTMARGIN= */
+  TidyAttr_LINK,              /**< LINK= */
+  TidyAttr_LONGDESC,          /**< LONGDESC= */
+  TidyAttr_LOWSRC,            /**< LOWSRC= */
+  TidyAttr_MARGINHEIGHT,      /**< MARGINHEIGHT= */
+  TidyAttr_MARGINWIDTH,       /**< MARGINWIDTH= */
+  TidyAttr_MAXLENGTH,         /**< MAXLENGTH= */
+  TidyAttr_MEDIA,             /**< MEDIA= */
+  TidyAttr_METHOD,            /**< METHOD= */
+  TidyAttr_MULTIPLE,          /**< MULTIPLE= */
+  TidyAttr_NAME,              /**< NAME= */
+  TidyAttr_NOHREF,            /**< NOHREF= */
+  TidyAttr_NORESIZE,          /**< NORESIZE= */
+  TidyAttr_NOSHADE,           /**< NOSHADE= */
+  TidyAttr_NOWRAP,            /**< NOWRAP= */
+  TidyAttr_OBJECT,            /**< OBJECT= */
+  TidyAttr_OnAFTERUPDATE,     /**< OnAFTERUPDATE= */
+  TidyAttr_OnBEFOREUNLOAD,    /**< OnBEFOREUNLOAD= */
+  TidyAttr_OnBEFOREUPDATE,    /**< OnBEFOREUPDATE= */
+  TidyAttr_OnBLUR,            /**< OnBLUR= */
+  TidyAttr_OnCHANGE,          /**< OnCHANGE= */
+  TidyAttr_OnCLICK,           /**< OnCLICK= */
+  TidyAttr_OnDATAAVAILABLE,   /**< OnDATAAVAILABLE= */
+  TidyAttr_OnDATASETCHANGED,  /**< OnDATASETCHANGED= */
+  TidyAttr_OnDATASETCOMPLETE, /**< OnDATASETCOMPLETE= */
+  TidyAttr_OnDBLCLICK,        /**< OnDBLCLICK= */
+  TidyAttr_OnERRORUPDATE,     /**< OnERRORUPDATE= */
+  TidyAttr_OnFOCUS,           /**< OnFOCUS= */
+  TidyAttr_OnKEYDOWN,         /**< OnKEYDOWN= */
+  TidyAttr_OnKEYPRESS,        /**< OnKEYPRESS= */
+  TidyAttr_OnKEYUP,           /**< OnKEYUP= */
+  TidyAttr_OnLOAD,            /**< OnLOAD= */
+  TidyAttr_OnMOUSEDOWN,       /**< OnMOUSEDOWN= */
+  TidyAttr_OnMOUSEMOVE,       /**< OnMOUSEMOVE= */
+  TidyAttr_OnMOUSEOUT,        /**< OnMOUSEOUT= */
+  TidyAttr_OnMOUSEOVER,       /**< OnMOUSEOVER= */
+  TidyAttr_OnMOUSEUP,         /**< OnMOUSEUP= */
+  TidyAttr_OnRESET,           /**< OnRESET= */
+  TidyAttr_OnROWENTER,        /**< OnROWENTER= */
+  TidyAttr_OnROWEXIT,         /**< OnROWEXIT= */
+  TidyAttr_OnSELECT,          /**< OnSELECT= */
+  TidyAttr_OnSUBMIT,          /**< OnSUBMIT= */
+  TidyAttr_OnUNLOAD,          /**< OnUNLOAD= */
+  TidyAttr_PROFILE,           /**< PROFILE= */
+  TidyAttr_PROMPT,            /**< PROMPT= */
+  TidyAttr_RBSPAN,            /**< RBSPAN= */
+  TidyAttr_READONLY,          /**< READONLY= */
+  TidyAttr_REL,               /**< REL= */
+  TidyAttr_REV,               /**< REV= */
+  TidyAttr_RIGHTMARGIN,       /**< RIGHTMARGIN= */
+  TidyAttr_ROLE,              /**< ROLE= */
+  TidyAttr_ROWS,              /**< ROWS= */
+  TidyAttr_ROWSPAN,           /**< ROWSPAN= */
+  TidyAttr_RULES,             /**< RULES= */
+  TidyAttr_SCHEME,            /**< SCHEME= */
+  TidyAttr_SCOPE,             /**< SCOPE= */
+  TidyAttr_SCROLLING,         /**< SCROLLING= */
+  TidyAttr_SELECTED,          /**< SELECTED= */
+  TidyAttr_SHAPE,             /**< SHAPE= */
+  TidyAttr_SHOWGRID,          /**< SHOWGRID= */
+  TidyAttr_SHOWGRIDX,         /**< SHOWGRIDX= */
+  TidyAttr_SHOWGRIDY,         /**< SHOWGRIDY= */
+  TidyAttr_SIZE,              /**< SIZE= */
+  TidyAttr_SPAN,              /**< SPAN= */
+  TidyAttr_SRC,               /**< SRC= */
+  TidyAttr_SRCSET,            /**< SRCSET= (HTML5) */
+  TidyAttr_STANDBY,           /**< STANDBY= */
+  TidyAttr_START,             /**< START= */
+  TidyAttr_STYLE,             /**< STYLE= */
+  TidyAttr_SUMMARY,           /**< SUMMARY= */
+  TidyAttr_TABINDEX,          /**< TABINDEX= */
+  TidyAttr_TARGET,            /**< TARGET= */
+  TidyAttr_TEXT,              /**< TEXT= */
+  TidyAttr_TITLE,             /**< TITLE= */
+  TidyAttr_TOPMARGIN,         /**< TOPMARGIN= */
+  TidyAttr_TRANSLATE,         /**< TRANSLATE= */
+  TidyAttr_TYPE,              /**< TYPE= */
+  TidyAttr_USEMAP,            /**< USEMAP= */
+  TidyAttr_VALIGN,            /**< VALIGN= */
+  TidyAttr_VALUE,             /**< VALUE= */
+  TidyAttr_VALUETYPE,         /**< VALUETYPE= */
+  TidyAttr_VERSION,           /**< VERSION= */
+  TidyAttr_VLINK,             /**< VLINK= */
+  TidyAttr_VSPACE,            /**< VSPACE= */
+  TidyAttr_WIDTH,             /**< WIDTH= */
+  TidyAttr_WRAP,              /**< WRAP= */
+  TidyAttr_XML_LANG,          /**< XML_LANG= */
+  TidyAttr_XML_SPACE,         /**< XML_SPACE= */
+  TidyAttr_XMLNS,             /**< XMLNS= */
+
+  TidyAttr_EVENT,             /**< EVENT= */
+  TidyAttr_METHODS,           /**< METHODS= */
+  TidyAttr_N,                 /**< N= */
+  TidyAttr_SDAFORM,           /**< SDAFORM= */
+  TidyAttr_SDAPREF,           /**< SDAPREF= */
+  TidyAttr_SDASUFF,           /**< SDASUFF= */
+  TidyAttr_URN,               /**< URN= */
+
+  TidyAttr_ASYNC,
+  TidyAttr_AUTOCOMPLETE,
+  TidyAttr_AUTOFOCUS,
+  TidyAttr_AUTOPLAY,
+  TidyAttr_CHALLENGE,
+  TidyAttr_CONTENTEDITABLE,
+  TidyAttr_CONTEXTMENU,
+  TidyAttr_CONTROLS,
+  TidyAttr_DEFAULT,
+  TidyAttr_DIRNAME,
+  TidyAttr_DRAGGABLE,
+  TidyAttr_DROPZONE,
+  TidyAttr_FORM,
+  TidyAttr_FORMACTION,
+  TidyAttr_FORMENCTYPE,
+  TidyAttr_FORMMETHOD,
+  TidyAttr_FORMNOVALIDATE,
+  TidyAttr_FORMTARGET,
+  TidyAttr_HIDDEN,
+  TidyAttr_HIGH,
+  TidyAttr_ICON,
+  TidyAttr_KEYTYPE,
+  TidyAttr_KIND,
+  TidyAttr_LIST,
+  TidyAttr_LOOP,
+  TidyAttr_LOW,
+  TidyAttr_MANIFEST,
+  TidyAttr_MAX,
+  TidyAttr_MEDIAGROUP,
+  TidyAttr_MIN,
+  TidyAttr_NOVALIDATE,
+  TidyAttr_OPEN,
+  TidyAttr_OPTIMUM,
+  TidyAttr_OnABORT,
+  TidyAttr_OnAFTERPRINT,
+  TidyAttr_OnBEFOREPRINT,
+  TidyAttr_OnCANPLAY,
+  TidyAttr_OnCANPLAYTHROUGH,
+  TidyAttr_OnCONTEXTMENU,
+  TidyAttr_OnCUECHANGE,
+  TidyAttr_OnDRAG,
+  TidyAttr_OnDRAGEND,
+  TidyAttr_OnDRAGENTER,
+  TidyAttr_OnDRAGLEAVE,
+  TidyAttr_OnDRAGOVER,
+  TidyAttr_OnDRAGSTART,
+  TidyAttr_OnDROP,
+  TidyAttr_OnDURATIONCHANGE,
+  TidyAttr_OnEMPTIED,
+  TidyAttr_OnENDED,
+  TidyAttr_OnERROR,
+  TidyAttr_OnHASHCHANGE,
+  TidyAttr_OnINPUT,
+  TidyAttr_OnINVALID,
+  TidyAttr_OnLOADEDDATA,
+  TidyAttr_OnLOADEDMETADATA,
+  TidyAttr_OnLOADSTART,
+  TidyAttr_OnMESSAGE,
+  TidyAttr_OnMOUSEWHEEL,
+  TidyAttr_OnOFFLINE,
+  TidyAttr_OnONLINE,
+  TidyAttr_OnPAGEHIDE,
+  TidyAttr_OnPAGESHOW,
+  TidyAttr_OnPAUSE,
+  TidyAttr_OnPLAY,
+  TidyAttr_OnPLAYING,
+  TidyAttr_OnPOPSTATE,
+  TidyAttr_OnPROGRESS,
+  TidyAttr_OnRATECHANGE,
+  TidyAttr_OnREADYSTATECHANGE,
+  TidyAttr_OnREDO,
+  TidyAttr_OnRESIZE,
+  TidyAttr_OnSCROLL,
+  TidyAttr_OnSEEKED,
+  TidyAttr_OnSEEKING,
+  TidyAttr_OnSHOW,
+  TidyAttr_OnSTALLED,
+  TidyAttr_OnSTORAGE,
+  TidyAttr_OnSUSPEND,
+  TidyAttr_OnTIMEUPDATE,
+  TidyAttr_OnUNDO,
+  TidyAttr_OnVOLUMECHANGE,
+  TidyAttr_OnWAITING,
+  TidyAttr_PATTERN,
+  TidyAttr_PLACEHOLDER,
+  TidyAttr_POSTER,
+  TidyAttr_PRELOAD,
+  TidyAttr_PUBDATE,
+  TidyAttr_RADIOGROUP,
+  TidyAttr_REQUIRED,
+  TidyAttr_REVERSED,
+  TidyAttr_SANDBOX,
+  TidyAttr_SCOPED,
+  TidyAttr_SEAMLESS,
+  TidyAttr_SIZES,
+  TidyAttr_SPELLCHECK,
+  TidyAttr_SRCDOC,
+  TidyAttr_SRCLANG,
+  TidyAttr_STEP,
+  TidyAttr_ARIA_ACTIVEDESCENDANT,
+  TidyAttr_ARIA_ATOMIC,
+  TidyAttr_ARIA_AUTOCOMPLETE,
+  TidyAttr_ARIA_BUSY,
+  TidyAttr_ARIA_CHECKED,
+  TidyAttr_ARIA_CONTROLS,
+  TidyAttr_ARIA_DESCRIBEDBY,
+  TidyAttr_ARIA_DISABLED,
+  TidyAttr_ARIA_DROPEFFECT,
+  TidyAttr_ARIA_EXPANDED,
+  TidyAttr_ARIA_FLOWTO,
+  TidyAttr_ARIA_GRABBED,
+  TidyAttr_ARIA_HASPOPUP,
+  TidyAttr_ARIA_HIDDEN,
+  TidyAttr_ARIA_INVALID,
+  TidyAttr_ARIA_LABEL,
+  TidyAttr_ARIA_LABELLEDBY,
+  TidyAttr_ARIA_LEVEL,
+  TidyAttr_ARIA_LIVE,
+  TidyAttr_ARIA_MULTILINE,
+  TidyAttr_ARIA_MULTISELECTABLE,
+  TidyAttr_ARIA_ORIENTATION,
+  TidyAttr_ARIA_OWNS,
+  TidyAttr_ARIA_POSINSET,
+  TidyAttr_ARIA_PRESSED,
+  TidyAttr_ARIA_READONLY,
+  TidyAttr_ARIA_RELEVANT,
+  TidyAttr_ARIA_REQUIRED,
+  TidyAttr_ARIA_SELECTED,
+  TidyAttr_ARIA_SETSIZE,
+  TidyAttr_ARIA_SORT,
+  TidyAttr_ARIA_VALUEMAX,
+  TidyAttr_ARIA_VALUEMIN,
+  TidyAttr_ARIA_VALUENOW,
+  TidyAttr_ARIA_VALUETEXT,
+
+  /* SVG attributes (SVG 1.1) */
+  TidyAttr_X,                   /**< X= */
+  TidyAttr_Y,                   /**< Y= */
+  TidyAttr_VIEWBOX,             /**< VIEWBOX= */
+  TidyAttr_PRESERVEASPECTRATIO, /**< PRESERVEASPECTRATIO= */
+  TidyAttr_ZOOMANDPAN,          /**< ZOOMANDPAN= */
+  TidyAttr_BASEPROFILE,         /**< BASEPROFILE= */
+  TidyAttr_CONTENTSCRIPTTYPE,   /**< CONTENTSCRIPTTYPE= */
+  TidyAttr_CONTENTSTYLETYPE,    /**< CONTENTSTYLETYPE= */
+  /* MathML <math> attributes */
+  TidyAttr_DISPLAY,             /**< DISPLAY= (html5) */
+
+  /* RDFa global attributes */
+  TidyAttr_ABOUT,             /**< ABOUT= */
+  TidyAttr_DATATYPE,          /**< DATATYPE= */
+  TidyAttr_INLIST,            /**< INLIST= */
+  TidyAttr_PREFIX,            /**< PREFIX= */
+  TidyAttr_PROPERTY,          /**< PROPERTY= */
+  TidyAttr_RESOURCE,          /**< RESOURCE= */
+  TidyAttr_TYPEOF,            /**< TYPEOF= */
+  TidyAttr_VOCAB,             /**< VOCAB= */
+
+  N_TIDY_ATTRIBS              /**< Must be last */
+} TidyAttrId;
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+#endif /* __TIDYENUM_H__ */
+
diff --git a/include/tidy/platform.h b/include/tidy/platform.h
new file mode 100644
index 0000000..68cb778
--- /dev/null
+++ b/include/tidy/platform.h
@@ -0,0 +1,635 @@
+#ifndef __TIDY_PLATFORM_H__
+#define __TIDY_PLATFORM_H__
+
+/* tidy/platform.h -- Platform specifics
+
+  (c) 1998-2008 (W3C) MIT, ERCIM, Keio University
+  See tidy.h for the copyright notice.
+
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  Uncomment and edit one of the following #defines if you
+  want to specify the config file at compile-time.
+*/
+
+/* #define TIDY_CONFIG_FILE "/etc/tidy_config.txt" */ /* original */
+/* #define TIDY_CONFIG_FILE "/etc/tidyrc" */
+/* #define TIDY_CONFIG_FILE "/etc/tidy.conf" */
+
+/*
+  Uncomment the following #define if you are on a system
+  supporting the HOME environment variable.
+  It enables tidy to find config files named ~/.tidyrc if 
+  the HTML_TIDY environment variable is not set.
+*/
+/* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */
+
+/*
+  Uncomment the following #define if your
+  system supports the call getpwnam(). 
+  E.g. Unix and Linux.
+
+  It enables tidy to find files named 
+  ~your/foo for use in the HTML_TIDY environment
+  variable or CONFIG_FILE or USER_CONFIGFILE or
+  on the command line: -config ~joebob/tidy.cfg
+
+  Contributed by Todd Lewis.
+*/
+
+/* #define SUPPORT_GETPWNAM */
+
+
+/* Enable/disable support for Big5 and Shift_JIS character encodings */
+#ifndef SUPPORT_ASIAN_ENCODINGS
+#define SUPPORT_ASIAN_ENCODINGS 1
+#endif
+
+/* Enable/disable support for UTF-16 character encodings */
+#ifndef SUPPORT_UTF16_ENCODINGS
+#define SUPPORT_UTF16_ENCODINGS 1
+#endif
+
+/* Enable/disable support for additional accessibility checks */
+#ifndef SUPPORT_ACCESSIBILITY_CHECKS
+#define SUPPORT_ACCESSIBILITY_CHECKS 1
+#endif
+
+/* Enable/disable support for additional languages */
+#ifndef SUPPORT_LOCALIZATIONS
+#define SUPPORT_LOCALIZATIONS 1
+#endif
+
+
+/* Convenience defines for Mac platforms */
+
+#if defined(macintosh)
+/* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */
+#define MAC_OS_CLASSIC
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Mac OS"
+#endif
+
+/* needed for access() */
+#if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
+#define NO_ACCESS_SUPPORT
+#endif
+
+#ifdef SUPPORT_GETPWNAM
+#undef SUPPORT_GETPWNAM
+#endif
+
+#elif defined(__APPLE__) && defined(__MACH__)
+/* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */
+#define MAC_OS_X
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Mac OS X"
+#endif
+#endif
+
+#if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
+/* Any OS on Mac platform */
+#define MAC_OS
+#define FILENAMES_CASE_SENSITIVE 0
+#define strcasecmp strcmp
+#endif
+
+/* Convenience defines for BSD like platforms */
+ 
+#if defined(__FreeBSD__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "FreeBSD"
+#endif
+
+#elif defined(__NetBSD__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "NetBSD"
+#endif
+
+#elif defined(__OpenBSD__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "OpenBSD"
+#endif
+
+#elif defined(__DragonFly__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "DragonFly"
+#endif
+
+#elif defined(__MINT__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "FreeMiNT"
+#endif
+
+#elif defined(__bsdi__)
+#define BSD_BASED_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "BSD/OS"
+#endif
+
+#endif
+
+/* Convenience defines for Windows platforms */
+ 
+#if defined(WINDOWS) || defined(_WIN32)
+
+#define WINDOWS_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Windows"
+#endif
+
+#if defined(__MWERKS__) || defined(__MSL__)
+/* not available with Metrowerks Standard Library */
+
+#ifdef SUPPORT_GETPWNAM
+#undef SUPPORT_GETPWNAM
+#endif
+
+/* needed for setmode() */
+#if !defined(NO_SETMODE_SUPPORT)
+#define NO_SETMODE_SUPPORT
+#endif
+
+#define strcasecmp _stricmp
+
+#endif
+
+#if defined(__BORLANDC__)
+#define strcasecmp stricmp
+#endif
+
+#define FILENAMES_CASE_SENSITIVE 0
+#define SUPPORT_POSIX_MAPPED_FILES 0
+
+#endif
+
+/* Convenience defines for Linux platforms */
+ 
+#if defined(linux) && defined(__alpha__)
+/* Linux on Alpha - gcc compiler */
+#define LINUX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Linux/Alpha"
+#endif
+
+#elif defined(linux) && defined(__sparc__)
+/* Linux on Sparc - gcc compiler */
+#define LINUX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Linux/Sparc"
+#endif
+
+#elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
+/* Linux on x86 - gcc compiler */
+#define LINUX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Linux/x86"
+#endif
+
+#elif defined(linux) && defined(__powerpc__)
+/* Linux on PPC - gcc compiler */
+#define LINUX_OS
+
+#if defined(__linux__) && defined(__powerpc__)
+
+/* #if #system(linux) */
+/* MkLinux on PPC  - gcc (egcs) compiler */
+/* #define MAC_OS_MKLINUX */
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "MkLinux"
+#endif
+
+#else
+
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Linux/PPC"
+#endif
+
+#endif
+
+#elif defined(linux) || defined(__linux__)
+/* generic Linux */
+#define LINUX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Linux"
+#endif
+
+#endif
+
+/* Convenience defines for Solaris platforms */
+ 
+#if defined(sun)
+#define SOLARIS_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Solaris"
+#endif
+#endif
+
+/* Convenience defines for HPUX + gcc platforms */
+
+#if defined(__hpux)
+#define HPUX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "HPUX"
+#endif
+#endif
+
+/* Convenience defines for RISCOS + gcc platforms */
+
+#if defined(__riscos__)
+#define RISC_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "RISC OS"
+#endif
+#endif
+
+/* Convenience defines for OS/2 + icc/gcc platforms */
+
+#if defined(__OS2__) || defined(__EMX__)
+#define OS2_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "OS/2"
+#endif
+#define FILENAMES_CASE_SENSITIVE 0
+#define strcasecmp stricmp
+#endif
+
+/* Convenience defines for IRIX */
+
+#if defined(__sgi)
+#define IRIX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "SGI IRIX"
+#endif
+#endif
+
+/* Convenience defines for AIX */
+
+#if defined(_AIX)
+#define AIX_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "IBM AIX"
+#endif
+#endif
+
+
+/* Convenience defines for BeOS platforms */
+
+#if defined(__BEOS__)
+#define BE_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "BeOS"
+#endif
+#endif
+
+/* Convenience defines for Cygwin platforms */
+
+#if defined(__CYGWIN__)
+#define CYGWIN_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Cygwin"
+#endif
+#define FILENAMES_CASE_SENSITIVE 0
+#endif
+
+/* Convenience defines for OpenVMS */
+
+#if defined(__VMS)
+#define OPENVMS_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "OpenVMS"
+#endif
+#define FILENAMES_CASE_SENSITIVE 0
+#endif
+
+/* Convenience defines for DEC Alpha OSF + gcc platforms */
+
+#if defined(__osf__)
+#define OSF_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "DEC Alpha OSF"
+#endif
+#endif
+
+/* Convenience defines for ARM platforms */
+
+#if defined(__arm)
+#define ARM_OS
+
+#if defined(forARM) && defined(__NEWTON_H)
+
+/* Using Newton C++ Tools ARMCpp compiler */
+#define NEWTON_OS
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "Newton"
+#endif
+
+#else
+
+#ifndef PLATFORM_NAME
+#define PLATFORM_NAME "ARM"
+#endif
+
+#endif
+
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <setjmp.h>  /* for longjmp on error exit */
+#include <stdlib.h>
+#include <stdarg.h>  /* may need <varargs.h> for Unix V */
+#include <string.h>
+#include <assert.h>
+
+#ifdef NEEDS_MALLOC_H
+#include <malloc.h>
+#endif
+
+#ifdef SUPPORT_GETPWNAM
+#include <pwd.h>
+#endif
+
+#ifdef NEEDS_UNISTD_H
+#include <unistd.h>  /* needed for unlink on some Unix systems */
+#endif
+
+/* By default, use case-sensitive filename comparison.
+*/
+#ifndef FILENAMES_CASE_SENSITIVE
+#define FILENAMES_CASE_SENSITIVE 1
+#endif
+
+
+/*
+  Tidy preserves the last modified time for the files it
+  cleans up.
+*/
+
+/*
+  If your platform doesn't support <utime.h> and the
+  utime() function, or <sys/futime> and the futime()
+  function then set PRESERVE_FILE_TIMES to 0.
+  
+  If your platform doesn't support <sys/utime.h> and the
+  futime() function, then set HAS_FUTIME to 0.
+  
+  If your platform supports <utime.h> and the
+  utime() function requires the file to be
+  closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
+*/
+
+/* Keep old PRESERVEFILETIMES define for compatibility */
+#ifdef PRESERVEFILETIMES
+#undef PRESERVE_FILE_TIMES
+#define PRESERVE_FILE_TIMES PRESERVEFILETIMES
+#endif
+
+#ifndef PRESERVE_FILE_TIMES
+#if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
+#define PRESERVE_FILE_TIMES 0
+#else
+#define PRESERVE_FILE_TIMES 1
+#endif
+#endif
+
+#if PRESERVE_FILE_TIMES
+
+#ifndef HAS_FUTIME
+#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__)
+#define HAS_FUTIME 0
+#else
+#define HAS_FUTIME 1
+#endif
+#endif
+
+#ifndef UTIME_NEEDS_CLOSED_FILE
+#if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
+#define UTIME_NEEDS_CLOSED_FILE 1
+#else
+#define UTIME_NEEDS_CLOSED_FILE 0
+#endif
+#endif
+
+#if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
+#include <sys/types.h> 
+#include <sys/stat.h>
+#else
+#include <stat.h>
+#endif
+
+#if HAS_FUTIME
+#include <sys/utime.h>
+#else
+#include <utime.h>
+#endif /* HASFUTIME */
+
+/*
+  MS Windows needs _ prefix for Unix file functions.
+  Not required by Metrowerks Standard Library (MSL).
+  
+  Tidy uses following for preserving the last modified time.
+
+  WINDOWS automatically set by Win16 compilers.
+  _WIN32 automatically set by Win32 compilers.
+*/
+#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
+
+#define futime _futime
+#define fstat _fstat
+#define utimbuf _utimbuf /* Windows seems to want utimbuf */
+#define stat _stat
+#define utime _utime
+#define vsnprintf _vsnprintf
+#endif /* _WIN32 */
+
+#endif /* PRESERVE_FILE_TIMES */
+
+/*
+  MS Windows needs _ prefix for Unix file functions.
+  Not required by Metrowerks Standard Library (MSL).
+  
+  WINDOWS automatically set by Win16 compilers.
+  _WIN32 automatically set by Win32 compilers.
+*/
+#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
+
+#if !(defined(__WATCOMC__) || defined(__MINGW32__))
+#define fileno _fileno
+#define setmode _setmode
+#endif
+
+#define access _access
+#define strcasecmp _stricmp
+
+#ifndef va_copy
+#define va_copy(dest, src) (dest = src)
+#endif
+
+#if _MSC_VER > 1000
+#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
+#pragma warning( disable : 4100 ) /* unreferenced formal parameter */
+#pragma warning( disable : 4706 ) /* assignment within conditional expression */
+#endif
+
+#if _MSC_VER > 1300
+#pragma warning( disable : 4996 ) /* disable depreciation warning */
+#endif
+
+#endif /* _WIN32 */
+
+#if defined(_WIN32)
+
+#if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
+#ifdef BUILDING_SHARED_LIB
+#define TIDY_EXPORT __declspec( dllexport ) 
+#else
+#define TIDY_EXPORT __declspec( dllimport ) 
+#endif
+#else
+#define TIDY_EXPORT extern
+#endif
+
+#ifndef TIDY_CALL
+#ifdef _WIN64
+#  define TIDY_CALL __fastcall
+#else
+#  define TIDY_CALL __stdcall
+#endif
+#endif
+
+#endif /* _WIN32 */
+
+/* hack for gnu sys/types.h file which defines uint and ulong */
+
+#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
+#include <sys/types.h>
+#endif
+#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
+# undef uint
+typedef unsigned int uint;
+#endif
+#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
+# undef ulong
+typedef unsigned long ulong;
+#endif
+
+/*
+With GCC 4,  __attribute__ ((visibility("default"))) can be used along compiling with tidylib 
+with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
+*/
+/*
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define TIDY_EXPORT __attribute__ ((visibility("default")))
+#endif
+*/
+
+#ifndef TIDY_EXPORT /* Define it away for most builds */
+#define TIDY_EXPORT 
+#endif
+
+#ifndef TIDY_STRUCT
+#define TIDY_STRUCT
+#endif
+
+typedef unsigned char byte;
+
+typedef uint tchar;         /* single, full character */
+typedef char tmbchar;       /* single, possibly partial character */
+#ifndef TMBSTR_DEFINED
+typedef tmbchar* tmbstr;    /* pointer to buffer of possibly partial chars */
+typedef const tmbchar* ctmbstr; /* Ditto, but const */
+#define NULLSTR (tmbstr)""
+#define TMBSTR_DEFINED
+#endif
+
+#ifndef TIDY_CALL
+#define TIDY_CALL
+#endif
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+# define ARG_UNUSED(x) x __attribute__((unused))
+#else
+# define ARG_UNUSED(x) x
+#endif
+
+/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to
+   buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF
+   has been defined. */
+#ifndef HAS_VSNPRINTF
+# define HAS_VSNPRINTF 1
+#endif
+
+#ifndef SUPPORT_POSIX_MAPPED_FILES
+# define SUPPORT_POSIX_MAPPED_FILES 1
+#endif
+
+/*
+  bool is a reserved word in some but
+  not all C++ compilers depending on age
+  work around is to avoid bool altogether
+  by introducing a new enum called Bool
+*/
+/* We could use the C99 definition where supported
+typedef _Bool Bool;
+#define no (_Bool)0
+#define yes (_Bool)1
+*/
+typedef enum
+{
+   no,
+   yes
+} Bool;
+
+/* for NULL pointers 
+#define null ((const void*)0)
+extern void* null;
+*/
+
+#if defined(DMALLOC)
+#include "dmalloc.h"
+#endif
+
+/* Opaque data structure.
+*  Cast to implementation type struct within lib.
+*  This will reduce inter-dependencies/conflicts w/ application code.
+*/
+#if 1
+#define opaque_type( typenam )\
+struct _##typenam { int _opaque; };\
+typedef struct _##typenam const * typenam
+#else
+#define opaque_type(typenam) typedef const void* typenam
+#endif
+
+/* Opaque data structure used to pass back
+** and forth to keep current position in a
+** list or other collection.
+*/
+opaque_type( TidyIterator );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __TIDY_PLATFORM_H__ */
+
+
+/*
+ * local variables:
+ * mode: c
+ * indent-tabs-mode: nil
+ * c-basic-offset: 4
+ * eval: (c-set-offset 'substatement-open 0)
+ * end:
+ */
diff --git a/include/tidybuffio.h b/include/tidybuffio.h
deleted file mode 100644
index 3bb4dfc..0000000
--- a/include/tidybuffio.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef __TIDY_BUFFIO_H__
-#define __TIDY_BUFFIO_H__
-
-/** @file tidybuffio.h - Treat buffer as an I/O stream.
-
-  (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
-  See tidy.h for the copyright notice.
-
-  Requires buffer to automatically grow as bytes are added.
-  Must keep track of current read and write points.
-
-*/
-
-#include "tidyplatform.h"
-#include "tidy.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** TidyBuffer - A chunk of memory */
-TIDY_STRUCT
-struct _TidyBuffer 
-{
-    TidyAllocator* allocator;  /**< Memory allocator */
-    byte* bp;           /**< Pointer to bytes */
-    uint  size;         /**< # bytes currently in use */
-    uint  allocated;    /**< # bytes allocated */ 
-    uint  next;         /**< Offset of current input position */
-};
-
-/** Initialize data structure using the default allocator */
-TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf );
-
-/** Initialize data structure using the given custom allocator */
-TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator );
-
-/** Free current buffer, allocate given amount, reset input pointer,
-    use the default allocator */
-TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize );
-
-/** Free current buffer, allocate given amount, reset input pointer,
-    use the given custom allocator */
-TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf,
-                                                      TidyAllocator* allocator,
-                                                      uint allocSize );
-
-/** Expand buffer to given size. 
-**  Chunk size is minimum growth. Pass 0 for default of 256 bytes.
-*/
-TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf,
-                                              uint allocSize, uint chunkSize );
-
-/** Free current contents and zero out */
-TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf );
-
-/** Set buffer bytes to 0 */
-TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf );
-
-/** Attach to existing buffer */
-TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size );
-
-/** Detach from buffer.  Caller must free. */
-TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf );
-
-
-/** Append bytes to buffer.  Expand if necessary. */
-TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size );
-
-/** Append one byte to buffer.  Expand if necessary. */
-TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv );
-
-/** Get byte from end of buffer */
-TIDY_EXPORT int TIDY_CALL  tidyBufPopByte( TidyBuffer* buf );
-
-
-/** Get byte from front of buffer.  Increment input offset. */
-TIDY_EXPORT int TIDY_CALL  tidyBufGetByte( TidyBuffer* buf );
-
-/** At end of buffer? */
-TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf );
-
-/** Put a byte back into the buffer.  Decrement input offset. */
-TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv );
-
-
-/**************
-   TIDY
-**************/
-
-/* Forward declarations
-*/
-
-/** Initialize a buffer input source */
-TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf );
-
-/** Initialize a buffer output sink */
-TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __TIDY_BUFFIO_H__ */
-
-/*
- * local variables:
- * mode: c
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * eval: (c-set-offset 'substatement-open 0)
- * end:
- */
diff --git a/include/tidyenum.h b/include/tidyenum.h
deleted file mode 100644
index 4f74e8d..0000000
--- a/include/tidyenum.h
+++ /dev/null
@@ -1,855 +0,0 @@
-#ifndef __TIDYENUM_H__
-#define __TIDYENUM_H__
-
-/* @file tidyenum.h -- Split public enums into separate header
-
-  Simplifies enum re-use in various wrappers.  e.g. SWIG
-  generated wrappers and COM IDL files.
-
-  Copyright (c) 1998-2008 World Wide Web Consortium
-  (Massachusetts Institute of Technology, European Research
-  Consortium for Informatics and Mathematics, Keio University).
-  All Rights Reserved.
-
-  Contributing Author(s):
-
-     Dave Raggett <dsr@w3.org>
-
-  The contributing author(s) would like to thank all those who
-  helped with testing, bug fixes and suggestions for improvements.
-  This wouldn't have been possible without your help.
-
-  COPYRIGHT NOTICE:
-
-  This software and documentation is provided "as is," and
-  the copyright holders and contributing author(s) make no
-  representations or warranties, express or implied, including
-  but not limited to, warranties of merchantability or fitness
-  for any particular purpose or that the use of the software or
-  documentation will not infringe any third party patents,
-  copyrights, trademarks or other rights.
-
-  The copyright holders and contributing author(s) will not be held
-  liable for any direct, indirect, special or consequential damages
-  arising out of any use of the software or documentation, even if
-  advised of the possibility of such damage.
-
-  Permission is hereby granted to use, copy, modify, and distribute
-  this source code, or portions hereof, documentation and executables,
-  for any purpose, without fee, subject to the following restrictions:
-
-  1. The origin of this source code must not be misrepresented.
-  2. Altered versions must be plainly marked as such and must
-     not be misrepresented as being the original source.
-  3. This Copyright notice may not be removed or altered from any
-     source or altered source distribution.
-
-  The copyright holders and contributing author(s) specifically
-  permit, without fee, and encourage the use of this source code
-  as a component for supporting the Hypertext Markup Language in
-  commercial products. If you use this source code in a product,
-  acknowledgment is not required but would be appreciated.
-
-
-  Created 2001-05-20 by Charles Reitzel
-  Updated 2002-07-01 by Charles Reitzel - 1st Implementation
-
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enumerate configuration options
-*/
-
-/** Categories of Tidy configuration options
-*/
-typedef enum
-{
-  TidyMarkup,          /**< Markup options: (X)HTML version, etc */
-  TidyDiagnostics,     /**< Diagnostics */
-  TidyPrettyPrint,     /**< Output layout */
-  TidyEncoding,        /**< Character encodings */
-  TidyMiscellaneous    /**< File handling, message format, etc. */
-} TidyConfigCategory;
-
-
-/** Option IDs Used to get/set option values.
-
-    These TidyOptionId are used throughout libtidy, and also
-    have associated localized strings to describe them.
- 
-    Note this enum MUST start at zero due to historical design-time
-    decisions that make assumptions about this starting value.
-*/
-typedef enum
-{
-  TidyUnknownOption,   /**< Unknown option! */
-  TidyIndentSpaces,    /**< Indentation n spaces/tabs */
-  TidyWrapLen,         /**< Wrap margin */
-  TidyTabSize,         /**< Expand tabs to n spaces */
-
-  TidyCharEncoding,    /**< In/out character encoding */
-  TidyInCharEncoding,  /**< Input character encoding (if different) */
-  TidyOutCharEncoding, /**< Output character encoding (if different) */
-  TidyNewline,         /**< Output line ending (default to platform) */
-
-  TidyDoctypeMode,     /**< See doctype property */
-  TidyDoctype,         /**< User specified doctype */
-
-  TidyDuplicateAttrs,  /**< Keep first or last duplicate attribute */
-  TidyAltText,         /**< Default text for alt attribute */
-
-  /* obsolete */
-  TidySlideStyle,      /**< Style sheet for slides: not used for anything yet */
-
-  TidyErrFile,         /**< File name to write errors to */
-  TidyOutFile,         /**< File name to write markup to */
-  TidyWriteBack,       /**< If true then output tidied markup */
-  TidyShowMarkup,      /**< If false, normal output is suppressed */
-  TidyShowInfo,        /**< If true, info-level messages are shown */
-  TidyShowWarnings,    /**< However errors are always shown */
-  TidyQuiet,           /**< No 'Parsing X', guessed DTD or summary */
-  TidyIndentContent,   /**< Indent content of appropriate tags */
-                       /**< "auto" does text/block level content indentation */
-  TidyCoerceEndTags,   /**< Coerce end tags from start tags where probably intended */
-  TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */
-  TidyHideEndTags,     /**< Legacy name for TidyOmitOptionalTags */
-  TidyXmlTags,         /**< Treat input as XML */
-  TidyXmlOut,          /**< Create output as XML */
-  TidyXhtmlOut,        /**< Output extensible HTML */
-  TidyHtmlOut,         /**< Output plain HTML, even for XHTML input.
-                           Yes means set explicitly. */
-  TidyXmlDecl,         /**< Add <?xml?> for XML docs */
-  TidyUpperCaseTags,   /**< Output tags in upper not lower case */
-  TidyUpperCaseAttrs,  /**< Output attributes in upper not lower case */
-  TidyMakeBare,        /**< Make bare HTML: remove Microsoft cruft */
-  TidyMakeClean,       /**< Replace presentational clutter by style rules */
-  TidyGDocClean,       /**< Clean up HTML exported from Google Docs */
-  TidyLogicalEmphasis, /**< Replace i by em and b by strong */
-  TidyDropPropAttrs,   /**< Discard proprietary attributes */
-  TidyDropFontTags,    /**< Discard presentation tags */
-  TidyDropEmptyElems,  /**< Discard empty elements */
-  TidyDropEmptyParas,  /**< Discard empty p elements */
-  TidyFixComments,     /**< Fix comments with adjacent hyphens */
-  TidyBreakBeforeBR,   /**< Output newline before <br> or not? */
-
-  /* obsolete */
-  TidyBurstSlides,     /**< Create slides on each h2 element */
-
-  TidyNumEntities,     /**< Use numeric entities */
-  TidyQuoteMarks,      /**< Output " marks as &quot; */
-  TidyQuoteNbsp,       /**< Output non-breaking space as entity */
-  TidyQuoteAmpersand,  /**< Output naked ampersand as &amp; */
-  TidyWrapAttVals,     /**< Wrap within attribute values */
-  TidyWrapScriptlets,  /**< Wrap within JavaScript string literals */
-  TidyWrapSection,     /**< Wrap within <![ ... ]> section tags */
-  TidyWrapAsp,         /**< Wrap within ASP pseudo elements */
-  TidyWrapJste,        /**< Wrap within JSTE pseudo elements */
-  TidyWrapPhp,         /**< Wrap within PHP pseudo elements */
-  TidyFixBackslash,    /**< Fix URLs by replacing \ with / */
-  TidyIndentAttributes,/**< Newline+indent before each attribute */
-  TidyXmlPIs,          /**< If set to yes PIs must end with ?> */
-  TidyXmlSpace,        /**< If set to yes adds xml:space attr as needed */
-  TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
-  TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */
-  TidyKeepFileTimes,   /**< If yes last modied time is preserved */
-  TidyWord2000,        /**< Draconian cleaning for Word2000 */
-  TidyMark,            /**< Add meta element indicating tidied doc */
-  TidyEmacs,           /**< If true format error output for GNU Emacs */
-  TidyEmacsFile,       /**< Name of current Emacs file */
-  TidyLiteralAttribs,  /**< If true attributes may use newlines */
-  TidyBodyOnly,        /**< Output BODY content only */
-  TidyFixUri,          /**< Applies URI encoding if necessary */
-  TidyLowerLiterals,   /**< Folds known attribute values to lower case */
-  TidyHideComments,    /**< Hides all (real) comments in output */
-  TidyIndentCdata,     /**< Indent <!CDATA[ ... ]]> section */
-  TidyForceOutput,     /**< Output document even if errors were found */
-  TidyShowErrors,      /**< Number of errors to put out */
-  TidyAsciiChars,      /**< Convert quotes and dashes to nearest ASCII char */
-  TidyJoinClasses,     /**< Join multiple class attributes */
-  TidyJoinStyles,      /**< Join multiple style attributes */
-  TidyEscapeCdata,     /**< Replace <![CDATA[]]> sections with escaped text */
-
-#if SUPPORT_ASIAN_ENCODINGS
-  TidyLanguage,        /**< Language property: not used for anything yet */
-  TidyNCR,             /**< Allow numeric character references */
-#else
-  TidyLanguageNotUsed,
-  TidyNCRNotUsed,
-#endif
-#if SUPPORT_UTF16_ENCODINGS
-  TidyOutputBOM,      /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */
-                      /**< auto: if input stream has BOM, we output a BOM */
-#else
-  TidyOutputBOMNotUsed,
-#endif
-
-  TidyReplaceColor,    /**< Replace hex color attribute values with names */
-  TidyCSSPrefix,       /**< CSS class naming for -clean option */
-
-  TidyInlineTags,      /**< Declared inline tags */
-  TidyBlockTags,       /**< Declared block tags */
-  TidyEmptyTags,       /**< Declared empty tags */
-  TidyPreTags,         /**< Declared pre tags */
-
-  TidyAccessibilityCheckLevel, /**< Accessibility check level
-                                   0 (old style), or 1, 2, 3 */
-
-  TidyVertSpace,       /**< degree to which markup is spread out vertically */
-#if SUPPORT_ASIAN_ENCODINGS
-  TidyPunctWrap,       /**< consider punctuation and breaking spaces for wrapping */
-#else
-  TidyPunctWrapNotUsed,
-#endif
-  TidyMergeEmphasis,       /**< Merge nested B and I elements */
-  TidyMergeDivs,           /**< Merge multiple DIVs */
-  TidyDecorateInferredUL,  /**< Mark inferred UL elements with no indent CSS */
-  TidyPreserveEntities,    /**< Preserve entities */
-  TidySortAttributes,      /**< Sort attributes */
-  TidyMergeSpans,          /**< Merge multiple SPANs */
-  TidyAnchorAsName,        /**< Define anchors as name attributes */
-  TidyPPrintTabs,          /**< Indent using tabs istead of spaces */
-  TidySkipNested,          /**< Skip nested tags in script and style CDATA */
-  TidyStrictTagsAttr,      /**< Ensure tags and attributes match output HTML version */
-  TidyEscapeScripts,       /**< Escape items that look like closing tags in script tags */
-  N_TIDY_OPTIONS           /**< Must be last */
-} TidyOptionId;
-
-    
-/** Option data types
-*/
-typedef enum
-{
-  TidyString,          /**< String */
-  TidyInteger,         /**< Integer or enumeration */
-  TidyBoolean          /**< Boolean flag */
-} TidyOptionType;
-
-
-/** AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM
-*/
-typedef enum
-{
-   TidyNoState,     /**< maps to 'no' */
-   TidyYesState,    /**< maps to 'yes' */
-   TidyAutoState    /**< Automatic */
-} TidyTriState;
-
-/** TidyNewline option values to control output line endings.
-*/
-typedef enum
-{
-    TidyLF,         /**< Use Unix style: LF */
-    TidyCRLF,       /**< Use DOS/Windows style: CR+LF */
-    TidyCR          /**< Use Macintosh style: CR */
-} TidyLineEnding;
-
-
-/** Mode controlling treatment of doctype
-*/
-typedef enum
-{
-    TidyDoctypeHtml5,   /**< <!DOCTYPE html> */
-    TidyDoctypeOmit,    /**< Omit DOCTYPE altogether */
-    TidyDoctypeAuto,    /**< Keep DOCTYPE in input.  Set version to content */
-    TidyDoctypeStrict,  /**< Convert document to HTML 4 strict content model */
-    TidyDoctypeLoose,   /**< Convert document to HTML 4 transitional
-                             content model */
-    TidyDoctypeUser     /**< Set DOCTYPE FPI explicitly */
-} TidyDoctypeModes;
-
-/** Mode controlling treatment of duplicate Attributes
-*/
-typedef enum
-{
-    TidyKeepFirst,
-    TidyKeepLast
-} TidyDupAttrModes;
-
-/** Mode controlling treatment of sorting attributes
-*/
-typedef enum
-{
-    TidySortAttrNone,
-    TidySortAttrAlpha
-} TidyAttrSortStrategy;
-
-
-/* I/O and Message handling interface
-**
-** By default, Tidy will define, create and use
-** instances of input and output handlers for
-** standard C buffered I/O (i.e. FILE* stdin,
-** FILE* stdout and FILE* stderr for content
-** input, content output and diagnostic output,
-** respectively.  A FILE* cfgFile input handler
-** will be used for config files.  Command line
-** options will just be set directly.
-*/
-
-/** Message severity level
- *  These TidyReportLevel are used throughout libtidy, but don't
- *  have associated localized strings to describe them because
- *  TidyReportLevel is externally-facing, and changing the enum
- *  starting int can break existing API's for poorly-written
- *  applications using libtidy. See enum `TidyReportLevelKeys`.
-*/
-typedef enum
-{
-  TidyInfo,             /**< Information about markup usage */
-  TidyWarning,          /**< Warning message */
-  TidyConfig,           /**< Configuration error */
-  TidyAccess,           /**< Accessibility message */
-  TidyError,            /**< Error message - output suppressed */
-  TidyBadDocument,      /**< I/O or file system error */
-  TidyFatal             /**< Crash! */
-} TidyReportLevel;
-
-/** Message severity level - string lookup keys
- *  These TidyReportLevelKeys are used throughout libtidy, and
- *  have associated localized strings to describe them. They
- *  correspond to enum `TidyReportLevel`.
-*/
-typedef enum
-{
-  TidyInfoString = 600,
-  TidyWarningString,
-  TidyConfigString,
-  TidyAccessString,
-  TidyErrorString,
-  TidyBadDocumentString,
-  TidyFatalString
-} TidyReportLevelKeys;
-
-
-/* Document tree traversal functions
-*/
-
-/** Node types
-*/
-typedef enum
-{
-  TidyNode_Root,        /**< Root */
-  TidyNode_DocType,     /**< DOCTYPE */
-  TidyNode_Comment,     /**< Comment */
-  TidyNode_ProcIns,     /**< Processing Instruction */
-  TidyNode_Text,        /**< Text */
-  TidyNode_Start,       /**< Start Tag */
-  TidyNode_End,         /**< End Tag */
-  TidyNode_StartEnd,    /**< Start/End (empty) Tag */
-  TidyNode_CDATA,       /**< Unparsed Text */
-  TidyNode_Section,     /**< XML Section */
-  TidyNode_Asp,         /**< ASP Source */
-  TidyNode_Jste,        /**< JSTE Source */
-  TidyNode_Php,         /**< PHP Source */
-  TidyNode_XmlDecl      /**< XML Declaration */
-} TidyNodeType;
-
-
-/** Known HTML element types
-*/
-typedef enum
-{
-  TidyTag_UNKNOWN,  /**< Unknown tag! */
-  TidyTag_A,        /**< A */
-  TidyTag_ABBR,     /**< ABBR */
-  TidyTag_ACRONYM,  /**< ACRONYM */
-  TidyTag_ADDRESS,  /**< ADDRESS */
-  TidyTag_ALIGN,    /**< ALIGN */
-  TidyTag_APPLET,   /**< APPLET */
-  TidyTag_AREA,     /**< AREA */
-  TidyTag_B,        /**< B */
-  TidyTag_BASE,     /**< BASE */
-  TidyTag_BASEFONT, /**< BASEFONT */
-  TidyTag_BDO,      /**< BDO */
-  TidyTag_BGSOUND,  /**< BGSOUND */
-  TidyTag_BIG,      /**< BIG */
-  TidyTag_BLINK,    /**< BLINK */
-  TidyTag_BLOCKQUOTE,   /**< BLOCKQUOTE */
-  TidyTag_BODY,     /**< BODY */
-  TidyTag_BR,       /**< BR */
-  TidyTag_BUTTON,   /**< BUTTON */
-  TidyTag_CAPTION,  /**< CAPTION */
-  TidyTag_CENTER,   /**< CENTER */
-  TidyTag_CITE,     /**< CITE */
-  TidyTag_CODE,     /**< CODE */
-  TidyTag_COL,      /**< COL */
-  TidyTag_COLGROUP, /**< COLGROUP */
-  TidyTag_COMMENT,  /**< COMMENT */
-  TidyTag_DD,       /**< DD */
-  TidyTag_DEL,      /**< DEL */
-  TidyTag_DFN,      /**< DFN */
-  TidyTag_DIR,      /**< DIR */
-  TidyTag_DIV,      /**< DIF */
-  TidyTag_DL,       /**< DL */
-  TidyTag_DT,       /**< DT */
-  TidyTag_EM,       /**< EM */
-  TidyTag_EMBED,    /**< EMBED */
-  TidyTag_FIELDSET, /**< FIELDSET */
-  TidyTag_FONT,     /**< FONT */
-  TidyTag_FORM,     /**< FORM */
-  TidyTag_FRAME,    /**< FRAME */
-  TidyTag_FRAMESET, /**< FRAMESET */
-  TidyTag_H1,       /**< H1 */
-  TidyTag_H2,       /**< H2 */
-  TidyTag_H3,       /**< H3 */
-  TidyTag_H4,       /**< H4 */
-  TidyTag_H5,       /**< H5 */
-  TidyTag_H6,       /**< H6 */
-  TidyTag_HEAD,     /**< HEAD */
-  TidyTag_HR,       /**< HR */
-  TidyTag_HTML,     /**< HTML */
-  TidyTag_I,        /**< I */
-  TidyTag_IFRAME,   /**< IFRAME */
-  TidyTag_ILAYER,   /**< ILAYER */
-  TidyTag_IMG,      /**< IMG */
-  TidyTag_INPUT,    /**< INPUT */
-  TidyTag_INS,      /**< INS */
-  TidyTag_ISINDEX,  /**< ISINDEX */
-  TidyTag_KBD,      /**< KBD */
-  TidyTag_KEYGEN,   /**< KEYGEN */
-  TidyTag_LABEL,    /**< LABEL */
-  TidyTag_LAYER,    /**< LAYER */
-  TidyTag_LEGEND,   /**< LEGEND */
-  TidyTag_LI,       /**< LI */
-  TidyTag_LINK,     /**< LINK */
-  TidyTag_LISTING,  /**< LISTING */
-  TidyTag_MAP,      /**< MAP */
-  TidyTag_MATHML,   /**< MATH  (HTML5) [i_a]2 MathML embedded in [X]HTML */
-  TidyTag_MARQUEE,  /**< MARQUEE */
-  TidyTag_MENU,     /**< MENU */
-  TidyTag_META,     /**< META */
-  TidyTag_MULTICOL, /**< MULTICOL */
-  TidyTag_NOBR,     /**< NOBR */
-  TidyTag_NOEMBED,  /**< NOEMBED */
-  TidyTag_NOFRAMES, /**< NOFRAMES */
-  TidyTag_NOLAYER,  /**< NOLAYER */
-  TidyTag_NOSAVE,   /**< NOSAVE */
-  TidyTag_NOSCRIPT, /**< NOSCRIPT */
-  TidyTag_OBJECT,   /**< OBJECT */
-  TidyTag_OL,       /**< OL */
-  TidyTag_OPTGROUP, /**< OPTGROUP */
-  TidyTag_OPTION,   /**< OPTION */
-  TidyTag_P,        /**< P */
-  TidyTag_PARAM,    /**< PARAM */
-  TidyTag_PICTURE,  /**< PICTURE (HTML5) */
-  TidyTag_PLAINTEXT,/**< PLAINTEXT */
-  TidyTag_PRE,      /**< PRE */
-  TidyTag_Q,        /**< Q */
-  TidyTag_RB,       /**< RB */
-  TidyTag_RBC,      /**< RBC */
-  TidyTag_RP,       /**< RP */
-  TidyTag_RT,       /**< RT */
-  TidyTag_RTC,      /**< RTC */
-  TidyTag_RUBY,     /**< RUBY */
-  TidyTag_S,        /**< S */
-  TidyTag_SAMP,     /**< SAMP */
-  TidyTag_SCRIPT,   /**< SCRIPT */
-  TidyTag_SELECT,   /**< SELECT */
-  TidyTag_SERVER,   /**< SERVER */
-  TidyTag_SERVLET,  /**< SERVLET */
-  TidyTag_SMALL,    /**< SMALL */
-  TidyTag_SPACER,   /**< SPACER */
-  TidyTag_SPAN,     /**< SPAN */
-  TidyTag_STRIKE,   /**< STRIKE */
-  TidyTag_STRONG,   /**< STRONG */
-  TidyTag_STYLE,    /**< STYLE */
-  TidyTag_SUB,      /**< SUB */
-  TidyTag_SUP,      /**< SUP */
-  TidyTag_SVG,      /**< SVG  (HTML5) */
-  TidyTag_TABLE,    /**< TABLE */
-  TidyTag_TBODY,    /**< TBODY */
-  TidyTag_TD,       /**< TD */
-  TidyTag_TEXTAREA, /**< TEXTAREA */
-  TidyTag_TFOOT,    /**< TFOOT */
-  TidyTag_TH,       /**< TH */
-  TidyTag_THEAD,    /**< THEAD */
-  TidyTag_TITLE,    /**< TITLE */
-  TidyTag_TR,       /**< TR */
-  TidyTag_TT,       /**< TT */
-  TidyTag_U,        /**< U */
-  TidyTag_UL,       /**< UL */
-  TidyTag_VAR,      /**< VAR */
-  TidyTag_WBR,      /**< WBR */
-  TidyTag_XMP,      /**< XMP */
-  TidyTag_NEXTID,   /**< NEXTID */
-
-  TidyTag_ARTICLE,
-  TidyTag_ASIDE,
-  TidyTag_AUDIO,
-  TidyTag_BDI,
-  TidyTag_CANVAS,
-  TidyTag_COMMAND,
-  TidyTag_DATALIST,
-  TidyTag_DETAILS,
-  TidyTag_DIALOG,
-  TidyTag_FIGCAPTION,
-  TidyTag_FIGURE,
-  TidyTag_FOOTER,
-  TidyTag_HEADER,
-  TidyTag_HGROUP,
-  TidyTag_MAIN,
-  TidyTag_MARK,
-  TidyTag_MENUITEM,
-  TidyTag_METER,
-  TidyTag_NAV,
-  TidyTag_OUTPUT,
-  TidyTag_PROGRESS,
-  TidyTag_SECTION,
-  TidyTag_SOURCE,
-  TidyTag_SUMMARY,
-  TidyTag_TEMPLATE,
-  TidyTag_TIME,
-  TidyTag_TRACK,
-  TidyTag_VIDEO,
-
-  N_TIDY_TAGS       /**< Must be last */
-} TidyTagId;
-
-/* Attribute interrogation
-*/
-
-/** Known HTML attributes
-*/
-typedef enum
-{
-  TidyAttr_UNKNOWN,           /**< UNKNOWN= */
-  TidyAttr_ABBR,              /**< ABBR= */
-  TidyAttr_ACCEPT,            /**< ACCEPT= */
-  TidyAttr_ACCEPT_CHARSET,    /**< ACCEPT_CHARSET= */
-  TidyAttr_ACCESSKEY,         /**< ACCESSKEY= */
-  TidyAttr_ACTION,            /**< ACTION= */
-  TidyAttr_ADD_DATE,          /**< ADD_DATE= */
-  TidyAttr_ALIGN,             /**< ALIGN= */
-  TidyAttr_ALINK,             /**< ALINK= */
-  TidyAttr_ALLOWFULLSCREEN,   /**< ALLOWFULLSCREEN= */
-  TidyAttr_ALT,               /**< ALT= */
-  TidyAttr_ARCHIVE,           /**< ARCHIVE= */
-  TidyAttr_AXIS,              /**< AXIS= */
-  TidyAttr_BACKGROUND,        /**< BACKGROUND= */
-  TidyAttr_BGCOLOR,           /**< BGCOLOR= */
-  TidyAttr_BGPROPERTIES,      /**< BGPROPERTIES= */
-  TidyAttr_BORDER,            /**< BORDER= */
-  TidyAttr_BORDERCOLOR,       /**< BORDERCOLOR= */
-  TidyAttr_BOTTOMMARGIN,      /**< BOTTOMMARGIN= */
-  TidyAttr_CELLPADDING,       /**< CELLPADDING= */
-  TidyAttr_CELLSPACING,       /**< CELLSPACING= */
-  TidyAttr_CHAR,              /**< CHAR= */
-  TidyAttr_CHAROFF,           /**< CHAROFF= */
-  TidyAttr_CHARSET,           /**< CHARSET= */
-  TidyAttr_CHECKED,           /**< CHECKED= */
-  TidyAttr_CITE,              /**< CITE= */
-  TidyAttr_CLASS,             /**< CLASS= */
-  TidyAttr_CLASSID,           /**< CLASSID= */
-  TidyAttr_CLEAR,             /**< CLEAR= */
-  TidyAttr_CODE,              /**< CODE= */
-  TidyAttr_CODEBASE,          /**< CODEBASE= */
-  TidyAttr_CODETYPE,          /**< CODETYPE= */
-  TidyAttr_COLOR,             /**< COLOR= */
-  TidyAttr_COLS,              /**< COLS= */
-  TidyAttr_COLSPAN,           /**< COLSPAN= */
-  TidyAttr_COMPACT,           /**< COMPACT= */
-  TidyAttr_CONTENT,           /**< CONTENT= */
-  TidyAttr_COORDS,            /**< COORDS= */
-  TidyAttr_DATA,              /**< DATA= */
-  TidyAttr_DATAFLD,           /**< DATAFLD= */
-  TidyAttr_DATAFORMATAS,      /**< DATAFORMATAS= */
-  TidyAttr_DATAPAGESIZE,      /**< DATAPAGESIZE= */
-  TidyAttr_DATASRC,           /**< DATASRC= */
-  TidyAttr_DATETIME,          /**< DATETIME= */
-  TidyAttr_DECLARE,           /**< DECLARE= */
-  TidyAttr_DEFER,             /**< DEFER= */
-  TidyAttr_DIR,               /**< DIR= */
-  TidyAttr_DISABLED,          /**< DISABLED= */
-  TidyAttr_ENCODING,          /**< ENCODING= */
-  TidyAttr_ENCTYPE,           /**< ENCTYPE= */
-  TidyAttr_FACE,              /**< FACE= */
-  TidyAttr_FOR,               /**< FOR= */
-  TidyAttr_FRAME,             /**< FRAME= */
-  TidyAttr_FRAMEBORDER,       /**< FRAMEBORDER= */
-  TidyAttr_FRAMESPACING,      /**< FRAMESPACING= */
-  TidyAttr_GRIDX,             /**< GRIDX= */
-  TidyAttr_GRIDY,             /**< GRIDY= */
-  TidyAttr_HEADERS,           /**< HEADERS= */
-  TidyAttr_HEIGHT,            /**< HEIGHT= */
-  TidyAttr_HREF,              /**< HREF= */
-  TidyAttr_HREFLANG,          /**< HREFLANG= */
-  TidyAttr_HSPACE,            /**< HSPACE= */
-  TidyAttr_HTTP_EQUIV,        /**< HTTP_EQUIV= */
-  TidyAttr_ID,                /**< ID= */
-  TidyAttr_ISMAP,             /**< ISMAP= */
-  TidyAttr_ITEMID,            /**< ITEMID= */
-  TidyAttr_ITEMPROP,          /**< ITEMPROP= */
-  TidyAttr_ITEMREF,           /**< ITEMREF= */
-  TidyAttr_ITEMSCOPE,         /**< ITEMSCOPE= */
-  TidyAttr_ITEMTYPE,          /**< ITEMTYPE= */
-  TidyAttr_LABEL,             /**< LABEL= */
-  TidyAttr_LANG,              /**< LANG= */
-  TidyAttr_LANGUAGE,          /**< LANGUAGE= */
-  TidyAttr_LAST_MODIFIED,     /**< LAST_MODIFIED= */
-  TidyAttr_LAST_VISIT,        /**< LAST_VISIT= */
-  TidyAttr_LEFTMARGIN,        /**< LEFTMARGIN= */
-  TidyAttr_LINK,              /**< LINK= */
-  TidyAttr_LONGDESC,          /**< LONGDESC= */
-  TidyAttr_LOWSRC,            /**< LOWSRC= */
-  TidyAttr_MARGINHEIGHT,      /**< MARGINHEIGHT= */
-  TidyAttr_MARGINWIDTH,       /**< MARGINWIDTH= */
-  TidyAttr_MAXLENGTH,         /**< MAXLENGTH= */
-  TidyAttr_MEDIA,             /**< MEDIA= */
-  TidyAttr_METHOD,            /**< METHOD= */
-  TidyAttr_MULTIPLE,          /**< MULTIPLE= */
-  TidyAttr_NAME,              /**< NAME= */
-  TidyAttr_NOHREF,            /**< NOHREF= */
-  TidyAttr_NORESIZE,          /**< NORESIZE= */
-  TidyAttr_NOSHADE,           /**< NOSHADE= */
-  TidyAttr_NOWRAP,            /**< NOWRAP= */
-  TidyAttr_OBJECT,            /**< OBJECT= */
-  TidyAttr_OnAFTERUPDATE,     /**< OnAFTERUPDATE= */
-  TidyAttr_OnBEFOREUNLOAD,    /**< OnBEFOREUNLOAD= */
-  TidyAttr_OnBEFOREUPDATE,    /**< OnBEFOREUPDATE= */
-  TidyAttr_OnBLUR,            /**< OnBLUR= */
-  TidyAttr_OnCHANGE,          /**< OnCHANGE= */
-  TidyAttr_OnCLICK,           /**< OnCLICK= */
-  TidyAttr_OnDATAAVAILABLE,   /**< OnDATAAVAILABLE= */
-  TidyAttr_OnDATASETCHANGED,  /**< OnDATASETCHANGED= */
-  TidyAttr_OnDATASETCOMPLETE, /**< OnDATASETCOMPLETE= */
-  TidyAttr_OnDBLCLICK,        /**< OnDBLCLICK= */
-  TidyAttr_OnERRORUPDATE,     /**< OnERRORUPDATE= */
-  TidyAttr_OnFOCUS,           /**< OnFOCUS= */
-  TidyAttr_OnKEYDOWN,         /**< OnKEYDOWN= */
-  TidyAttr_OnKEYPRESS,        /**< OnKEYPRESS= */
-  TidyAttr_OnKEYUP,           /**< OnKEYUP= */
-  TidyAttr_OnLOAD,            /**< OnLOAD= */
-  TidyAttr_OnMOUSEDOWN,       /**< OnMOUSEDOWN= */
-  TidyAttr_OnMOUSEMOVE,       /**< OnMOUSEMOVE= */
-  TidyAttr_OnMOUSEOUT,        /**< OnMOUSEOUT= */
-  TidyAttr_OnMOUSEOVER,       /**< OnMOUSEOVER= */
-  TidyAttr_OnMOUSEUP,         /**< OnMOUSEUP= */
-  TidyAttr_OnRESET,           /**< OnRESET= */
-  TidyAttr_OnROWENTER,        /**< OnROWENTER= */
-  TidyAttr_OnROWEXIT,         /**< OnROWEXIT= */
-  TidyAttr_OnSELECT,          /**< OnSELECT= */
-  TidyAttr_OnSUBMIT,          /**< OnSUBMIT= */
-  TidyAttr_OnUNLOAD,          /**< OnUNLOAD= */
-  TidyAttr_PROFILE,           /**< PROFILE= */
-  TidyAttr_PROMPT,            /**< PROMPT= */
-  TidyAttr_RBSPAN,            /**< RBSPAN= */
-  TidyAttr_READONLY,          /**< READONLY= */
-  TidyAttr_REL,               /**< REL= */
-  TidyAttr_REV,               /**< REV= */
-  TidyAttr_RIGHTMARGIN,       /**< RIGHTMARGIN= */
-  TidyAttr_ROLE,              /**< ROLE= */
-  TidyAttr_ROWS,              /**< ROWS= */
-  TidyAttr_ROWSPAN,           /**< ROWSPAN= */
-  TidyAttr_RULES,             /**< RULES= */
-  TidyAttr_SCHEME,            /**< SCHEME= */
-  TidyAttr_SCOPE,             /**< SCOPE= */
-  TidyAttr_SCROLLING,         /**< SCROLLING= */
-  TidyAttr_SELECTED,          /**< SELECTED= */
-  TidyAttr_SHAPE,             /**< SHAPE= */
-  TidyAttr_SHOWGRID,          /**< SHOWGRID= */
-  TidyAttr_SHOWGRIDX,         /**< SHOWGRIDX= */
-  TidyAttr_SHOWGRIDY,         /**< SHOWGRIDY= */
-  TidyAttr_SIZE,              /**< SIZE= */
-  TidyAttr_SPAN,              /**< SPAN= */
-  TidyAttr_SRC,               /**< SRC= */
-  TidyAttr_SRCSET,            /**< SRCSET= (HTML5) */
-  TidyAttr_STANDBY,           /**< STANDBY= */
-  TidyAttr_START,             /**< START= */
-  TidyAttr_STYLE,             /**< STYLE= */
-  TidyAttr_SUMMARY,           /**< SUMMARY= */
-  TidyAttr_TABINDEX,          /**< TABINDEX= */
-  TidyAttr_TARGET,            /**< TARGET= */
-  TidyAttr_TEXT,              /**< TEXT= */
-  TidyAttr_TITLE,             /**< TITLE= */
-  TidyAttr_TOPMARGIN,         /**< TOPMARGIN= */
-  TidyAttr_TRANSLATE,         /**< TRANSLATE= */
-  TidyAttr_TYPE,              /**< TYPE= */
-  TidyAttr_USEMAP,            /**< USEMAP= */
-  TidyAttr_VALIGN,            /**< VALIGN= */
-  TidyAttr_VALUE,             /**< VALUE= */
-  TidyAttr_VALUETYPE,         /**< VALUETYPE= */
-  TidyAttr_VERSION,           /**< VERSION= */
-  TidyAttr_VLINK,             /**< VLINK= */
-  TidyAttr_VSPACE,            /**< VSPACE= */
-  TidyAttr_WIDTH,             /**< WIDTH= */
-  TidyAttr_WRAP,              /**< WRAP= */
-  TidyAttr_XML_LANG,          /**< XML_LANG= */
-  TidyAttr_XML_SPACE,         /**< XML_SPACE= */
-  TidyAttr_XMLNS,             /**< XMLNS= */
-
-  TidyAttr_EVENT,             /**< EVENT= */
-  TidyAttr_METHODS,           /**< METHODS= */
-  TidyAttr_N,                 /**< N= */
-  TidyAttr_SDAFORM,           /**< SDAFORM= */
-  TidyAttr_SDAPREF,           /**< SDAPREF= */
-  TidyAttr_SDASUFF,           /**< SDASUFF= */
-  TidyAttr_URN,               /**< URN= */
-
-  TidyAttr_ASYNC,
-  TidyAttr_AUTOCOMPLETE,
-  TidyAttr_AUTOFOCUS,
-  TidyAttr_AUTOPLAY,
-  TidyAttr_CHALLENGE,
-  TidyAttr_CONTENTEDITABLE,
-  TidyAttr_CONTEXTMENU,
-  TidyAttr_CONTROLS,
-  TidyAttr_DEFAULT,
-  TidyAttr_DIRNAME,
-  TidyAttr_DRAGGABLE,
-  TidyAttr_DROPZONE,
-  TidyAttr_FORM,
-  TidyAttr_FORMACTION,
-  TidyAttr_FORMENCTYPE,
-  TidyAttr_FORMMETHOD,
-  TidyAttr_FORMNOVALIDATE,
-  TidyAttr_FORMTARGET,
-  TidyAttr_HIDDEN,
-  TidyAttr_HIGH,
-  TidyAttr_ICON,
-  TidyAttr_KEYTYPE,
-  TidyAttr_KIND,
-  TidyAttr_LIST,
-  TidyAttr_LOOP,
-  TidyAttr_LOW,
-  TidyAttr_MANIFEST,
-  TidyAttr_MAX,
-  TidyAttr_MEDIAGROUP,
-  TidyAttr_MIN,
-  TidyAttr_NOVALIDATE,
-  TidyAttr_OPEN,
-  TidyAttr_OPTIMUM,
-  TidyAttr_OnABORT,
-  TidyAttr_OnAFTERPRINT,
-  TidyAttr_OnBEFOREPRINT,
-  TidyAttr_OnCANPLAY,
-  TidyAttr_OnCANPLAYTHROUGH,
-  TidyAttr_OnCONTEXTMENU,
-  TidyAttr_OnCUECHANGE,
-  TidyAttr_OnDRAG,
-  TidyAttr_OnDRAGEND,
-  TidyAttr_OnDRAGENTER,
-  TidyAttr_OnDRAGLEAVE,
-  TidyAttr_OnDRAGOVER,
-  TidyAttr_OnDRAGSTART,
-  TidyAttr_OnDROP,
-  TidyAttr_OnDURATIONCHANGE,
-  TidyAttr_OnEMPTIED,
-  TidyAttr_OnENDED,
-  TidyAttr_OnERROR,
-  TidyAttr_OnHASHCHANGE,
-  TidyAttr_OnINPUT,
-  TidyAttr_OnINVALID,
-  TidyAttr_OnLOADEDDATA,
-  TidyAttr_OnLOADEDMETADATA,
-  TidyAttr_OnLOADSTART,
-  TidyAttr_OnMESSAGE,
-  TidyAttr_OnMOUSEWHEEL,
-  TidyAttr_OnOFFLINE,
-  TidyAttr_OnONLINE,
-  TidyAttr_OnPAGEHIDE,
-  TidyAttr_OnPAGESHOW,
-  TidyAttr_OnPAUSE,
-  TidyAttr_OnPLAY,
-  TidyAttr_OnPLAYING,
-  TidyAttr_OnPOPSTATE,
-  TidyAttr_OnPROGRESS,
-  TidyAttr_OnRATECHANGE,
-  TidyAttr_OnREADYSTATECHANGE,
-  TidyAttr_OnREDO,
-  TidyAttr_OnRESIZE,
-  TidyAttr_OnSCROLL,
-  TidyAttr_OnSEEKED,
-  TidyAttr_OnSEEKING,
-  TidyAttr_OnSHOW,
-  TidyAttr_OnSTALLED,
-  TidyAttr_OnSTORAGE,
-  TidyAttr_OnSUSPEND,
-  TidyAttr_OnTIMEUPDATE,
-  TidyAttr_OnUNDO,
-  TidyAttr_OnVOLUMECHANGE,
-  TidyAttr_OnWAITING,
-  TidyAttr_PATTERN,
-  TidyAttr_PLACEHOLDER,
-  TidyAttr_POSTER,
-  TidyAttr_PRELOAD,
-  TidyAttr_PUBDATE,
-  TidyAttr_RADIOGROUP,
-  TidyAttr_REQUIRED,
-  TidyAttr_REVERSED,
-  TidyAttr_SANDBOX,
-  TidyAttr_SCOPED,
-  TidyAttr_SEAMLESS,
-  TidyAttr_SIZES,
-  TidyAttr_SPELLCHECK,
-  TidyAttr_SRCDOC,
-  TidyAttr_SRCLANG,
-  TidyAttr_STEP,
-  TidyAttr_ARIA_ACTIVEDESCENDANT,
-  TidyAttr_ARIA_ATOMIC,
-  TidyAttr_ARIA_AUTOCOMPLETE,
-  TidyAttr_ARIA_BUSY,
-  TidyAttr_ARIA_CHECKED,
-  TidyAttr_ARIA_CONTROLS,
-  TidyAttr_ARIA_DESCRIBEDBY,
-  TidyAttr_ARIA_DISABLED,
-  TidyAttr_ARIA_DROPEFFECT,
-  TidyAttr_ARIA_EXPANDED,
-  TidyAttr_ARIA_FLOWTO,
-  TidyAttr_ARIA_GRABBED,
-  TidyAttr_ARIA_HASPOPUP,
-  TidyAttr_ARIA_HIDDEN,
-  TidyAttr_ARIA_INVALID,
-  TidyAttr_ARIA_LABEL,
-  TidyAttr_ARIA_LABELLEDBY,
-  TidyAttr_ARIA_LEVEL,
-  TidyAttr_ARIA_LIVE,
-  TidyAttr_ARIA_MULTILINE,
-  TidyAttr_ARIA_MULTISELECTABLE,
-  TidyAttr_ARIA_ORIENTATION,
-  TidyAttr_ARIA_OWNS,
-  TidyAttr_ARIA_POSINSET,
-  TidyAttr_ARIA_PRESSED,
-  TidyAttr_ARIA_READONLY,
-  TidyAttr_ARIA_RELEVANT,
-  TidyAttr_ARIA_REQUIRED,
-  TidyAttr_ARIA_SELECTED,
-  TidyAttr_ARIA_SETSIZE,
-  TidyAttr_ARIA_SORT,
-  TidyAttr_ARIA_VALUEMAX,
-  TidyAttr_ARIA_VALUEMIN,
-  TidyAttr_ARIA_VALUENOW,
-  TidyAttr_ARIA_VALUETEXT,
-
-  /* SVG attributes (SVG 1.1) */
-  TidyAttr_X,                   /**< X= */
-  TidyAttr_Y,                   /**< Y= */
-  TidyAttr_VIEWBOX,             /**< VIEWBOX= */
-  TidyAttr_PRESERVEASPECTRATIO, /**< PRESERVEASPECTRATIO= */
-  TidyAttr_ZOOMANDPAN,          /**< ZOOMANDPAN= */
-  TidyAttr_BASEPROFILE,         /**< BASEPROFILE= */
-  TidyAttr_CONTENTSCRIPTTYPE,   /**< CONTENTSCRIPTTYPE= */
-  TidyAttr_CONTENTSTYLETYPE,    /**< CONTENTSTYLETYPE= */
-  /* MathML <math> attributes */
-  TidyAttr_DISPLAY,             /**< DISPLAY= (html5) */
-
-  /* RDFa global attributes */
-  TidyAttr_ABOUT,             /**< ABOUT= */
-  TidyAttr_DATATYPE,          /**< DATATYPE= */
-  TidyAttr_INLIST,            /**< INLIST= */
-  TidyAttr_PREFIX,            /**< PREFIX= */
-  TidyAttr_PROPERTY,          /**< PROPERTY= */
-  TidyAttr_RESOURCE,          /**< RESOURCE= */
-  TidyAttr_TYPEOF,            /**< TYPEOF= */
-  TidyAttr_VOCAB,             /**< VOCAB= */
-
-  N_TIDY_ATTRIBS              /**< Must be last */
-} TidyAttrId;
-
-#ifdef __cplusplus
-}  /* extern "C" */
-#endif
-#endif /* __TIDYENUM_H__ */
-
diff --git a/include/tidyplatform.h b/include/tidyplatform.h
deleted file mode 100644
index a36039f..0000000
--- a/include/tidyplatform.h
+++ /dev/null
@@ -1,635 +0,0 @@
-#ifndef __TIDY_PLATFORM_H__
-#define __TIDY_PLATFORM_H__
-
-/* tidyplatform.h -- Platform specifics
-
-  (c) 1998-2008 (W3C) MIT, ERCIM, Keio University
-  See tidy.h for the copyright notice.
-
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-  Uncomment and edit one of the following #defines if you
-  want to specify the config file at compile-time.
-*/
-
-/* #define TIDY_CONFIG_FILE "/etc/tidy_config.txt" */ /* original */
-/* #define TIDY_CONFIG_FILE "/etc/tidyrc" */
-/* #define TIDY_CONFIG_FILE "/etc/tidy.conf" */
-
-/*
-  Uncomment the following #define if you are on a system
-  supporting the HOME environment variable.
-  It enables tidy to find config files named ~/.tidyrc if 
-  the HTML_TIDY environment variable is not set.
-*/
-/* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */
-
-/*
-  Uncomment the following #define if your
-  system supports the call getpwnam(). 
-  E.g. Unix and Linux.
-
-  It enables tidy to find files named 
-  ~your/foo for use in the HTML_TIDY environment
-  variable or CONFIG_FILE or USER_CONFIGFILE or
-  on the command line: -config ~joebob/tidy.cfg
-
-  Contributed by Todd Lewis.
-*/
-
-/* #define SUPPORT_GETPWNAM */
-
-
-/* Enable/disable support for Big5 and Shift_JIS character encodings */
-#ifndef SUPPORT_ASIAN_ENCODINGS
-#define SUPPORT_ASIAN_ENCODINGS 1
-#endif
-
-/* Enable/disable support for UTF-16 character encodings */
-#ifndef SUPPORT_UTF16_ENCODINGS
-#define SUPPORT_UTF16_ENCODINGS 1
-#endif
-
-/* Enable/disable support for additional accessibility checks */
-#ifndef SUPPORT_ACCESSIBILITY_CHECKS
-#define SUPPORT_ACCESSIBILITY_CHECKS 1
-#endif
-
-/* Enable/disable support for additional languages */
-#ifndef SUPPORT_LOCALIZATIONS
-#define SUPPORT_LOCALIZATIONS 1
-#endif
-
-
-/* Convenience defines for Mac platforms */
-
-#if defined(macintosh)
-/* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */
-#define MAC_OS_CLASSIC
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Mac OS"
-#endif
-
-/* needed for access() */
-#if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
-#define NO_ACCESS_SUPPORT
-#endif
-
-#ifdef SUPPORT_GETPWNAM
-#undef SUPPORT_GETPWNAM
-#endif
-
-#elif defined(__APPLE__) && defined(__MACH__)
-/* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */
-#define MAC_OS_X
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Mac OS X"
-#endif
-#endif
-
-#if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
-/* Any OS on Mac platform */
-#define MAC_OS
-#define FILENAMES_CASE_SENSITIVE 0
-#define strcasecmp strcmp
-#endif
-
-/* Convenience defines for BSD like platforms */
- 
-#if defined(__FreeBSD__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "FreeBSD"
-#endif
-
-#elif defined(__NetBSD__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "NetBSD"
-#endif
-
-#elif defined(__OpenBSD__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "OpenBSD"
-#endif
-
-#elif defined(__DragonFly__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "DragonFly"
-#endif
-
-#elif defined(__MINT__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "FreeMiNT"
-#endif
-
-#elif defined(__bsdi__)
-#define BSD_BASED_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "BSD/OS"
-#endif
-
-#endif
-
-/* Convenience defines for Windows platforms */
- 
-#if defined(WINDOWS) || defined(_WIN32)
-
-#define WINDOWS_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Windows"
-#endif
-
-#if defined(__MWERKS__) || defined(__MSL__)
-/* not available with Metrowerks Standard Library */
-
-#ifdef SUPPORT_GETPWNAM
-#undef SUPPORT_GETPWNAM
-#endif
-
-/* needed for setmode() */
-#if !defined(NO_SETMODE_SUPPORT)
-#define NO_SETMODE_SUPPORT
-#endif
-
-#define strcasecmp _stricmp
-
-#endif
-
-#if defined(__BORLANDC__)
-#define strcasecmp stricmp
-#endif
-
-#define FILENAMES_CASE_SENSITIVE 0
-#define SUPPORT_POSIX_MAPPED_FILES 0
-
-#endif
-
-/* Convenience defines for Linux platforms */
- 
-#if defined(linux) && defined(__alpha__)
-/* Linux on Alpha - gcc compiler */
-#define LINUX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Linux/Alpha"
-#endif
-
-#elif defined(linux) && defined(__sparc__)
-/* Linux on Sparc - gcc compiler */
-#define LINUX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Linux/Sparc"
-#endif
-
-#elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
-/* Linux on x86 - gcc compiler */
-#define LINUX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Linux/x86"
-#endif
-
-#elif defined(linux) && defined(__powerpc__)
-/* Linux on PPC - gcc compiler */
-#define LINUX_OS
-
-#if defined(__linux__) && defined(__powerpc__)
-
-/* #if #system(linux) */
-/* MkLinux on PPC  - gcc (egcs) compiler */
-/* #define MAC_OS_MKLINUX */
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "MkLinux"
-#endif
-
-#else
-
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Linux/PPC"
-#endif
-
-#endif
-
-#elif defined(linux) || defined(__linux__)
-/* generic Linux */
-#define LINUX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Linux"
-#endif
-
-#endif
-
-/* Convenience defines for Solaris platforms */
- 
-#if defined(sun)
-#define SOLARIS_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Solaris"
-#endif
-#endif
-
-/* Convenience defines for HPUX + gcc platforms */
-
-#if defined(__hpux)
-#define HPUX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "HPUX"
-#endif
-#endif
-
-/* Convenience defines for RISCOS + gcc platforms */
-
-#if defined(__riscos__)
-#define RISC_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "RISC OS"
-#endif
-#endif
-
-/* Convenience defines for OS/2 + icc/gcc platforms */
-
-#if defined(__OS2__) || defined(__EMX__)
-#define OS2_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "OS/2"
-#endif
-#define FILENAMES_CASE_SENSITIVE 0
-#define strcasecmp stricmp
-#endif
-
-/* Convenience defines for IRIX */
-
-#if defined(__sgi)
-#define IRIX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "SGI IRIX"
-#endif
-#endif
-
-/* Convenience defines for AIX */
-
-#if defined(_AIX)
-#define AIX_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "IBM AIX"
-#endif
-#endif
-
-
-/* Convenience defines for BeOS platforms */
-
-#if defined(__BEOS__)
-#define BE_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "BeOS"
-#endif
-#endif
-
-/* Convenience defines for Cygwin platforms */
-
-#if defined(__CYGWIN__)
-#define CYGWIN_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Cygwin"
-#endif
-#define FILENAMES_CASE_SENSITIVE 0
-#endif
-
-/* Convenience defines for OpenVMS */
-
-#if defined(__VMS)
-#define OPENVMS_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "OpenVMS"
-#endif
-#define FILENAMES_CASE_SENSITIVE 0
-#endif
-
-/* Convenience defines for DEC Alpha OSF + gcc platforms */
-
-#if defined(__osf__)
-#define OSF_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "DEC Alpha OSF"
-#endif
-#endif
-
-/* Convenience defines for ARM platforms */
-
-#if defined(__arm)
-#define ARM_OS
-
-#if defined(forARM) && defined(__NEWTON_H)
-
-/* Using Newton C++ Tools ARMCpp compiler */
-#define NEWTON_OS
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "Newton"
-#endif
-
-#else
-
-#ifndef PLATFORM_NAME
-#define PLATFORM_NAME "ARM"
-#endif
-
-#endif
-
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <setjmp.h>  /* for longjmp on error exit */
-#include <stdlib.h>
-#include <stdarg.h>  /* may need <varargs.h> for Unix V */
-#include <string.h>
-#include <assert.h>
-
-#ifdef NEEDS_MALLOC_H
-#include <malloc.h>
-#endif
-
-#ifdef SUPPORT_GETPWNAM
-#include <pwd.h>
-#endif
-
-#ifdef NEEDS_UNISTD_H
-#include <unistd.h>  /* needed for unlink on some Unix systems */
-#endif
-
-/* By default, use case-sensitive filename comparison.
-*/
-#ifndef FILENAMES_CASE_SENSITIVE
-#define FILENAMES_CASE_SENSITIVE 1
-#endif
-
-
-/*
-  Tidy preserves the last modified time for the files it
-  cleans up.
-*/
-
-/*
-  If your platform doesn't support <utime.h> and the
-  utime() function, or <sys/futime> and the futime()
-  function then set PRESERVE_FILE_TIMES to 0.
-  
-  If your platform doesn't support <sys/utime.h> and the
-  futime() function, then set HAS_FUTIME to 0.
-  
-  If your platform supports <utime.h> and the
-  utime() function requires the file to be
-  closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
-*/
-
-/* Keep old PRESERVEFILETIMES define for compatibility */
-#ifdef PRESERVEFILETIMES
-#undef PRESERVE_FILE_TIMES
-#define PRESERVE_FILE_TIMES PRESERVEFILETIMES
-#endif
-
-#ifndef PRESERVE_FILE_TIMES
-#if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
-#define PRESERVE_FILE_TIMES 0
-#else
-#define PRESERVE_FILE_TIMES 1
-#endif
-#endif
-
-#if PRESERVE_FILE_TIMES
-
-#ifndef HAS_FUTIME
-#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__)
-#define HAS_FUTIME 0
-#else
-#define HAS_FUTIME 1
-#endif
-#endif
-
-#ifndef UTIME_NEEDS_CLOSED_FILE
-#if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
-#define UTIME_NEEDS_CLOSED_FILE 1
-#else
-#define UTIME_NEEDS_CLOSED_FILE 0
-#endif
-#endif
-
-#if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
-#include <sys/types.h> 
-#include <sys/stat.h>
-#else
-#include <stat.h>
-#endif
-
-#if HAS_FUTIME
-#include <sys/utime.h>
-#else
-#include <utime.h>
-#endif /* HASFUTIME */
-
-/*
-  MS Windows needs _ prefix for Unix file functions.
-  Not required by Metrowerks Standard Library (MSL).
-  
-  Tidy uses following for preserving the last modified time.
-
-  WINDOWS automatically set by Win16 compilers.
-  _WIN32 automatically set by Win32 compilers.
-*/
-#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
-
-#define futime _futime
-#define fstat _fstat
-#define utimbuf _utimbuf /* Windows seems to want utimbuf */
-#define stat _stat
-#define utime _utime
-#define vsnprintf _vsnprintf
-#endif /* _WIN32 */
-
-#endif /* PRESERVE_FILE_TIMES */
-
-/*
-  MS Windows needs _ prefix for Unix file functions.
-  Not required by Metrowerks Standard Library (MSL).
-  
-  WINDOWS automatically set by Win16 compilers.
-  _WIN32 automatically set by Win32 compilers.
-*/
-#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
-
-#if !(defined(__WATCOMC__) || defined(__MINGW32__))
-#define fileno _fileno
-#define setmode _setmode
-#endif
-
-#define access _access
-#define strcasecmp _stricmp
-
-#ifndef va_copy
-#define va_copy(dest, src) (dest = src)
-#endif
-
-#if _MSC_VER > 1000
-#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
-#pragma warning( disable : 4100 ) /* unreferenced formal parameter */
-#pragma warning( disable : 4706 ) /* assignment within conditional expression */
-#endif
-
-#if _MSC_VER > 1300
-#pragma warning( disable : 4996 ) /* disable depreciation warning */
-#endif
-
-#endif /* _WIN32 */
-
-#if defined(_WIN32)
-
-#if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
-#ifdef BUILDING_SHARED_LIB
-#define TIDY_EXPORT __declspec( dllexport ) 
-#else
-#define TIDY_EXPORT __declspec( dllimport ) 
-#endif
-#else
-#define TIDY_EXPORT extern
-#endif
-
-#ifndef TIDY_CALL
-#ifdef _WIN64
-#  define TIDY_CALL __fastcall
-#else
-#  define TIDY_CALL __stdcall
-#endif
-#endif
-
-#endif /* _WIN32 */
-
-/* hack for gnu sys/types.h file which defines uint and ulong */
-
-#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
-#include <sys/types.h>
-#endif
-#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
-# undef uint
-typedef unsigned int uint;
-#endif
-#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
-# undef ulong
-typedef unsigned long ulong;
-#endif
-
-/*
-With GCC 4,  __attribute__ ((visibility("default"))) can be used along compiling with tidylib 
-with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
-*/
-/*
-#if defined(__GNUC__) && __GNUC__ >= 4
-#define TIDY_EXPORT __attribute__ ((visibility("default")))
-#endif
-*/
-
-#ifndef TIDY_EXPORT /* Define it away for most builds */
-#define TIDY_EXPORT 
-#endif
-
-#ifndef TIDY_STRUCT
-#define TIDY_STRUCT
-#endif
-
-typedef unsigned char byte;
-
-typedef uint tchar;         /* single, full character */
-typedef char tmbchar;       /* single, possibly partial character */
-#ifndef TMBSTR_DEFINED
-typedef tmbchar* tmbstr;    /* pointer to buffer of possibly partial chars */
-typedef const tmbchar* ctmbstr; /* Ditto, but const */
-#define NULLSTR (tmbstr)""
-#define TMBSTR_DEFINED
-#endif
-
-#ifndef TIDY_CALL
-#define TIDY_CALL
-#endif
-
-#if defined(__GNUC__) || defined(__INTEL_COMPILER)
-# define ARG_UNUSED(x) x __attribute__((unused))
-#else
-# define ARG_UNUSED(x) x
-#endif
-
-/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to
-   buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF
-   has been defined. */
-#ifndef HAS_VSNPRINTF
-# define HAS_VSNPRINTF 1
-#endif
-
-#ifndef SUPPORT_POSIX_MAPPED_FILES
-# define SUPPORT_POSIX_MAPPED_FILES 1
-#endif
-
-/*
-  bool is a reserved word in some but
-  not all C++ compilers depending on age
-  work around is to avoid bool altogether
-  by introducing a new enum called Bool
-*/
-/* We could use the C99 definition where supported
-typedef _Bool Bool;
-#define no (_Bool)0
-#define yes (_Bool)1
-*/
-typedef enum
-{
-   no,
-   yes
-} Bool;
-
-/* for NULL pointers 
-#define null ((const void*)0)
-extern void* null;
-*/
-
-#if defined(DMALLOC)
-#include "dmalloc.h"
-#endif
-
-/* Opaque data structure.
-*  Cast to implementation type struct within lib.
-*  This will reduce inter-dependencies/conflicts w/ application code.
-*/
-#if 1
-#define opaque_type( typenam )\
-struct _##typenam { int _opaque; };\
-typedef struct _##typenam const * typenam
-#else
-#define opaque_type(typenam) typedef const void* typenam
-#endif
-
-/* Opaque data structure used to pass back
-** and forth to keep current position in a
-** list or other collection.
-*/
-opaque_type( TidyIterator );
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* __TIDY_PLATFORM_H__ */
-
-
-/*
- * local variables:
- * mode: c
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * eval: (c-set-offset 'substatement-open 0)
- * end:
- */
diff --git a/src/buffio.c b/src/buffio.c
index 31a29c4..863ac07 100644
--- a/src/buffio.c
+++ b/src/buffio.c
@@ -9,7 +9,7 @@
 */
 
 #include "tidy.h"
-#include "tidybuffio.h"
+#include "tidy/buffio.h"
 #include "forward.h"
 
 /**************
diff --git a/src/fileio.h b/src/fileio.h
index a0e0df9..d94e73e 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -11,7 +11,7 @@
 
 */
 
-#include "tidybuffio.h"
+#include "tidy/buffio.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/src/forward.h b/src/forward.h
index 2f48630..0a7187c 100644
--- a/src/forward.h
+++ b/src/forward.h
@@ -15,7 +15,7 @@
 
 */
 
-#include "tidyplatform.h"
+#include "tidy/platform.h"
 #include "tidy.h"
 
 /* Internal symbols are prefixed to avoid clashes with other libraries */
diff --git a/src/language.h b/src/language.h
index 7b900a7..b72ad6f 100644
--- a/src/language.h
+++ b/src/language.h
@@ -14,7 +14,7 @@
  * Created by Jim Derry on 11/28/15.
  */
 
-#include "tidyplatform.h"
+#include "tidy/platform.h"
 
 
 /** @name Exposed Data Structures */
diff --git a/src/sprtf.h b/src/sprtf.h
index 30dbfcc..60220b8 100644
--- a/src/sprtf.h
+++ b/src/sprtf.h
@@ -27,7 +27,7 @@
 // Debug log file output
 #ifndef _SPRTF_HXX_
 #define _SPRTF_HXX_
-#include "tidyplatform.h"
+#include "tidy/platform.h"
 
 #ifdef   __cplusplus
 extern "C" {
diff --git a/src/streamio.h b/src/streamio.h
index 696cea9..7c9935c 100644
--- a/src/streamio.h
+++ b/src/streamio.h
@@ -14,7 +14,7 @@
 */
 
 #include "forward.h"
-#include "tidybuffio.h"
+#include "tidy/buffio.h"
 #include "fileio.h"
 
 #ifdef __cplusplus
diff --git a/src/tmbstr.h b/src/tmbstr.h
index 260a6e3..0bd66cf 100644
--- a/src/tmbstr.h
+++ b/src/tmbstr.h
@@ -8,7 +8,7 @@
 
 */
 
-#include "tidyplatform.h"
+#include "tidy/platform.h"
 
 #ifdef __cplusplus
 extern "C"
diff --git a/src/utf8.h b/src/utf8.h
index fe53a83..f8655ac 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -8,8 +8,8 @@
 
 */
 
-#include "tidyplatform.h"
-#include "tidybuffio.h"
+#include "tidy/platform.h"
+#include "tidy/buffio.h"
 
 /* UTF-8 encoding/decoding support
 ** Does not convert character "codepoints", i.e. to/from 10646.
-- 
2.1.4

