added support and APIs needed for the catalog PI cleanup Daniel

* include/libxml/catalog.h include/libxml/parser.h
  include/libxml/xmlerror.h catalog.c parser.c parserInternals.c
  xmlIO.c: added support and APIs needed for the catalog PI
* include/libxml/xmlIO.h: cleanup
Daniel
diff --git a/parserInternals.c b/parserInternals.c
index e31e6f2..8e652b3 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -46,6 +46,9 @@
 #include <libxml/valid.h>
 #include <libxml/xmlIO.h>
 #include <libxml/uri.h>
+#ifdef LIBXML_CATALOG_ENABLED
+#include <libxml/catalog.h>
+#endif
 
 void xmlUpgradeOldNs(xmlDocPtr doc);
 
@@ -2270,6 +2273,7 @@
     ctxt->errNo = XML_ERR_OK;
     ctxt->depth = 0;
     ctxt->charset = XML_CHAR_ENCODING_UTF8;
+    ctxt->catalogs = NULL;
     xmlInitNodeInfoSeq(&ctxt->node_seq);
 }
 
@@ -2308,6 +2312,10 @@
         xmlFree(ctxt->sax);
     if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
     if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
+#ifdef LIBXML_CATALOG_ENABLED
+    if (ctxt->catalogs != NULL)
+	xmlCatalogFreeLocal(ctxt->catalogs);
+#endif
     xmlFree(ctxt);
 }