First commit of the new Relax-NG validation code, not generally useful

* Makefile.am configure.in relaxng.c include/libxml/relaxng.h:
  First commit of the new Relax-NG validation code, not generally
  useful yet.
* test/relaxng/* result/relaxng/*: current state of the regression
  tests
Daniel
diff --git a/Makefile.am b/Makefile.am
index bf0f0cd..1841603 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,9 @@
 
 INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@ 
 
-noinst_PROGRAMS=testSchemas testSAX testHTML testXPath testURI testDocbook \
-                testThreads testC14N testAutomata testRegexp testReader
+noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
+                testDocbook testThreads testC14N testAutomata testRegexp \
+		testReader
 
 bin_PROGRAMS = xmllint xmlcatalog
 
@@ -26,7 +27,7 @@
 		xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
 		catalog.c globals.c threads.c c14n.c \
 		xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
-		triostr.c trio.c xmlreader.c
+		triostr.c trio.c xmlreader.c relaxng.c
 else
 libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
 		parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c  \
@@ -34,7 +35,7 @@
 		xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
 		catalog.c globals.c threads.c c14n.c \
 		xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
-		xmlreader.c
+		xmlreader.c relaxng.c
 endif
 
 DEPS = $(top_builddir)/libxml2.la
@@ -105,6 +106,11 @@
 testSchemas_DEPENDENCIES = $(DEPS)
 testSchemas_LDADD= $(LDADDS)
 
+testRelax_SOURCES=testRelax.c
+testRelax_LDFLAGS = 
+testRelax_DEPENDENCIES = $(DEPS)
+testRelax_LDADD= $(LDADDS)
+
 testReader_SOURCES=testReader.c
 testReader_LDFLAGS = 
 testReader_DEPENDENCIES = $(DEPS)
@@ -680,6 +686,36 @@
 	       fi ; \
 	  done; done)
 
+Relaxtests: testRelax$(EXEEXT)
+	@(echo > .memdump)
+	@echo "##"
+	@echo "## Relax-NG regression tests"
+	@echo "##"
+	-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
+	  name=`basename $$i | sed 's+\.rng++'`; \
+	  for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
+	      if [ -f $$j ] ; then \
+	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
+	      if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
+	      then \
+		  echo New test file "$$name"_"$$xno" ; \
+		  $(CHECKER) $(top_builddir)/testRelax $$i $$j \
+		    > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
+		    2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
+	      else \
+		  echo Testing "$$name"_"$$xno" ; \
+	          $(CHECKER) $(top_builddir)/testRelax $$i $$j \
+		    > res.$$name 2> err.$$name;\
+	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
+	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
+		       res.$$name;\
+	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
+		       err.$$name;\
+		  grep Unimplemented err.$$name; \
+	          rm res.$$name err.$$name ; \
+	       fi ; fi ; \
+	  done; done)
+
 dist-hook: libxml.spec
 	-cp libxml.spec $(distdir)
 	(cd $(srcdir) ; tar -cf - --exclude CVS win32 macos vms test result SAXresult ) | (cd $(distdir); tar xf -)